Actual source code: dlregisnep.c
slepc-3.22.2 2024-12-02
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/nepimpl.h>
13: static PetscBool NEPPackageInitialized = PETSC_FALSE;
15: const char *NEPErrorTypes[] = {"ABSOLUTE","RELATIVE","BACKWARD","NEPErrorType","NEP_ERROR_",NULL};
16: const char *NEPRefineTypes[] = {"NONE","SIMPLE","MULTIPLE","NEPRefine","NEP_REFINE_",NULL};
17: const char *NEPRefineSchemes[] = {"","SCHUR","MBE","EXPLICIT","NEPRefineScheme","NEP_REFINE_SCHEME_",NULL};
18: const char *NEPCISSExtractions[] = {"RITZ","HANKEL","CAA","NEPCISSExtraction","NEP_CISS_EXTRACTION_",NULL};
19: const char *const NEPConvergedReasons_Shifted[] = {"DIVERGED_SUBSPACE_EXHAUSTED","DIVERGED_LINEAR_SOLVE","","DIVERGED_BREAKDOWN","DIVERGED_ITS","CONVERGED_ITERATING","CONVERGED_TOL","CONVERGED_USER","NEPConvergedReason","NEP_",NULL};
20: const char *const*NEPConvergedReasons = NEPConvergedReasons_Shifted + 5;
22: /*@C
23: NEPFinalizePackage - This function destroys everything in the Slepc interface
24: to the NEP package. It is called from SlepcFinalize().
26: Level: developer
28: .seealso: SlepcFinalize()
29: @*/
30: PetscErrorCode NEPFinalizePackage(void)
31: {
32: PetscFunctionBegin;
33: PetscCall(PetscFunctionListDestroy(&NEPList));
34: PetscCall(PetscFunctionListDestroy(&NEPMonitorList));
35: PetscCall(PetscFunctionListDestroy(&NEPMonitorCreateList));
36: PetscCall(PetscFunctionListDestroy(&NEPMonitorDestroyList));
37: NEPPackageInitialized = PETSC_FALSE;
38: NEPRegisterAllCalled = PETSC_FALSE;
39: NEPMonitorRegisterAllCalled = PETSC_FALSE;
40: PetscFunctionReturn(PETSC_SUCCESS);
41: }
43: /*@C
44: NEPInitializePackage - This function initializes everything in the NEP package.
45: It is called from PetscDLLibraryRegister() when using dynamic libraries, and
46: on the first call to NEPCreate() when using static libraries.
48: Level: developer
50: .seealso: SlepcInitialize()
51: @*/
52: PetscErrorCode NEPInitializePackage(void)
53: {
54: char logList[256];
55: PetscBool opt,pkg;
56: PetscClassId classids[1];
58: PetscFunctionBegin;
59: if (NEPPackageInitialized) PetscFunctionReturn(PETSC_SUCCESS);
60: NEPPackageInitialized = PETSC_TRUE;
61: /* Register Classes */
62: PetscCall(PetscClassIdRegister("NEP Solver",&NEP_CLASSID));
63: /* Register Constructors */
64: PetscCall(NEPRegisterAll());
65: /* Register Monitors */
66: PetscCall(NEPMonitorRegisterAll());
67: /* Register Events */
68: PetscCall(PetscLogEventRegister("NEPSetUp",NEP_CLASSID,&NEP_SetUp));
69: PetscCall(PetscLogEventRegister("NEPSolve",NEP_CLASSID,&NEP_Solve));
70: PetscCall(PetscLogEventRegister("NEPRefine",NEP_CLASSID,&NEP_Refine));
71: PetscCall(PetscLogEventRegister("NEPFunctionEval",NEP_CLASSID,&NEP_FunctionEval));
72: PetscCall(PetscLogEventRegister("NEPJacobianEval",NEP_CLASSID,&NEP_JacobianEval));
73: PetscCall(PetscLogEventRegister("NEPResolvent",NEP_CLASSID,&NEP_Resolvent));
74: PetscCall(PetscLogEventRegister("NEPCISS_SVD",NEP_CLASSID,&NEP_CISS_SVD));
75: /* Process Info */
76: classids[0] = NEP_CLASSID;
77: PetscCall(PetscInfoProcessClass("nep",1,&classids[0]));
78: /* Process summary exclusions */
79: PetscCall(PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt));
80: if (opt) {
81: PetscCall(PetscStrInList("nep",logList,',',&pkg));
82: if (pkg) PetscCall(PetscLogEventDeactivateClass(NEP_CLASSID));
83: }
84: /* Register package finalizer */
85: PetscCall(PetscRegisterFinalize(NEPFinalizePackage));
86: PetscFunctionReturn(PETSC_SUCCESS);
87: }
89: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
90: /*
91: PetscDLLibraryRegister - This function is called when the dynamic library
92: it is in is opened.
94: This one registers all the NEP methods that are in the basic SLEPc libslepcnep
95: library.
96: */
97: SLEPC_EXTERN PetscErrorCode PetscDLLibraryRegister_slepcnep(void)
98: {
99: PetscFunctionBegin;
100: PetscCall(NEPInitializePackage());
101: PetscFunctionReturn(PETSC_SUCCESS);
102: }
103: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */