Actual source code: itregis.c

  1: #include <petsc/private/kspimpl.h>

  3: PETSC_EXTERN PetscErrorCode KSPCreate_Richardson(KSP);
  4: PETSC_EXTERN PetscErrorCode KSPCreate_Chebyshev(KSP);
  5: PETSC_EXTERN PetscErrorCode KSPCreate_CG(KSP);
  6: PETSC_EXTERN PetscErrorCode KSPCreate_GROPPCG(KSP);
  7: PETSC_EXTERN PetscErrorCode KSPCreate_PIPECG(KSP);
  8: PETSC_EXTERN PetscErrorCode KSPCreate_PIPECGRR(KSP);
  9: PETSC_EXTERN PetscErrorCode KSPCreate_PIPELCG(KSP);
 10: PETSC_EXTERN PetscErrorCode KSPCreate_PIPEPRCG(KSP);
 11: PETSC_EXTERN PetscErrorCode KSPCreate_PIPECG2(KSP);
 12: PETSC_EXTERN PetscErrorCode KSPCreate_CGNE(KSP);
 13: PETSC_EXTERN PetscErrorCode KSPCreate_NASH(KSP);
 14: PETSC_EXTERN PetscErrorCode KSPCreate_STCG(KSP);
 15: PETSC_EXTERN PetscErrorCode KSPCreate_GLTR(KSP);
 16: PETSC_EXTERN PetscErrorCode KSPCreate_TCQMR(KSP);
 17: PETSC_EXTERN PetscErrorCode KSPCreate_FCG(KSP);
 18: PETSC_EXTERN PetscErrorCode KSPCreate_PIPEFCG(KSP);
 19: PETSC_EXTERN PetscErrorCode KSPCreate_GMRES(KSP);
 20: PETSC_EXTERN PetscErrorCode KSPCreate_BCGS(KSP);
 21: PETSC_EXTERN PetscErrorCode KSPCreate_IBCGS(KSP);
 22: PETSC_EXTERN PetscErrorCode KSPCreate_QMRCGS(KSP);
 23: PETSC_EXTERN PetscErrorCode KSPCreate_FBCGS(KSP);
 24: PETSC_EXTERN PetscErrorCode KSPCreate_PIPEBCGS(KSP);
 25: PETSC_EXTERN PetscErrorCode KSPCreate_FBCGSR(KSP);
 26: PETSC_EXTERN PetscErrorCode KSPCreate_BCGSL(KSP);
 27: PETSC_EXTERN PetscErrorCode KSPCreate_CGS(KSP);
 28: PETSC_EXTERN PetscErrorCode KSPCreate_TFQMR(KSP);
 29: PETSC_EXTERN PetscErrorCode KSPCreate_LSQR(KSP);
 30: PETSC_EXTERN PetscErrorCode KSPCreate_PREONLY(KSP);
 31: PETSC_EXTERN PetscErrorCode KSPCreate_CR(KSP);
 32: PETSC_EXTERN PetscErrorCode KSPCreate_PIPECR(KSP);
 33: PETSC_EXTERN PetscErrorCode KSPCreate_QCG(KSP);
 34: PETSC_EXTERN PetscErrorCode KSPCreate_BiCG(KSP);
 35: PETSC_EXTERN PetscErrorCode KSPCreate_FGMRES(KSP);
 36: PETSC_EXTERN PetscErrorCode KSPCreate_PIPEFGMRES(KSP);
 37: PETSC_EXTERN PetscErrorCode KSPCreate_MINRES(KSP);
 38: PETSC_EXTERN PetscErrorCode KSPCreate_SYMMLQ(KSP);
 39: PETSC_EXTERN PetscErrorCode KSPCreate_LGMRES(KSP);
 40: PETSC_EXTERN PetscErrorCode KSPCreate_LCD(KSP);
 41: PETSC_EXTERN PetscErrorCode KSPCreate_GCR(KSP);
 42: PETSC_EXTERN PetscErrorCode KSPCreate_PIPEGCR(KSP);
 43: PETSC_EXTERN PetscErrorCode KSPCreate_PGMRES(KSP);
 44: #if !defined(PETSC_USE_COMPLEX)
 45: PETSC_EXTERN PetscErrorCode KSPCreate_DGMRES(KSP);
 46: #endif
 47: PETSC_EXTERN PetscErrorCode KSPCreate_TSIRM(KSP);
 48: PETSC_EXTERN PetscErrorCode KSPCreate_CGLS(KSP);
 49: PETSC_EXTERN PetscErrorCode KSPCreate_FETIDP(KSP);
 50: #if defined(PETSC_HAVE_HPDDM)
 51: PETSC_EXTERN PetscErrorCode KSPCreate_HPDDM(KSP);
 52: #endif

 54: /*@C
 55:   KSPRegisterAll - Registers all of the Krylov subspace methods in the `KSP` package.

 57:   Not Collective

 59:   Level: advanced

 61: .seealso: [](ch_ksp), `KSP`, `KSPRegister()`, `KSPType`
 62: @*/
 63: PetscErrorCode KSPRegisterAll(void)
 64: {
 65:   PetscFunctionBegin;
 66:   if (KSPRegisterAllCalled) PetscFunctionReturn(PETSC_SUCCESS);
 67:   KSPRegisterAllCalled = PETSC_TRUE;

 69:   PetscCall(KSPRegister(KSPCG, KSPCreate_CG));
 70:   PetscCall(KSPRegister(KSPGROPPCG, KSPCreate_GROPPCG));
 71:   PetscCall(KSPRegister(KSPPIPECG, KSPCreate_PIPECG));
 72:   PetscCall(KSPRegister(KSPPIPECGRR, KSPCreate_PIPECGRR));
 73:   PetscCall(KSPRegister(KSPPIPELCG, KSPCreate_PIPELCG));
 74:   PetscCall(KSPRegister(KSPPIPEPRCG, KSPCreate_PIPEPRCG));
 75:   PetscCall(KSPRegister(KSPPIPECG2, KSPCreate_PIPECG2));
 76:   PetscCall(KSPRegister(KSPCGNE, KSPCreate_CGNE));
 77:   PetscCall(KSPRegister(KSPNASH, KSPCreate_NASH));
 78:   PetscCall(KSPRegister(KSPSTCG, KSPCreate_STCG));
 79:   PetscCall(KSPRegister(KSPGLTR, KSPCreate_GLTR));
 80:   PetscCall(KSPRegister(KSPRICHARDSON, KSPCreate_Richardson));
 81:   PetscCall(KSPRegister(KSPCHEBYSHEV, KSPCreate_Chebyshev));
 82:   PetscCall(KSPRegister(KSPGMRES, KSPCreate_GMRES));
 83:   PetscCall(KSPRegister(KSPTCQMR, KSPCreate_TCQMR));
 84:   PetscCall(KSPRegister(KSPFCG, KSPCreate_FCG));
 85:   PetscCall(KSPRegister(KSPPIPEFCG, KSPCreate_PIPEFCG));
 86:   PetscCall(KSPRegister(KSPBCGS, KSPCreate_BCGS));
 87:   PetscCall(KSPRegister(KSPIBCGS, KSPCreate_IBCGS));
 88:   PetscCall(KSPRegister(KSPQMRCGS, KSPCreate_QMRCGS));
 89:   PetscCall(KSPRegister(KSPFBCGS, KSPCreate_FBCGS));
 90:   PetscCall(KSPRegister(KSPPIPEBCGS, KSPCreate_PIPEBCGS));
 91:   PetscCall(KSPRegister(KSPFBCGSR, KSPCreate_FBCGSR));
 92:   PetscCall(KSPRegister(KSPBCGSL, KSPCreate_BCGSL));
 93:   PetscCall(KSPRegister(KSPCGS, KSPCreate_CGS));
 94:   PetscCall(KSPRegister(KSPTFQMR, KSPCreate_TFQMR));
 95:   PetscCall(KSPRegister(KSPCR, KSPCreate_CR));
 96:   PetscCall(KSPRegister(KSPPIPECR, KSPCreate_PIPECR));
 97:   PetscCall(KSPRegister(KSPLSQR, KSPCreate_LSQR));
 98:   PetscCall(KSPRegister(KSPPREONLY, KSPCreate_PREONLY));
 99:   PetscCall(KSPRegister(KSPNONE, KSPCreate_PREONLY));
100:   PetscCall(KSPRegister(KSPQCG, KSPCreate_QCG));
101:   PetscCall(KSPRegister(KSPBICG, KSPCreate_BiCG));
102:   PetscCall(KSPRegister(KSPFGMRES, KSPCreate_FGMRES));
103:   PetscCall(KSPRegister(KSPPIPEFGMRES, KSPCreate_PIPEFGMRES));
104:   PetscCall(KSPRegister(KSPMINRES, KSPCreate_MINRES));
105:   PetscCall(KSPRegister(KSPSYMMLQ, KSPCreate_SYMMLQ));
106:   PetscCall(KSPRegister(KSPLGMRES, KSPCreate_LGMRES));
107:   PetscCall(KSPRegister(KSPLCD, KSPCreate_LCD));
108:   PetscCall(KSPRegister(KSPGCR, KSPCreate_GCR));
109:   PetscCall(KSPRegister(KSPPIPEGCR, KSPCreate_PIPEGCR));
110:   PetscCall(KSPRegister(KSPPGMRES, KSPCreate_PGMRES));
111: #if !defined(PETSC_USE_COMPLEX)
112:   PetscCall(KSPRegister(KSPDGMRES, KSPCreate_DGMRES));
113: #endif
114:   PetscCall(KSPRegister(KSPTSIRM, KSPCreate_TSIRM));
115:   PetscCall(KSPRegister(KSPCGLS, KSPCreate_CGLS));
116:   PetscCall(KSPRegister(KSPFETIDP, KSPCreate_FETIDP));
117: #if defined(PETSC_HAVE_HPDDM)
118:   PetscCall(KSPRegister(KSPHPDDM, KSPCreate_HPDDM));
119: #endif
120:   PetscFunctionReturn(PETSC_SUCCESS);
121: }

123: /*@C
124:   KSPMonitorRegisterAll - Registers all of the Krylov subspace monitors in the `KSP` package.

126:   Not Collective

128:   Level: advanced

130: .seealso: [](ch_ksp), `KSP`, `KSPMonitorRegister()`, `KSPRegister()`
131: @*/
132: PetscErrorCode KSPMonitorRegisterAll(void)
133: {
134:   PetscFunctionBegin;
135:   if (KSPMonitorRegisterAllCalled) PetscFunctionReturn(PETSC_SUCCESS);
136:   KSPMonitorRegisterAllCalled = PETSC_TRUE;

138:   PetscCall(KSPMonitorRegister("preconditioned_residual", PETSCVIEWERASCII, PETSC_VIEWER_DEFAULT, KSPMonitorResidual, NULL, NULL));
139:   PetscCall(KSPMonitorRegister("preconditioned_residual", PETSCVIEWERDRAW, PETSC_VIEWER_DEFAULT, KSPMonitorResidualDraw, NULL, NULL));
140:   PetscCall(KSPMonitorRegister("preconditioned_residual", PETSCVIEWERDRAW, PETSC_VIEWER_DRAW_LG, KSPMonitorResidualDrawLG, KSPMonitorResidualDrawLGCreate, NULL));
141:   PetscCall(KSPMonitorRegister("preconditioned_residual_short", PETSCVIEWERASCII, PETSC_VIEWER_DEFAULT, KSPMonitorResidualShort, NULL, NULL));
142:   PetscCall(KSPMonitorRegister("preconditioned_residual_range", PETSCVIEWERASCII, PETSC_VIEWER_DEFAULT, KSPMonitorResidualRange, NULL, NULL));
143:   PetscCall(KSPMonitorRegister("true_residual", PETSCVIEWERASCII, PETSC_VIEWER_DEFAULT, KSPMonitorTrueResidual, NULL, NULL));
144:   PetscCall(KSPMonitorRegister("true_residual", PETSCVIEWERDRAW, PETSC_VIEWER_DEFAULT, KSPMonitorTrueResidualDraw, NULL, NULL));
145:   PetscCall(KSPMonitorRegister("true_residual", PETSCVIEWERDRAW, PETSC_VIEWER_DRAW_LG, KSPMonitorTrueResidualDrawLG, KSPMonitorTrueResidualDrawLGCreate, NULL));
146:   PetscCall(KSPMonitorRegister("true_residual_max", PETSCVIEWERASCII, PETSC_VIEWER_DEFAULT, KSPMonitorTrueResidualMax, NULL, NULL));
147:   PetscCall(KSPMonitorRegister("error", PETSCVIEWERASCII, PETSC_VIEWER_DEFAULT, KSPMonitorError, NULL, NULL));
148:   PetscCall(KSPMonitorRegister("error", PETSCVIEWERDRAW, PETSC_VIEWER_DEFAULT, KSPMonitorErrorDraw, NULL, NULL));
149:   PetscCall(KSPMonitorRegister("error", PETSCVIEWERDRAW, PETSC_VIEWER_DRAW_LG, KSPMonitorErrorDrawLG, KSPMonitorErrorDrawLGCreate, NULL));
150:   PetscCall(KSPMonitorRegister("solution", PETSCVIEWERASCII, PETSC_VIEWER_DEFAULT, KSPMonitorSolution, NULL, NULL));
151:   PetscCall(KSPMonitorRegister("solution", PETSCVIEWERDRAW, PETSC_VIEWER_DEFAULT, KSPMonitorSolutionDraw, NULL, NULL));
152:   PetscCall(KSPMonitorRegister("solution", PETSCVIEWERDRAW, PETSC_VIEWER_DRAW_LG, KSPMonitorSolutionDrawLG, KSPMonitorSolutionDrawLGCreate, NULL));
153:   PetscCall(KSPMonitorRegister("singular_value", PETSCVIEWERASCII, PETSC_VIEWER_DEFAULT, KSPMonitorSingularValue, KSPMonitorSingularValueCreate, NULL));
154:   PetscCall(KSPMonitorRegister("lsqr_residual", PETSCVIEWERASCII, PETSC_VIEWER_DEFAULT, KSPLSQRMonitorResidual, NULL, NULL));
155:   PetscCall(KSPMonitorRegister("lsqr_residual", PETSCVIEWERDRAW, PETSC_VIEWER_DRAW_LG, KSPLSQRMonitorResidualDrawLG, KSPLSQRMonitorResidualDrawLGCreate, NULL));
156:   PetscFunctionReturn(PETSC_SUCCESS);
157: }