xref: /libCEED/tests/t303-basis.c (revision 4fee36f0a30516a0b5ad51bf7eb3b32d83efd623)
14411cf47Sjeremylt /// @file
22e95cc35Svaleriabarra /// Test that length of BasisApply input/output vectors is incompatible with basis dimensions
352bfb9bbSJeremy L Thompson /// \test Test that topological and geometric dimensions of basis match
457c64913Sjeremylt #include <ceed.h>
557c64913Sjeremylt #include <math.h>
657c64913Sjeremylt 
757c64913Sjeremylt int main(int argc, char **argv) {
857c64913Sjeremylt   Ceed       ceed;
9*4fee36f0SJeremy L Thompson   CeedBasis  basis;
10*4fee36f0SJeremy L Thompson   CeedVector u, v;
11*4fee36f0SJeremy L Thompson   CeedInt    q = 8, p = 2, num_comp = 1, dim = 3, len = pow((CeedScalar)(q), dim);
1257c64913Sjeremylt 
1357c64913Sjeremylt   CeedInit(argv[1], &ceed);
1457c64913Sjeremylt 
15*4fee36f0SJeremy L Thompson   CeedVectorCreate(ceed, len, &u);
16*4fee36f0SJeremy L Thompson   CeedVectorCreate(ceed, len + 1, &v);
17aedaa0e5Sjeremylt 
18*4fee36f0SJeremy L Thompson   CeedBasisCreateTensorH1Lagrange(ceed, dim, num_comp, p, q, CEED_GAUSS, &basis);
19aedaa0e5Sjeremylt 
2052bfb9bbSJeremy L Thompson   // Basis apply will error because dimensions don't agree
21*4fee36f0SJeremy L Thompson   CeedBasisApply(basis, 1, CEED_NOTRANSPOSE, CEED_EVAL_INTERP, u, v);
22aedaa0e5Sjeremylt 
23a2546046Sjeremylt   // LCOV_EXCL_START
24*4fee36f0SJeremy L Thompson   CeedBasisDestroy(&basis);
25*4fee36f0SJeremy L Thompson   CeedVectorDestroy(&u);
26*4fee36f0SJeremy L Thompson   CeedVectorDestroy(&v);
2757c64913Sjeremylt   CeedDestroy(&ceed);
2857c64913Sjeremylt   return 0;
2952bfb9bbSJeremy L Thompson   // LCOV_EXCL_STOP
3057c64913Sjeremylt }
31