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