Actual source code: dascatter.c

petsc-3.3-p7 2013-05-11
  2: /*
  3:   Code for manipulating distributed regular arrays in parallel.
  4: */

  6: #include <petsc-private/daimpl.h>    /*I   "petscdmda.h"   I*/
  7: extern PetscErrorCode DMDALocalToLocalCreate(DM);

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

 15:    Collective on DMDA

 17:    Input Parameter:
 18: .  da - the distributed array

 20:    Output Parameters:
 21: +  ltog - local-to-global scatter context (may be PETSC_NULL)
 22: .  gtol - global-to-local scatter context (may be PETSC_NULL) 
 23: -  ltol - local-to-local scatter context (may be PETSC_NULL)

 25:    Level: developer

 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.

 31: .keywords: distributed array, get, scatter, context, global-to-local,
 32:            local-to-global, local-to-local

 34: .seealso: DMGlobalToLocalBegin(), DMGlobalToLocalEnd(), DMLocalToGlobalBegin()
 35: @*/
 36: PetscErrorCode  DMDAGetScatter(DM da,VecScatter *ltog,VecScatter *gtol,VecScatter *ltol)
 37: {
 39:   DM_DA          *dd = (DM_DA*)da->data;

 43:   if (ltog) *ltog = dd->ltog;
 44:   if (gtol) *gtol = dd->gtol;
 45:   if (ltol) {
 46:     if (!dd->ltol) {
 47:       DMDALocalToLocalCreate(da);
 48:     }
 49:     *ltol = dd->ltol;
 50:   }
 51:   return(0);
 52: }
 53: