Actual source code: dlregismfn.c

slepc-3.17.2 2022-08-09
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/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: {
 28:   PetscFunctionListDestroy(&MFNList);
 29:   PetscFunctionListDestroy(&MFNMonitorList);
 30:   PetscFunctionListDestroy(&MFNMonitorCreateList);
 31:   PetscFunctionListDestroy(&MFNMonitorDestroyList);
 32:   MFNPackageInitialized       = PETSC_FALSE;
 33:   MFNRegisterAllCalled        = PETSC_FALSE;
 34:   MFNMonitorRegisterAllCalled = PETSC_FALSE;
 35:   PetscFunctionReturn(0);
 36: }

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

 43:   Level: developer

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

 53:   if (MFNPackageInitialized) PetscFunctionReturn(0);
 54:   MFNPackageInitialized = PETSC_TRUE;
 55:   /* Register Classes */
 56:   PetscClassIdRegister("Matrix Function",&MFN_CLASSID);
 57:   /* Register Constructors */
 58:   MFNRegisterAll();
 59:   /* Register Monitors */
 60:   MFNMonitorRegisterAll();
 61:   /* Register Events */
 62:   PetscLogEventRegister("MFNSetUp",MFN_CLASSID,&MFN_SetUp);
 63:   PetscLogEventRegister("MFNSolve",MFN_CLASSID,&MFN_Solve);
 64:   /* Process Info */
 65:   classids[0] = MFN_CLASSID;
 66:   PetscInfoProcessClass("mfn",1,&classids[0]);
 67:   /* Process summary exclusions */
 68:   PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt);
 69:   if (opt) {
 70:     PetscStrInList("mfn",logList,',',&pkg);
 71:     if (pkg) PetscLogEventDeactivateClass(MFN_CLASSID);
 72:   }
 73:   /* Register package finalizer */
 74:   PetscRegisterFinalize(MFNFinalizePackage);
 75:   PetscFunctionReturn(0);
 76: }

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

 83:   This one registers all the MFN methods that are in the basic SLEPc libslepcmfn
 84:   library.
 85:  */
 86: SLEPC_EXTERN PetscErrorCode PetscDLLibraryRegister_slepcmfn()
 87: {
 88:   MFNInitializePackage();
 89:   PetscFunctionReturn(0);
 90: }
 91: #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */