GCC Code Coverage Report


Directory: ./
File: src/lme/interface/dlregislme.c
Date: 2025-12-10 04:20:18
Exec Total Coverage
Lines: 35 35 100.0%
Functions: 3 3 100.0%
Branches: 96 156 61.5%

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/lmeimpl.h>
12
13 static PetscBool LMEPackageInitialized = PETSC_FALSE;
14
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;
18
19 /*@C
20 LMEFinalizePackage - This function destroys everything in the SLEPc interface
21 to the `LME` package. It is called from `SlepcFinalize()`.
22
23 Level: developer
24
25 .seealso: [](ch:lme), `SlepcFinalize()`, `LMEInitializePackage()`
26 @*/
27 138 PetscErrorCode LMEFinalizePackage(void)
28 {
29
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
138 PetscFunctionBegin;
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.
138 PetscCall(PetscFunctionListDestroy(&LMEList));
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.
138 PetscCall(PetscFunctionListDestroy(&LMEMonitorList));
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.
138 PetscCall(PetscFunctionListDestroy(&LMEMonitorCreateList));
33
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.
138 PetscCall(PetscFunctionListDestroy(&LMEMonitorDestroyList));
34 138 LMEPackageInitialized = PETSC_FALSE;
35 138 LMERegisterAllCalled = PETSC_FALSE;
36 138 LMEMonitorRegisterAllCalled = PETSC_FALSE;
37
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.
138 PetscFunctionReturn(PETSC_SUCCESS);
38 }
39
40 /*@C
41 LMEInitializePackage - This function initializes everything in the `LME` package.
42 It is called from `PetscDLLibraryRegister_slepclme()` when using dynamic libraries, and
43 on the first call to `LMECreate()` when using shared or static libraries.
44
45 Note:
46 This function never needs to be called by SLEPc users.
47
48 Level: developer
49
50 .seealso: [](ch:lme), `LME`, `SlepcInitialize()`, `LMEFinalizePackage()`
51 @*/
52 694 PetscErrorCode LMEInitializePackage(void)
53 {
54 694 char logList[256];
55 694 PetscBool opt,pkg;
56 694 PetscClassId classids[1];
57
58
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
694 PetscFunctionBegin;
59
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.
694 if (LMEPackageInitialized) PetscFunctionReturn(PETSC_SUCCESS);
60 138 LMEPackageInitialized = PETSC_TRUE;
61 /* Register Classes */
62
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.
138 PetscCall(PetscClassIdRegister("Lin. Matrix Equation",&LME_CLASSID));
63 /* Register Constructors */
64
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.
138 PetscCall(LMERegisterAll());
65 /* Register Monitors */
66
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.
138 PetscCall(LMEMonitorRegisterAll());
67 /* Register Events */
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.
138 PetscCall(PetscLogEventRegister("LMESetUp",LME_CLASSID,&LME_SetUp));
69
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.
138 PetscCall(PetscLogEventRegister("LMESolve",LME_CLASSID,&LME_Solve));
70
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.
138 PetscCall(PetscLogEventRegister("LMEComputeError",LME_CLASSID,&LME_ComputeError));
71 /* Process Info */
72 138 classids[0] = LME_CLASSID;
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.
138 PetscCall(PetscInfoProcessClass("lme",1,&classids[0]));
74 /* Process summary exclusions */
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.
138 PetscCall(PetscOptionsGetString(NULL,NULL,"-log_exclude",logList,sizeof(logList),&opt));
76
2/2
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 10 times.
138 if (opt) {
77
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(PetscStrInList("lme",logList,',',&pkg));
78
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.
10 if (pkg) PetscCall(PetscLogEventDeactivateClass(LME_CLASSID));
79 }
80 /* Register package finalizer */
81
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.
138 PetscCall(PetscRegisterFinalize(LMEFinalizePackage));
82
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.
20 PetscFunctionReturn(PETSC_SUCCESS);
83 }
84
85 #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
86 /*
87 PetscDLLibraryRegister - This function is called when the dynamic library
88 it is in is opened.
89
90 This one registers all the LME methods that are in the basic SLEPc libslepclme
91 library.
92 */
93 10 SLEPC_EXTERN PetscErrorCode PetscDLLibraryRegister_slepclme(void)
94 {
95
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
10 PetscFunctionBegin;
96
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(LMEInitializePackage());
97
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);
98 }
99 #endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */
100