Skip to content

Commit 38020cd

Browse files
committed
petsc - minor update for API change
1 parent 84326e1 commit 38020cd

File tree

6 files changed

+20
-4
lines changed

6 files changed

+20
-4
lines changed

examples/fluids/navierstokes.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
#error "PETSc v3.23 or later is required"
2222
#endif
2323

24+
#if PETSC_VERSION_LT(3, 24, 0)
25+
#define DMSetCoordinateDisc(a, b, c, d) DMSetCoordinateDisc(a, b, d)
26+
#endif
27+
2428
// -----------------------------------------------------------------------------
2529
// Enums
2630
// -----------------------------------------------------------------------------

examples/fluids/src/dm_utils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ PetscErrorCode DMSetupByOrderBegin_FEM(PetscBool setup_faces, PetscBool setup_co
456456
if (coord_order != PETSC_DECIDE) fe_coord_order = coord_order;
457457
PetscCall(PetscFECreateLagrange(comm, dim, num_comp_coord, is_simplex, fe_coord_order, q_order, &fe_coord_new));
458458
if (setup_faces) PetscCall(PetscFEGetHeightSubspace(fe_coord_new, 1, &fe_coord_face_new));
459-
PetscCall(DMSetCoordinateDisc(dm, fe_coord_new, PETSC_TRUE));
459+
PetscCall(DMSetCoordinateDisc(dm, fe_coord_new, PETSC_FALSE, PETSC_TRUE));
460460
PetscCall(PetscFEDestroy(&fe_coord_new));
461461
}
462462
PetscFunctionReturn(PETSC_SUCCESS);

examples/petsc/include/petscutils.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414

1515
#include "structs.h"
1616

17+
#if PETSC_VERSION_LT(3, 24, 0)
18+
#define DMSetCoordinateDisc(a, b, c, d) DMSetCoordinateDisc(a, b, d)
19+
#endif
20+
1721
CeedMemType MemTypeP2C(PetscMemType mtype);
1822
PetscErrorCode VecP2C(Vec X_petsc, PetscMemType *mem_type, CeedVector x_ceed);
1923
PetscErrorCode VecC2P(CeedVector x_ceed, PetscMemType mem_type, Vec X_petsc);

examples/petsc/src/petscutils.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,23 +151,26 @@ PetscErrorCode SetupDMByDegree(DM dm, PetscInt p_degree, PetscInt q_extra, Petsc
151151
// create FE field for coordinates
152152
PetscFE fe_coords;
153153
PetscInt num_comp_coord;
154+
154155
PetscCall(DMGetCoordinateDim(dm, &num_comp_coord));
155156
PetscCall(PetscFECreateLagrange(comm, dim, num_comp_coord, is_simplex, 1, q_degree, &fe_coords));
156-
PetscCall(DMSetCoordinateDisc(dm, fe_coords, PETSC_TRUE));
157+
PetscCall(DMSetCoordinateDisc(dm, fe_coords, PETSC_FALSE, PETSC_TRUE));
157158
PetscCall(PetscFEDestroy(&fe_coords));
158159
}
159160

160161
// Setup Dirichlet BC
161162
// Note bp1, bp2 are projection and we don't need to apply BC
162-
// For bp3,bp4, the target function is zero on the boundaries
163+
// For bp3, bp4, the target function is zero on the boundaries
163164
// So we pass bcFunc = NULL in DMAddBoundary function
164165
if (enforce_bc) {
165166
PetscBool has_label;
167+
166168
PetscCall(DMHasLabel(dm, "marker", &has_label));
167169
if (!has_label) {
168170
PetscCall(CreateBCLabel(dm, "marker"));
169171
}
170172
DMLabel label;
173+
171174
PetscCall(DMGetLabel(dm, "marker", &label));
172175
PetscCall(DMAddBoundary(dm, DM_BC_ESSENTIAL, "wall", label, 1, marker_ids, 0, 0, NULL, NULL, NULL, NULL, NULL));
173176
PetscCall(DMSetOptionsPrefix(dm, "final_"));
@@ -176,6 +179,7 @@ PetscErrorCode SetupDMByDegree(DM dm, PetscInt p_degree, PetscInt q_extra, Petsc
176179

177180
if (!is_simplex) {
178181
DM dm_coord;
182+
179183
PetscCall(DMGetCoordinateDM(dm, &dm_coord));
180184
PetscCall(DMPlexSetClosurePermutationTensor(dm, PETSC_DETERMINE, NULL));
181185
PetscCall(DMPlexSetClosurePermutationTensor(dm_coord, PETSC_DETERMINE, NULL));

examples/solids/include/setup-dm.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111

1212
#include "../include/structs.h"
1313

14+
#if PETSC_VERSION_LT(3, 24, 0)
15+
#define DMSetCoordinateDisc(a, b, c, d) DMSetCoordinateDisc(a, b, d)
16+
#endif
17+
1418
// -----------------------------------------------------------------------------
1519
// Setup DM
1620
// -----------------------------------------------------------------------------

examples/solids/src/setup-dm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ PetscErrorCode SetupDMByDegree(DM dm, AppCtx app_ctx, PetscInt order, PetscBool
8686
PetscInt num_comp_coord;
8787
PetscCall(DMGetCoordinateDim(dm, &num_comp_coord));
8888
PetscCall(PetscFECreateLagrange(comm, dim, num_comp_coord, PETSC_FALSE, 1, 1, &fe_coords));
89-
PetscCall(DMSetCoordinateDisc(dm, fe_coords, PETSC_TRUE));
89+
PetscCall(DMSetCoordinateDisc(dm, fe_coords, PETSC_FALSE, PETSC_TRUE));
9090
PetscCall(PetscFEDestroy(&fe_coords));
9191
}
9292

0 commit comments

Comments
 (0)