PetscSplitOwnership — PETSc 3.25.1 documentation

Skip to main content
`Ctrl`+`K`

# PetscSplitOwnership

Given a global (or local) length determines a local (or global) length via a simple formula

## Synopsis

    #include "petscsys.h"
    PetscErrorCode PetscSplitOwnership(MPI_Comm comm, PetscInt *n, PetscInt *N)

Collective (if `n` or `N` is `PETSC_DECIDE` or `PETSC_DETERMINE`)

## Input Parameters

- comm - MPI communicator that shares the object being divided

- n - local length (or `PETSC_DECIDE` to have it set)

- N - global length (or `PETSC_DETERMINE` to have it set)

## Notes

`n` and `N` cannot be both `PETSC_DECIDE` and `PETSC_DETERMINE`

If one processor calls this with `n` of `PETSC_DECIDE` (or with `N` `PETSC_DETERMINE`) then all processors must. Otherwise, an error is thrown in debug mode while the program will hang in optimized (i.e. configured –with-debugging=0) mode.

## See Also

`PetscSplitOwnershipBlock()`, `PetscSplitOwnershipEqual()`, `PETSC_DECIDE`, `PETSC_DETERMINE`

## Level

developer

## Location

src/sys/utils/psplit.c

## Examples

src/ksp/ksp/tutorials/bench_kspsolve.c
src/ksp/ksp/tutorials/ex85.c

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