xref: /libCEED/tests/t307-basis.c (revision 5fb68f377259d3910de46d787b7c5d1587fd01e1)
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 basis, basis_2;
9   CeedInt   p = 4;
10 
11   CeedInit(argv[1], &ceed);
12 
13   CeedBasisCreateTensorH1Lagrange(ceed, 1, 1, p, 4, CEED_GAUSS_LOBATTO, &basis);
14   CeedBasisCreateTensorH1Lagrange(ceed, 1, 1, p + 1, 4, CEED_GAUSS_LOBATTO, &basis_2);
15 
16   CeedBasisReferenceCopy(basis, &basis_2);  // This destroys the previous basis_2
17   CeedBasisDestroy(&basis);
18 
19   CeedInt p_2;
20   CeedBasisGetNumNodes1D(basis_2, &p_2);
21   if (p != p_2) printf("Error copying CeedBasis reference\n");
22 
23   CeedBasisDestroy(&basis_2);
24   CeedDestroy(&ceed);
25   return 0;
26 }
27