Actual source code: gmres2.c
1: #define PETSCKSP_DLL
3: #include ../src/ksp/ksp/impls/gmres/gmresp.h
7: /*@C
8: KSPGMRESSetOrthogonalization - Sets the orthogonalization routine used by GMRES and FGMRES.
10: Collective on KSP
12: Input Parameters:
13: + ksp - iterative context obtained from KSPCreate
14: - fcn - orthogonalization function
16: Calling Sequence of function:
17: $ errorcode = int fcn(KSP ksp,int it);
18: $ it is one minus the number of GMRES iterations since last restart;
19: $ i.e. the size of Krylov space minus one
21: Notes:
22: Two orthogonalization routines are predefined, including
24: KSPGMRESModifiedGramSchmidtOrthogonalization()
26: KSPGMRESClassicalGramSchmidtOrthogonalization() - Default. Use KSPGMRESSetCGSRefinementType() to determine if
27: iterative refinement is used to increase stability.
30: Options Database Keys:
32: + -ksp_gmres_classicalgramschmidt - Activates KSPGMRESClassicalGramSchmidtOrthogonalization() (default)
33: - -ksp_gmres_modifiedgramschmidt - Activates KSPGMRESModifiedGramSchmidtOrthogonalization()
35: Level: intermediate
37: .keywords: KSP, GMRES, set, orthogonalization, Gram-Schmidt, iterative refinement
39: .seealso: KSPGMRESSetRestart(), KSPGMRESSetPreAllocateVectors(), KSPGMRESSetCGSRefinementType(),
40: KSPGMRESModifiedGramSchmidtOrthogonalization(), KSPGMRESClassicalGramSchmidtOrthogonalization()
41: @*/
42: PetscErrorCode KSPGMRESSetOrthogonalization(KSP ksp,PetscErrorCode (*fcn)(KSP,PetscInt))
43: {
44: PetscErrorCode ierr,(*f)(KSP,PetscErrorCode (*)(KSP,PetscInt));
48: PetscObjectQueryFunction((PetscObject)ksp,"KSPGMRESSetOrthogonalization_C",(void (**)(void))&f);
49: if (f) {
50: (*f)(ksp,fcn);
51: }
52: return(0);
53: }