Skip to main content
`Ctrl`+`K`

# PCFieldSplitSetFields

Sets the fields that define one particular split in `PCFIELDSPLIT`

## Synopsis

    #include "petscpc.h"
    PetscErrorCode PCFieldSplitSetFields(PC pc, const char splitname[], PetscInt n, const PetscInt fields[], const PetscInt fields_col[])

Logically Collective

## Input Parameters

- pc - the preconditioner context

- splitname - name of this split, if `NULL` the number of the split is used

- n - the number of fields in this split

- fields - the fields in this split

- fields_col - generally the same as `fields`, if it does not match `fields` then the submatrix that is solved for this set of fields comes from an off-diagonal block of the matrix and `fields_col` provides the column indices for that block

## Options Database Key

- -pc_fieldsplit_%d_fields a,b,… - indicates the fields to be used in the `%d`’th split

## Notes

Use `PCFieldSplitSetIS()` to set a general set of indices as a split.

If the matrix used to construct the preconditioner is `MATNEST` then field i refers to the `is_row[i]` `IS` passed to `MatCreateNest()`.

If the matrix used to construct the preconditioner is not `MATNEST` then `PCFieldSplitSetFields()` is for defining fields as strided blocks (based on the block size provided to the matrix with `MatSetBlockSize()` or to the `PC` with `PCFieldSplitSetBlockSize()`). For example, if the block size is three then one can define a split as 0, or 1 or 2 or 0,1 or 0,2 or 1,2 which mean 0xx3xx6xx9xx12 … x1xx4xx7xx … xx2xx5xx8xx.. 01x34x67x… 0x23x56x8.. x12x45x78x…. where the numbered entries indicate what is in the split.

This function is called once per split (it creates a new split each time). Solve options for this split will be available under the prefix `-fieldsplit_SPLITNAME_`.

`PCFieldSplitSetIS()` does not support having a `fields_col` different from `fields`

## Developer Notes

This routine does not actually create the `IS` representing the split, that is delayed until `PCSetUp_FieldSplit()`, because information about the vector/matrix layouts may not be available when this routine is called.

## See Also

Solving Block Matrices with PCFIELDSPLIT, `PC`, `PCFieldSplitGetSubKSP()`, `PCFIELDSPLIT`, `PCFieldSplitSetBlockSize()`, `PCFieldSplitSetIS()`, `PCFieldSplitRestrictIS()`, `MatSetBlockSize()`, `MatCreateNest()`

## Level

intermediate

## Location

src/ksp/pc/impls/fieldsplit/fieldsplit.c

## Examples

src/ksp/ksp/tutorials/ex70.c
src/ksp/ksp/tutorials/ex43.c
src/ksp/ksp/tutorials/ex42.c

## Implementations

PCFieldSplitSetFields_FieldSplit() in src/ksp/pc/impls/fieldsplit/fieldsplit.c

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