// Test polynomial interpolation in 1D #include #include #define ALEN(a) (sizeof(a) / sizeof((a)[0])) static CeedScalar PolyEval(CeedScalar x, CeedInt n, const CeedScalar *p) { CeedScalar y = p[n-1]; for (CeedInt i=n-2; i>=0; i--) y = y*x + p[i]; return y; } int main(int argc, char **argv) { Ceed ceed; CeedBasis bxl, bxg, bug; CeedInt Q = 6; const CeedScalar p[] = {1, 2, 3, 4, 5, 6}; // 1 + 2x + 3x^2 + ... const CeedScalar x[] = {-1, 1}; CeedScalar xq[Q], u[Q], uq[Q], w[Q], sum, error, pint[ALEN(p)+1]; CeedInit(argv[1], &ceed); CeedBasisCreateTensorH1Lagrange(ceed, 1, 1, 2, Q, CEED_GAUSS_LOBATTO, &bxl); CeedBasisApply(bxl, 1, CEED_NOTRANSPOSE, CEED_EVAL_INTERP, x, xq); for (CeedInt i=0; i