1: /*
2: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3: SLEPc - Scalable Library for Eigenvalue Problem Computations
4: Copyright (c) 2002-2016, 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/mfnimpl.h>
24: static PetscBool MFNPackageInitialized = PETSC_FALSE;
26: const char *const MFNConvergedReasons_Shifted[] = {"DIVERGED_BREAKDOWN","DIVERGED_ITS","","","CONVERGED_ITERATING","","CONVERGED_TOL","CONVERGED_ITS","MFNConvergedReason","MFN_",0};
27: const char *const*MFNConvergedReasons = MFNConvergedReasons_Shifted + 4;
31: /*@C
32: MFNFinalizePackage - This function destroys everything in the SLEPc interface
33: to the MFN package. It is called from SlepcFinalize().
35: Level: developer
37: .seealso: SlepcFinalize()
38: @*/
39: PetscErrorCode MFNFinalizePackage(void) 40: {
44: PetscFunctionListDestroy(&MFNList);
45: MFNPackageInitialized = PETSC_FALSE;
46: MFNRegisterAllCalled = PETSC_FALSE;
47: return(0);
48: }
52: /*@C
53: MFNInitializePackage - This function initializes everything in the MFN package.
54: It is called from PetscDLLibraryRegister() when using dynamic libraries, and
55: on the first call to MFNCreate() when using static libraries.
57: Level: developer
59: .seealso: SlepcInitialize()
60: @*/
61: PetscErrorCode MFNInitializePackage(void) 62: {
63: char logList[256];
64: char *className;
65: PetscBool opt;
69: if (MFNPackageInitialized) return(0);
70: MFNPackageInitialized = PETSC_TRUE;
71: /* Register Classes */
72: PetscClassIdRegister("Matrix Function",&MFN_CLASSID);
73: /* Register Constructors */
74: MFNRegisterAll();
75: /* Register Events */
76: PetscLogEventRegister("MFNSetUp",MFN_CLASSID,&MFN_SetUp);
77: PetscLogEventRegister("MFNSolve",MFN_CLASSID,&MFN_Solve);
78: /* Process info exclusions */
79: PetscOptionsGetString(NULL,NULL,"-info_exclude",logList,256,&opt);
80: if (opt) {
81: PetscStrstr(logList,"mfn",&className);
82: if (className) {
83: PetscInfoDeactivateClass(MFN_CLASSID);
84: }
85: }
86: /* Process summary exclusions */
87: PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,256,&opt);
88: if (opt) {
89: PetscStrstr(logList,"mfn",&className);
90: if (className) {
91: PetscLogEventDeactivateClass(MFN_CLASSID);
92: }
93: }
94: PetscRegisterFinalize(MFNFinalizePackage);
95: return(0);
96: }
98: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
102: /*
103: PetscDLLibraryRegister - This function is called when the dynamic library
104: it is in is opened.
106: This one registers all the MFN methods that are in the basic SLEPc libslepcmfn
107: library.
108: */
109: PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_slepcmfn()110: {
114: MFNInitializePackage();
115: return(0);
116: }
117: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */