xref: /libCEED/tests/t403-qfunction.c (revision 49aac155e7a09736f56fb3abac0f57dab29f7cbf)
19560d06aSjeremylt /// @file
29560d06aSjeremylt /// Test creation, copying, and destruction for QFunction and QFunctionContext
39560d06aSjeremylt /// \test Test creation, copying, and destruction for QFunction and QFunctionContext
49560d06aSjeremylt #include <ceed.h>
5*49aac155SJeremy L Thompson #include <stdio.h>
62b730f8bSJeremy L Thompson 
79560d06aSjeremylt #include "t400-qfunction.h"
89560d06aSjeremylt 
main(int argc,char ** argv)99560d06aSjeremylt int main(int argc, char **argv) {
109560d06aSjeremylt   Ceed                 ceed;
119560d06aSjeremylt   CeedQFunction        qf, qf_2;
129560d06aSjeremylt   CeedQFunctionContext ctx, ctx_2;
139560d06aSjeremylt 
149560d06aSjeremylt   CeedInit(argv[1], &ceed);
159560d06aSjeremylt 
169560d06aSjeremylt   CeedQFunctionCreateInterior(ceed, 1, setup, setup_loc, &qf);
179560d06aSjeremylt   CeedQFunctionCreateInterior(ceed, 1, mass, mass_loc, &qf_2);
189560d06aSjeremylt 
199560d06aSjeremylt   CeedQFunctionReferenceCopy(qf, &qf_2);  // This destroys the previous qf_2
202b730f8bSJeremy L Thompson   if (qf != qf_2) printf("Error copying CeedQFunction reference\n");
219560d06aSjeremylt 
229560d06aSjeremylt   CeedQFunctionContextCreate(ceed, &ctx);
239560d06aSjeremylt   CeedQFunctionContextCreate(ceed, &ctx_2);
249560d06aSjeremylt 
259560d06aSjeremylt   CeedQFunctionContextReferenceCopy(ctx, &ctx_2);
262b730f8bSJeremy L Thompson   if (ctx != ctx_2) printf("Error copying CeedQFunctionContext reference\n");
279560d06aSjeremylt 
289560d06aSjeremylt   CeedQFunctionDestroy(&qf);
299560d06aSjeremylt   CeedQFunctionDestroy(&qf_2);
309560d06aSjeremylt   CeedQFunctionContextDestroy(&ctx);
319560d06aSjeremylt   CeedQFunctionContextDestroy(&ctx_2);
329560d06aSjeremylt   CeedDestroy(&ceed);
339560d06aSjeremylt   return 0;
349560d06aSjeremylt }
35