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: #undef __FUNCT__  
 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: int DALocalToGlobal(DA da,Vec l,InsertMode mode,Vec g)
 43: {

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