Actual source code: daltog.c

  1: /*$Id: daltog.c,v 1.22 2001/03/23 23:25:00 balay Exp $*/
  2: 
  3: /*
  4:   Code for manipulating distributed regular arrays in parallel.
  5: */

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

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

 13:    Not Collective

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

 20:    Output Parameter:
 21: .  g - the global vector

 23:    Level: beginner

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

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

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

 37: .seealso: DAGlobalToLocalBegin(), DACreate2d(), DALocalToLocalBegin(),
 38:            DALocalToLocalEnd(), DALocalToGlobalBegin(), DALocalToGlobalEnd()
 39: @*/
 40: int DALocalToGlobal(DA da,Vec l,InsertMode mode,Vec g)
 41: {

 46:   VecScatterBegin(l,g,mode,SCATTER_FORWARD,da->ltog);
 47:   VecScatterEnd(l,g,mode,SCATTER_FORWARD,da->ltog);
 48:   return(0);
 49: }