GCC Code Coverage Report


Directory: ./
File: src/mfn/interface/dlregismfn.c
Date: 2026-03-15 03:56:54
Exec Total Coverage
Lines: 34 34 100.0%
Functions: 3 3 100.0%
Branches: 92 150 61.3%

Line Branch Exec Source
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: [](ch:mfn), `SlepcFinalize()`, `MFNInitializePackage()`
25 @*/
26 217 PetscErrorCode MFNFinalizePackage(void)
27 {
28
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
217 PetscFunctionBegin;
29
4/6
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
217 PetscCall(PetscFunctionListDestroy(&MFNList));
30
4/6
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
217 PetscCall(PetscFunctionListDestroy(&MFNMonitorList));
31
4/6
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
217 PetscCall(PetscFunctionListDestroy(&MFNMonitorCreateList));
32
4/6
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
217 PetscCall(PetscFunctionListDestroy(&MFNMonitorDestroyList));
33 217 MFNPackageInitialized = PETSC_FALSE;
34 217 MFNRegisterAllCalled = PETSC_FALSE;
35 217 MFNMonitorRegisterAllCalled = PETSC_FALSE;
36
6/12
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 2 times.
217 PetscFunctionReturn(PETSC_SUCCESS);
37 }
38
39 /*@C
40 MFNInitializePackage - This function initializes everything in the `MFN` package.
41 It is called from `PetscDLLibraryRegister_slepcmfn()` when using dynamic libraries, and
42 on the first call to `MFNCreate()` when using shared or static libraries.
43
44 Note:
45 This function never needs to be called by SLEPc users.
46
47 Level: developer
48
49 .seealso: [](ch:mfn), `MFN`, `SlepcInitialize()`, `MFNFinalizePackage()`
50 @*/
51 1212 PetscErrorCode MFNInitializePackage(void)
52 {
53 1212 char logList[256];
54 1212 PetscBool opt,pkg;
55 1212 PetscClassId classids[1];
56
57
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
1212 PetscFunctionBegin;
58
8/14
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 10 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 2 times.
1212 if (MFNPackageInitialized) PetscFunctionReturn(PETSC_SUCCESS);
59 217 MFNPackageInitialized = PETSC_TRUE;
60 /* Register Classes */
61
4/6
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
217 PetscCall(PetscClassIdRegister("Matrix Function",&MFN_CLASSID));
62 /* Register Constructors */
63
4/6
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
217 PetscCall(MFNRegisterAll());
64 /* Register Monitors */
65
4/6
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
217 PetscCall(MFNMonitorRegisterAll());
66 /* Register Events */
67
4/6
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
217 PetscCall(PetscLogEventRegister("MFNSetUp",MFN_CLASSID,&MFN_SetUp));
68
4/6
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
217 PetscCall(PetscLogEventRegister("MFNSolve",MFN_CLASSID,&MFN_Solve));
69 /* Process Info */
70 217 classids[0] = MFN_CLASSID;
71
4/6
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
217 PetscCall(PetscInfoProcessClass("mfn",1,&classids[0]));
72 /* Process summary exclusions */
73
4/6
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
217 PetscCall(PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt));
74
2/2
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 10 times.
217 if (opt) {
75
4/6
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
26 PetscCall(PetscStrInList("mfn",logList,',',&pkg));
76
5/8
✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 8 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 2 times.
26 if (pkg) PetscCall(PetscLogEventDeactivateClass(MFN_CLASSID));
77 }
78 /* Register package finalizer */
79
4/6
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
217 PetscCall(PetscRegisterFinalize(MFNFinalizePackage));
80
6/12
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 2 times.
34 PetscFunctionReturn(PETSC_SUCCESS);
81 }
82
83 #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
84 /*
85 PetscDLLibraryRegister - This function is called when the dynamic library
86 it is in is opened.
87
88 This one registers all the MFN methods that are in the basic SLEPc libslepcmfn
89 library.
90 */
91 10 SLEPC_EXTERN PetscErrorCode PetscDLLibraryRegister_slepcmfn(void)
92 {
93
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
10 PetscFunctionBegin;
94
4/6
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
10 PetscCall(MFNInitializePackage());
95
6/12
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 2 times.
2 PetscFunctionReturn(PETSC_SUCCESS);
96 }
97 #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */
98