Actual source code: dlregismfn.c
slepc-3.11.2 2019-07-30
1: /*
2: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3: SLEPc - Scalable Library for Eigenvalue Problem Computations
4: Copyright (c) 2002-2019, 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/mfnimpl.h>
13: static PetscBool MFNPackageInitialized = PETSC_FALSE;
15: const char *const MFNConvergedReasons_Shifted[] = {"DIVERGED_BREAKDOWN","DIVERGED_ITS","CONVERGED_ITERATING","CONVERGED_TOL","CONVERGED_ITS","MFNConvergedReason","MFN_",0};
16: const char *const*MFNConvergedReasons = MFNConvergedReasons_Shifted + 2;
18: /*@C
19: MFNFinalizePackage - This function destroys everything in the SLEPc interface
20: to the MFN package. It is called from SlepcFinalize().
22: Level: developer
24: .seealso: SlepcFinalize()
25: @*/
26: PetscErrorCode MFNFinalizePackage(void)
27: {
31: PetscFunctionListDestroy(&MFNList);
32: MFNPackageInitialized = PETSC_FALSE;
33: MFNRegisterAllCalled = PETSC_FALSE;
34: return(0);
35: }
37: /*@C
38: MFNInitializePackage - This function initializes everything in the MFN package.
39: It is called from PetscDLLibraryRegister() when using dynamic libraries, and
40: on the first call to MFNCreate() when using static libraries.
42: Level: developer
44: .seealso: SlepcInitialize()
45: @*/
46: PetscErrorCode MFNInitializePackage(void)
47: {
48: char logList[256];
49: PetscBool opt,pkg;
53: if (MFNPackageInitialized) return(0);
54: MFNPackageInitialized = PETSC_TRUE;
55: /* Register Classes */
56: PetscClassIdRegister("Matrix Function",&MFN_CLASSID);
57: /* Register Constructors */
58: MFNRegisterAll();
59: /* Register Events */
60: PetscLogEventRegister("MFNSetUp",MFN_CLASSID,&MFN_SetUp);
61: PetscLogEventRegister("MFNSolve",MFN_CLASSID,&MFN_Solve);
62: /* Process info exclusions */
63: PetscOptionsGetString(NULL,NULL,"-info_exclude",logList,sizeof(logList),&opt);
64: if (opt) {
65: PetscStrInList("mfn",logList,',',&pkg);
66: if (pkg) { PetscInfoDeactivateClass(MFN_CLASSID); }
67: }
68: /* Process summary exclusions */
69: PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
70: if (opt) {
71: PetscStrInList("mfn",logList,',',&pkg);
72: if (pkg) { PetscLogEventDeactivateClass(MFN_CLASSID); }
73: }
74: /* Register package finalizer */
75: PetscRegisterFinalize(MFNFinalizePackage);
76: return(0);
77: }
79: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
80: /*
81: PetscDLLibraryRegister - This function is called when the dynamic library
82: it is in is opened.
84: This one registers all the MFN methods that are in the basic SLEPc libslepcmfn
85: library.
86: */
87: SLEPC_EXTERN PetscErrorCode PetscDLLibraryRegister_slepcmfn()
88: {
92: MFNInitializePackage();
93: return(0);
94: }
95: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */