Actual source code: daltog.c

      1: #define PETSCDM_DLL

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

     7:  #include src/dm/da/daimpl.h

     11: /*@
     12:    DALocalToGlobal - Maps values from the local patch back to the
     13:    global vector. The ghost points are discarded.

     15:    Not Collective

     17:    Input Parameters:
     18: +  da - the distributed array context
     19: .  l  - the local values
     20: -  mode - one of INSERT_VALUES or ADD_VALUES

     22:    Output Parameter:
     23: .  g - the global vector

     25:    Level: beginner

     27:    Note:
     28:    This routine discards the values in the ghost point locations. Use
     29:    DALocalToGlobalBegin()/DALocalToGlobalEnd() to add the values from the
     30:    ghost points.

     32:    The global and local vectors used here need not be the same as those
     33:    obtained from DACreateGlobalVector() and DACreateLocalVector(), BUT they
     34:    must have the same parallel data layout; they could, for example, be
     35:    obtained with VecDuplicate() from the DA originating vectors.

     37: .keywords: distributed array, local-to-global

     39: .seealso: DAGlobalToLocalBegin(), DACreate2d(), DALocalToLocalBegin(),
     40:            DALocalToLocalEnd(), DALocalToGlobalBegin(), DALocalToGlobalEnd()
     41: @*/
     42: PetscErrorCode PETSCDM_DLLEXPORT DALocalToGlobal(DA da,Vec l,InsertMode mode,Vec g)
     43: {

     50:   VecScatterBegin(l,g,mode,SCATTER_FORWARD,da->ltog);
     51:   VecScatterEnd(l,g,mode,SCATTER_FORWARD,da->ltog);
     52:   return(0);
     53: }