diff --git a/src/utils/CMakeLists.txt b/src/utils/CMakeLists.txt index 3e2e1c15bf8aa0f3754023cca37c2c8e26a75fc5..7639963d4fc73094f2e79f64e9f9c9383426ac43 100644 --- a/src/utils/CMakeLists.txt +++ b/src/utils/CMakeLists.txt @@ -13,7 +13,14 @@ add_library( PETScWrapper.cpp PugsUtils.cpp RevisionInfo.cpp - SignalManager.cpp) + SignalManager.cpp + SLEPcWrapper.cpp) + +target_link_libraries( + PugsUtils + ${PETSC_LIBRARIES} + ${SLEPC_LIBRARIES} +) # --------------- get git revision info --------------- diff --git a/src/utils/PugsUtils.cpp b/src/utils/PugsUtils.cpp index fbf2b04e35b6ef7e4c7f983696f1fba8f1055de8..d35fa95f43cb03810814ec6b62ed039842de1289 100644 --- a/src/utils/PugsUtils.cpp +++ b/src/utils/PugsUtils.cpp @@ -6,6 +6,7 @@ #include <utils/Messenger.hpp> #include <utils/PETScWrapper.hpp> #include <utils/RevisionInfo.hpp> +#include <utils/SLEPcWrapper.hpp> #include <utils/SignalManager.hpp> #include <utils/pugs_build_info.hpp> @@ -124,6 +125,7 @@ initialize(int& argc, char* argv[]) } PETScWrapper::initialize(argc, argv); + SLEPcWrapper::initialize(argc, argv); setDefaultOMPEnvironment(); Kokkos::initialize(argc, argv); @@ -153,6 +155,7 @@ void finalize() { Kokkos::finalize(); + SLEPcWrapper::finalize(); PETScWrapper::finalize(); parallel::Messenger::destroy(); } diff --git a/src/utils/SLEPcWrapper.cpp b/src/utils/SLEPcWrapper.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2c7076d54f9cf438e34e54302041cd6e76633689 --- /dev/null +++ b/src/utils/SLEPcWrapper.cpp @@ -0,0 +1,26 @@ +#include <utils/SLEPcWrapper.hpp> + +#include <utils/pugs_config.hpp> + +#ifdef PUGS_HAS_SLEPC +#include <slepc.h> +#endif // PUGS_HAS_SLEPC + +namespace SLEPcWrapper +{ +void +initialize([[maybe_unused]] int& argc, [[maybe_unused]] char* argv[]) +{ +#ifdef PUGS_HAS_SLEPC + SlepcInitialize(&argc, &argv, 0, 0); +#endif // PUGS_HAS_SLEPC +} + +void +finalize() +{ +#ifdef PUGS_HAS_SLEPC + SlepcFinalize(); +#endif // PUGS_HAS_SLEPC +} +} // namespace SLEPcWrapper diff --git a/src/utils/SLEPcWrapper.hpp b/src/utils/SLEPcWrapper.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8b64802339ba2c6d8c78aa3c7a86005e3fd013bf --- /dev/null +++ b/src/utils/SLEPcWrapper.hpp @@ -0,0 +1,10 @@ +#ifndef SLEPC_WRAPPER_HPP +#define SLEPC_WRAPPER_HPP + +namespace SLEPcWrapper +{ +void initialize(int& argc, char* argv[]); +void finalize(); +} // namespace SLEPcWrapper + +#endif // SLEPC_WRAPPER_HPP