diff --git a/src/phare/phare.cpp b/src/phare/phare.cpp index 4267c2cfe..2cdf4adef 100644 --- a/src/phare/phare.cpp +++ b/src/phare/phare.cpp @@ -5,11 +5,9 @@ #include "amr/wrappers/hierarchy.hpp" #include "initializer/python_data_provider.hpp" -#include "core/logger.hpp" - -#include -#include #include +#include +#include namespace { @@ -21,10 +19,26 @@ void signal_handler(int signal) gSignalStatus = signal; } -std::unique_ptr fromCommandLine(int argc, char** argv) +namespace PHARE { - using dataProvider [[maybe_unused]] = std::unique_ptr; +std::unique_ptr getSimulator(std::shared_ptr& hierarchy) +{ + PHARE::initializer::PHAREDict const& theDict + = PHARE::initializer::PHAREDictHandler::INSTANCE().dict(); + auto dim = theDict["simulation"]["dimension"].template to(); + auto interpOrder = theDict["simulation"]["interp_order"].template to(); + auto nbRefinedPart = theDict["simulation"]["refined_particle_nbr"].template to(); + + return core::makeAtRuntime(dim, interpOrder, nbRefinedPart, + SimulatorMaker{hierarchy}); +} + +} // namespace PHARE + + +std::unique_ptr fromCommandLine(int argc, char** argv) +{ switch (argc) { case 1: return nullptr; @@ -45,10 +59,12 @@ std::unique_ptr fromCommandLine(int argc, char int main(int argc, char** argv) { - if (std::signal(SIGINT, signal_handler) == SIG_ERR) { + if (std::signal(SIGINT, signal_handler) == SIG_ERR) + { throw std::runtime_error("PHARE Error: Failed to register SIGINT signal handler"); } - if (std::signal(SIGABRT, signal_handler) == SIG_ERR) { + if (std::signal(SIGABRT, signal_handler) == SIG_ERR) + { throw std::runtime_error("PHARE Error: Failed to register SIGABRT signal handler"); } diff --git a/src/simulator/CMakeLists.txt b/src/simulator/CMakeLists.txt index 8e57e57a3..8831fcde3 100644 --- a/src/simulator/CMakeLists.txt +++ b/src/simulator/CMakeLists.txt @@ -3,16 +3,13 @@ project(phare_simulator) set( SOURCES_INC simulator.hpp - simulator.cpp phare_types.hpp ) -add_library(${PROJECT_NAME} ${SOURCES_INC} ) -target_compile_options(${PROJECT_NAME} PRIVATE ${PHARE_WERROR_FLAGS} -DPHARE_HAS_HIGHFIVE=${PHARE_HAS_HIGHFIVE}) -set_property(TARGET ${PROJECT_NAME} PROPERTY INTERPROCEDURAL_OPTIMIZATION ${PHARE_INTERPROCEDURAL_OPTIMIZATION}) -target_link_libraries(${PROJECT_NAME} PUBLIC +add_library(${PROJECT_NAME} INTERFACE) + +target_link_libraries(${PROJECT_NAME} INTERFACE phare_initializer phare_amr # for mpicc phare_diagnostic ) -set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS " ${PHARE_LINK_FLAGS}") diff --git a/src/simulator/simulator.cpp b/src/simulator/simulator.cpp deleted file mode 100644 index b93a6005d..000000000 --- a/src/simulator/simulator.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "simulator.hpp" - - -namespace PHARE -{ -std::unique_ptr getSimulator(std::shared_ptr& hierarchy) -{ - PHARE::initializer::PHAREDict const& theDict - = PHARE::initializer::PHAREDictHandler::INSTANCE().dict(); - auto dim = theDict["simulation"]["dimension"].template to(); - auto interpOrder = theDict["simulation"]["interp_order"].template to(); - auto nbRefinedPart = theDict["simulation"]["refined_particle_nbr"].template to(); - - return core::makeAtRuntime(dim, interpOrder, nbRefinedPart, - SimulatorMaker{hierarchy}); -} -} /* namespace PHARE */ diff --git a/src/simulator/simulator.hpp b/src/simulator/simulator.hpp index 81cc00c8e..a438d5838 100644 --- a/src/simulator/simulator.hpp +++ b/src/simulator/simulator.hpp @@ -379,7 +379,7 @@ void Simulator<_dimension, _interp_order, _nbRefinedPart>::initialize() else throw std::runtime_error("Error - Simulator has no integrator"); } - catch (const std::runtime_error& e) + catch (std::runtime_error const& e) { std::cerr << "EXCEPTION CAUGHT: " << e.what() << std::endl; std::rethrow_exception(std::current_exception()); @@ -483,9 +483,6 @@ struct SimulatorMaker }; -std::unique_ptr getSimulator(std::shared_ptr& hierarchy); - - template std::unique_ptr> makeSimulator(std::shared_ptr const& hierarchy)