# DALocalToGlobal

Maps values from the local patch back to the global vector. The ghost points are discarded.

### Synopsis

    #include "petscda.h"
    PetscErrorCode PETSCDM_DLLEXPORT DALocalToGlobal(DA da,Vec l,InsertMode mode,Vec g)

Not Collective

### Input Parameters

| da | - the distributed array context
| l | - the local values
| mode | - one of INSERT_VALUES or ADD_VALUES

### Output Parameter

g -the global vector

### Note

This routine discards the values in the ghost point locations. Use DALocalToGlobalBegin()/DALocalToGlobalEnd() to add the values from the ghost points.

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

### Keywords

distributed array, local-to-global

### See Also

DAGlobalToLocalBegin(), DACreate2d(), DALocalToLocalBegin(),
DALocalToLocalEnd(), DALocalToGlobalBegin(), DALocalToGlobalEnd()

Level:beginner
Location:src/dm/da/src/daltog.c
Index of all DA routines
Table of Contents for all manual pages
Index of all manual pages

### Examples

src/ksp/examples/tutorials/ex14f.F.html
src/snes/examples/tutorials/ex5.c.html
src/snes/examples/tutorials/ex5f.F.html
src/snes/examples/tutorials/ex5f90.F.html
src/ts/examples/tutorials/ex2.c.html
src/ts/examples/tutorials/ex2f.F.html
src/dm/da/examples/tutorials/ex1.c.html
src/dm/da/examples/tutorials/ex3.c.html
src/dm/da/examples/tutorials/ex5.c.html