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 DMDALocalToLocalCreate(DM); 8 9 #undef __FUNCT__ 10 #define __FUNCT__ "DMDAGetScatter" 11 /*@C 12 DMDAGetScatter - Gets the local-to-global, local-to-global, 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 + ltog - local-to-global scatter context (may be NULL) 22 . gtol - global-to-local scatter context (may be NULL) 23 - ltol - local-to-local scatter context (may be NULL) 24 25 Level: developer 26 27 Notes: 28 The output contexts are valid only as long as the input da is valid. 29 If you delete the da, the scatter contexts will become invalid. 30 31 .keywords: distributed array, get, scatter, context, global-to-local, 32 local-to-global, local-to-local 33 34 .seealso: DMGlobalToLocalBegin(), DMGlobalToLocalEnd(), DMLocalToGlobalBegin() 35 @*/ 36 PetscErrorCode DMDAGetScatter(DM da,VecScatter *ltog,VecScatter *gtol,VecScatter *ltol) 37 { 38 PetscErrorCode ierr; 39 DM_DA *dd = (DM_DA*)da->data; 40 41 PetscFunctionBegin; 42 PetscValidHeaderSpecific(da,DM_CLASSID,1); 43 if (ltog) *ltog = dd->ltog; 44 if (gtol) *gtol = dd->gtol; 45 if (ltol) { 46 if (!dd->ltol) { 47 ierr = DMDALocalToLocalCreate(da);CHKERRQ(ierr); 48 } 49 *ltol = dd->ltol; 50 } 51 PetscFunctionReturn(0); 52 } 53 54