Skip to main content
`Ctrl`+`K`

# DMDACreatePatchIS

Creates an index set corresponding to a logically rectangular patch of the `DMDA`.

## Synopsis

    #include "petscdmda.h"
    PetscErrorCode DMDACreatePatchIS(DM da, MatStencil *lower, MatStencil *upper, IS *is, PetscBool offproc)

Collective

## Input Parameters

- da - the `DMDA`

- lower - a `MatStencil` with i, j and k entries corresponding to the lower corner of the patch

- upper - a `MatStencil` with i, j and k entries corresponding to the upper corner of the patch

- offproc - indicate whether the returned `IS` will contain off process indices

## Output Parameter

- is - the `IS` corresponding to the patch

## Notes

This routine always returns an `IS` on the `DMDA` communicator.

If `offproc` is set to `PETSC_TRUE`, the routine returns an `IS` with all the indices requested regardless of whether these indices are present on the requesting MPI process or not. Thus, it is upon the caller to ensure that the indices returned in this mode are appropriate.

If `offproc` is set to `PETSC_FALSE`, the `IS` only returns the subset of indices that are present on the requesting MPI process and there is no duplication of indices between multiple MPI processes.

## See Also

DMDA - Creating vectors for structured grids, `DM`, `DMDA`, `DMCreateDomainDecomposition()`, `DMCreateDomainDecompositionScatters()`

## Level

developer

## Location

src/dm/impls/da/dadd.c

## Examples

src/dm/tutorials/ex22.c
src/dm/tutorials/ex14.c

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