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