From 1250dc59d9e55b0149be315630d5fae7f2412009 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20L=C3=BCbke?= Date: Wed, 6 Mar 2024 11:59:12 +0100 Subject: [PATCH] Add Macros.hpp and RInsidePOET.hpp*** ***Add RInsidePOET class and RHookFunction template*** ***Update include paths in SimParams.hpp*** ***Update CMakeLists.txt to link poetlib*** ***Update DHT_Wrapper.hpp include path*** ***Update DiffusionModule.cpp include path*** ***Update poet.cpp include paths*** ***Add poet.hpp.in --- src/{ => Base}/Macros.hpp | 0 src/{ => Base}/RInsidePOET.hpp | 0 src/Base/SimParams.hpp | 4 +- src/CMakeLists.txt | 39 ++++++++++++------- src/Chemistry/SurrogateModels/DHT_Wrapper.hpp | 2 +- src/Transport/DiffusionModule.cpp | 2 +- src/poet.cpp | 6 +-- src/{poet.h.in => poet.hpp.in} | 0 8 files changed, 33 insertions(+), 20 deletions(-) rename src/{ => Base}/Macros.hpp (100%) rename src/{ => Base}/RInsidePOET.hpp (100%) rename src/{poet.h.in => poet.hpp.in} (100%) diff --git a/src/Macros.hpp b/src/Base/Macros.hpp similarity index 100% rename from src/Macros.hpp rename to src/Base/Macros.hpp diff --git a/src/RInsidePOET.hpp b/src/Base/RInsidePOET.hpp similarity index 100% rename from src/RInsidePOET.hpp rename to src/Base/RInsidePOET.hpp diff --git a/src/Base/SimParams.hpp b/src/Base/SimParams.hpp index 212ec9948..523b5b105 100644 --- a/src/Base/SimParams.hpp +++ b/src/Base/SimParams.hpp @@ -22,8 +22,8 @@ #define PARSER_H #include "../DataStructures/DataStructures.hpp" -#include "../Macros.hpp" -#include "../RInsidePOET.hpp" +#include "Macros.hpp" +#include "RInsidePOET.hpp" #include "argh.hpp" // Argument handler https://github.com/adishavit/argh diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index addb7c11b..51261c39a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,20 +1,27 @@ -file(GLOB_RECURSE poet_lib_SRC - CONFIGURE_DEPENDS - "*.cpp" "*.c") +add_library(poetlib + Base/Grid.cpp + Base/SimParams.cpp + Chemistry/ChemistryModule.cpp + Chemistry/MasterFunctions.cpp + Chemistry/WorkerFunctions.cpp + Chemistry/SurrogateModels/DHT_Wrapper.cpp + Chemistry/SurrogateModels/DHT.c + Chemistry/SurrogateModels/HashFunctions.cpp + Chemistry/SurrogateModels/InterpolationModule.cpp + Chemistry/SurrogateModels/ProximityHashTable.cpp + DataStructures/Field.cpp + Transport/DiffusionModule.cpp +) -configure_file(poet.h.in poet.h) - -add_executable(poet ${poet_lib_SRC}) -target_link_libraries(poet - MPI::MPI_CXX +target_link_libraries(poetlib PUBLIC + MPI::MPI_C ${MATH_LIBRARY} RRuntime PhreeqcRM tug ) -target_include_directories(poet PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") -target_compile_definitions(poet PRIVATE STRICT_R_HEADERS OMPI_SKIP_MPICXX) +target_compile_definitions(poetlib PUBLIC STRICT_R_HEADERS) mark_as_advanced(PHREEQCRM_BUILD_MPI PHREEQCRM_DISABLE_OPENMP) set(PHREEQCRM_DISABLE_OPENMP ON CACHE BOOL "" FORCE) @@ -22,13 +29,19 @@ set(PHREEQCRM_DISABLE_OPENMP ON CACHE BOOL "" FORCE) option(POET_DHT_DEBUG "Build with DHT debug info" OFF) if(POET_DHT_DEBUG) - target_compile_definitions(poet PRIVATE DHT_STATISTICS) + target_compile_definitions(poetlib PRIVATE DHT_STATISTICS) endif() option(POET_PHT_ADDITIONAL_INFO "Enables additional information in the PHT" OFF) if (POET_PHT_ADDITIONAL_INFO) - target_compile_definitions(poet PRIVATE POET_PHT_ADD) + target_compile_definitions(poetlib PRIVATE POET_PHT_ADD) endif() -install(TARGETS poet DESTINATION bin) \ No newline at end of file +configure_file(poet.hpp.in poet.hpp) + +add_executable(poet poet.cpp) +target_link_libraries(poet PRIVATE poetlib MPI::MPI_C RRuntime) +target_include_directories(poet PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") + +install(TARGETS poet DESTINATION bin) diff --git a/src/Chemistry/SurrogateModels/DHT_Wrapper.hpp b/src/Chemistry/SurrogateModels/DHT_Wrapper.hpp index 083fe9d25..791be2d1b 100644 --- a/src/Chemistry/SurrogateModels/DHT_Wrapper.hpp +++ b/src/Chemistry/SurrogateModels/DHT_Wrapper.hpp @@ -23,9 +23,9 @@ #ifndef DHT_WRAPPER_H #define DHT_WRAPPER_H +#include "../../Base/RInsidePOET.hpp" #include "../../Base/SimParams.hpp" #include "../../DataStructures/DataStructures.hpp" -#include "../../RInsidePOET.hpp" #include "../enums.hpp" #include "HashFunctions.hpp" #include "LookupKey.hpp" diff --git a/src/Transport/DiffusionModule.cpp b/src/Transport/DiffusionModule.cpp index b02f5ca0b..abbecce95 100644 --- a/src/Transport/DiffusionModule.cpp +++ b/src/Transport/DiffusionModule.cpp @@ -19,7 +19,7 @@ */ #include "DiffusionModule.hpp" -#include "../Macros.hpp" +#include "../Base/Macros.hpp" #include #include diff --git a/src/poet.cpp b/src/poet.cpp index aa6c22cb6..c4996dc97 100644 --- a/src/poet.cpp +++ b/src/poet.cpp @@ -19,13 +19,13 @@ */ #include "Base/Grid.hpp" +#include "Base/Macros.hpp" +#include "Base/RInsidePOET.hpp" #include "Base/SimParams.hpp" #include "Chemistry/ChemistryModule.hpp" -#include "Macros.hpp" -#include "RInsidePOET.hpp" #include "Transport/DiffusionModule.hpp" -#include +#include #include #include diff --git a/src/poet.h.in b/src/poet.hpp.in similarity index 100% rename from src/poet.h.in rename to src/poet.hpp.in