Actual source code: dlregiseps.c

  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-, Universitat Politecnica de Valencia, Spain

  6:    This file is part of SLEPc.
  7:    SLEPc is distributed under a 2-clause BSD license (see LICENSE).
  8:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  9: */

 11: #include <slepc/private/epsimpl.h>

 13: static PetscBool EPSPackageInitialized = PETSC_FALSE;

 15: const char *EPSBalanceTypes[] = {"NONE","ONESIDE","TWOSIDE","USER","EPSBalance","EPS_BALANCE_",NULL};
 16: const char *EPSErrorTypes[] = {"ABSOLUTE","RELATIVE","BACKWARD","EPSErrorType","EPS_ERROR_",NULL};
 17: const char *EPSPowerShiftTypes[] = {"CONSTANT","RAYLEIGH","WILKINSON","EPSPowerShiftType","EPS_POWER_SHIFT_",NULL};
 18: const char *EPSKrylovSchurBSETypes[] = {"SHAO","GRUNING","PROJECTEDBSE","EPSKrylovSchurBSEType","EPS_KRYLOVSCHUR_BSE_",NULL};
 19: const char *EPSKrylovSchurLREPTypes[] = {"TENG","ZHONG","EPSKrylovSchurLREPType","EPS_KRYLOVSCHUR_LREP_",NULL};
 20: const char *EPSLanczosReorthogTypes[] = {"LOCAL","FULL","SELECTIVE","PERIODIC","PARTIAL","DELAYED","EPSLanczosReorthogType","EPS_LANCZOS_REORTHOG_",NULL};
 21: const char *EPSPRIMMEMethods[] = {"","DYNAMIC","DEFAULT_MIN_TIME","DEFAULT_MIN_MATVECS","ARNOLDI","GD","GD_PLUSK","GD_OLSEN_PLUSK","JD_OLSEN_PLUSK","RQI","JDQR","JDQMR","JDQMR_ETOL","SUBSPACE_ITERATION","LOBPCG_ORTHOBASIS","LOBPCG_ORTHOBASISW","EPSPRIMMEMethod","EPS_PRIMME_",NULL};
 22: const char *EPSCISSQuadRules[] = {"(not set yet)","TRAPEZOIDAL","CHEBYSHEV","EPSCISSQuadRule","EPS_CISS_QUADRULE_",NULL};
 23: const char *EPSCISSExtractions[] = {"RITZ","HANKEL","EPSCISSExtraction","EPS_CISS_EXTRACTION_",NULL};
 24: const char *EPSCISSStrategies[] = {"(not set yet)","USEST","SPLIT","MULTISHIFT","EPSCISSStrategy","EPS_CISS_STRATEGY_",NULL};
 25: const char *EPSEVSLDOSMethods[] = {"KPM","LANCZOS","EPSEVSLDOSMethod","EPS_EVSL_DOS_",NULL};
 26: const char *EPSEVSLDampings[] = {"NONE","JACKSON","SIGMA","EPSEVSLDamping","EPS_EVSL_DAMPING_",NULL};
 27: const char *const EPSConvergedReasons_Shifted[] = {"","DIVERGED_SYMMETRY_LOST","DIVERGED_BREAKDOWN","DIVERGED_ITS","CONVERGED_ITERATING","CONVERGED_TOL","CONVERGED_USER","EPSConvergedReason","EPS_",NULL};
 28: const char *const*EPSConvergedReasons = EPSConvergedReasons_Shifted + 4;

 30: /*@
 31:   EPSFinalizePackage - This function destroys everything in the SLEPc interface
 32:   to the `EPS` package. It is called from `SlepcFinalize()`.

 34:   Level: developer

 36: .seealso: [](ch:eps), `SlepcFinalize()`, `EPSInitializePackage()`
 37: @*/
 38: PetscErrorCode EPSFinalizePackage(void)
 39: {
 40:   PetscFunctionBegin;
 41:   PetscCall(PetscFunctionListDestroy(&EPSList));
 42:   PetscCall(PetscFunctionListDestroy(&EPSMonitorList));
 43:   PetscCall(PetscFunctionListDestroy(&EPSMonitorCreateList));
 44:   PetscCall(PetscFunctionListDestroy(&EPSMonitorDestroyList));
 45:   EPSPackageInitialized       = PETSC_FALSE;
 46:   EPSRegisterAllCalled        = PETSC_FALSE;
 47:   EPSMonitorRegisterAllCalled = PETSC_FALSE;
 48:   PetscFunctionReturn(PETSC_SUCCESS);
 49: }

 51: /*@
 52:    EPSInitializePackage - This function initializes everything in the `EPS` package.
 53:    It is called from `PetscDLLibraryRegister_slepceps()` when using dynamic libraries, and
 54:    on the first call to `EPSCreate()` when using shared or static libraries.

 56:    Note:
 57:    This function never needs to be called by SLEPc users.

 59:    Level: developer

 61: .seealso: [](ch:eps), `EPS`, `SlepcInitialize()`, `EPSFinalizePackage()`
 62: @*/
 63: PetscErrorCode EPSInitializePackage(void)
 64: {
 65:   char           logList[256];
 66:   PetscBool      opt,pkg;
 67:   PetscClassId   classids[1];

 69:   PetscFunctionBegin;
 70:   if (EPSPackageInitialized) PetscFunctionReturn(PETSC_SUCCESS);
 71:   EPSPackageInitialized = PETSC_TRUE;
 72:   /* Register Classes */
 73:   PetscCall(PetscClassIdRegister("EPS Solver",&EPS_CLASSID));
 74:   /* Register Constructors */
 75:   PetscCall(EPSRegisterAll());
 76:   /* Register Monitors */
 77:   PetscCall(EPSMonitorRegisterAll());
 78:   /* Register Events */
 79:   PetscCall(PetscLogEventRegister("EPSSetUp",EPS_CLASSID,&EPS_SetUp));
 80:   PetscCall(PetscLogEventRegister("EPSSolve",EPS_CLASSID,&EPS_Solve));
 81:   PetscCall(PetscLogEventRegister("EPSCISS_SVD",EPS_CLASSID,&EPS_CISS_SVD));
 82:   /* Process Info */
 83:   classids[0] = EPS_CLASSID;
 84:   PetscCall(PetscInfoProcessClass("eps",1,&classids[0]));
 85:   /* Process summary exclusions */
 86:   PetscCall(PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt));
 87:   if (opt) {
 88:     PetscCall(PetscStrInList("eps",logList,',',&pkg));
 89:     if (pkg) PetscCall(PetscLogEventDeactivateClass(EPS_CLASSID));
 90:   }
 91:   /* Register package finalizer */
 92:   PetscCall(PetscRegisterFinalize(EPSFinalizePackage));
 93:   PetscFunctionReturn(PETSC_SUCCESS);
 94: }

 96: #if PetscDefined(HAVE_DYNAMIC_LIBRARIES)
 97: /*
 98:   PetscDLLibraryRegister - This function is called when the dynamic library
 99:   it is in is opened.

101:   This one registers all the EPS methods that are in the basic SLEPc libslepceps
102:   library.
103:  */
104: SLEPC_EXTERN PetscErrorCode PetscDLLibraryRegister_slepceps(void)
105: {
106:   PetscFunctionBegin;
107:   PetscCall(EPSInitializePackage());
108:   PetscFunctionReturn(PETSC_SUCCESS);
109: }
110: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */