DMCreateLocalVector#
Creates a local vector from a DM object.
Synopsis#
#include "petscdm.h"
#include "petscdmlabel.h"
#include "petscds.h"
PetscErrorCode DMCreateLocalVector(DM dm, Vec *vec)
Not Collective
Input Parameter#
dm - the
DMobject
Output Parameter#
vec - the local vector
Notes#
A local vector usually has ghost locations that contain values that are owned by different MPI ranks. A global vector has no ghost locations.
PETSc Vec always have all zero entries when created with DMCreateLocalVector() until routines such as VecSet() or VecSetValues()
are used to change the values. There is no reason to call VecZeroEntries() after creation.
See Also#
DM Basics, DM, Vec, DMCreateGlobalVector(), DMGetLocalVector(), DMDestroy(), DMView(), DMCreateInterpolation(), DMCreateColoring(), DMCreateMatrix(),
DMGlobalToLocalBegin(), DMGlobalToLocalEnd()
Level#
beginner
Location#
Examples#
src/snes/tutorials/ex77.c
src/ksp/ksp/tutorials/ex65.c
src/ksp/ksp/tutorials/ex14f.F90
src/snes/tutorials/ex11.c
src/snes/tutorials/ex7.c
src/snes/tutorials/ex12.c
src/ksp/ksp/tutorials/ex43.c
src/snes/tutorials/ex48.c
src/ksp/ksp/tutorials/ex42.c
src/ksp/ksp/tutorials/ex49.c
Implementations#
DMCreateLocalVector_Composite() in src/dm/impls/composite/pack.c
DMCreateLocalVector_DA() in src/dm/impls/da/dalocal.c
DMCreateLocalVector_pforest() in src/dm/impls/forest/p4est/pforest.h
DMCreateLocalVector_Moab() in src/dm/impls/moab/dmmbvec.cxx
DMCreateLocalVector_Network() in src/dm/impls/network/networkcreate.c
DMCreateLocalVector_Patch() in src/dm/impls/patch/patch.c
DMCreateLocalVector_Plex() in src/dm/impls/plex/plexcreate.c
DMCreateLocalVector_Redundant() in src/dm/impls/redundant/dmredundant.c
DMCreateLocalVector_Shell() in src/dm/impls/shell/dmshell.c
DMCreateLocalVector_Stag() in src/dm/impls/stag/stag.c
DMCreateLocalVector_Swarm() in src/dm/impls/swarm/swarm.c
Index of all DM routines
Table of Contents for all manual pages
Index of all manual pages