Actual source code: dlregislme.c

slepc-3.18.0 2022-10-01
Report Typos and Errors
  1: /*
  2:    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  3:    SLEPc - Scalable Library for Eigenvalue Problem Computations
  4:    Copyright (c) 2002-, 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/lmeimpl.h>

 13: static PetscBool LMEPackageInitialized = PETSC_FALSE;

 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;

 19: /*@C
 20:   LMEFinalizePackage - This function destroys everything in the SLEPc interface
 21:   to the LME package. It is called from SlepcFinalize().

 23:   Level: developer

 25: .seealso: SlepcFinalize()
 26: @*/
 27: PetscErrorCode LMEFinalizePackage(void)
 28: {
 29:   PetscFunctionListDestroy(&LMEList);
 30:   PetscFunctionListDestroy(&LMEMonitorList);
 31:   PetscFunctionListDestroy(&LMEMonitorCreateList);
 32:   PetscFunctionListDestroy(&LMEMonitorDestroyList);
 33:   LMEPackageInitialized       = PETSC_FALSE;
 34:   LMERegisterAllCalled        = PETSC_FALSE;
 35:   LMEMonitorRegisterAllCalled = PETSC_FALSE;
 36:   return 0;
 37: }

 39: /*@C
 40:   LMEInitializePackage - This function initializes everything in the LME package.
 41:   It is called from PetscDLLibraryRegister() when using dynamic libraries, and
 42:   on the first call to LMECreate() when using static libraries.

 44:   Level: developer

 46: .seealso: SlepcInitialize()
 47: @*/
 48: PetscErrorCode LMEInitializePackage(void)
 49: {
 50:   char           logList[256];
 51:   PetscBool      opt,pkg;
 52:   PetscClassId   classids[1];

 54:   if (LMEPackageInitialized) return 0;
 55:   LMEPackageInitialized = PETSC_TRUE;
 56:   /* Register Classes */
 57:   PetscClassIdRegister("Lin. Matrix Equation",&LME_CLASSID);
 58:   /* Register Constructors */
 59:   LMERegisterAll();
 60:   /* Register Monitors */
 61:   LMEMonitorRegisterAll();
 62:   /* Register Events */
 63:   PetscLogEventRegister("LMESetUp",LME_CLASSID,&LME_SetUp);
 64:   PetscLogEventRegister("LMESolve",LME_CLASSID,&LME_Solve);
 65:   PetscLogEventRegister("LMEComputeError",LME_CLASSID,&LME_ComputeError);
 66:   /* Process Info */
 67:   classids[0] = LME_CLASSID;
 68:   PetscInfoProcessClass("lme",1,&classids[0]);
 69:   /* Process summary exclusions */
 70:   PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
 71:   if (opt) {
 72:     PetscStrInList("lme",logList,',',&pkg);
 73:     if (pkg) PetscLogEventDeactivateClass(LME_CLASSID);
 74:   }
 75:   /* Register package finalizer */
 76:   PetscRegisterFinalize(LMEFinalizePackage);
 77:   return 0;
 78: }

 80: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
 81: /*
 82:   PetscDLLibraryRegister - This function is called when the dynamic library
 83:   it is in is opened.

 85:   This one registers all the LME methods that are in the basic SLEPc libslepclme
 86:   library.
 87:  */
 88: SLEPC_EXTERN PetscErrorCode PetscDLLibraryRegister_slepclme()
 89: {
 90:   LMEInitializePackage();
 91:   return 0;
 92: }
 93: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */