175affc3bSjeremylt /// @file 2d1d35e2fSjeremylt /// Test viewing of QFunction 3d1d35e2fSjeremylt /// \test Test viewing of QFunction 475affc3bSjeremylt #include <ceed.h> 5*2b730f8bSJeremy 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, "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 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*2b730f8bSJeremy L Thompson CeedQFunctionContextSetData(ctx, CEED_MEM_HOST, CEED_COPY_VALUES, sizeof(ctxData), &ctxData); 3180a9ef05SNatalie Beams } else { // Make context twice as long so the size is the same in output 3280a9ef05SNatalie Beams CeedScalar ctxData[10] = {1, 2, 3, 4, 5, 1, 2, 3, 4, 5}; 33*2b730f8bSJeremy L Thompson CeedQFunctionContextSetData(ctx, CEED_MEM_HOST, CEED_COPY_VALUES, sizeof(ctxData), &ctxData); 3480a9ef05SNatalie Beams } 35777ff853SJeremy L Thompson CeedQFunctionContextView(ctx, stdout); 36777ff853SJeremy L Thompson 3775affc3bSjeremylt CeedQFunctionDestroy(&qf_setup); 3875affc3bSjeremylt CeedQFunctionDestroy(&qf_mass); 39777ff853SJeremy L Thompson CeedQFunctionContextDestroy(&ctx); 4075affc3bSjeremylt CeedDestroy(&ceed); 4175affc3bSjeremylt return 0; 4275affc3bSjeremylt } 43