Actual source code: dlregislme.c

slepc-3.15.1 2021-05-28
Report Typos and Errors
  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/lmeimpl.h>

 13: static PetscBool LMEPackageInitialized = PETSC_FALSE;

 15: const char *LMEProblemTypes[] = {"LYAPUNOV","SYLVESTER","GEN_LYAPUNOV","GEN_SYLVESTER","DT_LYAPUNOV","STEIN","LMEProblemType","LME_",0};
 16: const char *const LMEConvergedReasons_Shifted[] = {"DIVERGED_BREAKDOWN","DIVERGED_ITS","CONVERGED_ITERATING","CONVERGED_TOL","LMEConvergedReason","LME_",0};
 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: {

 32:   PetscFunctionListDestroy(&LMEList);
 33:   PetscFunctionListDestroy(&LMEMonitorList);
 34:   PetscFunctionListDestroy(&LMEMonitorCreateList);
 35:   PetscFunctionListDestroy(&LMEMonitorDestroyList);
 36:   LMEPackageInitialized       = PETSC_FALSE;
 37:   LMERegisterAllCalled        = PETSC_FALSE;
 38:   LMEMonitorRegisterAllCalled = PETSC_FALSE;
 39:   return(0);
 40: }

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

 47:   Level: developer

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

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

 85: #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
 86: /*
 87:   PetscDLLibraryRegister - This function is called when the dynamic library
 88:   it is in is opened.

 90:   This one registers all the LME methods that are in the basic SLEPc libslepclme
 91:   library.
 92:  */
 93: SLEPC_EXTERN PetscErrorCode PetscDLLibraryRegister_slepclme()
 94: {

 98:   LMEInitializePackage();
 99:   return(0);
100: }
101: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */