xref: /libCEED/tests/t402-qfunction.c (revision 777ff853944a0dbc06f7f09486fdf4674828e728)
175affc3bSjeremylt /// @file
275affc3bSjeremylt /// Test viewing of qfunction
375affc3bSjeremylt /// \test Test viewing of qfunction
475affc3bSjeremylt #include <ceed.h>
575affc3bSjeremylt 
675affc3bSjeremylt #include "t400-qfunction.h"
775affc3bSjeremylt 
875affc3bSjeremylt int main(int argc, char **argv) {
975affc3bSjeremylt   Ceed ceed;
1075affc3bSjeremylt   CeedQFunction qf_setup, qf_mass;
11*777ff853SJeremy L Thompson   CeedQFunctionContext ctx;
1275affc3bSjeremylt 
1375affc3bSjeremylt   CeedInit(argv[1], &ceed);
1475affc3bSjeremylt 
1575affc3bSjeremylt   CeedQFunctionCreateInterior(ceed, 1, setup, setup_loc, &qf_setup);
1684e209c4Sjeremylt   CeedQFunctionAddInput(qf_setup, "w", 1, CEED_EVAL_WEIGHT);
1784e209c4Sjeremylt   CeedQFunctionAddOutput(qf_setup, "qdata", 1, CEED_EVAL_NONE);
1875affc3bSjeremylt 
1975affc3bSjeremylt   CeedQFunctionCreateInterior(ceed, 1, mass, mass_loc, &qf_mass);
2084e209c4Sjeremylt   CeedQFunctionAddInput(qf_mass, "qdata", 1, CEED_EVAL_NONE);
2175affc3bSjeremylt   CeedQFunctionAddInput(qf_mass, "u", 1, CEED_EVAL_INTERP);
2275affc3bSjeremylt   CeedQFunctionAddOutput(qf_mass, "v", 1, CEED_EVAL_INTERP);
2375affc3bSjeremylt 
2475affc3bSjeremylt   CeedQFunctionView(qf_setup, stdout);
2575affc3bSjeremylt   CeedQFunctionView(qf_mass, stdout);
2675affc3bSjeremylt 
27*777ff853SJeremy L Thompson   CeedQFunctionContextCreate(ceed, &ctx);
28*777ff853SJeremy L Thompson   CeedScalar ctxData[5] = {1, 2, 3, 4, 5};
29*777ff853SJeremy L Thompson   CeedQFunctionContextSetData(ctx, CEED_MEM_HOST, CEED_COPY_VALUES,
30*777ff853SJeremy L Thompson                               sizeof(ctxData), &ctxData);
31*777ff853SJeremy L Thompson   CeedQFunctionContextView(ctx, stdout);
32*777ff853SJeremy L Thompson 
3375affc3bSjeremylt   CeedQFunctionDestroy(&qf_setup);
3475affc3bSjeremylt   CeedQFunctionDestroy(&qf_mass);
35*777ff853SJeremy L Thompson   CeedQFunctionContextDestroy(&ctx);
3675affc3bSjeremylt   CeedDestroy(&ceed);
3775affc3bSjeremylt   return 0;
3875affc3bSjeremylt }
39