Skip to content

Commit 3e4d339

Browse files
committed
SWE: Fix set context bug after change in the interface
1 parent 5d013b9 commit 3e4d339

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

examples/fluids/shallow-water/shallowwater.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,10 +385,19 @@ int main(int argc, char **argv) {
385385
// Free edgenodes structure array
386386
ierr = PetscFree(edgenodes); CHKERRQ(ierr);
387387

388-
// Setup libCEED's objects
388+
// Setup libCEED's objects and contexts
389389
ierr = PetscMalloc1(1, &ceeddata); CHKERRQ(ierr);
390+
CeedQFunctionContextCreate(ceed, &ceeddata->physCtx);
391+
CeedQFunctionContextSetData(ceeddata->physCtx, CEED_MEM_HOST,
392+
CEED_USE_POINTER, sizeof physCtxData,
393+
&physCtxData);
394+
CeedQFunctionContextCreate(ceed, &ceeddata->problCtx);
395+
CeedQFunctionContextSetData(ceeddata->problCtx, CEED_MEM_HOST,
396+
CEED_USE_POINTER, sizeof problCtxData,
397+
&problCtxData);
398+
390399
ierr = SetupLibceed(dm, ceed, degree, qextra, ncompx, ncompq, user,
391-
ceeddata, problem, &physCtxData, &problCtxData);
400+
ceeddata, problem);
392401
CHKERRQ(ierr);
393402

394403
// Set up PETSc context

examples/fluids/shallow-water/src/setup.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -651,9 +651,7 @@ PetscErrorCode VectorPlacePetscVec(CeedVector c, Vec p) {
651651

652652
PetscErrorCode SetupLibceed(DM dm, Ceed ceed, CeedInt degree, CeedInt qextra,
653653
PetscInt ncompx, PetscInt ncompq, User user,
654-
CeedData data, problemData *problem,
655-
PhysicsContext physCtxData,
656-
ProblemContext problCtxData) {
654+
CeedData data, problemData *problem) {
657655
int ierr;
658656
DM dmcoord;
659657
Vec Xloc;
@@ -831,13 +829,7 @@ PetscErrorCode SetupLibceed(DM dm, Ceed ceed, CeedInt degree, CeedInt qextra,
831829
user->op_jacobian = op_jacobian;
832830

833831
// Set up the libCEED context
834-
CeedQFunctionContextCreate(ceed, &data->physCtx);
835-
CeedQFunctionContextSetData(data->physCtx, CEED_MEM_HOST, CEED_USE_POINTER,
836-
sizeof physCtxData, &physCtxData);
837832
CeedQFunctionSetContext(qf_ics, data->physCtx);
838-
CeedQFunctionContextCreate(ceed, &data->problCtx);
839-
CeedQFunctionContextSetData(data->problCtx, CEED_MEM_HOST, CEED_USE_POINTER,
840-
sizeof problCtxData, &problCtxData);
841833
CeedQFunctionSetContext(qf_explicit, data->problCtx);
842834
CeedQFunctionSetContext(qf_implicit, data->problCtx);
843835
CeedQFunctionSetContext(qf_jacobian, data->problCtx);

examples/fluids/shallow-water/sw_headers.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,7 @@ PetscErrorCode CreateRestrictionPlex(Ceed ceed, DM dm, CeedInt P, CeedInt ncomp,
183183
// Auxiliary function to set up libCEED objects for a given degree
184184
PetscErrorCode SetupLibceed(DM dm, Ceed ceed, CeedInt degree, CeedInt qextra,
185185
const PetscInt ncompx, PetscInt ncompq, User user,
186-
CeedData data, problemData *problem,
187-
PhysicsContext physCtxData,
188-
ProblemContext problCtxData);
186+
CeedData data, problemData *problem);
189187

190188
// -----------------------------------------------------------------------------
191189
// RHS (Explicit part in time-stepper) function setup

0 commit comments

Comments
 (0)