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