/// @file /// Test grad in multiple dimensions /// \test Test grad in multiple dimensions #include #include static CeedScalar Eval(CeedInt dim, const CeedScalar x[]) { CeedScalar result = tanh(x[0] + 0.1); if (dim > 1) result += atan(x[1] + 0.2); if (dim > 2) result += exp(-(x[2] + 0.3)*(x[2] + 0.3)); return result; } int main(int argc, char **argv) { Ceed ceed; CeedInit(argv[1], &ceed); for (CeedInt dim=1; dim<=3; dim++) { CeedVector X, Xq, U, Uq, Ones, Gtposeones; CeedBasis bxl, bug; CeedInt P = 8, Q = 10, Pdim = CeedIntPow(P, dim), Qdim = CeedIntPow(Q, dim), Xdim = CeedIntPow(2, dim); CeedScalar x[Xdim*dim], u[Pdim]; const CeedScalar *xq, *uq, *gtposeones; CeedScalar sum1 = 0, sum2 = 0; for (CeedInt d=0; d 1E-10) // LCOV_EXCL_START printf("[%d] %f != %f\n", dim, sum1, sum2); // LCOV_EXCL_STOP CeedVectorDestroy(&X); CeedVectorDestroy(&Xq); CeedVectorDestroy(&U); CeedVectorDestroy(&Uq); CeedVectorDestroy(&Ones); CeedVectorDestroy(&Gtposeones); CeedBasisDestroy(&bxl); CeedBasisDestroy(&bug); } CeedDestroy(&ceed); return 0; }