/// @file /// Test viewing of QFunction and QFunctionContext /// \test Test viewing of QFunction and QFunctionContext #include #include #include "t400-qfunction.h" int main(int argc, char **argv) { Ceed ceed; CeedQFunction qf_setup, qf_mass; CeedQFunctionContext ctx; CeedInit(argv[1], &ceed); CeedQFunctionCreateInterior(ceed, 1, setup, setup_loc, &qf_setup); CeedQFunctionAddInput(qf_setup, "w", 1, CEED_EVAL_WEIGHT); CeedQFunctionAddOutput(qf_setup, "q data", 1, CEED_EVAL_NONE); CeedQFunctionCreateInterior(ceed, 1, mass, mass_loc, &qf_mass); CeedQFunctionAddInput(qf_mass, "q data", 1, CEED_EVAL_NONE); CeedQFunctionAddInput(qf_mass, "u", 1, CEED_EVAL_INTERP); CeedQFunctionAddOutput(qf_mass, "v", 1, CEED_EVAL_INTERP); CeedQFunctionView(qf_setup, stdout); CeedQFunctionView(qf_mass, stdout); CeedQFunctionContextCreate(ceed, &ctx); { double ctxData[5] = {1, 2, 3, 4, 5}; CeedQFunctionContextSetData(ctx, CEED_MEM_HOST, CEED_COPY_VALUES, sizeof(ctxData), &ctxData); CeedQFunctionContextRegisterDouble(ctx, "scale", 0, 5, "scaling values"); } CeedQFunctionContextView(ctx, stdout); // Check tabs and CeedObject functionality { CeedQFunction qf_mass_copy = NULL; CeedQFunctionContext ctx_copy = NULL; CeedQFunctionReferenceCopy(qf_mass, &qf_mass_copy); CeedQFunctionSetNumViewTabs(qf_mass_copy, 1); CeedObjectView((CeedObject)qf_mass_copy, stdout); CeedObjectDestroy((CeedObject *)&qf_mass_copy); CeedQFunctionContextReferenceCopy(ctx, &ctx_copy); CeedQFunctionContextSetNumViewTabs(ctx_copy, 1); CeedObjectView((CeedObject)ctx_copy, stdout); CeedObjectDestroy((CeedObject *)&ctx_copy); } CeedQFunctionDestroy(&qf_setup); CeedQFunctionDestroy(&qf_mass); CeedQFunctionContextDestroy(&ctx); CeedDestroy(&ceed); return 0; }