| 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/slepcimpl.h> /*I "slepcsys.h" I*/ | ||
| 12 | |||
| 13 | #if defined(SLEPC_HAVE_HPDDM) | ||
| 14 | #include <petscksp.h> | ||
| 15 | SLEPC_EXTERN PetscErrorCode KSPCreate_HPDDM(KSP); | ||
| 16 | SLEPC_EXTERN PetscErrorCode PCCreate_HPDDM(PC); | ||
| 17 | #endif | ||
| 18 | |||
| 19 | /*@C | ||
| 20 | SlepcGetVersion - Gets the SLEPc version information in a string. | ||
| 21 | |||
| 22 | Not Collective | ||
| 23 | |||
| 24 | Input Parameter: | ||
| 25 | . len - length of the string | ||
| 26 | |||
| 27 | Output Parameter: | ||
| 28 | . version - version string | ||
| 29 | |||
| 30 | Level: intermediate | ||
| 31 | |||
| 32 | .seealso: [](sec:writing-prog), `SlepcGetVersionNumber()` | ||
| 33 | @*/ | ||
| 34 | 19 | PetscErrorCode SlepcGetVersion(char version[],size_t len) | |
| 35 | { | ||
| 36 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
19 | PetscFunctionBegin; |
| 37 | #if (SLEPC_VERSION_RELEASE == 1) | ||
| 38 | PetscCall(PetscSNPrintf(version,len,"SLEPc Release Version %d.%d.%d, %s",SLEPC_VERSION_MAJOR,SLEPC_VERSION_MINOR,SLEPC_VERSION_SUBMINOR,SLEPC_VERSION_DATE)); | ||
| 39 | #else | ||
| 40 |
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.
|
19 | PetscCall(PetscSNPrintf(version,len,"SLEPc Development Git Revision: %s Git Date: %s",SLEPC_VERSION_GIT,SLEPC_VERSION_DATE_GIT)); |
| 41 | #endif | ||
| 42 |
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.
|
4 | PetscFunctionReturn(PETSC_SUCCESS); |
| 43 | } | ||
| 44 | |||
| 45 | /*@ | ||
| 46 | SlepcGetVersionNumber - Gets the SLEPc version information from the library. | ||
| 47 | |||
| 48 | Not Collective | ||
| 49 | |||
| 50 | Output Parameters: | ||
| 51 | + major - the major version | ||
| 52 | . minor - the minor version | ||
| 53 | . subminor - the subminor version (patch number) | ||
| 54 | - release - indicates the library is from a release | ||
| 55 | |||
| 56 | Notes: | ||
| 57 | Pass `NULL` in any argument that is not requested. | ||
| 58 | |||
| 59 | The C macros `SLEPC_VERSION_MAJOR`, `SLEPC_VERSION_MINOR`, `SLEPC_VERSION_SUBMINOR`, | ||
| 60 | `SLEPC_VERSION_RELEASE` provide the information at compile time. This can be used to confirm | ||
| 61 | that the shared library being loaded at runtime has the appropriate version updates. | ||
| 62 | |||
| 63 | This function can be called before `SlepcInitialize()`. | ||
| 64 | |||
| 65 | Level: intermediate | ||
| 66 | |||
| 67 | .seealso: [](sec:writing-prog), `SlepcGetVersion()`, `SlepcInitialize()` | ||
| 68 | @*/ | ||
| 69 | 17 | PetscErrorCode SlepcGetVersionNumber(PetscInt *major,PetscInt *minor,PetscInt *subminor,PetscInt *release) | |
| 70 | { | ||
| 71 |
1/2✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
|
17 | if (major) *major = SLEPC_VERSION_MAJOR; |
| 72 |
1/2✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
|
17 | if (minor) *minor = SLEPC_VERSION_MINOR; |
| 73 |
1/2✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
|
17 | if (subminor) *subminor = SLEPC_VERSION_SUBMINOR; |
| 74 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 10 times.
|
17 | if (release) *release = SLEPC_VERSION_RELEASE; |
| 75 | 17 | return PETSC_SUCCESS; | |
| 76 | } | ||
| 77 | |||
| 78 | /* | ||
| 79 | SlepcPrintVersion - Prints SLEPc version info. | ||
| 80 | |||
| 81 | Collective | ||
| 82 | */ | ||
| 83 | 2 | static PetscErrorCode SlepcPrintVersion(MPI_Comm comm) | |
| 84 | { | ||
| 85 | 2 | char version[256]; | |
| 86 | |||
| 87 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | PetscFunctionBegin; |
| 88 |
3/6✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
2 | PetscCall(SlepcGetVersion(version,256)); |
| 89 |
3/6✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
2 | PetscCall((*PetscHelpPrintf)(comm,"%s\n",version)); |
| 90 |
3/6✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
2 | PetscCall((*PetscHelpPrintf)(comm,SLEPC_AUTHOR_INFO)); |
| 91 |
3/6✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
2 | PetscCall((*PetscHelpPrintf)(comm,"See https://slepc.upv.es/documentation/ for help.\n")); |
| 92 |
3/6✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
2 | PetscCall((*PetscHelpPrintf)(comm,"SLEPc libraries linked from %s\n",SLEPC_LIB_DIR)); |
| 93 |
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); |
| 94 | } | ||
| 95 | |||
| 96 | /* | ||
| 97 | SlepcPrintHelpIntro - Prints introductory SLEPc help info. | ||
| 98 | |||
| 99 | Collective | ||
| 100 | */ | ||
| 101 | 2 | static PetscErrorCode SlepcPrintHelpIntro(MPI_Comm comm) | |
| 102 | { | ||
| 103 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | PetscFunctionBegin; |
| 104 |
3/6✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
2 | PetscCall((*PetscHelpPrintf)(comm,"SLEPc help information includes that for the PETSc libraries, which provide\n")); |
| 105 |
3/6✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
2 | PetscCall((*PetscHelpPrintf)(comm,"low-level system infrastructure and linear algebra tools.\n")); |
| 106 |
3/6✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
2 | PetscCall((*PetscHelpPrintf)(comm,"----------------------------------------\n")); |
| 107 |
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); |
| 108 | } | ||
| 109 | |||
| 110 | /* ------------------------Nasty global variables -------------------------------*/ | ||
| 111 | /* | ||
| 112 | Indicates whether SLEPc started PETSc, or whether it was | ||
| 113 | already started before SLEPc was initialized. | ||
| 114 | */ | ||
| 115 | PetscBool SlepcBeganPetsc = PETSC_FALSE; | ||
| 116 | PetscBool SlepcInitializeCalled = PETSC_FALSE; | ||
| 117 | PetscBool SlepcFinalizeCalled = PETSC_FALSE; | ||
| 118 | |||
| 119 | #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES) && defined(PETSC_USE_SHARED_LIBRARIES) | ||
| 120 | 16 | static PetscErrorCode SlepcLoadDynamicLibrary(const char *name,PetscBool *found) | |
| 121 | { | ||
| 122 | 16 | char libs[PETSC_MAX_PATH_LEN],dlib[PETSC_MAX_PATH_LEN]; | |
| 123 | |||
| 124 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
16 | PetscFunctionBegin; |
| 125 |
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.
|
16 | PetscCall(PetscStrcpy(libs,SLEPC_LIB_DIR)); |
| 126 |
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.
|
16 | PetscCall(PetscStrlcat(libs,"/libslepc",sizeof(libs))); |
| 127 |
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.
|
16 | PetscCall(PetscStrlcat(libs,name,sizeof(libs))); |
| 128 | #if defined(PETSC_LIB_NAME_SUFFIX) | ||
| 129 |
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.
|
16 | PetscCall(PetscStrlcat(libs,PETSC_LIB_NAME_SUFFIX,sizeof(libs))); |
| 130 | #endif | ||
| 131 |
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.
|
16 | PetscCall(PetscDLLibraryRetrieve(PETSC_COMM_WORLD,libs,dlib,sizeof(dlib),found)); |
| 132 |
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.
|
16 | if (*found) PetscCall(PetscDLLibraryAppend(PETSC_COMM_WORLD,&PetscDLLibrariesLoaded,dlib)); |
| 133 |
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); |
| 134 | } | ||
| 135 | #endif | ||
| 136 | |||
| 137 | #if defined(PETSC_USE_SINGLE_LIBRARY) && !(defined(PETSC_HAVE_DYNAMIC_LIBRARIES) && defined(PETSC_USE_SHARED_LIBRARIES)) | ||
| 138 | SLEPC_EXTERN PetscErrorCode STInitializePackage(void); | ||
| 139 | SLEPC_EXTERN PetscErrorCode DSInitializePackage(void); | ||
| 140 | SLEPC_EXTERN PetscErrorCode FNInitializePackage(void); | ||
| 141 | SLEPC_EXTERN PetscErrorCode BVInitializePackage(void); | ||
| 142 | SLEPC_EXTERN PetscErrorCode RGInitializePackage(void); | ||
| 143 | SLEPC_EXTERN PetscErrorCode EPSInitializePackage(void); | ||
| 144 | SLEPC_EXTERN PetscErrorCode SVDInitializePackage(void); | ||
| 145 | SLEPC_EXTERN PetscErrorCode PEPInitializePackage(void); | ||
| 146 | SLEPC_EXTERN PetscErrorCode NEPInitializePackage(void); | ||
| 147 | SLEPC_EXTERN PetscErrorCode MFNInitializePackage(void); | ||
| 148 | SLEPC_EXTERN PetscErrorCode LMEInitializePackage(void); | ||
| 149 | #endif | ||
| 150 | |||
| 151 | /* | ||
| 152 | SlepcInitialize_DynamicLibraries - Adds the default dynamic link libraries to the | ||
| 153 | search path. | ||
| 154 | */ | ||
| 155 | 16854 | PetscErrorCode SlepcInitialize_DynamicLibraries(void) | |
| 156 | { | ||
| 157 | 16854 | PetscBool preload = PETSC_FALSE; | |
| 158 | |||
| 159 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
16854 | PetscFunctionBegin; |
| 160 | #if defined(PETSC_HAVE_THREADSAFETY) | ||
| 161 | /* These must be all initialized here because it is not safe for individual threads to call these initialize routines */ | ||
| 162 | preload = PETSC_TRUE; | ||
| 163 | #endif | ||
| 164 | |||
| 165 |
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.
|
16854 | PetscCall(PetscOptionsGetBool(NULL,NULL,"-library_preload",&preload,NULL)); |
| 166 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 10 times.
|
16854 | if (preload) { |
| 167 | #if defined(PETSC_HAVE_DYNAMIC_LIBRARIES) && defined(PETSC_USE_SHARED_LIBRARIES) | ||
| 168 | 10 | PetscBool found; | |
| 169 | #if defined(PETSC_USE_SINGLE_LIBRARY) | ||
| 170 |
4/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 7 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
9 | PetscCall(SlepcLoadDynamicLibrary("",&found)); |
| 171 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
9 | PetscCheck(found,PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to locate SLEPc dynamic library. You cannot move the dynamic libraries!"); |
| 172 | #else | ||
| 173 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | PetscCall(SlepcLoadDynamicLibrary("sys",&found)); |
| 174 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1 | PetscCheck(found,PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to locate SLEPc sys dynamic library. You cannot move the dynamic libraries!"); |
| 175 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | PetscCall(SlepcLoadDynamicLibrary("eps",&found)); |
| 176 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1 | PetscCheck(found,PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to locate SLEPc EPS dynamic library. You cannot move the dynamic libraries!"); |
| 177 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | PetscCall(SlepcLoadDynamicLibrary("pep",&found)); |
| 178 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1 | PetscCheck(found,PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to locate SLEPc PEP dynamic library. You cannot move the dynamic libraries!"); |
| 179 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | PetscCall(SlepcLoadDynamicLibrary("nep",&found)); |
| 180 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1 | PetscCheck(found,PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to locate SLEPc NEP dynamic library. You cannot move the dynamic libraries!"); |
| 181 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | PetscCall(SlepcLoadDynamicLibrary("svd",&found)); |
| 182 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1 | PetscCheck(found,PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to locate SLEPc SVD dynamic library. You cannot move the dynamic libraries!"); |
| 183 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | PetscCall(SlepcLoadDynamicLibrary("mfn",&found)); |
| 184 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1 | PetscCheck(found,PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to locate SLEPc MFN dynamic library. You cannot move the dynamic libraries!"); |
| 185 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | PetscCall(SlepcLoadDynamicLibrary("lme",&found)); |
| 186 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1 | PetscCheck(found,PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to locate SLEPc LME dynamic library. You cannot move the dynamic libraries!"); |
| 187 | #endif | ||
| 188 | #else /* defined(PETSC_HAVE_DYNAMIC_LIBRARIES) && defined(PETSC_USE_SHARED_LIBRARIES) */ | ||
| 189 | #if defined(PETSC_USE_SINGLE_LIBRARY) | ||
| 190 | PetscCall(STInitializePackage()); | ||
| 191 | PetscCall(DSInitializePackage()); | ||
| 192 | PetscCall(FNInitializePackage()); | ||
| 193 | PetscCall(BVInitializePackage()); | ||
| 194 | PetscCall(RGInitializePackage()); | ||
| 195 | PetscCall(EPSInitializePackage()); | ||
| 196 | PetscCall(SVDInitializePackage()); | ||
| 197 | PetscCall(PEPInitializePackage()); | ||
| 198 | PetscCall(NEPInitializePackage()); | ||
| 199 | PetscCall(MFNInitializePackage()); | ||
| 200 | PetscCall(LMEInitializePackage()); | ||
| 201 | #else | ||
| 202 | SETERRQ(PETSC_COMM_WORLD,PETSC_ERR_SUP,"Cannot use -library_preload with multiple static SLEPc libraries"); | ||
| 203 | #endif | ||
| 204 | #endif /* defined(PETSC_HAVE_DYNAMIC_LIBRARIES) && defined(PETSC_USE_SHARED_LIBRARIES) */ | ||
| 205 | } | ||
| 206 | |||
| 207 | #if defined(SLEPC_HAVE_HPDDM) | ||
| 208 |
3/6✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
3180 | PetscCall(KSPRegister(KSPHPDDM,KSPCreate_HPDDM)); |
| 209 |
3/6✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
3180 | PetscCall(PCRegister(PCHPDDM,PCCreate_HPDDM)); |
| 210 | #endif | ||
| 211 |
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.
|
3180 | PetscFunctionReturn(PETSC_SUCCESS); |
| 212 | } | ||
| 213 | |||
| 214 | 16854 | PetscErrorCode SlepcCitationsInitialize(void) | |
| 215 | { | ||
| 216 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
16854 | PetscFunctionBegin; |
| 217 |
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.
|
16854 | PetscCall(PetscCitationsRegister("@Article{slepc-toms,\n" |
| 218 | " author = \"Vicente Hernandez and Jose E. Roman and Vicente Vidal\",\n" | ||
| 219 | " title = \"{SLEPc}: A Scalable and Flexible Toolkit for the Solution of Eigenvalue Problems\",\n" | ||
| 220 | " journal = \"{ACM} Trans. Math. Software\",\n" | ||
| 221 | " volume = \"31\",\n" | ||
| 222 | " number = \"3\",\n" | ||
| 223 | " pages = \"351--362\",\n" | ||
| 224 | " year = \"2005\",\n" | ||
| 225 | " doi = \"https://doi.org/10.1145/1089014.1089019\"\n" | ||
| 226 | "}\n",NULL)); | ||
| 227 |
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.
|
16854 | PetscCall(PetscCitationsRegister("@TechReport{slepc-manual,\n" |
| 228 | " author = \"J. E. Roman and C. Campos and L. Dalcin and E. Romero and A. Tomas\",\n" | ||
| 229 | " title = \"{SLEPc} Users Manual\",\n" | ||
| 230 | " number = \"DSIC-II/24/02 - Revision 3.24\",\n" | ||
| 231 | " institution = \"D. Sistemes Inform\\`atics i Computaci\\'o, Universitat Polit\\`ecnica de Val\\`encia\",\n" | ||
| 232 | " year = \"2025\"\n" | ||
| 233 | "}\n",NULL)); | ||
| 234 |
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.
|
3180 | PetscFunctionReturn(PETSC_SUCCESS); |
| 235 | } | ||
| 236 | |||
| 237 | /*@C | ||
| 238 | SlepcInitialize - Initializes the SLEPc library. `SlepcInitialize()` calls | ||
| 239 | `PetscInitialize()` if it has not been called yet, so this function should | ||
| 240 | always be called near the beginning of your program. | ||
| 241 | |||
| 242 | Collective on `MPI_COMM_WORLD` or `PETSC_COMM_WORLD` if it has been set | ||
| 243 | |||
| 244 | Input Parameters: | ||
| 245 | + argc - count of number of command line arguments | ||
| 246 | . args - the command line arguments | ||
| 247 | . file - [optional] PETSc database file | ||
| 248 | - help - [optional] Help message to print, use `NULL` for no message | ||
| 249 | |||
| 250 | Note: | ||
| 251 | Works in the same way as `PetscInitialize()`, but in addition initializes SLEPc. | ||
| 252 | The same considerations apply with respect to command line options and | ||
| 253 | environment variables. | ||
| 254 | |||
| 255 | Fortran Notes: | ||
| 256 | In Fortran this routine can be called with | ||
| 257 | .vb | ||
| 258 | call SlepcInitialize(ierr) | ||
| 259 | .ve | ||
| 260 | .vb | ||
| 261 | call SlepcInitialize(file,ierr) | ||
| 262 | .ve | ||
| 263 | or | ||
| 264 | .vb | ||
| 265 | call SlepcInitialize(file,help,ierr) | ||
| 266 | .ve | ||
| 267 | |||
| 268 | If your main program is C but you call Fortran code that also uses SLEPc you need | ||
| 269 | to call `SlepcInitializeFortran()` soon after calling `SlepcInitialize()`. | ||
| 270 | |||
| 271 | Level: beginner | ||
| 272 | |||
| 273 | .seealso: [](sec:writing-prog), `SlepcFinalize()`, `PetscInitialize()`, `SlepcInitializeFortran()` | ||
| 274 | @*/ | ||
| 275 | 16609 | PetscErrorCode SlepcInitialize(int *argc,char ***args,const char file[],const char help[]) | |
| 276 | { | ||
| 277 | 16609 | PetscBool flg; | |
| 278 | |||
| 279 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
16609 | PetscFunctionBegin; |
| 280 |
8/14✓ Branch 0 taken 10 times.
✓ Branch 1 taken 2 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.
|
16609 | if (SlepcInitializeCalled) PetscFunctionReturn(PETSC_SUCCESS); |
| 281 |
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.
|
16582 | PetscCall(PetscSetHelpVersionFunctions(SlepcPrintHelpIntro,SlepcPrintVersion)); |
| 282 |
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.
|
16582 | PetscCall(PetscInitialized(&flg)); |
| 283 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 10 times.
|
16582 | if (!flg) { |
| 284 |
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.
|
16527 | PetscCall(PetscInitialize(argc,args,file,help)); |
| 285 | 16527 | SlepcBeganPetsc = PETSC_TRUE; | |
| 286 | } | ||
| 287 | |||
| 288 |
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.
|
16582 | PetscCall(SlepcCitationsInitialize()); |
| 289 | |||
| 290 | /* Load the dynamic libraries (on machines that support them), this registers all the solvers etc. */ | ||
| 291 |
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.
|
16582 | PetscCall(SlepcInitialize_DynamicLibraries()); |
| 292 | |||
| 293 | 16582 | SlepcInitializeCalled = PETSC_TRUE; | |
| 294 | 16582 | SlepcFinalizeCalled = PETSC_FALSE; | |
| 295 |
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.
|
16582 | PetscCall(PetscInfo(0,"SLEPc successfully started\n")); |
| 296 |
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.
|
3180 | PetscFunctionReturn(PETSC_SUCCESS); |
| 297 | } | ||
| 298 | |||
| 299 | /*@C | ||
| 300 | SlepcFinalize - Checks for options to be called at the conclusion | ||
| 301 | of the SLEPc program and calls `PetscFinalize()`. | ||
| 302 | |||
| 303 | Collective on `PETSC_COMM_WORLD` | ||
| 304 | |||
| 305 | Level: beginner | ||
| 306 | |||
| 307 | .seealso: [](sec:writing-prog), `SlepcInitialize()`, `PetscFinalize()` | ||
| 308 | @*/ | ||
| 309 | 16846 | PetscErrorCode SlepcFinalize(void) | |
| 310 | { | ||
| 311 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
16846 | PetscFunctionBegin; |
| 312 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
16846 | if (PetscUnlikely(!SlepcInitializeCalled)) { |
| 313 | ✗ | fprintf(PETSC_STDOUT,"SlepcInitialize() must be called before SlepcFinalize()\n"); | |
| 314 | ✗ | PetscStackClearTop; | |
| 315 | ✗ | return PETSC_ERR_ARG_WRONGSTATE; | |
| 316 | } | ||
| 317 |
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.
|
16846 | PetscCall(PetscInfo(NULL,"SlepcFinalize() called\n")); |
| 318 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 10 times.
|
16846 | if (SlepcBeganPetsc) { |
| 319 |
3/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
16799 | PetscCall(PetscFinalize()); |
| 320 | 3497 | SlepcBeganPetsc = PETSC_FALSE; | |
| 321 | } | ||
| 322 | 3544 | SlepcInitializeCalled = PETSC_FALSE; | |
| 323 | 3544 | SlepcFinalizeCalled = PETSC_TRUE; | |
| 324 |
2/4✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
3544 | PetscStackClearTop; |
| 325 | 3544 | return PETSC_SUCCESS; | |
| 326 | } | ||
| 327 | |||
| 328 | /*@C | ||
| 329 | SlepcInitializeNoArguments - Calls `SlepcInitialize()` from C/C++ without | ||
| 330 | the command line arguments. | ||
| 331 | |||
| 332 | Collective | ||
| 333 | |||
| 334 | Level: advanced | ||
| 335 | |||
| 336 | .seealso: [](sec:writing-prog), `SlepcInitialize()`, `SlepcInitializeFortran()` | ||
| 337 | @*/ | ||
| 338 | 37 | PetscErrorCode SlepcInitializeNoArguments(void) PeNS | |
| 339 | { | ||
| 340 | 37 | int argc = 0; | |
| 341 | 37 | char **args = NULL; | |
| 342 | |||
| 343 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
37 | PetscFunctionBegin; |
| 344 |
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.
|
37 | PetscCall(SlepcInitialize(&argc,&args,NULL,NULL)); |
| 345 |
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.
|
29 | PetscFunctionReturn(PETSC_SUCCESS); |
| 346 | } | ||
| 347 | |||
| 348 | /*@ | ||
| 349 | SlepcInitialized - Determine whether SLEPc is initialized. | ||
| 350 | |||
| 351 | Output Parameter: | ||
| 352 | . isInitialized - the result | ||
| 353 | |||
| 354 | Level: beginner | ||
| 355 | |||
| 356 | .seealso: [](sec:writing-prog), `SlepcInitialize()`, `SlepcInitializeFortran()` | ||
| 357 | @*/ | ||
| 358 | 87 | PetscErrorCode SlepcInitialized(PetscBool *isInitialized) | |
| 359 | { | ||
| 360 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
87 | PetscFunctionBegin; |
| 361 | 87 | *isInitialized = SlepcInitializeCalled; | |
| 362 |
8/12✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2 times.
✗ 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 taken 2 times.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 2 times.
|
87 | PetscFunctionReturn(PETSC_SUCCESS); |
| 363 | } | ||
| 364 | |||
| 365 | /*@ | ||
| 366 | SlepcFinalized - Determine whether `SlepcFinalize()` has been called. | ||
| 367 | |||
| 368 | Output Parameter: | ||
| 369 | . isFinalized - the result | ||
| 370 | |||
| 371 | Level: beginner | ||
| 372 | |||
| 373 | .seealso: [](sec:writing-prog), `SlepcFinalize()` | ||
| 374 | @*/ | ||
| 375 | 36 | PetscErrorCode SlepcFinalized(PetscBool *isFinalized) | |
| 376 | { | ||
| 377 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
36 | PetscFunctionBegin; |
| 378 | 36 | *isFinalized = SlepcFinalizeCalled; | |
| 379 |
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.
|
36 | PetscFunctionReturn(PETSC_SUCCESS); |
| 380 | } | ||
| 381 | |||
| 382 | PETSC_EXTERN PetscBool PetscBeganMPI; | ||
| 383 | |||
| 384 | /*@C | ||
| 385 | SlepcInitializeNoPointers - Calls `SlepcInitialize()` from C/C++ without the pointers | ||
| 386 | to `argc` and `args`. | ||
| 387 | |||
| 388 | Collective | ||
| 389 | |||
| 390 | Input Parameters: | ||
| 391 | + argc - count of number of command line arguments | ||
| 392 | . args - the command line arguments | ||
| 393 | . file - [optional] PETSc database file | ||
| 394 | - help - [optional] Help message to print, use `NULL` for no message | ||
| 395 | |||
| 396 | Note: | ||
| 397 | Check the manual page of `PetscInitializeNoPointers()` for an explanation. | ||
| 398 | |||
| 399 | Level: advanced | ||
| 400 | |||
| 401 | .seealso: [](sec:writing-prog), `SlepcInitialize()` | ||
| 402 | @*/ | ||
| 403 | ✗ | PetscErrorCode SlepcInitializeNoPointers(int argc,char **args,const char *file,const char *help) | |
| 404 | { | ||
| 405 | ✗ | int myargc = argc; | |
| 406 | ✗ | char **myargs = args; | |
| 407 | |||
| 408 | ✗ | PetscFunctionBegin; | |
| 409 | ✗ | PetscCall(SlepcInitialize(&myargc,&myargs,file,help)); | |
| 410 | ✗ | PetscCall(PetscPopSignalHandler()); | |
| 411 | ✗ | PetscBeganMPI = PETSC_FALSE; | |
| 412 | ✗ | PetscFunctionReturn(PETSC_SUCCESS); | |
| 413 | } | ||
| 414 |