xref: /libCEED/tests/t307-basis.c (revision a697ff736c4bbf0dcf3b0c0690ba5a6b92dd6bdf)
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,
15                                   &b_2);
16 
17   CeedBasisReferenceCopy(b, &b_2); // This destroys the previous b_2
18   CeedBasisDestroy(&b);
19 
20   CeedInt P_1d_2;
21   CeedBasisGetNumNodes1D(b_2, &P_1d_2);
22   if (P_1d != P_1d_2)
23     // LCOV_EXCL_START
24     printf("Error copying CeedBasis reference.");
25   // LCOV_EXCL_STOP
26 
27   CeedBasisDestroy(&b_2);
28   CeedDestroy(&ceed);
29   return 0;
30 }
31