xref: /libCEED/tests/t303-basis.c (revision f85e4a7b5ace0077fded2faa470b8becfe6fbd4e)
14411cf47Sjeremylt /// @file
2*f85e4a7bSJeremy L Thompson /// Test checking BasisApply input/output vectors compatibility with basis dimensions
3*f85e4a7bSJeremy L Thompson /// \test Test checking BasisApply input/output vectors compatibility with basis dimensions
4*f85e4a7bSJeremy L Thompson 
5*f85e4a7bSJeremy L Thompson //TESTARGS(only="cpu") {ceed_resource}
657c64913Sjeremylt #include <ceed.h>
757c64913Sjeremylt #include <math.h>
857c64913Sjeremylt 
957c64913Sjeremylt int main(int argc, char **argv) {
1057c64913Sjeremylt   Ceed       ceed;
114fee36f0SJeremy L Thompson   CeedBasis  basis;
124fee36f0SJeremy L Thompson   CeedVector u, v;
134fee36f0SJeremy L Thompson   CeedInt    q = 8, p = 2, num_comp = 1, dim = 3, len = pow((CeedScalar)(q), dim);
1457c64913Sjeremylt 
1557c64913Sjeremylt   CeedInit(argv[1], &ceed);
1657c64913Sjeremylt 
174fee36f0SJeremy L Thompson   CeedVectorCreate(ceed, len, &u);
184fee36f0SJeremy L Thompson   CeedVectorCreate(ceed, len + 1, &v);
19aedaa0e5Sjeremylt 
204fee36f0SJeremy L Thompson   CeedBasisCreateTensorH1Lagrange(ceed, dim, num_comp, p, q, CEED_GAUSS, &basis);
21aedaa0e5Sjeremylt 
2252bfb9bbSJeremy L Thompson   // Basis apply will error because dimensions don't agree
234fee36f0SJeremy L Thompson   CeedBasisApply(basis, 1, CEED_NOTRANSPOSE, CEED_EVAL_INTERP, u, v);
24aedaa0e5Sjeremylt 
25a2546046Sjeremylt   // LCOV_EXCL_START
264fee36f0SJeremy L Thompson   CeedBasisDestroy(&basis);
274fee36f0SJeremy L Thompson   CeedVectorDestroy(&u);
284fee36f0SJeremy L Thompson   CeedVectorDestroy(&v);
2957c64913Sjeremylt   CeedDestroy(&ceed);
3057c64913Sjeremylt   return 0;
3152bfb9bbSJeremy L Thompson   // LCOV_EXCL_STOP
3257c64913Sjeremylt }
33