175affc3bSjeremylt /// @file 2d1d35e2fSjeremylt /// Test viewing of QFunction 3d1d35e2fSjeremylt /// \test Test viewing of QFunction 475affc3bSjeremylt #include <ceed.h> 52b730f8bSJeremy L Thompson 675affc3bSjeremylt #include "t400-qfunction.h" 775affc3bSjeremylt 875affc3bSjeremylt int main(int argc, char **argv) { 975affc3bSjeremylt Ceed ceed; 1075affc3bSjeremylt CeedQFunction qf_setup, qf_mass; 11777ff853SJeremy 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, "q data", 1, CEED_EVAL_NONE); 1875affc3bSjeremylt 1975affc3bSjeremylt CeedQFunctionCreateInterior(ceed, 1, mass, mass_loc, &qf_mass); 2084e209c4Sjeremylt CeedQFunctionAddInput(qf_mass, "q data", 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 27777ff853SJeremy L Thompson CeedQFunctionContextCreate(ceed, &ctx); 2880a9ef05SNatalie Beams if (CEED_SCALAR_TYPE == CEED_SCALAR_FP64) { 29777ff853SJeremy L Thompson CeedScalar ctxData[5] = {1, 2, 3, 4, 5}; 30*4fee36f0SJeremy L Thompson 312b730f8bSJeremy L Thompson CeedQFunctionContextSetData(ctx, CEED_MEM_HOST, CEED_COPY_VALUES, sizeof(ctxData), &ctxData); 3280a9ef05SNatalie Beams } else { // Make context twice as long so the size is the same in output 3380a9ef05SNatalie Beams CeedScalar ctxData[10] = {1, 2, 3, 4, 5, 1, 2, 3, 4, 5}; 34*4fee36f0SJeremy L Thompson 352b730f8bSJeremy L Thompson CeedQFunctionContextSetData(ctx, CEED_MEM_HOST, CEED_COPY_VALUES, sizeof(ctxData), &ctxData); 3680a9ef05SNatalie Beams } 37777ff853SJeremy L Thompson CeedQFunctionContextView(ctx, stdout); 38777ff853SJeremy L Thompson 3975affc3bSjeremylt CeedQFunctionDestroy(&qf_setup); 4075affc3bSjeremylt CeedQFunctionDestroy(&qf_mass); 41777ff853SJeremy L Thompson CeedQFunctionContextDestroy(&ctx); 4275affc3bSjeremylt CeedDestroy(&ceed); 4375affc3bSjeremylt return 0; 4475affc3bSjeremylt } 45