xref: /libCEED/tests/t330-basis.c (revision bdee0278611904727ee35fcc2d0d7c3bf83db4c4)
1 /// @file
2 /// Test creation and destruction of a 2D Quad non-tensor H(div) basis
3 /// \test Test creation and destruction of a 2D Quad non-tensor H(div) 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 p = 8, q = 3, dim = 2, num_qpts = q * q;
12   CeedBasis     basis;
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) return CeedError(ceed, CEED_ERROR_UNSUPPORTED, "Test not implemented in single precision");
20 
21   BuildHdivQuadrilateral(q, q_ref, q_weights, interp, div, CEED_GAUSS);
22   CeedBasisCreateHdiv(ceed, CEED_TOPOLOGY_QUAD, 1, p, num_qpts, interp, div, q_ref, q_weights, &basis);
23   CeedBasisView(basis, stdout);
24   CeedBasisSetNumViewTabs(basis, 1);
25   CeedBasisView(basis, stdout);
26 
27   CeedBasisDestroy(&basis);
28   CeedDestroy(&ceed);
29   return 0;
30 }
31