LCOV - code coverage report
Current view: top level - mfn/interface - dlregismfn.c (source / functions) Hit Total Coverage
Test: SLEPc Lines: 34 34 100.0 %
Date: 2024-11-23 00:34:26 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          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/mfnimpl.h>
      12             : 
      13             : static PetscBool MFNPackageInitialized = PETSC_FALSE;
      14             : 
      15             : const char *const MFNConvergedReasons_Shifted[] = {"DIVERGED_BREAKDOWN","DIVERGED_ITS","CONVERGED_ITERATING","CONVERGED_TOL","CONVERGED_ITS","MFNConvergedReason","MFN_",NULL};
      16             : const char *const*MFNConvergedReasons = MFNConvergedReasons_Shifted + 2;
      17             : 
      18             : /*@C
      19             :   MFNFinalizePackage - This function destroys everything in the SLEPc interface
      20             :   to the MFN package. It is called from SlepcFinalize().
      21             : 
      22             :   Level: developer
      23             : 
      24             : .seealso: SlepcFinalize()
      25             : @*/
      26          16 : PetscErrorCode MFNFinalizePackage(void)
      27             : {
      28          16 :   PetscFunctionBegin;
      29          16 :   PetscCall(PetscFunctionListDestroy(&MFNList));
      30          16 :   PetscCall(PetscFunctionListDestroy(&MFNMonitorList));
      31          16 :   PetscCall(PetscFunctionListDestroy(&MFNMonitorCreateList));
      32          16 :   PetscCall(PetscFunctionListDestroy(&MFNMonitorDestroyList));
      33          16 :   MFNPackageInitialized       = PETSC_FALSE;
      34          16 :   MFNRegisterAllCalled        = PETSC_FALSE;
      35          16 :   MFNMonitorRegisterAllCalled = PETSC_FALSE;
      36          16 :   PetscFunctionReturn(PETSC_SUCCESS);
      37             : }
      38             : 
      39             : /*@C
      40             :   MFNInitializePackage - This function initializes everything in the MFN package.
      41             :   It is called from PetscDLLibraryRegister() when using dynamic libraries, and
      42             :   on the first call to MFNCreate() when using static libraries.
      43             : 
      44             :   Level: developer
      45             : 
      46             : .seealso: SlepcInitialize()
      47             : @*/
      48          82 : PetscErrorCode MFNInitializePackage(void)
      49             : {
      50          82 :   char           logList[256];
      51          82 :   PetscBool      opt,pkg;
      52          82 :   PetscClassId   classids[1];
      53             : 
      54          82 :   PetscFunctionBegin;
      55          82 :   if (MFNPackageInitialized) PetscFunctionReturn(PETSC_SUCCESS);
      56          16 :   MFNPackageInitialized = PETSC_TRUE;
      57             :   /* Register Classes */
      58          16 :   PetscCall(PetscClassIdRegister("Matrix Function",&MFN_CLASSID));
      59             :   /* Register Constructors */
      60          16 :   PetscCall(MFNRegisterAll());
      61             :   /* Register Monitors */
      62          16 :   PetscCall(MFNMonitorRegisterAll());
      63             :   /* Register Events */
      64          16 :   PetscCall(PetscLogEventRegister("MFNSetUp",MFN_CLASSID,&MFN_SetUp));
      65          16 :   PetscCall(PetscLogEventRegister("MFNSolve",MFN_CLASSID,&MFN_Solve));
      66             :   /* Process Info */
      67          16 :   classids[0] = MFN_CLASSID;
      68          16 :   PetscCall(PetscInfoProcessClass("mfn",1,&classids[0]));
      69             :   /* Process summary exclusions */
      70          16 :   PetscCall(PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt));
      71          16 :   if (opt) {
      72           1 :     PetscCall(PetscStrInList("mfn",logList,',',&pkg));
      73           1 :     if (pkg) PetscCall(PetscLogEventDeactivateClass(MFN_CLASSID));
      74             :   }
      75             :   /* Register package finalizer */
      76          16 :   PetscCall(PetscRegisterFinalize(MFNFinalizePackage));
      77          16 :   PetscFunctionReturn(PETSC_SUCCESS);
      78             : }
      79             : 
      80             : #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
      81             : /*
      82             :   PetscDLLibraryRegister - This function is called when the dynamic library
      83             :   it is in is opened.
      84             : 
      85             :   This one registers all the MFN methods that are in the basic SLEPc libslepcmfn
      86             :   library.
      87             :  */
      88           1 : SLEPC_EXTERN PetscErrorCode PetscDLLibraryRegister_slepcmfn(void)
      89             : {
      90           1 :   PetscFunctionBegin;
      91           1 :   PetscCall(MFNInitializePackage());
      92           1 :   PetscFunctionReturn(PETSC_SUCCESS);
      93             : }
      94             : #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */

Generated by: LCOV version 1.14