xref: /libCEED/tests/t330-basis.c (revision caee03026e6576cbf7a399c2fc51bb918c77f451)
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 "t330-basis.h"
5 
6 #include <ceed.h>
7 
8 int main(int argc, char **argv) {
9   Ceed          ceed;
10   const CeedInt Q = 3, dim = 2, num_qpts = Q * Q, elem_nodes = 4;
11   CeedInt       num_comp = 1;
12   CeedInt       P        = dim * elem_nodes;  // dof per element! dof is vector in H(div)
13   CeedBasis     b;
14   CeedScalar    q_ref[dim * num_qpts], q_weights[num_qpts];
15   CeedScalar    interp[dim * P * num_qpts], div[P * num_qpts];
16 
17   CeedInit(argv[1], &ceed);
18 
19   // Test skipped if using single precision
20   if (CEED_SCALAR_TYPE == CEED_SCALAR_FP32)
21     // LCOV_EXCL_START
22     return CeedError(ceed, CEED_ERROR_UNSUPPORTED, "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, div, q_ref, q_weights, &b);
27   // interp[0]--.interp[num_qpts-1] ==> basis in x-direction
28   // interp[num_qpts]--.interp[dim*num_qpts-1] ==> basis in y-direction
29   CeedBasisView(b, stdout);
30 
31   CeedBasisDestroy(&b);
32   CeedDestroy(&ceed);
33   return 0;
34 }
35