Actual source code: snesregi.c

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

      3: PETSC_EXTERN PetscErrorCode SNESCreate_NEWTONLS(SNES);
      4: PETSC_EXTERN PetscErrorCode SNESCreate_NEWTONTR(SNES);
      5: PETSC_EXTERN PetscErrorCode SNESCreate_NEWTONTRDC(SNES);
      6: PETSC_EXTERN PetscErrorCode SNESCreate_NRichardson(SNES);
      7: PETSC_EXTERN PetscErrorCode SNESCreate_KSPONLY(SNES);
      8: PETSC_EXTERN PetscErrorCode SNESCreate_KSPTRANSPOSEONLY(SNES);
      9: PETSC_EXTERN PetscErrorCode SNESCreate_VINEWTONRSLS(SNES);
     10: PETSC_EXTERN PetscErrorCode SNESCreate_VINEWTONSSLS(SNES);
     11: PETSC_EXTERN PetscErrorCode SNESCreate_NGMRES(SNES);
     12: PETSC_EXTERN PetscErrorCode SNESCreate_QN(SNES);
     13: PETSC_EXTERN PetscErrorCode SNESCreate_Shell(SNES);
     14: PETSC_EXTERN PetscErrorCode SNESCreate_NGS(SNES);
     15: PETSC_EXTERN PetscErrorCode SNESCreate_NCG(SNES);
     16: PETSC_EXTERN PetscErrorCode SNESCreate_FAS(SNES);
     17: PETSC_EXTERN PetscErrorCode SNESCreate_MS(SNES);
     18: PETSC_EXTERN PetscErrorCode SNESCreate_NASM(SNES);
     19: PETSC_EXTERN PetscErrorCode SNESCreate_Anderson(SNES);
     20: PETSC_EXTERN PetscErrorCode SNESCreate_ASPIN(SNES);
     21: PETSC_EXTERN PetscErrorCode SNESCreate_Composite(SNES);
     22: PETSC_EXTERN PetscErrorCode SNESCreate_Patch(SNES);
     23: PETSC_EXTERN PetscErrorCode SNESCreate_NEWTONAL(SNES);

     25: const char *SNESConvergedReasons_Shifted[] = {" ", "DIVERGED_OBJECTIVE_NANORINF", "DIVERGED_OBJECTIVE_DOMAIN", "DIVERGED_USER", "DIVERGED_TR_DELTA", "DIVERGED_JACOBIAN_DOMAIN", "DIVERGED_DTOL", "DIVERGED_LOCAL_MIN", "DIVERGED_INNER", "DIVERGED_LINE_SEARCH", "DIVERGED_MAX_IT", "DIVERGED_FUNCTION_NANORINF", "DIVERGED_LINEAR_SOLVE", "DIVERGED_FUNCTION_COUNT", "DIVERGED_FUNCTION_DOMAIN", "CONVERGED_ITERATING", " ", "CONVERGED_FNORM_ABS", "CONVERGED_FNORM_RELATIVE", "CONVERGED_SNORM_RELATIVE", "CONVERGED_ITS", "CONVERGED_BREAKOUT_INNER_ITER", "CONVERGED_USER", " ", "SNESConvergedReason", "", NULL};
     26: const char *const *SNESConvergedReasons = SNESConvergedReasons_Shifted + 15;

     28: const char              *SNESNormSchedules_Shifted[] = {"DEFAULT", "NONE", "ALWAYS", "INITIALONLY", "FINALONLY", "INITIALFINALONLY", "SNESNormSchedule", "SNES_NORM_", NULL};
     29: const char *const *const SNESNormSchedules           = SNESNormSchedules_Shifted + 1;

     31: const char              *SNESFunctionTypes_Shifted[] = {"DEFAULT", "UNPRECONDITIONED", "PRECONDITIONED", "SNESFunctionType", "SNES_FUNCTION_", NULL};
     32: const char *const *const SNESFunctionTypes           = SNESFunctionTypes_Shifted + 1;

     34: /*@C
     35:   SNESRegisterAll - Registers all of the nonlinear solver methods in the `SNES` package.

     37:   Not Collective

     39:   Level: advanced

     41: .seealso: [](ch_snes), `SNES`, `SNESRegisterDestroy()`
     42: @*/
     43: PetscErrorCode SNESRegisterAll(void)
     44: {
     45:   PetscFunctionBegin;
     46:   if (SNESRegisterAllCalled) PetscFunctionReturn(PETSC_SUCCESS);
     47:   SNESRegisterAllCalled = PETSC_TRUE;

     49:   PetscCall(SNESRegister(SNESNEWTONLS, SNESCreate_NEWTONLS));
     50:   PetscCall(SNESRegister(SNESNEWTONTR, SNESCreate_NEWTONTR));
     51:   PetscCall(SNESRegister(SNESNEWTONTRDC, SNESCreate_NEWTONTRDC));
     52:   PetscCall(SNESRegister(SNESNRICHARDSON, SNESCreate_NRichardson));
     53:   PetscCall(SNESRegister(SNESKSPONLY, SNESCreate_KSPONLY));
     54:   PetscCall(SNESRegister(SNESKSPTRANSPOSEONLY, SNESCreate_KSPTRANSPOSEONLY));
     55:   PetscCall(SNESRegister(SNESVINEWTONRSLS, SNESCreate_VINEWTONRSLS));
     56:   PetscCall(SNESRegister(SNESVINEWTONSSLS, SNESCreate_VINEWTONSSLS));
     57:   PetscCall(SNESRegister(SNESNGMRES, SNESCreate_NGMRES));
     58:   PetscCall(SNESRegister(SNESQN, SNESCreate_QN));
     59:   PetscCall(SNESRegister(SNESSHELL, SNESCreate_Shell));
     60:   PetscCall(SNESRegister(SNESNGS, SNESCreate_NGS));
     61:   PetscCall(SNESRegister(SNESNCG, SNESCreate_NCG));
     62:   PetscCall(SNESRegister(SNESFAS, SNESCreate_FAS));
     63:   PetscCall(SNESRegister(SNESMS, SNESCreate_MS));
     64:   PetscCall(SNESRegister(SNESNASM, SNESCreate_NASM));
     65:   PetscCall(SNESRegister(SNESANDERSON, SNESCreate_Anderson));
     66:   PetscCall(SNESRegister(SNESASPIN, SNESCreate_ASPIN));
     67:   PetscCall(SNESRegister(SNESCOMPOSITE, SNESCreate_Composite));
     68:   PetscCall(SNESRegister(SNESPATCH, SNESCreate_Patch));
     69:   PetscCall(SNESRegister(SNESNEWTONAL, SNESCreate_NEWTONAL));

     71:   PetscCall(KSPMonitorRegister("snes_preconditioned_residual", PETSCVIEWERASCII, PETSC_VIEWER_DEFAULT, KSPMonitorSNESResidual, NULL, NULL));
     72:   PetscCall(KSPMonitorRegister("snes_preconditioned_residual", PETSCVIEWERDRAW, PETSC_VIEWER_DRAW_LG, KSPMonitorSNESResidualDrawLG, KSPMonitorSNESResidualDrawLGCreate, NULL));
     73:   PetscFunctionReturn(PETSC_SUCCESS);
     74: }