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/pepimpl.h>
12 :
13 : static PetscBool PEPPackageInitialized = PETSC_FALSE;
14 :
15 : const char *PEPBasisTypes[] = {"MONOMIAL","CHEBYSHEV1","CHEBYSHEV2","LEGENDRE","LAGUERRE","HERMITE","PEPBasis","PEP_BASIS_",NULL};
16 : const char *PEPScaleTypes[] = {"NONE","SCALAR","DIAGONAL","BOTH","PEPScale","PEP_SCALE_",NULL};
17 : const char *PEPRefineTypes[] = {"NONE","SIMPLE","MULTIPLE","PEPRefine","PEP_REFINE_",NULL};
18 : const char *PEPRefineSchemes[] = {"","SCHUR","MBE","EXPLICIT","PEPRefineScheme","PEP_REFINE_SCHEME_",NULL};
19 : const char *PEPExtractTypes[] = {"","NONE","NORM","RESIDUAL","STRUCTURED","PEPExtract","PEP_EXTRACT_",NULL};
20 : const char *PEPErrorTypes[] = {"ABSOLUTE","RELATIVE","BACKWARD","PEPErrorType","PEP_ERROR_",NULL};
21 : const char *const PEPConvergedReasons_Shifted[] = {"","DIVERGED_SYMMETRY_LOST","DIVERGED_BREAKDOWN","DIVERGED_ITS","CONVERGED_ITERATING","CONVERGED_TOL","CONVERGED_USER","PEPConvergedReason","PEP_",NULL};
22 : const char *const*PEPConvergedReasons = PEPConvergedReasons_Shifted + 4;
23 : const char *PEPJDProjectionTypes[] = {"HARMONIC","ORTHOGONAL","PEPJDProjection","PEP_JD_PROJECTION_",NULL};
24 : const char *PEPCISSExtractions[] = {"RITZ","HANKEL","CAA","PEPCISSExtraction","PEP_CISS_EXTRACTION_",NULL};
25 :
26 : /*@C
27 : PEPFinalizePackage - This function destroys everything in the Slepc interface
28 : to the PEP package. It is called from SlepcFinalize().
29 :
30 : Level: developer
31 :
32 : .seealso: SlepcFinalize()
33 : @*/
34 179 : PetscErrorCode PEPFinalizePackage(void)
35 : {
36 179 : PetscFunctionBegin;
37 179 : PetscCall(PetscFunctionListDestroy(&PEPList));
38 179 : PetscCall(PetscFunctionListDestroy(&PEPMonitorList));
39 179 : PetscCall(PetscFunctionListDestroy(&PEPMonitorCreateList));
40 179 : PetscCall(PetscFunctionListDestroy(&PEPMonitorDestroyList));
41 179 : PEPPackageInitialized = PETSC_FALSE;
42 179 : PEPRegisterAllCalled = PETSC_FALSE;
43 179 : PEPMonitorRegisterAllCalled = PETSC_FALSE;
44 179 : PetscFunctionReturn(PETSC_SUCCESS);
45 : }
46 :
47 : /*@C
48 : PEPInitializePackage - This function initializes everything in the PEP package.
49 : It is called from PetscDLLibraryRegister() when using dynamic libraries, and
50 : on the first call to PEPCreate() when using static libraries.
51 :
52 : Level: developer
53 :
54 : .seealso: SlepcInitialize()
55 : @*/
56 2331 : PetscErrorCode PEPInitializePackage(void)
57 : {
58 2331 : char logList[256];
59 2331 : PetscBool opt,pkg;
60 2331 : PetscClassId classids[1];
61 :
62 2331 : PetscFunctionBegin;
63 2331 : if (PEPPackageInitialized) PetscFunctionReturn(PETSC_SUCCESS);
64 179 : PEPPackageInitialized = PETSC_TRUE;
65 : /* Register Classes */
66 179 : PetscCall(PetscClassIdRegister("PEP Solver",&PEP_CLASSID));
67 : /* Register Constructors */
68 179 : PetscCall(PEPRegisterAll());
69 : /* Register Monitors */
70 179 : PetscCall(PEPMonitorRegisterAll());
71 : /* Register Events */
72 179 : PetscCall(PetscLogEventRegister("PEPSetUp",PEP_CLASSID,&PEP_SetUp));
73 179 : PetscCall(PetscLogEventRegister("PEPSolve",PEP_CLASSID,&PEP_Solve));
74 179 : PetscCall(PetscLogEventRegister("PEPRefine",PEP_CLASSID,&PEP_Refine));
75 179 : PetscCall(PetscLogEventRegister("PEPCISS_SVD",PEP_CLASSID,&PEP_CISS_SVD));
76 : /* Process Info */
77 179 : classids[0] = PEP_CLASSID;
78 179 : PetscCall(PetscInfoProcessClass("pep",1,&classids[0]));
79 : /* Process summary exclusions */
80 179 : PetscCall(PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt));
81 179 : if (opt) {
82 4 : PetscCall(PetscStrInList("pep",logList,',',&pkg));
83 4 : if (pkg) PetscCall(PetscLogEventDeactivateClass(PEP_CLASSID));
84 : }
85 : /* Register package finalizer */
86 179 : PetscCall(PetscRegisterFinalize(PEPFinalizePackage));
87 179 : PetscFunctionReturn(PETSC_SUCCESS);
88 : }
89 :
90 : #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
91 : /*
92 : PetscDLLibraryRegister - This function is called when the dynamic library
93 : it is in is opened.
94 :
95 : This one registers all the PEP methods that are in the basic SLEPc libslepcpep
96 : library.
97 : */
98 1 : SLEPC_EXTERN PetscErrorCode PetscDLLibraryRegister_slepcpep(void)
99 : {
100 1 : PetscFunctionBegin;
101 1 : PetscCall(PEPInitializePackage());
102 1 : PetscFunctionReturn(PETSC_SUCCESS);
103 : }
104 : #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */
|