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