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 103 : PetscErrorCode NEPFinalizePackage(void)
31 : {
32 103 : PetscFunctionBegin;
33 103 : PetscCall(PetscFunctionListDestroy(&NEPList));
34 103 : PetscCall(PetscFunctionListDestroy(&NEPMonitorList));
35 103 : PetscCall(PetscFunctionListDestroy(&NEPMonitorCreateList));
36 103 : PetscCall(PetscFunctionListDestroy(&NEPMonitorDestroyList));
37 103 : NEPPackageInitialized = PETSC_FALSE;
38 103 : NEPRegisterAllCalled = PETSC_FALSE;
39 103 : NEPMonitorRegisterAllCalled = PETSC_FALSE;
40 103 : 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 1236 : PetscErrorCode NEPInitializePackage(void)
53 : {
54 1236 : char logList[256];
55 1236 : PetscBool opt,pkg;
56 1236 : PetscClassId classids[1];
57 :
58 1236 : PetscFunctionBegin;
59 1236 : if (NEPPackageInitialized) PetscFunctionReturn(PETSC_SUCCESS);
60 103 : NEPPackageInitialized = PETSC_TRUE;
61 : /* Register Classes */
62 103 : PetscCall(PetscClassIdRegister("NEP Solver",&NEP_CLASSID));
63 : /* Register Constructors */
64 103 : PetscCall(NEPRegisterAll());
65 : /* Register Monitors */
66 103 : PetscCall(NEPMonitorRegisterAll());
67 : /* Register Events */
68 103 : PetscCall(PetscLogEventRegister("NEPSetUp",NEP_CLASSID,&NEP_SetUp));
69 103 : PetscCall(PetscLogEventRegister("NEPSolve",NEP_CLASSID,&NEP_Solve));
70 103 : PetscCall(PetscLogEventRegister("NEPRefine",NEP_CLASSID,&NEP_Refine));
71 103 : PetscCall(PetscLogEventRegister("NEPFunctionEval",NEP_CLASSID,&NEP_FunctionEval));
72 103 : PetscCall(PetscLogEventRegister("NEPJacobianEval",NEP_CLASSID,&NEP_JacobianEval));
73 103 : PetscCall(PetscLogEventRegister("NEPResolvent",NEP_CLASSID,&NEP_Resolvent));
74 103 : PetscCall(PetscLogEventRegister("NEPCISS_SVD",NEP_CLASSID,&NEP_CISS_SVD));
75 : /* Process Info */
76 103 : classids[0] = NEP_CLASSID;
77 103 : PetscCall(PetscInfoProcessClass("nep",1,&classids[0]));
78 : /* Process summary exclusions */
79 103 : PetscCall(PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt));
80 103 : if (opt) {
81 4 : PetscCall(PetscStrInList("nep",logList,',',&pkg));
82 4 : if (pkg) PetscCall(PetscLogEventDeactivateClass(NEP_CLASSID));
83 : }
84 : /* Register package finalizer */
85 103 : PetscCall(PetscRegisterFinalize(NEPFinalizePackage));
86 103 : 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 */
|