/// @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++) { CeedBasis bxl, bug; CeedInt P = 8, Q = 10, Pdim = CeedIntPow(P, dim), Qdim = CeedIntPow(Q, dim), Xdim = CeedIntPow(2, dim); CeedScalar x[Xdim*dim], ones[dim*Qdim], gtposeones[Pdim]; CeedScalar xq[Pdim*dim], uq[dim*Qdim], u[Pdim], sum1 = 0, sum2 = 0; for (CeedInt i=0; i 1e-10) { printf("[%d] %f != %f\n", dim, sum1, sum2); } CeedBasisDestroy(&bxl); CeedBasisDestroy(&bug); } CeedDestroy(&ceed); return 0; }