Line data Source code
1 : /*
2 : - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3 : SLEPc - Scalable Library for Eigenvalue Problem Computations
4 : Copyright (c) 2002-, Universitat Politecnica de Valencia, Spain
5 :
6 : This file is part of SLEPc.
7 : SLEPc is distributed under a 2-clause BSD license (see LICENSE).
8 : - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9 : */
10 :
11 : #include <slepc/private/nepimpl.h>
12 :
13 : static PetscBool NEPPackageInitialized = PETSC_FALSE;
14 :
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;
21 :
22 : /*@C
23 : NEPFinalizePackage - This function destroys everything in the Slepc interface
24 : to the NEP package. It is called from SlepcFinalize().
25 :
26 : Level: developer
27 :
28 : .seealso: SlepcFinalize()
29 : @*/
30 141 : PetscErrorCode NEPFinalizePackage(void)
31 : {
32 141 : PetscFunctionBegin;
33 141 : PetscCall(PetscFunctionListDestroy(&NEPList));
34 141 : PetscCall(PetscFunctionListDestroy(&NEPMonitorList));
35 141 : PetscCall(PetscFunctionListDestroy(&NEPMonitorCreateList));
36 141 : PetscCall(PetscFunctionListDestroy(&NEPMonitorDestroyList));
37 141 : NEPPackageInitialized = PETSC_FALSE;
38 141 : NEPRegisterAllCalled = PETSC_FALSE;
39 141 : NEPMonitorRegisterAllCalled = PETSC_FALSE;
40 141 : PetscFunctionReturn(PETSC_SUCCESS);
41 : }
42 :
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.
47 :
48 : Level: developer
49 :
50 : .seealso: SlepcInitialize()
51 : @*/
52 1833 : PetscErrorCode NEPInitializePackage(void)
53 : {
54 1833 : char logList[256];
55 1833 : PetscBool opt,pkg;
56 1833 : PetscClassId classids[1];
57 :
58 1833 : PetscFunctionBegin;
59 1833 : if (NEPPackageInitialized) PetscFunctionReturn(PETSC_SUCCESS);
60 141 : NEPPackageInitialized = PETSC_TRUE;
61 : /* Register Classes */
62 141 : PetscCall(PetscClassIdRegister("NEP Solver",&NEP_CLASSID));
63 : /* Register Constructors */
64 141 : PetscCall(NEPRegisterAll());
65 : /* Register Monitors */
66 141 : PetscCall(NEPMonitorRegisterAll());
67 : /* Register Events */
68 141 : PetscCall(PetscLogEventRegister("NEPSetUp",NEP_CLASSID,&NEP_SetUp));
69 141 : PetscCall(PetscLogEventRegister("NEPSolve",NEP_CLASSID,&NEP_Solve));
70 141 : PetscCall(PetscLogEventRegister("NEPRefine",NEP_CLASSID,&NEP_Refine));
71 141 : PetscCall(PetscLogEventRegister("NEPFunctionEval",NEP_CLASSID,&NEP_FunctionEval));
72 141 : PetscCall(PetscLogEventRegister("NEPJacobianEval",NEP_CLASSID,&NEP_JacobianEval));
73 141 : PetscCall(PetscLogEventRegister("NEPResolvent",NEP_CLASSID,&NEP_Resolvent));
74 141 : PetscCall(PetscLogEventRegister("NEPCISS_SVD",NEP_CLASSID,&NEP_CISS_SVD));
75 : /* Process Info */
76 141 : classids[0] = NEP_CLASSID;
77 141 : PetscCall(PetscInfoProcessClass("nep",1,&classids[0]));
78 : /* Process summary exclusions */
79 141 : PetscCall(PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt));
80 141 : if (opt) {
81 4 : PetscCall(PetscStrInList("nep",logList,',',&pkg));
82 4 : if (pkg) PetscCall(PetscLogEventDeactivateClass(NEP_CLASSID));
83 : }
84 : /* Register package finalizer */
85 141 : PetscCall(PetscRegisterFinalize(NEPFinalizePackage));
86 141 : PetscFunctionReturn(PETSC_SUCCESS);
87 : }
88 :
89 : #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
90 : /*
91 : PetscDLLibraryRegister - This function is called when the dynamic library
92 : it is in is opened.
93 :
94 : This one registers all the NEP methods that are in the basic SLEPc libslepcnep
95 : library.
96 : */
97 1 : SLEPC_EXTERN PetscErrorCode PetscDLLibraryRegister_slepcnep(void)
98 : {
99 1 : PetscFunctionBegin;
100 1 : PetscCall(NEPInitializePackage());
101 1 : PetscFunctionReturn(PETSC_SUCCESS);
102 : }
103 : #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */
|