PetscLayout — PETSc 3.21.4 documentation

Skip to main content
`Ctrl`+`K`

# PetscLayout

defines layout of vectors and matrices (that is the “global” numbering of vector and matrix entries) across MPI processes (which rows are owned by which processes)

## Synopsis

    typedef struct _n_PetscLayout *PetscLayout;

## Notes

PETSc vectors (`Vec`) have a global number associated with each vector entry. The first MPI process that shares the vector owns the first `n0` entries of the vector, the second MPI process the next `n1` entries, etc. A `PetscLayout` is a way of managing this information, for example the number of locally owned entries is provided by `PetscLayoutGetLocalSize()` and the range of indices for a given MPI process is provided by `PetscLayoutGetRange()`.

Each PETSc `Vec` contains a `PetscLayout` object which can be obtained with `VecGetLayout()`. For convenience `Vec` provides an API to access the layout information directly, for example with `VecGetLocalSize()` and `VecGetOwnershipRange()`.

Similarly PETSc matrices have layouts, these are discussed in Matrices.

## See Also

`PetscLayoutCreate()`, `PetscLayoutDestroy()`, `PetscLayoutGetRange()`, `PetscLayoutGetLocalSize()`, `PetscLayoutGetSize()`, `PetscLayoutGetBlockSize()`, `PetscLayoutGetRanges()`, `PetscLayoutFindOwner()`, `PetscLayoutFindOwnerIndex()`, `VecGetLayout()`, `VecGetLocalSize()`, `VecGetOwnershipRange()`

## Level

developer

## Location

include/petscistypes.h

## Examples

src/ts/tutorials/ex30.c
src/ksp/ksp/tutorials/ex85.c
src/vec/vec/utils/tagger/tutorials/ex1.c

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