petsc-3.7.1 2016-05-15
Report Typos and Errors

DMGetLocalVector

Gets a Seq PETSc vector that may be used with the DMXXX routines. This vector has spaces for the ghost values.

Synopsis

#include "petscdm.h" 
PetscErrorCode  DMGetLocalVector(DM dm,Vec *g)
Not Collective Many br

Input Parameter

dm -the distributed array Many br

Output Parameter

g -the local vector Many br

Many br

Note

The vector values are NOT initialized and may have garbage in them, so you may need Many brto zero them. Many br

The output parameter, g, is a regular PETSc vector that should be returned with Many brDMRestoreLocalVector() DO NOT call VecDestroy() on it. Many br

This is intended to be used for vectors you need for a short time, like within a single function call. Many brFor vectors that you intend to keep around (for example in a C struct) or pass around large parts of your Many brcode you should use DMCreateLocalVector(). Many br

VecStride*() operations can be useful when using DM with dof > 1 Many br

Keywords

distributed array, create, local, vector

See Also

DMCreateGlobalVector(), VecDuplicate(), VecDuplicateVecs(),
DMDACreate1d(), DMDACreate2d(), DMDACreate3d(), DMGlobalToLocalBegin(), Many brDMGlobalToLocalEnd(), DMLocalToGlobalBegin(), DMCreateLocalVector(), DMRestoreLocalVector(), Many brVecStrideMax(), VecStrideMin(), VecStrideNorm() Many br

Level:beginner
Location:
src/dm/interface/dmget.c
Index of all DM routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/ksp/ksp/examples/tutorials/ex31.c.html
src/ksp/ksp/examples/tutorials/ex42.c.html
src/ksp/ksp/examples/tutorials/ex43.c.html
src/ksp/ksp/examples/tutorials/ex49.c.html
src/snes/examples/tutorials/ex3.c.html
src/snes/examples/tutorials/ex5.c.html
src/snes/examples/tutorials/ex7.c.html
src/snes/examples/tutorials/ex12.c.html
src/snes/examples/tutorials/ex14.c.html
src/snes/examples/tutorials/ex15.c.html
src/snes/examples/tutorials/ex18.c.html