KSPHPDDMSetType — PETSc 3.22.5 documentation

Skip to main content
`Ctrl`+`K`

# KSPHPDDMSetType

Sets the type of Krylov method used in `KSPHPDDM`.

## Synopsis

    #include "petscksp.h"
    PetscErrorCode KSPHPDDMSetType(KSP ksp, KSPHPDDMType type)

Collective

## Input Parameters

- ksp - iterative context

- type - any of gmres, bgmres, cg, bcg, gcrodr, bgcrodr, bfbcg, or preonly

## Notes

Unlike `KSPReset()`, this function does not destroy any deflation space attached to the `KSP`.

As an example, in the following sequence:

         KSPHPDDMSetType(ksp, KSPGCRODR);
         KSPSolve(ksp, b, x);
         KSPHPDDMSetType(ksp, KSPGMRES);
         KSPHPDDMSetType(ksp, KSPGCRODR);
         KSPSolve(ksp, b, x);

the recycled space is reused in the second `KSPSolve()`.

## See Also

KSP: Linear System Solvers, `KSPCreate()`, `KSPType`, `KSPHPDDMType`, `KSPHPDDMGetType()`

## Level

intermediate

## Location

src/ksp/ksp/impls/hpddm/hpddm.cxx

## Examples

src/ksp/ksp/tutorials/ex78.c

## Implementations

KSPHPDDMSetType_HPDDM() in src/ksp/ksp/impls/hpddm/hpddm.cxx

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