diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 1aa791dd4..bd4fc4bf1 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -1,7 +1,6 @@ -configure_file(poet.h.in poet.h) -add_executable(poet poet.cpp) -target_include_directories(poet PUBLIC "${CMAKE_CURRENT_BINARY_DIR}") -target_link_libraries(poet PUBLIC poet_lib MPI::MPI_CXX) +# add_executable(poet poet.cpp) +# target_include_directories(poet PUBLIC "${CMAKE_CURRENT_BINARY_DIR}") +# target_link_libraries(poet PUBLIC poet_lib MPI::MPI_CXX) -install(TARGETS poet DESTINATION bin) +# install(TARGETS poet DESTINATION bin) diff --git a/app/poet.h.in b/app/poet.h.in deleted file mode 100644 index 96a25a2c1..000000000 --- a/app/poet.h.in +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef POET_H -#define POET_H - -#include "poet/ChemistryModule.hpp" -#include -const char *poet_version = "@POET_VERSION@"; - -const char *CHEMISTRY_MODULE_NAME = "state_C"; - - -#endif // POET_H diff --git a/src/Grid.cpp b/src/Base/Grid.cpp similarity index 99% rename from src/Grid.cpp rename to src/Base/Grid.cpp index 64561b5ae..e51b114ba 100644 --- a/src/Grid.cpp +++ b/src/Base/Grid.cpp @@ -18,7 +18,9 @@ ** Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "poet/SimParams.hpp" +#include "Grid.hpp" +#include "SimParams.hpp" + #include #include #include @@ -26,7 +28,6 @@ #include #include #include -#include #include #include #include diff --git a/include/poet/Grid.hpp b/src/Base/Grid.hpp similarity index 99% rename from include/poet/Grid.hpp rename to src/Base/Grid.hpp index 2ea2068b9..deec5c04a 100644 --- a/include/poet/Grid.hpp +++ b/src/Base/Grid.hpp @@ -21,7 +21,8 @@ #ifndef GRID_H #define GRID_H -#include "poet/SimParams.hpp" +#include "SimParams.hpp" + #include #include #include diff --git a/src/SimParams.cpp b/src/Base/SimParams.cpp similarity index 99% rename from src/SimParams.cpp rename to src/Base/SimParams.cpp index e02046392..f711e796a 100644 --- a/src/SimParams.cpp +++ b/src/Base/SimParams.cpp @@ -20,11 +20,13 @@ ** Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "poet/enums.hpp" +#include "SimParams.hpp" + +#include "../Chemistry/enums.hpp" + #include #include #include -#include #include #include diff --git a/include/poet/SimParams.hpp b/src/Base/SimParams.hpp similarity index 98% rename from include/poet/SimParams.hpp rename to src/Base/SimParams.hpp index 9928bcdba..212ec9948 100644 --- a/include/poet/SimParams.hpp +++ b/src/Base/SimParams.hpp @@ -21,6 +21,12 @@ #ifndef PARSER_H #define PARSER_H +#include "../DataStructures/DataStructures.hpp" +#include "../Macros.hpp" +#include "../RInsidePOET.hpp" + +#include "argh.hpp" // Argument handler https://github.com/adishavit/argh + #include #include #include @@ -28,10 +34,6 @@ #include #include -#include "DataStructures.hpp" -#include "Macros.hpp" -#include "RInsidePOET.hpp" -#include "argh.hpp" // Argument handler https://github.com/adishavit/argh #include #include // BSD-licenced diff --git a/include/poet/argh.hpp b/src/Base/argh.hpp similarity index 100% rename from include/poet/argh.hpp rename to src/Base/argh.hpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 74a61c8c7..addb7c11b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,12 +2,19 @@ file(GLOB_RECURSE poet_lib_SRC CONFIGURE_DEPENDS "*.cpp" "*.c") -add_library(poet_lib ${poet_lib_SRC}) -target_include_directories(poet_lib PUBLIC ${PROJECT_SOURCE_DIR}/include) -target_link_libraries(poet_lib PUBLIC - MPI::MPI_CXX ${MATH_LIBRARY} RRuntime PhreeqcRM tug) +configure_file(poet.h.in poet.h) -target_compile_definitions(poet_lib PUBLIC STRICT_R_HEADERS OMPI_SKIP_MPICXX) +add_executable(poet ${poet_lib_SRC}) +target_link_libraries(poet + MPI::MPI_CXX + ${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) mark_as_advanced(PHREEQCRM_BUILD_MPI PHREEQCRM_DISABLE_OPENMP) set(PHREEQCRM_DISABLE_OPENMP ON CACHE BOOL "" FORCE) @@ -15,11 +22,13 @@ 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_lib PRIVATE DHT_STATISTICS) + target_compile_definitions(poet 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_lib PRIVATE POET_PHT_ADD) + target_compile_definitions(poet PRIVATE POET_PHT_ADD) endif() + +install(TARGETS poet DESTINATION bin) \ No newline at end of file diff --git a/src/ChemistryModule/ChemistryModule.cpp b/src/Chemistry/ChemistryModule.cpp similarity index 99% rename from src/ChemistryModule/ChemistryModule.cpp rename to src/Chemistry/ChemistryModule.cpp index a1b1a8837..46531f2c6 100644 --- a/src/ChemistryModule/ChemistryModule.cpp +++ b/src/Chemistry/ChemistryModule.cpp @@ -1,7 +1,9 @@ -#include "poet/ChemistryModule.hpp" -#include "PhreeqcRM.h" -#include "poet/DHT_Wrapper.hpp" -#include "poet/Interpolation.hpp" +#include "ChemistryModule.hpp" + +#include "SurrogateModels/DHT_Wrapper.hpp" +#include "SurrogateModels/Interpolation.hpp" + +#include #include #include diff --git a/include/poet/ChemistryModule.hpp b/src/Chemistry/ChemistryModule.hpp similarity index 98% rename from include/poet/ChemistryModule.hpp rename to src/Chemistry/ChemistryModule.hpp index c0c7f9083..a17069d53 100644 --- a/include/poet/ChemistryModule.hpp +++ b/src/Chemistry/ChemistryModule.hpp @@ -3,12 +3,13 @@ #ifndef CHEMISTRYMODULE_H_ #define CHEMISTRYMODULE_H_ -#include "DHT_Wrapper.hpp" -#include "DataStructures.hpp" -#include "Interpolation.hpp" -#include "IrmResult.h" -#include "PhreeqcRM.h" -#include "SimParams.hpp" +#include "../Base/SimParams.hpp" +#include "../DataStructures/DataStructures.hpp" +#include "SurrogateModels/DHT_Wrapper.hpp" +#include "SurrogateModels/Interpolation.hpp" + +#include +#include #include #include diff --git a/src/ChemistryModule/MasterFunctions.cpp b/src/Chemistry/MasterFunctions.cpp similarity index 99% rename from src/ChemistryModule/MasterFunctions.cpp rename to src/Chemistry/MasterFunctions.cpp index 51b656da3..543cd21a8 100644 --- a/src/ChemistryModule/MasterFunctions.cpp +++ b/src/Chemistry/MasterFunctions.cpp @@ -1,5 +1,6 @@ -#include "PhreeqcRM.h" -#include "poet/ChemistryModule.hpp" +#include "ChemistryModule.hpp" + +#include #include #include diff --git a/src/ChemistryModule/SurrogateModels/CMakeLists.txt b/src/Chemistry/SurrogateModels/CMakeLists.txt similarity index 100% rename from src/ChemistryModule/SurrogateModels/CMakeLists.txt rename to src/Chemistry/SurrogateModels/CMakeLists.txt diff --git a/src/ChemistryModule/SurrogateModels/DHT.c b/src/Chemistry/SurrogateModels/DHT.c similarity index 99% rename from src/ChemistryModule/SurrogateModels/DHT.c rename to src/Chemistry/SurrogateModels/DHT.c index 0a7261049..b0d5b3caa 100644 --- a/src/ChemistryModule/SurrogateModels/DHT.c +++ b/src/Chemistry/SurrogateModels/DHT.c @@ -16,8 +16,9 @@ ** Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include "DHT.h" + #include -#include #include #include diff --git a/include/poet/DHT.h b/src/Chemistry/SurrogateModels/DHT.h similarity index 100% rename from include/poet/DHT.h rename to src/Chemistry/SurrogateModels/DHT.h diff --git a/src/ChemistryModule/SurrogateModels/DHT_Wrapper.cpp b/src/Chemistry/SurrogateModels/DHT_Wrapper.cpp similarity index 96% rename from src/ChemistryModule/SurrogateModels/DHT_Wrapper.cpp rename to src/Chemistry/SurrogateModels/DHT_Wrapper.cpp index 861375c04..69491b2c2 100644 --- a/src/ChemistryModule/SurrogateModels/DHT_Wrapper.cpp +++ b/src/Chemistry/SurrogateModels/DHT_Wrapper.cpp @@ -20,14 +20,7 @@ ** Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "poet/DHT_Wrapper.hpp" -#include "poet/HashFunctions.hpp" -#include "poet/Interpolation.hpp" -#include "poet/LookupKey.hpp" -#include "poet/Rounding.hpp" -#include "poet/enums.hpp" - -#include "poet/RInsidePOET.hpp" +#include "DHT_Wrapper.hpp" #include #include @@ -150,10 +143,9 @@ void DHT_Wrapper::fillDHT(const WorkPackage &work_package) { uint32_t proc, index; auto &key = dht_results.keys[i]; const auto data = - (with_interp - ? outputToInputAndRates(work_package.input[i], - work_package.output[i]) - : work_package.output[i]); + (with_interp ? outputToInputAndRates(work_package.input[i], + work_package.output[i]) + : work_package.output[i]); // void *data = (void *)&(work_package[i * this->data_count]); // fuzz data (round, logarithm etc.) diff --git a/include/poet/DHT_Wrapper.hpp b/src/Chemistry/SurrogateModels/DHT_Wrapper.hpp similarity index 97% rename from include/poet/DHT_Wrapper.hpp rename to src/Chemistry/SurrogateModels/DHT_Wrapper.hpp index 115d5e769..083fe9d25 100644 --- a/include/poet/DHT_Wrapper.hpp +++ b/src/Chemistry/SurrogateModels/DHT_Wrapper.hpp @@ -23,14 +23,14 @@ #ifndef DHT_WRAPPER_H #define DHT_WRAPPER_H -#include "DataStructures.hpp" +#include "../../Base/SimParams.hpp" +#include "../../DataStructures/DataStructures.hpp" +#include "../../RInsidePOET.hpp" +#include "../enums.hpp" +#include "HashFunctions.hpp" #include "LookupKey.hpp" -#include "RInsidePOET.hpp" -#include "SimParams.hpp" -#include "enums.hpp" -#include "poet/HashFunctions.hpp" -#include "poet/LookupKey.hpp" -#include "poet/Rounding.hpp" +#include "Rounding.hpp" + #include #include #include diff --git a/src/ChemistryModule/SurrogateModels/HashFunctions.cpp b/src/Chemistry/SurrogateModels/HashFunctions.cpp similarity index 98% rename from src/ChemistryModule/SurrogateModels/HashFunctions.cpp rename to src/Chemistry/SurrogateModels/HashFunctions.cpp index 431cd286f..d93702990 100644 --- a/src/ChemistryModule/SurrogateModels/HashFunctions.cpp +++ b/src/Chemistry/SurrogateModels/HashFunctions.cpp @@ -24,7 +24,7 @@ ** Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "poet/HashFunctions.hpp" +#include "HashFunctions.hpp" #if defined(_MSC_VER) diff --git a/include/poet/HashFunctions.hpp b/src/Chemistry/SurrogateModels/HashFunctions.hpp similarity index 100% rename from include/poet/HashFunctions.hpp rename to src/Chemistry/SurrogateModels/HashFunctions.hpp diff --git a/include/poet/Interpolation.hpp b/src/Chemistry/SurrogateModels/Interpolation.hpp similarity index 97% rename from include/poet/Interpolation.hpp rename to src/Chemistry/SurrogateModels/Interpolation.hpp index 71b9f9a01..15361f4bf 100644 --- a/include/poet/Interpolation.hpp +++ b/src/Chemistry/SurrogateModels/Interpolation.hpp @@ -3,13 +3,12 @@ #ifndef INTERPOLATION_H_ #define INTERPOLATION_H_ -#include "DHT.h" +#include "../../Base/SimParams.hpp" +#include "../../DataStructures/DataStructures.hpp" #include "DHT_Wrapper.hpp" -#include "DataStructures.hpp" #include "LookupKey.hpp" -#include "poet/DHT_Wrapper.hpp" -#include "poet/Rounding.hpp" -#include "poet/SimParams.hpp" +#include "Rounding.hpp" + #include #include #include @@ -17,11 +16,11 @@ #include #include #include + extern "C" { -#include "poet/DHT.h" +#include "DHT.h" } -#include "poet/LookupKey.hpp" #include #include #include diff --git a/src/ChemistryModule/SurrogateModels/InterpolationModule.cpp b/src/Chemistry/SurrogateModels/InterpolationModule.cpp similarity index 94% rename from src/ChemistryModule/SurrogateModels/InterpolationModule.cpp rename to src/Chemistry/SurrogateModels/InterpolationModule.cpp index 9384731b2..26bfd4ab0 100644 --- a/src/ChemistryModule/SurrogateModels/InterpolationModule.cpp +++ b/src/Chemistry/SurrogateModels/InterpolationModule.cpp @@ -1,13 +1,15 @@ // Time-stamp: "Last modified 2023-08-16 17:02:31 mluebke" +#include "Interpolation.hpp" -#include "poet/DHT_Wrapper.hpp" -#include "poet/DataStructures.hpp" -#include "poet/HashFunctions.hpp" -#include "poet/Interpolation.hpp" -#include "poet/LookupKey.hpp" -#include "poet/Rounding.hpp" -#include +#include "../../DataStructures/DataStructures.hpp" +#include "DHT_Wrapper.hpp" +#include "HashFunctions.hpp" +#include "LookupKey.hpp" +#include "Rounding.hpp" + +#include #include + #include #include #include @@ -20,8 +22,9 @@ #include #include #include + extern "C" { -#include "poet/DHT.h" +#include "DHT.h" } namespace poet { diff --git a/include/poet/LookupKey.hpp b/src/Chemistry/SurrogateModels/LookupKey.hpp similarity index 97% rename from include/poet/LookupKey.hpp rename to src/Chemistry/SurrogateModels/LookupKey.hpp index fbb064c53..f64b92721 100644 --- a/include/poet/LookupKey.hpp +++ b/src/Chemistry/SurrogateModels/LookupKey.hpp @@ -3,7 +3,8 @@ #ifndef LOOKUPKEY_H_ #define LOOKUPKEY_H_ -#include "poet/HashFunctions.hpp" +#include "HashFunctions.hpp" + #include #include #include diff --git a/src/ChemistryModule/SurrogateModels/ProximityHashTable.cpp b/src/Chemistry/SurrogateModels/ProximityHashTable.cpp similarity index 97% rename from src/ChemistryModule/SurrogateModels/ProximityHashTable.cpp rename to src/Chemistry/SurrogateModels/ProximityHashTable.cpp index 3ea44430d..f1589fa21 100644 --- a/src/ChemistryModule/SurrogateModels/ProximityHashTable.cpp +++ b/src/Chemistry/SurrogateModels/ProximityHashTable.cpp @@ -1,10 +1,11 @@ // Time-stamp: "Last modified 2023-08-15 14:50:59 mluebke" +#include "Interpolation.hpp" + +#include "DHT_Wrapper.hpp" +#include "HashFunctions.hpp" +#include "LookupKey.hpp" +#include "Rounding.hpp" -#include "poet/DHT_Wrapper.hpp" -#include "poet/HashFunctions.hpp" -#include "poet/Interpolation.hpp" -#include "poet/LookupKey.hpp" -#include "poet/Rounding.hpp" #include #include #include @@ -12,8 +13,9 @@ #include #include #include + extern "C" { -#include "poet/DHT.h" +#include "DHT.h" } namespace poet { diff --git a/include/poet/Rounding.hpp b/src/Chemistry/SurrogateModels/Rounding.hpp similarity index 100% rename from include/poet/Rounding.hpp rename to src/Chemistry/SurrogateModels/Rounding.hpp diff --git a/src/ChemistryModule/WorkerFunctions.cpp b/src/Chemistry/WorkerFunctions.cpp similarity index 98% rename from src/ChemistryModule/WorkerFunctions.cpp rename to src/Chemistry/WorkerFunctions.cpp index 624a78b4f..faa99834b 100644 --- a/src/ChemistryModule/WorkerFunctions.cpp +++ b/src/Chemistry/WorkerFunctions.cpp @@ -1,8 +1,8 @@ // Time-stamp: "Last modified 2023-08-16 14:50:04 mluebke" -#include "poet/ChemistryModule.hpp" -#include "poet/DHT_Wrapper.hpp" -#include "poet/Interpolation.hpp" +#include "ChemistryModule.hpp" +#include "SurrogateModels/DHT_Wrapper.hpp" +#include "SurrogateModels/Interpolation.hpp" #include #include diff --git a/include/poet/enums.hpp b/src/Chemistry/enums.hpp similarity index 100% rename from include/poet/enums.hpp rename to src/Chemistry/enums.hpp diff --git a/include/poet/DataStructures.hpp b/src/DataStructures/DataStructures.hpp similarity index 99% rename from include/poet/DataStructures.hpp rename to src/DataStructures/DataStructures.hpp index 834ceca50..30f69e5dd 100644 --- a/include/poet/DataStructures.hpp +++ b/src/DataStructures/DataStructures.hpp @@ -1,7 +1,7 @@ #ifndef DATASTRUCTURES_H_ #define DATASTRUCTURES_H_ -#include "enums.hpp" +#include "../Chemistry/enums.hpp" #include @@ -13,6 +13,7 @@ #include #include #include + namespace poet { struct WorkPackage { diff --git a/src/DataStructures/Field.cpp b/src/DataStructures/Field.cpp index de364a599..71d51dea4 100644 --- a/src/DataStructures/Field.cpp +++ b/src/DataStructures/Field.cpp @@ -1,4 +1,5 @@ -#include "poet/DataStructures.hpp" +#include "DataStructures.hpp" + #include #include #include diff --git a/include/poet/Macros.hpp b/src/Macros.hpp similarity index 100% rename from include/poet/Macros.hpp rename to src/Macros.hpp diff --git a/include/poet/RInsidePOET.hpp b/src/RInsidePOET.hpp similarity index 100% rename from include/poet/RInsidePOET.hpp rename to src/RInsidePOET.hpp diff --git a/src/DiffusionModule.cpp b/src/Transport/DiffusionModule.cpp similarity index 96% rename from src/DiffusionModule.cpp rename to src/Transport/DiffusionModule.cpp index ba7a60e62..b02f5ca0b 100644 --- a/src/DiffusionModule.cpp +++ b/src/Transport/DiffusionModule.cpp @@ -18,15 +18,15 @@ ** Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include "DiffusionModule.hpp" +#include "../Macros.hpp" + +#include +#include + #include #include #include -#include -#include -#include -#include -#include -#include #include #include @@ -177,11 +177,11 @@ void DiffusionModule::simulate(double dt) { t_field = field_2d; - sim_a_transport = MPI_Wtime(); transport_t += sim_a_transport - sim_b_transport; - std::cout << " done in "<< sim_a_transport - sim_b_transport << "sec" << std::endl; + std::cout << " done in " << sim_a_transport - sim_b_transport << "sec" + << std::endl; } void DiffusionModule::end() { diff --git a/include/poet/DiffusionModule.hpp b/src/Transport/DiffusionModule.hpp similarity index 96% rename from include/poet/DiffusionModule.hpp rename to src/Transport/DiffusionModule.hpp index 8ea379027..a31bc0738 100644 --- a/include/poet/DiffusionModule.hpp +++ b/src/Transport/DiffusionModule.hpp @@ -21,16 +21,17 @@ #ifndef DIFFUSION_MODULE_H #define DIFFUSION_MODULE_H -#include "DataStructures.hpp" -#include "SimParams.hpp" -#include "poet/SimParams.hpp" +#include "../Base/Grid.hpp" +#include "../Base/SimParams.hpp" +#include "../DataStructures/DataStructures.hpp" + +#include +#include + #include #include #include -#include #include -#include -#include #include namespace poet { diff --git a/app/poet.cpp b/src/poet.cpp similarity index 98% rename from app/poet.cpp rename to src/poet.cpp index 4095cf858..aa6c22cb6 100644 --- a/app/poet.cpp +++ b/src/poet.cpp @@ -18,15 +18,18 @@ ** Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include "Base/Grid.hpp" +#include "Base/SimParams.hpp" +#include "Chemistry/ChemistryModule.hpp" +#include "Macros.hpp" +#include "RInsidePOET.hpp" +#include "Transport/DiffusionModule.hpp" + +#include + #include #include #include -#include -#include -#include -#include -#include -#include #include #include @@ -34,7 +37,6 @@ #include #include -#include using namespace std; using namespace poet; diff --git a/src/poet.h.in b/src/poet.h.in new file mode 100644 index 000000000..6a85179d4 --- /dev/null +++ b/src/poet.h.in @@ -0,0 +1,8 @@ +#ifndef POET_H +#define POET_H + +static const char *poet_version = "@POET_VERSION@"; + +static const char *CHEMISTRY_MODULE_NAME = "state_C"; + +#endif // POET_H