Actual source code: patch.c
1: #include <petsc/private/dmpatchimpl.h>
2: #include <petscdmda.h>
3: #include <petscsf.h>
5: /*
6: Solver loop to update \tau:
8: DMZoom(dmc, &dmz)
9: DMRefine(dmz, &dmf),
10: Scatter Xcoarse -> Xzoom,
11: Interpolate Xzoom -> Xfine (note that this may be on subcomms),
12: Smooth Xfine using two-step smoother
13: normal smoother plus Kaczmarz---moves back and forth from dmzoom to dmfine
14: Compute residual Rfine
15: Restrict Rfine to Rzoom_restricted
16: Scatter Rzoom_restricted -> Rcoarse_restricted
17: Compute global residual Rcoarse
18: TauCoarse = Rcoarse - Rcoarse_restricted
19: */
21: /*@
22: DMPatchZoom - Create patches of a `DMDA` on subsets of processes, indicated by `commz`
24: Collective
26: Input Parameters:
27: + dm - the `DM`
28: . lower - the lower left corner of the requested patch
29: . upper - the upper right corner of the requested patch
30: - commz - the new communicator for the patch, `MPI_COMM_NULL` indicates that the given rank will not own a patch
32: Output Parameters:
33: + dmz - the patch `DM`
34: . sfz - the `PetscSF` mapping the patch+halo to the zoomed version (optional)
35: - sfzr - the `PetscSF` mapping the patch to the restricted zoomed version
37: Level: intermediate
39: .seealso: `DMPatchSolve()`, `DMDACreatePatchIS()`
40: @*/
41: PetscErrorCode DMPatchZoom(DM dm, MatStencil lower, MatStencil upper, MPI_Comm commz, DM *dmz, PeOp PetscSF *sfz, PeOp PetscSF *sfzr)
42: {
43: DMDAStencilType st;
44: MatStencil blower, bupper, loclower, locupper;
45: IS is;
46: const PetscInt *ranges, *indices;
47: PetscInt *localPoints = NULL;
48: PetscSFNode *remotePoints = NULL;
49: PetscInt dim, dof;
50: PetscInt M, N, P, rM, rN, rP, halo = 1, sxb, syb, szb, sxr, syr, szr, exr, eyr, ezr, mxb, myb, mzb, i, j, k, l, q;
51: PetscMPIInt size;
52: PetscBool patchis_offproc = PETSC_TRUE;
53: Vec X;
55: PetscFunctionBegin;
56: if (!sfz) halo = 0;
57: PetscCallMPI(MPI_Comm_size(PetscObjectComm((PetscObject)dm), &size));
58: /* Create patch DM */
59: PetscCall(DMDAGetInfo(dm, &dim, &M, &N, &P, NULL, NULL, NULL, &dof, NULL, NULL, NULL, NULL, &st));
61: /* Get piece for rank r, expanded by halo */
62: bupper.i = PetscMin(M, upper.i + halo);
63: blower.i = PetscMax(lower.i - halo, 0);
64: bupper.j = PetscMin(N, upper.j + halo);
65: blower.j = PetscMax(lower.j - halo, 0);
66: bupper.k = PetscMin(P, upper.k + halo);
67: blower.k = PetscMax(lower.k - halo, 0);
68: rM = bupper.i - blower.i;
69: rN = bupper.j - blower.j;
70: rP = bupper.k - blower.k;
72: if (commz != MPI_COMM_NULL) {
73: PetscCall(DMDACreate(commz, dmz));
74: PetscCall(DMSetDimension(*dmz, dim));
75: PetscCall(DMDASetSizes(*dmz, rM, rN, rP));
76: PetscCall(DMDASetNumProcs(*dmz, PETSC_DECIDE, PETSC_DECIDE, PETSC_DECIDE));
77: PetscCall(DMDASetBoundaryType(*dmz, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE));
78: PetscCall(DMDASetDof(*dmz, dof));
79: PetscCall(DMDASetStencilType(*dmz, st));
80: PetscCall(DMDASetStencilWidth(*dmz, 0));
81: PetscCall(DMDASetOwnershipRanges(*dmz, NULL, NULL, NULL));
82: PetscCall(DMSetFromOptions(*dmz));
83: PetscCall(DMSetUp(*dmz));
84: PetscCall(DMDAGetCorners(*dmz, &sxb, &syb, &szb, &mxb, &myb, &mzb));
85: sxr = PetscMax(sxb, lower.i - blower.i);
86: syr = PetscMax(syb, lower.j - blower.j);
87: szr = PetscMax(szb, lower.k - blower.k);
88: exr = PetscMin(sxb + mxb, upper.i - blower.i);
89: eyr = PetscMin(syb + myb, upper.j - blower.j);
90: ezr = PetscMin(szb + mzb, upper.k - blower.k);
91: PetscCall(PetscMalloc2(dof * rM * rN * PetscMax(rP, 1), &localPoints, dof * rM * rN * PetscMax(rP, 1), &remotePoints));
92: } else {
93: sxr = syr = szr = exr = eyr = ezr = sxb = syb = szb = mxb = myb = mzb = 0;
94: }
96: /* Create SF for restricted map */
97: PetscCall(DMCreateGlobalVector(dm, &X));
98: PetscCall(VecGetOwnershipRanges(X, &ranges));
100: loclower.i = blower.i + sxr;
101: locupper.i = blower.i + exr;
102: loclower.j = blower.j + syr;
103: locupper.j = blower.j + eyr;
104: loclower.k = blower.k + szr;
105: locupper.k = blower.k + ezr;
107: PetscCall(DMDACreatePatchIS(dm, &loclower, &locupper, &is, patchis_offproc));
108: PetscCall(ISGetIndices(is, &indices));
110: if (dim < 3) {
111: mzb = 1;
112: ezr = 1;
113: }
114: q = 0;
115: for (k = szb; k < szb + mzb; ++k) {
116: if ((k < szr) || (k >= ezr)) continue;
117: for (j = syb; j < syb + myb; ++j) {
118: if ((j < syr) || (j >= eyr)) continue;
119: for (i = sxb; i < sxb + mxb; ++i) {
120: for (l = 0; l < dof; l++) {
121: const PetscInt lp = l + dof * (((k - szb) * rN + (j - syb)) * rM + i - sxb);
122: PetscMPIInt r;
123: PetscInt ir;
125: if ((i < sxr) || (i >= exr)) continue;
126: localPoints[q] = lp;
127: PetscCall(PetscFindInt(indices[q], size + 1, ranges, &ir));
128: PetscCall(PetscMPIIntCast(ir, &r));
130: remotePoints[q].rank = r < 0 ? -(r + 1) - 1 : r;
131: remotePoints[q].index = indices[q] - ranges[remotePoints[q].rank];
132: ++q;
133: }
134: }
135: }
136: }
137: PetscCall(ISRestoreIndices(is, &indices));
138: PetscCall(ISDestroy(&is));
139: PetscCall(PetscSFCreate(PetscObjectComm((PetscObject)dm), sfzr));
140: PetscCall(PetscObjectSetName((PetscObject)*sfzr, "Restricted Map"));
141: PetscCall(PetscSFSetGraph(*sfzr, dof * M * N * P, q, localPoints, PETSC_COPY_VALUES, remotePoints, PETSC_COPY_VALUES));
143: if (sfz) {
144: /* Create SF for buffered map */
145: loclower.i = blower.i + sxb;
146: locupper.i = blower.i + sxb + mxb;
147: loclower.j = blower.j + syb;
148: locupper.j = blower.j + syb + myb;
149: loclower.k = blower.k + szb;
150: locupper.k = blower.k + szb + mzb;
152: PetscCall(DMDACreatePatchIS(dm, &loclower, &locupper, &is, patchis_offproc));
153: PetscCall(ISGetIndices(is, &indices));
155: q = 0;
156: for (k = szb; k < szb + mzb; ++k) {
157: for (j = syb; j < syb + myb; ++j) {
158: for (i = sxb; i < sxb + mxb; ++i, ++q) {
159: PetscInt ir;
160: PetscMPIInt r;
162: localPoints[q] = q;
163: PetscCall(PetscFindInt(indices[q], size + 1, ranges, &ir));
164: PetscCall(PetscMPIIntCast(ir, &r));
165: remotePoints[q].rank = r < 0 ? -(r + 1) - 1 : r;
166: remotePoints[q].index = indices[q] - ranges[remotePoints[q].rank];
167: }
168: }
169: }
170: PetscCall(ISRestoreIndices(is, &indices));
171: PetscCall(ISDestroy(&is));
172: PetscCall(PetscSFCreate(PetscObjectComm((PetscObject)dm), sfz));
173: PetscCall(PetscObjectSetName((PetscObject)*sfz, "Buffered Map"));
174: PetscCall(PetscSFSetGraph(*sfz, M * N * P, q, localPoints, PETSC_COPY_VALUES, remotePoints, PETSC_COPY_VALUES));
175: }
177: PetscCall(VecDestroy(&X));
178: PetscCall(PetscFree2(localPoints, remotePoints));
179: PetscFunctionReturn(PETSC_SUCCESS);
180: }
182: typedef enum {
183: PATCH_COMM_TYPE_WORLD = 0,
184: PATCH_COMM_TYPE_SELF = 1
185: } PatchCommType;
187: /*@
188: DMPatchSolve - Iterate over all patches of a `DMPATCH`, zooming the coarse `DM` onto each patch and scattering data between the coarse and zoomed representations
190: Collective
192: Input Parameter:
193: . dm - the `DMPATCH`
195: Level: developer
197: Note:
198: This code is a work in progress and is not currently used by other parts of PETSc. It implements the outer loop of the FAS/multigrid-like patch solver sketched at the top of the source file.
200: .seealso: `DMPATCH`, `DMPatchZoom()`, `DMPatchGetCoarse()`, `DMPatchGetPatchSize()`, `DMPatchGetCommSize()`
201: @*/
202: PetscErrorCode DMPatchSolve(DM dm)
203: {
204: MPI_Comm comm, commz;
205: DM dmc;
206: PetscSF sfz, sfzr;
207: Vec XC;
208: MatStencil patchSize, commSize, gridRank, lower, upper;
209: PetscInt M, N, P, i, j, k, l, m, n, p = 0;
210: PetscMPIInt rank, size;
211: PetscInt debug = 0;
213: PetscFunctionBegin;
214: PetscCall(PetscObjectGetComm((PetscObject)dm, &comm));
215: PetscCallMPI(MPI_Comm_rank(comm, &rank));
216: PetscCallMPI(MPI_Comm_size(comm, &size));
217: PetscCall(DMPatchGetCoarse(dm, &dmc));
218: PetscCall(DMPatchGetPatchSize(dm, &patchSize));
219: PetscCall(DMPatchGetCommSize(dm, &commSize));
220: PetscCall(DMPatchGetCommSize(dm, &commSize));
221: PetscCall(DMGetGlobalVector(dmc, &XC));
222: PetscCall(DMDAGetInfo(dmc, NULL, &M, &N, &P, &l, &m, &n, NULL, NULL, NULL, NULL, NULL, NULL));
223: M = PetscMax(M, 1);
224: l = PetscMax(l, 1);
225: N = PetscMax(N, 1);
226: m = PetscMax(m, 1);
227: P = PetscMax(P, 1);
228: n = PetscMax(n, 1);
230: gridRank.i = rank % l;
231: gridRank.j = rank / l % m;
232: gridRank.k = rank / (l * m) % n;
234: if (commSize.i * commSize.j * commSize.k == size || commSize.i * commSize.j * commSize.k == 0) {
235: commSize.i = l;
236: commSize.j = m;
237: commSize.k = n;
238: commz = comm;
239: } else if (commSize.i * commSize.j * commSize.k == 1) {
240: commz = PETSC_COMM_SELF;
241: } else {
242: PetscInt newComm = ((gridRank.k / commSize.k) * (m / commSize.j) + gridRank.j / commSize.j) * (l / commSize.i) + gridRank.i / commSize.i;
243: PetscInt newRank = ((gridRank.k % commSize.k) * commSize.j + gridRank.j % commSize.j) * commSize.i + gridRank.i % commSize.i;
244: PetscMPIInt newCommi;
245: PetscMPIInt newRanki;
247: PetscCall(PetscMPIIntCast(newComm, &newCommi));
248: PetscCall(PetscMPIIntCast(newRank, &newRanki));
249: PetscCallMPI(MPI_Comm_split(comm, newCommi, newRanki, &commz));
250: if (debug) PetscCall(PetscPrintf(PETSC_COMM_SELF, "Rank %d color %d key %d commz %p\n", rank, newCommi, newRanki, (void *)(MPI_Aint)commz));
251: }
252: /*
253: Assumptions:
254: - patchSize divides gridSize
255: - commSize divides gridSize
256: - commSize divides l,m,n
257: Ignore multiple patches per rank for now
259: Multiple ranks per patch:
260: - l,m,n divides patchSize
261: - commSize divides patchSize
262: */
263: for (k = 0; k < P; k += PetscMax(patchSize.k, 1)) {
264: for (j = 0; j < N; j += PetscMax(patchSize.j, 1)) {
265: for (i = 0; i < M; i += PetscMax(patchSize.i, 1), ++p) {
266: MPI_Comm commp = MPI_COMM_NULL;
267: DM dmz = NULL;
268: #if 0
269: DM dmf = NULL;
270: Mat interpz = NULL;
271: #endif
272: Vec XZ = NULL;
273: PetscScalar *xcarray = NULL;
274: PetscScalar *xzarray = NULL;
276: if ((gridRank.k / commSize.k == p / (l / commSize.i * m / commSize.j) % n / commSize.k) && (gridRank.j / commSize.j == p / (l / commSize.i) % m / commSize.j) && (gridRank.i / commSize.i == p % l / commSize.i)) {
277: if (debug) PetscCall(PetscPrintf(PETSC_COMM_SELF, "Rank %d is accepting Patch %" PetscInt_FMT "\n", rank, p));
278: commp = commz;
279: }
280: /* Zoom to coarse patch */
281: lower.i = i;
282: lower.j = j;
283: lower.k = k;
284: upper.i = i + patchSize.i;
285: upper.j = j + patchSize.j;
286: upper.k = k + patchSize.k;
287: PetscCall(DMPatchZoom(dmc, lower, upper, commp, &dmz, &sfz, &sfzr));
288: lower.c = 0; /* initialize member, otherwise compiler issues warnings */
289: upper.c = 0; /* initialize member, otherwise compiler issues warnings */
290: if (debug)
291: PetscCall(PetscPrintf(comm, "Patch %" PetscInt_FMT ": (%" PetscInt_FMT ", %" PetscInt_FMT ", %" PetscInt_FMT ")--(%" PetscInt_FMT ", %" PetscInt_FMT ", %" PetscInt_FMT ")\n", p, lower.i, lower.j, lower.k, upper.i, upper.j, upper.k));
292: if (dmz) PetscCall(DMView(dmz, PETSC_VIEWER_STDOUT_(commz)));
293: PetscCall(PetscSFView(sfz, PETSC_VIEWER_STDOUT_(comm)));
294: PetscCall(PetscSFView(sfzr, PETSC_VIEWER_STDOUT_(comm)));
295: /* Scatter Xcoarse -> Xzoom */
296: if (dmz) PetscCall(DMGetGlobalVector(dmz, &XZ));
297: if (XZ) PetscCall(VecGetArray(XZ, &xzarray));
298: PetscCall(VecGetArray(XC, &xcarray));
299: PetscCall(PetscSFBcastBegin(sfz, MPIU_SCALAR, xcarray, xzarray, MPI_REPLACE));
300: PetscCall(PetscSFBcastEnd(sfz, MPIU_SCALAR, xcarray, xzarray, MPI_REPLACE));
301: PetscCall(VecRestoreArray(XC, &xcarray));
302: if (XZ) PetscCall(VecRestoreArray(XZ, &xzarray));
303: #if 0
304: /* Interpolate Xzoom -> Xfine, note that this may be on subcomms */
305: PetscCall(DMRefine(dmz, MPI_COMM_NULL, &dmf));
306: PetscCall(DMCreateInterpolation(dmz, dmf, &interpz, NULL));
307: PetscCall(DMInterpolate(dmz, interpz, dmf));
308: /* Smooth Xfine using two-step smoother, normal smoother plus Kaczmarz---moves back and forth from dmzoom to dmfine */
309: /* Compute residual Rfine */
310: /* Restrict Rfine to Rzoom_restricted */
311: #endif
312: /* Scatter Rzoom_restricted -> Rcoarse_restricted */
313: if (XZ) PetscCall(VecGetArray(XZ, &xzarray));
314: PetscCall(VecGetArray(XC, &xcarray));
315: PetscCall(PetscSFReduceBegin(sfzr, MPIU_SCALAR, xzarray, xcarray, MPIU_SUM));
316: PetscCall(PetscSFReduceEnd(sfzr, MPIU_SCALAR, xzarray, xcarray, MPIU_SUM));
317: PetscCall(VecRestoreArray(XC, &xcarray));
318: if (XZ) PetscCall(VecRestoreArray(XZ, &xzarray));
319: if (dmz) PetscCall(DMRestoreGlobalVector(dmz, &XZ));
320: /* Compute global residual Rcoarse */
321: /* TauCoarse = Rcoarse - Rcoarse_restricted */
323: PetscCall(PetscSFDestroy(&sfz));
324: PetscCall(PetscSFDestroy(&sfzr));
325: PetscCall(DMDestroy(&dmz));
326: }
327: }
328: }
329: PetscCall(DMRestoreGlobalVector(dmc, &XC));
330: PetscFunctionReturn(PETSC_SUCCESS);
331: }
333: static PetscErrorCode DMPatchView_ASCII(DM dm, PetscViewer viewer)
334: {
335: DM_Patch *mesh = (DM_Patch *)dm->data;
336: PetscViewerFormat format;
337: const char *name;
339: PetscFunctionBegin;
340: PetscCall(PetscViewerGetFormat(viewer, &format));
341: /* if (format == PETSC_VIEWER_ASCII_INFO_DETAIL) */
342: PetscCall(PetscObjectGetName((PetscObject)dm, &name));
343: PetscCall(PetscViewerASCIIPrintf(viewer, "Patch DM %s\n", name));
344: PetscCall(PetscViewerASCIIPushTab(viewer));
345: PetscCall(PetscViewerASCIIPrintf(viewer, "Coarse DM\n"));
346: PetscCall(DMView(mesh->dmCoarse, viewer));
347: PetscCall(PetscViewerASCIIPopTab(viewer));
348: PetscFunctionReturn(PETSC_SUCCESS);
349: }
351: PetscErrorCode DMView_Patch(DM dm, PetscViewer viewer)
352: {
353: PetscBool isascii, isbinary;
355: PetscFunctionBegin;
358: PetscCall(PetscObjectTypeCompare((PetscObject)viewer, PETSCVIEWERASCII, &isascii));
359: PetscCall(PetscObjectTypeCompare((PetscObject)viewer, PETSCVIEWERBINARY, &isbinary));
360: if (isascii) PetscCall(DMPatchView_ASCII(dm, viewer));
361: PetscFunctionReturn(PETSC_SUCCESS);
362: }
364: PetscErrorCode DMDestroy_Patch(DM dm)
365: {
366: DM_Patch *mesh = (DM_Patch *)dm->data;
368: PetscFunctionBegin;
369: if (--mesh->refct > 0) PetscFunctionReturn(PETSC_SUCCESS);
370: PetscCall(DMDestroy(&mesh->dmCoarse));
371: /* This was originally freed in DMDestroy(), but that prevents reference counting of backend objects */
372: PetscCall(PetscFree(mesh));
373: PetscFunctionReturn(PETSC_SUCCESS);
374: }
376: PetscErrorCode DMSetUp_Patch(DM dm)
377: {
378: DM_Patch *mesh = (DM_Patch *)dm->data;
380: PetscFunctionBegin;
382: PetscCall(DMSetUp(mesh->dmCoarse));
383: PetscFunctionReturn(PETSC_SUCCESS);
384: }
386: PetscErrorCode DMCreateGlobalVector_Patch(DM dm, Vec *g)
387: {
388: DM_Patch *mesh = (DM_Patch *)dm->data;
390: PetscFunctionBegin;
392: PetscCall(DMCreateGlobalVector(mesh->dmCoarse, g));
393: PetscFunctionReturn(PETSC_SUCCESS);
394: }
396: PetscErrorCode DMCreateLocalVector_Patch(DM dm, Vec *l)
397: {
398: DM_Patch *mesh = (DM_Patch *)dm->data;
400: PetscFunctionBegin;
402: PetscCall(DMCreateLocalVector(mesh->dmCoarse, l));
403: PetscFunctionReturn(PETSC_SUCCESS);
404: }
406: PetscErrorCode DMCreateSubDM_Patch(DM dm, PetscInt numFields, const PetscInt fields[], IS *is, DM *subdm)
407: {
408: SETERRQ(PetscObjectComm((PetscObject)dm), PETSC_ERR_SUP, "Tell me to code this");
409: }
411: /*@
412: DMPatchGetCoarse - Get the coarse `DM` associated with a `DMPATCH`
414: Not Collective
416: Input Parameter:
417: . dm - the `DMPATCH`
419: Output Parameter:
420: . dmCoarse - the coarse `DM`
422: Level: intermediate
424: .seealso: `DMPATCH`, `DMPatchCreate()`, `DMPatchZoom()`
425: @*/
426: PetscErrorCode DMPatchGetCoarse(DM dm, DM *dmCoarse)
427: {
428: DM_Patch *mesh = (DM_Patch *)dm->data;
430: PetscFunctionBegin;
432: *dmCoarse = mesh->dmCoarse;
433: PetscFunctionReturn(PETSC_SUCCESS);
434: }
436: /*@
437: DMPatchGetPatchSize - Get the size of a single patch of a `DMPATCH`, in grid cells
439: Not Collective
441: Input Parameter:
442: . dm - the `DMPATCH`
444: Output Parameter:
445: . patchSize - a `MatStencil` whose `i`, `j`, `k`, `c` fields hold the patch extent in each dimension
447: Level: intermediate
449: .seealso: `DMPATCH`, `DMPatchSetPatchSize()`, `DMPatchGetCommSize()`, `MatStencil`
450: @*/
451: PetscErrorCode DMPatchGetPatchSize(DM dm, MatStencil *patchSize)
452: {
453: DM_Patch *mesh = (DM_Patch *)dm->data;
455: PetscFunctionBegin;
457: PetscAssertPointer(patchSize, 2);
458: *patchSize = mesh->patchSize;
459: PetscFunctionReturn(PETSC_SUCCESS);
460: }
462: /*@
463: DMPatchSetPatchSize - Set the size of a single patch of a `DMPATCH`, in grid cells
465: Logically Collective
467: Input Parameters:
468: + dm - the `DMPATCH`
469: - patchSize - a `MatStencil` whose `i`, `j`, `k`, `c` fields hold the patch extent in each dimension
471: Level: intermediate
473: .seealso: `DMPATCH`, `DMPatchGetPatchSize()`, `DMPatchSetCommSize()`, `MatStencil`
474: @*/
475: PetscErrorCode DMPatchSetPatchSize(DM dm, MatStencil patchSize)
476: {
477: DM_Patch *mesh = (DM_Patch *)dm->data;
479: PetscFunctionBegin;
481: mesh->patchSize = patchSize;
482: PetscFunctionReturn(PETSC_SUCCESS);
483: }
485: /*@
486: DMPatchGetCommSize - Get the process grid used for each patch of a `DMPATCH`
488: Not Collective
490: Input Parameter:
491: . dm - the `DMPATCH`
493: Output Parameter:
494: . commSize - a `MatStencil` whose `i`, `j`, `k` fields hold the number of processes used per patch in each dimension
496: Level: intermediate
498: .seealso: `DMPATCH`, `DMPatchSetCommSize()`, `DMPatchGetPatchSize()`, `MatStencil`
499: @*/
500: PetscErrorCode DMPatchGetCommSize(DM dm, MatStencil *commSize)
501: {
502: DM_Patch *mesh = (DM_Patch *)dm->data;
504: PetscFunctionBegin;
506: PetscAssertPointer(commSize, 2);
507: *commSize = mesh->commSize;
508: PetscFunctionReturn(PETSC_SUCCESS);
509: }
511: /*@
512: DMPatchSetCommSize - Set the process grid used for each patch of a `DMPATCH`
514: Logically Collective
516: Input Parameters:
517: + dm - the `DMPATCH`
518: - commSize - a `MatStencil` whose `i`, `j`, `k` fields hold the number of processes to use per patch in each dimension
520: Level: intermediate
522: .seealso: `DMPATCH`, `DMPatchGetCommSize()`, `DMPatchSetPatchSize()`, `MatStencil`
523: @*/
524: PetscErrorCode DMPatchSetCommSize(DM dm, MatStencil commSize)
525: {
526: DM_Patch *mesh = (DM_Patch *)dm->data;
528: PetscFunctionBegin;
530: mesh->commSize = commSize;
531: PetscFunctionReturn(PETSC_SUCCESS);
532: }