xref: /libCEED/tests/t402-qfunction.c (revision d1d35e2f02dc969aee8debf3fd943dd784aa847a)
175affc3bSjeremylt /// @file
2*d1d35e2fSjeremylt /// Test viewing of QFunction
3*d1d35e2fSjeremylt /// \test Test viewing of QFunction
475affc3bSjeremylt #include <ceed.h>
575affc3bSjeremylt #include "t400-qfunction.h"
675affc3bSjeremylt 
775affc3bSjeremylt int main(int argc, char **argv) {
875affc3bSjeremylt   Ceed ceed;
975affc3bSjeremylt   CeedQFunction qf_setup, qf_mass;
10777ff853SJeremy L Thompson   CeedQFunctionContext ctx;
1175affc3bSjeremylt 
1275affc3bSjeremylt   CeedInit(argv[1], &ceed);
1375affc3bSjeremylt 
1475affc3bSjeremylt   CeedQFunctionCreateInterior(ceed, 1, setup, setup_loc, &qf_setup);
1584e209c4Sjeremylt   CeedQFunctionAddInput(qf_setup, "w", 1, CEED_EVAL_WEIGHT);
1684e209c4Sjeremylt   CeedQFunctionAddOutput(qf_setup, "qdata", 1, CEED_EVAL_NONE);
1775affc3bSjeremylt 
1875affc3bSjeremylt   CeedQFunctionCreateInterior(ceed, 1, mass, mass_loc, &qf_mass);
1984e209c4Sjeremylt   CeedQFunctionAddInput(qf_mass, "qdata", 1, CEED_EVAL_NONE);
2075affc3bSjeremylt   CeedQFunctionAddInput(qf_mass, "u", 1, CEED_EVAL_INTERP);
2175affc3bSjeremylt   CeedQFunctionAddOutput(qf_mass, "v", 1, CEED_EVAL_INTERP);
2275affc3bSjeremylt 
2375affc3bSjeremylt   CeedQFunctionView(qf_setup, stdout);
2475affc3bSjeremylt   CeedQFunctionView(qf_mass, stdout);
2575affc3bSjeremylt 
26777ff853SJeremy L Thompson   CeedQFunctionContextCreate(ceed, &ctx);
27777ff853SJeremy L Thompson   CeedScalar ctxData[5] = {1, 2, 3, 4, 5};
28777ff853SJeremy L Thompson   CeedQFunctionContextSetData(ctx, CEED_MEM_HOST, CEED_COPY_VALUES,
29777ff853SJeremy L Thompson                               sizeof(ctxData), &ctxData);
30777ff853SJeremy L Thompson   CeedQFunctionContextView(ctx, stdout);
31777ff853SJeremy L Thompson 
3275affc3bSjeremylt   CeedQFunctionDestroy(&qf_setup);
3375affc3bSjeremylt   CeedQFunctionDestroy(&qf_mass);
34777ff853SJeremy L Thompson   CeedQFunctionContextDestroy(&ctx);
3575affc3bSjeremylt   CeedDestroy(&ceed);
3675affc3bSjeremylt   return 0;
3775affc3bSjeremylt }
38