VecGetOwnershipRange#

Returns the range of indices owned by this process. The vector is laid out with the first n1 elements on the first processor, next n2 elements on the second, etc. For certain parallel layouts this range may not be well defined.

Synopsis#

#include "petscvec.h"   
PetscErrorCode VecGetOwnershipRange(Vec x, PetscInt *low, PetscInt *high)

Not Collective

Input Parameter#

  • x - the vector

Output Parameters#

  • low - the first local element, pass in NULL if not interested

  • high - one more than the last local element, pass in NULL if not interested

Notes#

If the Vec was obtained from a DM with DMCreateGlobalVector(), then the range values are determined by the specific DM.

If the Vec was created directly the range values are determined by the local size passed to VecSetSizes() or VecCreateMPI(). If PETSC_DECIDE was passed as the local size, then the vector uses default values for the range using PetscSplitOwnership().

The high argument is one more than the last element stored locally.

For certain DM, such as DMDA, it is better to use DM specific routines, such as DMDAGetGhostCorners(), to determine the local values in the vector.

See Also#

Vectors and Parallel Data, Vec, MatGetOwnershipRange(), MatGetOwnershipRanges(), VecGetOwnershipRanges(), PetscSplitOwnership(), VecSetSizes(), VecCreateMPI(), PetscLayout, DMDAGetGhostCorners(), DM

Level#

beginner

Location#

src/vec/vec/interface/vector.c

Examples#

src/tao/pde_constrained/tutorials/parabolic.c
src/vec/vec/tutorials/ex15.c
src/vec/vec/tutorials/ex8.c
src/vec/vec/tutorials/ex9.c
src/vec/vec/tutorials/ex18.c
src/vec/vec/utils/tagger/tutorials/ex1.c
src/tao/pde_constrained/tutorials/elliptic.c
src/vec/vec/tutorials/ex3.c
src/vec/vec/tutorials/ex5.c
src/tao/pde_constrained/tutorials/hyperbolic.c


Index of all Vec routines
Table of Contents for all manual pages
Index of all manual pages