xref: /libCEED/tests/t403-qfunction.c (revision 8ec64e9ae9d5df169dba8c8ee61d8ec8907b8f80)
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 
6 #include "t400-qfunction.h"
7 
8 int main(int argc, char **argv) {
9   Ceed                 ceed;
10   CeedQFunction        qf, qf_2;
11   CeedQFunctionContext ctx, ctx_2;
12 
13   CeedInit(argv[1], &ceed);
14 
15   CeedQFunctionCreateInterior(ceed, 1, setup, setup_loc, &qf);
16   CeedQFunctionCreateInterior(ceed, 1, mass, mass_loc, &qf_2);
17 
18   CeedQFunctionReferenceCopy(qf, &qf_2);  // This destroys the previous qf_2
19   if (qf != qf_2) printf("Error copying CeedQFunction reference\n");
20 
21   CeedQFunctionContextCreate(ceed, &ctx);
22   CeedQFunctionContextCreate(ceed, &ctx_2);
23 
24   CeedQFunctionContextReferenceCopy(ctx, &ctx_2);
25   if (ctx != ctx_2) printf("Error copying CeedQFunctionContext reference\n");
26 
27   CeedQFunctionDestroy(&qf);
28   CeedQFunctionDestroy(&qf_2);
29   CeedQFunctionContextDestroy(&ctx);
30   CeedQFunctionContextDestroy(&ctx_2);
31   CeedDestroy(&ceed);
32   return 0;
33 }
34