Actual source code: dascatter.c


  2: /*
  3:   Code for manipulating distributed regular arrays in parallel.
  4: */

  6: #include <petsc/private/dmdaimpl.h>
  7: extern PetscErrorCode DMLocalToLocalCreate_DA(DM);

  9: /*@C
 10:    DMDAGetScatter - Gets the global-to-local, and
 11:    local-to-local vector scatter contexts for a distributed array.

 13:    Collective

 15:    Input Parameter:
 16: .  da - the distributed array

 18:    Output Parameters:
 19: +  gtol - global-to-local scatter context (may be `NULL`)
 20: -  ltol - local-to-local scatter context (may be `NULL`)

 22:    Level: developer

 24:    Note:
 25:    The output contexts are valid only as long as the input `da` is valid.
 26:    If you delete the `da`, the scatter contexts will become invalid.

 28: .seealso: `DM`, `DMDA`, `DMGlobalToLocalBegin()`, `DMGlobalToLocalEnd()`, `DMLocalToGlobalBegin()`
 29: @*/
 30: PetscErrorCode DMDAGetScatter(DM da, VecScatter *gtol, VecScatter *ltol)
 31: {
 32:   DM_DA *dd = (DM_DA *)da->data;

 34:   PetscFunctionBegin;
 36:   if (gtol) *gtol = dd->gtol;
 37:   if (ltol) {
 38:     if (!dd->ltol) PetscCall(DMLocalToLocalCreate_DA(da));
 39:     *ltol = dd->ltol;
 40:   }
 41:   PetscFunctionReturn(PETSC_SUCCESS);
 42: }