xref: /libCEED/tests/t403-qfunction.c (revision 5571c6fd979b2d8a02ec737d0c535858266a543d)
1 /// @file
2 /// Test creation, copying, and destruction for QFunction and QFunctionContext
3 /// \test Test creation, copying, and destruction for QFunction and QFunctionContext
4 #include <ceed.h>
5 #include "t400-qfunction.h"
6 
7 int main(int argc, char **argv) {
8   Ceed ceed;
9   CeedQFunction qf, qf_2;
10   CeedQFunctionContext ctx, ctx_2;
11 
12   CeedInit(argv[1], &ceed);
13 
14   CeedQFunctionCreateInterior(ceed, 1, setup, setup_loc, &qf);
15   CeedQFunctionCreateInterior(ceed, 1, mass, mass_loc, &qf_2);
16 
17   CeedQFunctionReferenceCopy(qf, &qf_2); // This destroys the previous qf_2
18   if (qf != qf_2)
19     // LCOV_EXCL_START
20     printf("Error copying CeedQFunction reference\n");
21   // LCOV_EXCL_STOP
22 
23   CeedQFunctionContextCreate(ceed, &ctx);
24   CeedQFunctionContextCreate(ceed, &ctx_2);
25 
26   CeedQFunctionContextReferenceCopy(ctx, &ctx_2);
27   if (ctx != ctx_2)
28     // LCOV_EXCL_START
29     printf("Error copying CeedQFunctionContext reference\n");
30   // LCOV_EXCL_STOP
31 
32   CeedQFunctionDestroy(&qf);
33   CeedQFunctionDestroy(&qf_2);
34   CeedQFunctionContextDestroy(&ctx);
35   CeedQFunctionContextDestroy(&ctx_2);
36   CeedDestroy(&ceed);
37   return 0;
38 }
39