Skip to content

Commit 71bbf5a

Browse files
authored
Merge pull request #1275 from CEED/jrwrigh/fluidsCeedCall
fluids: Add PetscCallCeed to capture ceed errors with Petsc
2 parents 3843268 + a424bcd commit 71bbf5a

23 files changed

Lines changed: 858 additions & 775 deletions

examples/fluids/navierstokes.c

Lines changed: 49 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -104,22 +104,24 @@ int main(int argc, char **argv) {
104104
// ---------------------------------------------------------------------------
105105
// -- Initialize backend
106106
Ceed ceed;
107-
CeedInit(app_ctx->ceed_resource, &ceed);
107+
PetscCheck(CeedInit(app_ctx->ceed_resource, &ceed) == CEED_ERROR_SUCCESS, comm, PETSC_ERR_LIB, "Ceed initialization failed");
108108
user->ceed = ceed;
109109

110+
PetscCheck(CeedSetErrorHandler(ceed, CeedErrorStore) == CEED_ERROR_SUCCESS, comm, PETSC_ERR_LIB, "Setting libCEED error handler failed");
111+
110112
// -- Check preferred MemType
111113
CeedMemType mem_type_backend;
112-
CeedGetPreferredMemType(ceed, &mem_type_backend);
114+
PetscCallCeed(ceed, CeedGetPreferredMemType(ceed, &mem_type_backend));
113115

114116
{
115117
const char *resource;
116-
CeedGetResource(ceed, &resource);
118+
PetscCallCeed(ceed, CeedGetResource(ceed, &resource));
117119
if (strstr(resource, "/gpu/sycl")) {
118120
PetscDeviceContext dctx;
119121
PetscCall(PetscDeviceContextGetCurrentContext(&dctx));
120122
void *stream_handle;
121123
PetscCall(PetscDeviceContextGetStreamHandle(dctx, &stream_handle));
122-
CeedSetStream(ceed, stream_handle);
124+
PetscCallCeed(ceed, CeedSetStream(ceed, stream_handle));
123125
}
124126
}
125127

@@ -136,7 +138,7 @@ int main(int argc, char **argv) {
136138
break;
137139
case CEED_MEM_DEVICE: {
138140
const char *resolved;
139-
CeedGetResource(ceed, &resolved);
141+
PetscCallCeed(ceed, CeedGetResource(ceed, &resolved));
140142
if (strstr(resolved, "/gpu/cuda")) vec_type = VECCUDA;
141143
else if (strstr(resolved, "/gpu/hip")) vec_type = VECKOKKOS;
142144
else if (strstr(resolved, "/gpu/sycl")) vec_type = VECKOKKOS;
@@ -256,65 +258,65 @@ int main(int argc, char **argv) {
256258
PetscCall(DifferentialFilterDataDestroy(user->diff_filter));
257259

258260
// -- Vectors
259-
CeedVectorDestroy(&ceed_data->x_coord);
260-
CeedVectorDestroy(&ceed_data->q_data);
261-
CeedVectorDestroy(&user->q_ceed);
262-
CeedVectorDestroy(&user->q_dot_ceed);
263-
CeedVectorDestroy(&user->g_ceed);
264-
CeedVectorDestroy(&user->coo_values_amat);
265-
CeedVectorDestroy(&user->coo_values_pmat);
261+
PetscCallCeed(ceed, CeedVectorDestroy(&ceed_data->x_coord));
262+
PetscCallCeed(ceed, CeedVectorDestroy(&ceed_data->q_data));
263+
PetscCallCeed(ceed, CeedVectorDestroy(&user->q_ceed));
264+
PetscCallCeed(ceed, CeedVectorDestroy(&user->q_dot_ceed));
265+
PetscCallCeed(ceed, CeedVectorDestroy(&user->g_ceed));
266+
PetscCallCeed(ceed, CeedVectorDestroy(&user->coo_values_amat));
267+
PetscCallCeed(ceed, CeedVectorDestroy(&user->coo_values_pmat));
266268

267269
// -- Bases
268-
CeedBasisDestroy(&ceed_data->basis_q);
269-
CeedBasisDestroy(&ceed_data->basis_x);
270-
CeedBasisDestroy(&ceed_data->basis_xc);
271-
CeedBasisDestroy(&ceed_data->basis_q_sur);
272-
CeedBasisDestroy(&ceed_data->basis_x_sur);
270+
PetscCallCeed(ceed, CeedBasisDestroy(&ceed_data->basis_q));
271+
PetscCallCeed(ceed, CeedBasisDestroy(&ceed_data->basis_x));
272+
PetscCallCeed(ceed, CeedBasisDestroy(&ceed_data->basis_xc));
273+
PetscCallCeed(ceed, CeedBasisDestroy(&ceed_data->basis_q_sur));
274+
PetscCallCeed(ceed, CeedBasisDestroy(&ceed_data->basis_x_sur));
273275

274276
// -- Restrictions
275-
CeedElemRestrictionDestroy(&ceed_data->elem_restr_q);
276-
CeedElemRestrictionDestroy(&ceed_data->elem_restr_x);
277-
CeedElemRestrictionDestroy(&ceed_data->elem_restr_qd_i);
277+
PetscCallCeed(ceed, CeedElemRestrictionDestroy(&ceed_data->elem_restr_q));
278+
PetscCallCeed(ceed, CeedElemRestrictionDestroy(&ceed_data->elem_restr_x));
279+
PetscCallCeed(ceed, CeedElemRestrictionDestroy(&ceed_data->elem_restr_qd_i));
278280

279281
// Destroy QFunction contexts after using
280282
// ToDo: Simplify tracked libCEED objects, smaller struct
281283
{
282-
CeedQFunctionContextDestroy(&problem->apply_inflow_jacobian.qfunction_context);
283-
CeedQFunctionContextDestroy(&problem->apply_inflow_jacobian.qfunction_context);
284-
CeedQFunctionContextDestroy(&problem->apply_outflow_jacobian.qfunction_context);
285-
CeedQFunctionContextDestroy(&problem->apply_outflow_jacobian.qfunction_context);
286-
CeedQFunctionContextDestroy(&problem->apply_freestream_jacobian.qfunction_context);
287-
CeedQFunctionContextDestroy(&problem->apply_freestream_jacobian.qfunction_context);
288-
CeedQFunctionContextDestroy(&problem->setup_sur.qfunction_context);
289-
CeedQFunctionContextDestroy(&problem->setup_vol.qfunction_context);
290-
CeedQFunctionContextDestroy(&problem->ics.qfunction_context);
291-
CeedQFunctionContextDestroy(&problem->apply_vol_rhs.qfunction_context);
292-
CeedQFunctionContextDestroy(&problem->apply_vol_ifunction.qfunction_context);
293-
CeedQFunctionContextDestroy(&problem->apply_vol_ijacobian.qfunction_context);
284+
PetscCallCeed(ceed, CeedQFunctionContextDestroy(&problem->apply_inflow_jacobian.qfunction_context));
285+
PetscCallCeed(ceed, CeedQFunctionContextDestroy(&problem->apply_inflow_jacobian.qfunction_context));
286+
PetscCallCeed(ceed, CeedQFunctionContextDestroy(&problem->apply_outflow_jacobian.qfunction_context));
287+
PetscCallCeed(ceed, CeedQFunctionContextDestroy(&problem->apply_outflow_jacobian.qfunction_context));
288+
PetscCallCeed(ceed, CeedQFunctionContextDestroy(&problem->apply_freestream_jacobian.qfunction_context));
289+
PetscCallCeed(ceed, CeedQFunctionContextDestroy(&problem->apply_freestream_jacobian.qfunction_context));
290+
PetscCallCeed(ceed, CeedQFunctionContextDestroy(&problem->setup_sur.qfunction_context));
291+
PetscCallCeed(ceed, CeedQFunctionContextDestroy(&problem->setup_vol.qfunction_context));
292+
PetscCallCeed(ceed, CeedQFunctionContextDestroy(&problem->ics.qfunction_context));
293+
PetscCallCeed(ceed, CeedQFunctionContextDestroy(&problem->apply_vol_rhs.qfunction_context));
294+
PetscCallCeed(ceed, CeedQFunctionContextDestroy(&problem->apply_vol_ifunction.qfunction_context));
295+
PetscCallCeed(ceed, CeedQFunctionContextDestroy(&problem->apply_vol_ijacobian.qfunction_context));
294296
}
295297

296298
// -- QFunctions
297-
CeedQFunctionDestroy(&ceed_data->qf_setup_vol);
298-
CeedQFunctionDestroy(&ceed_data->qf_ics);
299-
CeedQFunctionDestroy(&ceed_data->qf_rhs_vol);
300-
CeedQFunctionDestroy(&ceed_data->qf_ifunction_vol);
301-
CeedQFunctionDestroy(&ceed_data->qf_setup_sur);
302-
CeedQFunctionDestroy(&ceed_data->qf_apply_inflow);
303-
CeedQFunctionDestroy(&ceed_data->qf_apply_inflow_jacobian);
304-
CeedQFunctionDestroy(&ceed_data->qf_apply_freestream);
305-
CeedQFunctionDestroy(&ceed_data->qf_apply_freestream_jacobian);
299+
PetscCallCeed(ceed, CeedQFunctionDestroy(&ceed_data->qf_setup_vol));
300+
PetscCallCeed(ceed, CeedQFunctionDestroy(&ceed_data->qf_ics));
301+
PetscCallCeed(ceed, CeedQFunctionDestroy(&ceed_data->qf_rhs_vol));
302+
PetscCallCeed(ceed, CeedQFunctionDestroy(&ceed_data->qf_ifunction_vol));
303+
PetscCallCeed(ceed, CeedQFunctionDestroy(&ceed_data->qf_setup_sur));
304+
PetscCallCeed(ceed, CeedQFunctionDestroy(&ceed_data->qf_apply_inflow));
305+
PetscCallCeed(ceed, CeedQFunctionDestroy(&ceed_data->qf_apply_inflow_jacobian));
306+
PetscCallCeed(ceed, CeedQFunctionDestroy(&ceed_data->qf_apply_freestream));
307+
PetscCallCeed(ceed, CeedQFunctionDestroy(&ceed_data->qf_apply_freestream_jacobian));
306308

307309
// -- Operators
308-
CeedOperatorDestroy(&ceed_data->op_setup_vol);
310+
PetscCallCeed(ceed, CeedOperatorDestroy(&ceed_data->op_setup_vol));
309311
PetscCall(OperatorApplyContextDestroy(ceed_data->op_ics_ctx));
310-
CeedOperatorDestroy(&user->op_rhs_vol);
311-
CeedOperatorDestroy(&user->op_ifunction_vol);
312+
PetscCallCeed(ceed, CeedOperatorDestroy(&user->op_rhs_vol));
313+
PetscCallCeed(ceed, CeedOperatorDestroy(&user->op_ifunction_vol));
312314
PetscCall(OperatorApplyContextDestroy(user->op_rhs_ctx));
313-
CeedOperatorDestroy(&user->op_ifunction);
314-
CeedOperatorDestroy(&user->op_ijacobian);
315+
PetscCallCeed(ceed, CeedOperatorDestroy(&user->op_ifunction));
316+
PetscCallCeed(ceed, CeedOperatorDestroy(&user->op_ijacobian));
315317

316318
// -- Ceed
317-
CeedDestroy(&ceed);
319+
PetscCheck(CeedDestroy(&ceed) == CEED_ERROR_SUCCESS, comm, PETSC_ERR_LIB, "Destroying Ceed object failed");
318320

319321
if (app_ctx->test_type != TESTTYPE_NONE) {
320322
PetscInt num_options_left = 0;

examples/fluids/navierstokes.h

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,25 @@
1616
#include "qfunctions/newtonian_types.h"
1717
#include "qfunctions/stabilization_types.h"
1818

19-
// -----------------------------------------------------------------------------
20-
// PETSc Version
21-
// -----------------------------------------------------------------------------
2219
#if PETSC_VERSION_LT(3, 19, 0)
2320
#error "PETSc v3.19 or later is required"
2421
#endif
2522

23+
#define PetscCeedChk(ceed, ierr) \
24+
do { \
25+
if (ierr != CEED_ERROR_SUCCESS) { \
26+
const char *error_message; \
27+
CeedGetErrorMessage(ceed, &error_message); \
28+
SETERRQ(PETSC_COMM_SELF, PETSC_ERR_LIB, "%s", error_message); \
29+
} \
30+
} while (0)
31+
32+
#define PetscCallCeed(ceed, ...) \
33+
do { \
34+
int ierr_q_ = __VA_ARGS__; \
35+
PetscCeedChk(ceed, ierr_q_); \
36+
} while (0)
37+
2638
// -----------------------------------------------------------------------------
2739
// Enums
2840
// -----------------------------------------------------------------------------
@@ -279,7 +291,7 @@ struct ProblemData_private {
279291
apply_freestream, apply_inflow_jacobian, apply_outflow_jacobian, apply_freestream_jacobian;
280292
bool non_zero_time;
281293
PetscBool bc_from_ics, use_strong_bc_ceed;
282-
PetscErrorCode (*print_info)(ProblemData *, AppCtx);
294+
PetscErrorCode (*print_info)(User, ProblemData *, AppCtx);
283295
};
284296

285297
extern int FreeContextPetsc(void *);
@@ -299,15 +311,15 @@ extern PetscErrorCode NS_ADVECTION(ProblemData *problem, DM dm, void *ctx, Simpl
299311
extern PetscErrorCode NS_ADVECTION2D(ProblemData *problem, DM dm, void *ctx, SimpleBC bc);
300312

301313
// Print function for each problem
302-
extern PetscErrorCode PRINT_NEWTONIAN(ProblemData *problem, AppCtx app_ctx);
314+
extern PetscErrorCode PRINT_NEWTONIAN(User user, ProblemData *problem, AppCtx app_ctx);
303315

304-
extern PetscErrorCode PRINT_EULER_VORTEX(ProblemData *problem, AppCtx app_ctx);
316+
extern PetscErrorCode PRINT_EULER_VORTEX(User user, ProblemData *problem, AppCtx app_ctx);
305317

306-
extern PetscErrorCode PRINT_SHOCKTUBE(ProblemData *problem, AppCtx app_ctx);
318+
extern PetscErrorCode PRINT_SHOCKTUBE(User user, ProblemData *problem, AppCtx app_ctx);
307319

308-
extern PetscErrorCode PRINT_ADVECTION(ProblemData *problem, AppCtx app_ctx);
320+
extern PetscErrorCode PRINT_ADVECTION(User user, ProblemData *problem, AppCtx app_ctx);
309321

310-
extern PetscErrorCode PRINT_ADVECTION2D(ProblemData *problem, AppCtx app_ctx);
322+
extern PetscErrorCode PRINT_ADVECTION2D(User user, ProblemData *problem, AppCtx app_ctx);
311323

312324
PetscErrorCode PrintRunInfo(User user, Physics phys_ctx, ProblemData *problem, MPI_Comm comm);
313325

examples/fluids/problems/advection.c

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ PetscErrorCode NS_ADVECTION(ProblemData *problem, DM dm, void *ctx, SimpleBC bc)
2323
StabilizationType stab;
2424
SetupContextAdv setup_context;
2525
User user = *(User *)ctx;
26-
MPI_Comm comm = PETSC_COMM_WORLD;
26+
MPI_Comm comm = user->comm;
27+
Ceed ceed = user->ceed;
2728
PetscBool implicit;
2829
PetscBool has_curr_time = PETSC_FALSE;
2930
AdvectionContext advection_ctx;
@@ -173,27 +174,29 @@ PetscErrorCode NS_ADVECTION(ProblemData *problem, DM dm, void *ctx, SimpleBC bc)
173174
advection_ctx->strong_form = strong_form;
174175
advection_ctx->stabilization = stab;
175176

176-
CeedQFunctionContextCreate(user->ceed, &problem->ics.qfunction_context);
177-
CeedQFunctionContextSetData(problem->ics.qfunction_context, CEED_MEM_HOST, CEED_USE_POINTER, sizeof(*setup_context), setup_context);
178-
CeedQFunctionContextSetDataDestroy(problem->ics.qfunction_context, CEED_MEM_HOST, FreeContextPetsc);
177+
PetscCallCeed(ceed, CeedQFunctionContextCreate(user->ceed, &problem->ics.qfunction_context));
178+
PetscCallCeed(ceed,
179+
CeedQFunctionContextSetData(problem->ics.qfunction_context, CEED_MEM_HOST, CEED_USE_POINTER, sizeof(*setup_context), setup_context));
180+
PetscCallCeed(ceed, CeedQFunctionContextSetDataDestroy(problem->ics.qfunction_context, CEED_MEM_HOST, FreeContextPetsc));
179181

180-
CeedQFunctionContextCreate(user->ceed, &advection_context);
181-
CeedQFunctionContextSetData(advection_context, CEED_MEM_HOST, CEED_USE_POINTER, sizeof(*advection_ctx), advection_ctx);
182-
CeedQFunctionContextSetDataDestroy(advection_context, CEED_MEM_HOST, FreeContextPetsc);
182+
PetscCallCeed(ceed, CeedQFunctionContextCreate(user->ceed, &advection_context));
183+
PetscCallCeed(ceed, CeedQFunctionContextSetData(advection_context, CEED_MEM_HOST, CEED_USE_POINTER, sizeof(*advection_ctx), advection_ctx));
184+
PetscCallCeed(ceed, CeedQFunctionContextSetDataDestroy(advection_context, CEED_MEM_HOST, FreeContextPetsc));
183185
problem->apply_vol_rhs.qfunction_context = advection_context;
184-
CeedQFunctionContextReferenceCopy(advection_context, &problem->apply_vol_ifunction.qfunction_context);
185-
CeedQFunctionContextReferenceCopy(advection_context, &problem->apply_inflow.qfunction_context);
186+
PetscCallCeed(ceed, CeedQFunctionContextReferenceCopy(advection_context, &problem->apply_vol_ifunction.qfunction_context));
187+
PetscCallCeed(ceed, CeedQFunctionContextReferenceCopy(advection_context, &problem->apply_inflow.qfunction_context));
186188
PetscFunctionReturn(PETSC_SUCCESS);
187189
}
188190

189-
PetscErrorCode PRINT_ADVECTION(ProblemData *problem, AppCtx app_ctx) {
190-
MPI_Comm comm = PETSC_COMM_WORLD;
191+
PetscErrorCode PRINT_ADVECTION(User user, ProblemData *problem, AppCtx app_ctx) {
192+
MPI_Comm comm = user->comm;
193+
Ceed ceed = user->ceed;
191194
SetupContextAdv setup_ctx;
192195
AdvectionContext advection_ctx;
193196

194197
PetscFunctionBeginUser;
195-
CeedQFunctionContextGetData(problem->ics.qfunction_context, CEED_MEM_HOST, &setup_ctx);
196-
CeedQFunctionContextGetData(problem->apply_vol_rhs.qfunction_context, CEED_MEM_HOST, &advection_ctx);
198+
PetscCallCeed(ceed, CeedQFunctionContextGetData(problem->ics.qfunction_context, CEED_MEM_HOST, &setup_ctx));
199+
PetscCallCeed(ceed, CeedQFunctionContextGetData(problem->apply_vol_rhs.qfunction_context, CEED_MEM_HOST, &advection_ctx));
197200
PetscCall(PetscPrintf(comm,
198201
" Problem:\n"
199202
" Problem Name : %s\n"
@@ -208,7 +211,7 @@ PetscErrorCode PRINT_ADVECTION(ProblemData *problem, AppCtx app_ctx) {
208211
if (setup_ctx->wind_type == WIND_TRANSLATION) {
209212
PetscCall(PetscPrintf(comm, " Background Wind : %f,%f,%f\n", setup_ctx->wind[0], setup_ctx->wind[1], setup_ctx->wind[2]));
210213
}
211-
CeedQFunctionContextRestoreData(problem->ics.qfunction_context, &setup_ctx);
212-
CeedQFunctionContextRestoreData(problem->apply_vol_rhs.qfunction_context, &advection_ctx);
214+
PetscCallCeed(ceed, CeedQFunctionContextRestoreData(problem->ics.qfunction_context, &setup_ctx));
215+
PetscCallCeed(ceed, CeedQFunctionContextRestoreData(problem->apply_vol_rhs.qfunction_context, &advection_ctx));
213216
PetscFunctionReturn(PETSC_SUCCESS);
214217
}

examples/fluids/problems/advection2d.c

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ PetscErrorCode NS_ADVECTION2D(ProblemData *problem, DM dm, void *ctx, SimpleBC b
2121
StabilizationType stab;
2222
SetupContextAdv2D setup_context;
2323
User user = *(User *)ctx;
24-
MPI_Comm comm = PETSC_COMM_WORLD;
24+
MPI_Comm comm = user->comm;
25+
Ceed ceed = user->ceed;
2526
PetscBool implicit;
2627
PetscBool has_curr_time = PETSC_FALSE;
2728
AdvectionContext advection_ctx;
@@ -156,27 +157,29 @@ PetscErrorCode NS_ADVECTION2D(ProblemData *problem, DM dm, void *ctx, SimpleBC b
156157
advection_ctx->strong_form = strong_form;
157158
advection_ctx->stabilization = stab;
158159

159-
CeedQFunctionContextCreate(user->ceed, &problem->ics.qfunction_context);
160-
CeedQFunctionContextSetData(problem->ics.qfunction_context, CEED_MEM_HOST, CEED_USE_POINTER, sizeof(*setup_context), setup_context);
161-
CeedQFunctionContextSetDataDestroy(problem->ics.qfunction_context, CEED_MEM_HOST, FreeContextPetsc);
160+
PetscCallCeed(ceed, CeedQFunctionContextCreate(user->ceed, &problem->ics.qfunction_context));
161+
PetscCallCeed(ceed,
162+
CeedQFunctionContextSetData(problem->ics.qfunction_context, CEED_MEM_HOST, CEED_USE_POINTER, sizeof(*setup_context), setup_context));
163+
PetscCallCeed(ceed, CeedQFunctionContextSetDataDestroy(problem->ics.qfunction_context, CEED_MEM_HOST, FreeContextPetsc));
162164

163-
CeedQFunctionContextCreate(user->ceed, &advection_context);
164-
CeedQFunctionContextSetData(advection_context, CEED_MEM_HOST, CEED_USE_POINTER, sizeof(*advection_ctx), advection_ctx);
165-
CeedQFunctionContextSetDataDestroy(advection_context, CEED_MEM_HOST, FreeContextPetsc);
165+
PetscCallCeed(ceed, CeedQFunctionContextCreate(user->ceed, &advection_context));
166+
PetscCallCeed(ceed, CeedQFunctionContextSetData(advection_context, CEED_MEM_HOST, CEED_USE_POINTER, sizeof(*advection_ctx), advection_ctx));
167+
PetscCallCeed(ceed, CeedQFunctionContextSetDataDestroy(advection_context, CEED_MEM_HOST, FreeContextPetsc));
166168
problem->apply_vol_rhs.qfunction_context = advection_context;
167-
CeedQFunctionContextReferenceCopy(advection_context, &problem->apply_vol_ifunction.qfunction_context);
168-
CeedQFunctionContextReferenceCopy(advection_context, &problem->apply_inflow.qfunction_context);
169+
PetscCallCeed(ceed, CeedQFunctionContextReferenceCopy(advection_context, &problem->apply_vol_ifunction.qfunction_context));
170+
PetscCallCeed(ceed, CeedQFunctionContextReferenceCopy(advection_context, &problem->apply_inflow.qfunction_context));
169171
PetscFunctionReturn(PETSC_SUCCESS);
170172
}
171173

172-
PetscErrorCode PRINT_ADVECTION2D(ProblemData *problem, AppCtx app_ctx) {
173-
MPI_Comm comm = PETSC_COMM_WORLD;
174+
PetscErrorCode PRINT_ADVECTION2D(User user, ProblemData *problem, AppCtx app_ctx) {
175+
MPI_Comm comm = user->comm;
176+
Ceed ceed = user->ceed;
174177
SetupContextAdv2D setup_ctx;
175178
AdvectionContext advection_ctx;
176179

177180
PetscFunctionBeginUser;
178-
CeedQFunctionContextGetData(problem->ics.qfunction_context, CEED_MEM_HOST, &setup_ctx);
179-
CeedQFunctionContextGetData(problem->apply_vol_rhs.qfunction_context, CEED_MEM_HOST, &advection_ctx);
181+
PetscCallCeed(ceed, CeedQFunctionContextGetData(problem->ics.qfunction_context, CEED_MEM_HOST, &setup_ctx));
182+
PetscCallCeed(ceed, CeedQFunctionContextGetData(problem->apply_vol_rhs.qfunction_context, CEED_MEM_HOST, &advection_ctx));
180183
PetscCall(PetscPrintf(comm,
181184
" Problem:\n"
182185
" Problem Name : %s\n"
@@ -187,7 +190,7 @@ PetscErrorCode PRINT_ADVECTION2D(ProblemData *problem, AppCtx app_ctx) {
187190
if (setup_ctx->wind_type == WIND_TRANSLATION) {
188191
PetscCall(PetscPrintf(comm, " Background Wind : %f,%f\n", setup_ctx->wind[0], setup_ctx->wind[1]));
189192
}
190-
CeedQFunctionContextRestoreData(problem->ics.qfunction_context, &setup_ctx);
191-
CeedQFunctionContextRestoreData(problem->apply_vol_rhs.qfunction_context, &advection_ctx);
193+
PetscCallCeed(ceed, CeedQFunctionContextRestoreData(problem->ics.qfunction_context, &setup_ctx));
194+
PetscCallCeed(ceed, CeedQFunctionContextRestoreData(problem->apply_vol_rhs.qfunction_context, &advection_ctx));
192195
PetscFunctionReturn(PETSC_SUCCESS);
193196
}

0 commit comments

Comments
 (0)