xref: /libCEED/tests/t307-basis.c (revision a9e65696a8c8214eb82d2dcf9ed1f28a32d2c94e)
1 /// @file
2 /// Test creation, copying, and distruction of a H1Lagrange basis
3 /// \test Test creation, copying, and distruction of a H1Lagrange basis
4 #include <ceed.h>
5 
6 int main(int argc, char **argv) {
7   Ceed      ceed;
8   CeedBasis b, b_2;
9   CeedInt   P_1d = 4;
10 
11   CeedInit(argv[1], &ceed);
12 
13   CeedBasisCreateTensorH1Lagrange(ceed, 1, 1, P_1d, 4, CEED_GAUSS_LOBATTO, &b);
14   CeedBasisCreateTensorH1Lagrange(ceed, 1, 1, P_1d + 1, 4, CEED_GAUSS_LOBATTO, &b_2);
15 
16   CeedBasisReferenceCopy(b, &b_2);  // This destroys the previous b_2
17   CeedBasisDestroy(&b);
18 
19   CeedInt P_1d_2;
20   CeedBasisGetNumNodes1D(b_2, &P_1d_2);
21   if (P_1d != P_1d_2) printf("Error copying CeedBasis reference\n");
22 
23   CeedBasisDestroy(&b_2);
24   CeedDestroy(&ceed);
25   return 0;
26 }
27