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/lmeimpl.h> 12 : 13 : static PetscBool LMEPackageInitialized = PETSC_FALSE; 14 : 15 : const char *LMEProblemTypes[] = {"LYAPUNOV","SYLVESTER","GEN_LYAPUNOV","GEN_SYLVESTER","DT_LYAPUNOV","STEIN","LMEProblemType","LME_",NULL}; 16 : const char *const LMEConvergedReasons_Shifted[] = {"DIVERGED_BREAKDOWN","DIVERGED_ITS","CONVERGED_ITERATING","CONVERGED_TOL","LMEConvergedReason","LME_",NULL}; 17 : const char *const*LMEConvergedReasons = LMEConvergedReasons_Shifted + 2; 18 : 19 : /*@C 20 : LMEFinalizePackage - This function destroys everything in the SLEPc interface 21 : to the LME package. It is called from SlepcFinalize(). 22 : 23 : Level: developer 24 : 25 : .seealso: SlepcFinalize() 26 : @*/ 27 9 : PetscErrorCode LMEFinalizePackage(void) 28 : { 29 9 : PetscFunctionBegin; 30 9 : PetscCall(PetscFunctionListDestroy(&LMEList)); 31 9 : PetscCall(PetscFunctionListDestroy(&LMEMonitorList)); 32 9 : PetscCall(PetscFunctionListDestroy(&LMEMonitorCreateList)); 33 9 : PetscCall(PetscFunctionListDestroy(&LMEMonitorDestroyList)); 34 9 : LMEPackageInitialized = PETSC_FALSE; 35 9 : LMERegisterAllCalled = PETSC_FALSE; 36 9 : LMEMonitorRegisterAllCalled = PETSC_FALSE; 37 9 : PetscFunctionReturn(PETSC_SUCCESS); 38 : } 39 : 40 : /*@C 41 : LMEInitializePackage - This function initializes everything in the LME package. 42 : It is called from PetscDLLibraryRegister() when using dynamic libraries, and 43 : on the first call to LMECreate() when using static libraries. 44 : 45 : Level: developer 46 : 47 : .seealso: SlepcInitialize() 48 : @*/ 49 36 : PetscErrorCode LMEInitializePackage(void) 50 : { 51 36 : char logList[256]; 52 36 : PetscBool opt,pkg; 53 36 : PetscClassId classids[1]; 54 : 55 36 : PetscFunctionBegin; 56 36 : if (LMEPackageInitialized) PetscFunctionReturn(PETSC_SUCCESS); 57 9 : LMEPackageInitialized = PETSC_TRUE; 58 : /* Register Classes */ 59 9 : PetscCall(PetscClassIdRegister("Lin. Matrix Equation",&LME_CLASSID)); 60 : /* Register Constructors */ 61 9 : PetscCall(LMERegisterAll()); 62 : /* Register Monitors */ 63 9 : PetscCall(LMEMonitorRegisterAll()); 64 : /* Register Events */ 65 9 : PetscCall(PetscLogEventRegister("LMESetUp",LME_CLASSID,&LME_SetUp)); 66 9 : PetscCall(PetscLogEventRegister("LMESolve",LME_CLASSID,&LME_Solve)); 67 9 : PetscCall(PetscLogEventRegister("LMEComputeError",LME_CLASSID,&LME_ComputeError)); 68 : /* Process Info */ 69 9 : classids[0] = LME_CLASSID; 70 9 : PetscCall(PetscInfoProcessClass("lme",1,&classids[0])); 71 : /* Process summary exclusions */ 72 9 : PetscCall(PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt)); 73 9 : if (opt) { 74 1 : PetscCall(PetscStrInList("lme",logList,',',&pkg)); 75 1 : if (pkg) PetscCall(PetscLogEventDeactivateClass(LME_CLASSID)); 76 : } 77 : /* Register package finalizer */ 78 9 : PetscCall(PetscRegisterFinalize(LMEFinalizePackage)); 79 9 : PetscFunctionReturn(PETSC_SUCCESS); 80 : } 81 : 82 : #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES) 83 : /* 84 : PetscDLLibraryRegister - This function is called when the dynamic library 85 : it is in is opened. 86 : 87 : This one registers all the LME methods that are in the basic SLEPc libslepclme 88 : library. 89 : */ 90 1 : SLEPC_EXTERN PetscErrorCode PetscDLLibraryRegister_slepclme(void) 91 : { 92 1 : PetscFunctionBegin; 93 1 : PetscCall(LMEInitializePackage()); 94 1 : PetscFunctionReturn(PETSC_SUCCESS); 95 : } 96 : #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */