# PCFieldSplitSchurGetSubKSP
Gets the `KSP` contexts used inside the Schur complement based `PCFIELDSPLIT` 
## Synopsis
```
#include "petscpc.h" 
PetscErrorCode PCFieldSplitSchurGetSubKSP(PC pc, PetscInt *n, KSP *subksp[])
```
Collective


## Input Parameter

- ***pc -*** the preconditioner context



## Output Parameters

- ***n -*** the number of splits
- ***subksp -*** the array of `KSP` contexts





## Notes
After `PCFieldSplitSchurGetSubKSP()` the array of `KSP`s is to be freed by the user with `PetscFree()`
(not the `KSP` just the array that contains them).

You must call `PCSetUp()` before calling `PCFieldSplitSchurGetSubKSP()`.

If the fieldsplit type is of type `PC_COMPOSITE_SCHUR`, it returns (in order)

- ***1  -*** the `KSP` used for the (1,1) block
- ***2  -*** the `KSP` used for the Schur complement (not the one used for the interior Schur solver)
- ***3  -*** the `KSP` used for the (1,1) block in the upper triangular factor (if different from that of the (1,1) block).


It returns a null array if the fieldsplit is not of type `PC_COMPOSITE_SCHUR`; in this case, you should use `PCFieldSplitGetSubKSP()`.


## Fortran Note
You must pass in a `KSP` array that is large enough to contain all the local `KSP`s.
You can call `PCFieldSplitSchurGetSubKSP`(pc,n,`PETSC_NULL_KSP`,ierr) to determine how large the
`KSP` array must be.


## Developer Notes
There should be a `PCFieldSplitRestoreSubKSP()` instead of requiring the user to call `PetscFree()`

Should the functionality of `PCFieldSplitSchurGetSubKSP()` and `PCFieldSplitGetSubKSP()` be merged?

The Fortran interface should be modernized to return directly the array of values.


## See Also
 [](sec_block_matrices), `PC`, `PCFIELDSPLIT`, `PCFieldSplitSetFields()`, `PCFieldSplitSetIS()`, `PCFieldSplitGetSubKSP()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/pc/impls/fieldsplit/fieldsplit.c.html#PCFieldSplitSchurGetSubKSP">src/ksp/pc/impls/fieldsplit/fieldsplit.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/stag/tutorials/ex4.c.html">src/dm/impls/stag/tutorials/ex4.c.html</A><BR>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/pc/impls/fieldsplit/fieldsplit.c.html#PCFieldSplitSchurGetSubKSP_FieldSplit">PCFieldSplitSchurGetSubKSP_FieldSplit in src/ksp/pc/impls/fieldsplit/fieldsplit.c</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/ksp/pc/impls/fieldsplit/fieldsplit.c)


[Index of all PC routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
