1: /*
2: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3: SLEPc - Scalable Library for Eigenvalue Problem Computations
4: Copyright (c) 2002-2015, Universitat Politecnica de Valencia, Spain
6: This file is part of SLEPc.
8: SLEPc is free software: you can redistribute it and/or modify it under the
9: terms of version 3 of the GNU Lesser General Public License as published by
10: the Free Software Foundation.
12: SLEPc is distributed in the hope that it will be useful, but WITHOUT ANY
13: WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14: FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
15: more details.
17: You should have received a copy of the GNU Lesser General Public License
18: along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
19: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
20: */
22: #include <slepc/private/nepimpl.h>
24: static PetscBool NEPPackageInitialized = PETSC_FALSE;
26: const char *NEPErrorTypes[] = {"ABSOLUTE","RELATIVE","NEPErrorType","NEP_ERROR_",0};
27: const char *NEPRefineTypes[] = {"NONE","SIMPLE","MULTIPLE","NEPRefine","NEP_REFINE_",0};
28: const char *const NEPConvergedReasons_Shifted[] = {"DIVERGED_FNORM_NAN","DIVERGED_BREAKDOWN","DIVERGED_MAX_IT","DIVERGED_FUNCTION_COUNT","DIVERGED_LINEAR_SOLVE","CONVERGED_ITERATING","","CONVERGED_FNORM_ABS","CONVERGED_FNORM_RELATIVE","CONVERGED_SNORM_RELATIVE","NEPConvergedReason","NEP_",0};
29: const char *const*NEPConvergedReasons = NEPConvergedReasons_Shifted + 5;
33: /*@C
34: NEPFinalizePackage - This function destroys everything in the Slepc interface
35: to the NEP package. It is called from SlepcFinalize().
37: Level: developer
39: .seealso: SlepcFinalize()
40: @*/
41: PetscErrorCode NEPFinalizePackage(void) 42: {
46: PetscFunctionListDestroy(&NEPList);
47: NEPPackageInitialized = PETSC_FALSE;
48: NEPRegisterAllCalled = PETSC_FALSE;
49: return(0);
50: }
54: /*@C
55: NEPInitializePackage - This function initializes everything in the NEP package.
56: It is called from PetscDLLibraryRegister() when using dynamic libraries, and
57: on the first call to NEPCreate() when using static libraries.
59: Level: developer
61: .seealso: SlepcInitialize()
62: @*/
63: PetscErrorCode NEPInitializePackage(void) 64: {
65: char logList[256];
66: char *className;
67: PetscBool opt;
71: if (NEPPackageInitialized) return(0);
72: NEPPackageInitialized = PETSC_TRUE;
73: /* Register Classes */
74: PetscClassIdRegister("NEP Solver",&NEP_CLASSID);
75: /* Register Constructors */
76: NEPRegisterAll();
77: /* Register Events */
78: PetscLogEventRegister("NEPSetUp",NEP_CLASSID,&NEP_SetUp);
79: PetscLogEventRegister("NEPSolve",NEP_CLASSID,&NEP_Solve);
80: PetscLogEventRegister("NEPRefine",NEP_CLASSID,&NEP_Refine);
81: PetscLogEventRegister("NEPFunctionEval",NEP_CLASSID,&NEP_FunctionEval);
82: PetscLogEventRegister("NEPJacobianEval",NEP_CLASSID,&NEP_JacobianEval);
83: /* Process info exclusions */
84: PetscOptionsGetString(NULL,"-info_exclude",logList,256,&opt);
85: if (opt) {
86: PetscStrstr(logList,"nep",&className);
87: if (className) {
88: PetscInfoDeactivateClass(NEP_CLASSID);
89: }
90: }
91: /* Process summary exclusions */
92: PetscOptionsGetString(NULL,"-log_summary_exclude",logList,256,&opt);
93: if (opt) {
94: PetscStrstr(logList,"nep",&className);
95: if (className) {
96: PetscLogEventDeactivateClass(NEP_CLASSID);
97: }
98: }
99: PetscRegisterFinalize(NEPFinalizePackage);
100: return(0);
101: }
103: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
107: /*
108: PetscDLLibraryRegister - This function is called when the dynamic library
109: it is in is opened.
111: This one registers all the NEP methods that are in the basic SLEPc libslepcnep
112: library.
113: */
114: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_slepcnep()115: {
119: NEPInitializePackage();
120: return(0);
121: }
122: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */