1 /* 2 Code for manipulating distributed regular arrays in parallel. 3 */ 4 5 #include <petsc/private/dmdaimpl.h> /*I "petscdmda.h" I*/ 6 7 /*@C 8 DMDAGetScatter - Gets the global-to-local, and 9 local-to-local vector scatter contexts for a distributed array. 10 11 Collective 12 13 Input Parameter: 14 . da - the distributed array 15 16 Output Parameters: 17 + gtol - global-to-local scatter context (may be `NULL`) 18 - ltol - local-to-local scatter context (may be `NULL`) 19 20 Level: developer 21 22 Note: 23 The output contexts are valid only as long as the input `da` is valid. 24 If you delete the `da`, the scatter contexts will become invalid. 25 26 .seealso: `DM`, `DMDA`, `DMGlobalToLocalBegin()`, `DMGlobalToLocalEnd()`, `DMLocalToGlobalBegin()` 27 @*/ 28 PetscErrorCode DMDAGetScatter(DM da, VecScatter *gtol, VecScatter *ltol) 29 { 30 DM_DA *dd = (DM_DA *)da->data; 31 32 PetscFunctionBegin; 33 PetscValidHeaderSpecificType(da, DM_CLASSID, 1, DMDA); 34 if (gtol) *gtol = dd->gtol; 35 if (ltol) { 36 if (!dd->ltol) PetscCall(DMLocalToLocalCreate_DA(da)); 37 *ltol = dd->ltol; 38 } 39 PetscFunctionReturn(PETSC_SUCCESS); 40 } 41