Actual source code: dlregismfn.c
slepc-3.16.1 2021-11-17
1: /*
2: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
3: SLEPc - Scalable Library for Eigenvalue Problem Computations
4: Copyright (c) 2002-2021, 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: PetscFunctionListDestroy(&MFNMonitorList);
33: PetscFunctionListDestroy(&MFNMonitorCreateList);
34: PetscFunctionListDestroy(&MFNMonitorDestroyList);
35: MFNPackageInitialized = PETSC_FALSE;
36: MFNRegisterAllCalled = PETSC_FALSE;
37: MFNMonitorRegisterAllCalled = PETSC_FALSE;
38: return(0);
39: }
41: /*@C
42: MFNInitializePackage - This function initializes everything in the MFN package.
43: It is called from PetscDLLibraryRegister() when using dynamic libraries, and
44: on the first call to MFNCreate() when using static libraries.
46: Level: developer
48: .seealso: SlepcInitialize()
49: @*/
50: PetscErrorCode MFNInitializePackage(void)
51: {
52: char logList[256];
53: PetscBool opt,pkg;
54: PetscClassId classids[1];
58: if (MFNPackageInitialized) return(0);
59: MFNPackageInitialized = PETSC_TRUE;
60: /* Register Classes */
61: PetscClassIdRegister("Matrix Function",&MFN_CLASSID);
62: /* Register Constructors */
63: MFNRegisterAll();
64: /* Register Monitors */
65: MFNMonitorRegisterAll();
66: /* Register Events */
67: PetscLogEventRegister("MFNSetUp",MFN_CLASSID,&MFN_SetUp);
68: PetscLogEventRegister("MFNSolve",MFN_CLASSID,&MFN_Solve);
69: /* Process Info */
70: classids[0] = MFN_CLASSID;
71: PetscInfoProcessClass("mfn",1,&classids[0]);
72: /* Process summary exclusions */
73: PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
74: if (opt) {
75: PetscStrInList("mfn",logList,',',&pkg);
76: if (pkg) { PetscLogEventDeactivateClass(MFN_CLASSID); }
77: }
78: /* Register package finalizer */
79: PetscRegisterFinalize(MFNFinalizePackage);
80: return(0);
81: }
83: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
84: /*
85: PetscDLLibraryRegister - This function is called when the dynamic library
86: it is in is opened.
88: This one registers all the MFN methods that are in the basic SLEPc libslepcmfn
89: library.
90: */
91: SLEPC_EXTERN PetscErrorCode PetscDLLibraryRegister_slepcmfn()
92: {
96: MFNInitializePackage();
97: return(0);
98: }
99: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */