xref: /libCEED/tests/t330-basis.c (revision 3d8e882215d238700cdceb37404f76ca7fa24eaa)
1 /// @file
2 /// Test creation and destruction of a 2D Quad non-tensor Hdiv basis
3 /// \test Test creation and distruction of a 2D Quad non-tensor Hdiv basis
4 #include <ceed.h>
5 #include "t330-basis.h"
6 
7 int main(int argc, char **argv) {
8   Ceed ceed;
9   const CeedInt Q = 3, dim = 2, num_qpts = Q*Q, elem_nodes = 4;
10   CeedInt num_comp = 1;
11   CeedInt P = dim*elem_nodes; // dof per element! dof is vector in H(div)
12   CeedBasis b;
13   CeedScalar q_ref[dim*num_qpts], q_weights[num_qpts];
14   CeedScalar interp[dim*P*num_qpts], div[P*num_qpts];
15 
16   CeedInit(argv[1], &ceed);
17 
18   // Test skipped if using single precision
19   if (CEED_SCALAR_TYPE == CEED_SCALAR_FP32)
20     // LCOV_EXCL_START
21     return CeedError(ceed, CEED_ERROR_UNSUPPORTED,
22                      "Test not implemented in single precision");
23   // LCOV_EXCL_STOP
24 
25   HdivBasisQuad(Q, q_ref, q_weights, interp, div, CEED_GAUSS);
26   CeedBasisCreateHdiv(ceed, CEED_TOPOLOGY_QUAD, num_comp, P, num_qpts, interp,
27                       div, q_ref, q_weights, &b);
28   // interp[0]--.interp[num_qpts-1] ==> basis in x-direction
29   // interp[num_qpts]--.interp[dim*num_qpts-1] ==> basis in y-direction
30   CeedBasisView(b, stdout);
31 
32   CeedBasisDestroy(&b);
33   CeedDestroy(&ceed);
34   return 0;
35 }
36