Actual source code: gmres2.c

  1: #include "src/ksp/ksp/impls/gmres/gmresp.h"       /*I  "petscksp.h"  I*/

  5: /*@C
  6:    KSPGMRESSetOrthogonalization - Sets the orthogonalization routine used by GMRES and FGMRES.

  8:    Collective on KSP

 10:    Input Parameters:
 11: +  ksp - iterative context obtained from KSPCreate
 12: -  fcn - orthogonalization function

 14:    Calling Sequence of function:
 15: $   errorcode = int fcn(KSP ksp,int it);
 16: $   it is one minus the number of GMRES iterations since last restart;
 17: $    i.e. the size of Krylov space minus one

 19:    Notes:
 20:    Two orthogonalization routines are predefined, including

 22:    KSPGMRESModifiedGramSchmidtOrthogonalization()

 24:    KSPGMRESClassicalGramSchmidtOrthogonalization() - Default. Use KSPGMRESSetCGSRefinementType() to determine if 
 25:      iterative refinement is used to increase stability. 


 28:    Options Database Keys:

 30: +  -ksp_gmres_classicalgramschmidt - Activates KSPGMRESClassicalGramSchmidtOrthogonalization() (default)
 31: -  -ksp_gmres_modifiedgramschmidt - Activates KSPGMRESModifiedGramSchmidtOrthogonalization()

 33:    Level: intermediate

 35: .keywords: KSP, GMRES, set, orthogonalization, Gram-Schmidt, iterative refinement

 37: .seealso: KSPGMRESSetRestart(), KSPGMRESSetPreAllocateVectors(), KSPGMRESSetCGSRefinementType(),
 38:           KSPGMRESModifiedGramSchmidtOrthogonalization(), KSPGMRESClassicalGramSchmidtOrthogonalization()
 39: @*/
 40: PetscErrorCode KSPGMRESSetOrthogonalization(KSP ksp,PetscErrorCode (*fcn)(KSP,PetscInt))
 41: {
 42:   PetscErrorCode ierr,(*f)(KSP,PetscErrorCode (*)(KSP,PetscInt));

 46:   PetscObjectQueryFunction((PetscObject)ksp,"KSPGMRESSetOrthogonalization_C",(void (**)(void))&f);
 47:   if (f) {
 48:     (*f)(ksp,fcn);
 49:   }
 50:   return(0);
 51: }