1 /// @file 2 /// Test viewing of QFunction 3 /// \test Test viewing of QFunction 4 #include <ceed.h> 5 #include "t400-qfunction.h" 6 7 int main(int argc, char **argv) { 8 Ceed ceed; 9 CeedQFunction qf_setup, qf_mass; 10 CeedQFunctionContext ctx; 11 12 CeedInit(argv[1], &ceed); 13 14 CeedQFunctionCreateInterior(ceed, 1, setup, setup_loc, &qf_setup); 15 CeedQFunctionAddInput(qf_setup, "w", 1, CEED_EVAL_WEIGHT); 16 CeedQFunctionAddOutput(qf_setup, "qdata", 1, CEED_EVAL_NONE); 17 18 CeedQFunctionCreateInterior(ceed, 1, mass, mass_loc, &qf_mass); 19 CeedQFunctionAddInput(qf_mass, "qdata", 1, CEED_EVAL_NONE); 20 CeedQFunctionAddInput(qf_mass, "u", 1, CEED_EVAL_INTERP); 21 CeedQFunctionAddOutput(qf_mass, "v", 1, CEED_EVAL_INTERP); 22 23 CeedQFunctionView(qf_setup, stdout); 24 CeedQFunctionView(qf_mass, stdout); 25 26 CeedQFunctionContextCreate(ceed, &ctx); 27 if (CEED_SCALAR_TYPE == CEED_SCALAR_FP64) { 28 CeedScalar ctxData[5] = {1, 2, 3, 4, 5}; 29 CeedQFunctionContextSetData(ctx, CEED_MEM_HOST, CEED_COPY_VALUES, 30 sizeof(ctxData), &ctxData); 31 } else { // Make context twice as long so the size is the same in output 32 CeedScalar ctxData[10] = {1, 2, 3, 4, 5, 1, 2, 3, 4, 5}; 33 CeedQFunctionContextSetData(ctx, CEED_MEM_HOST, CEED_COPY_VALUES, 34 sizeof(ctxData), &ctxData); 35 } 36 CeedQFunctionContextView(ctx, stdout); 37 38 CeedQFunctionDestroy(&qf_setup); 39 CeedQFunctionDestroy(&qf_mass); 40 CeedQFunctionContextDestroy(&ctx); 41 CeedDestroy(&ceed); 42 return 0; 43 } 44