xref: /libCEED/tests/t303-basis.c (revision bdd4742d30d5b1a067c34ba18810a01cac386b2f)
1 /// @file
2 /// Test checking BasisApply input/output vectors compatibility with basis
3 /// \test Test checking BasisApply input/output vectors compatibility with basis
4 
5 //TESTARGS(only="cpu") {ceed_resource}
6 #include <ceed.h>
7 #include <math.h>
8 
main(int argc,char ** argv)9 int main(int argc, char **argv) {
10   Ceed       ceed;
11   CeedBasis  basis;
12   CeedVector u, v;
13   CeedInt    q = 8, p = 2, num_comp = 1, dim = 3, len = pow((CeedScalar)(q), dim);
14 
15   CeedInit(argv[1], &ceed);
16 
17   CeedVectorCreate(ceed, len, &u);
18   CeedVectorCreate(ceed, len - 1, &v);
19 
20   CeedBasisCreateTensorH1Lagrange(ceed, dim, num_comp, p, q, CEED_GAUSS, &basis);
21 
22   // Basis apply will error because dimensions don't agree
23   CeedBasisApply(basis, 1, CEED_NOTRANSPOSE, CEED_EVAL_INTERP, u, v);
24 
25   // LCOV_EXCL_START
26   CeedBasisDestroy(&basis);
27   CeedVectorDestroy(&u);
28   CeedVectorDestroy(&v);
29   CeedDestroy(&ceed);
30   return 0;
31   // LCOV_EXCL_STOP
32 }
33