mirror of
https://git.gfz-potsdam.de/naaice/poet.git
synced 2025-12-15 20:38:23 +01:00
Refactor build process
Now include/app paths are combined in the src dir.
This commit is contained in:
parent
c685ff536e
commit
599088d964
@ -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)
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
#ifndef POET_H
|
||||
#define POET_H
|
||||
|
||||
#include "poet/ChemistryModule.hpp"
|
||||
#include <Rcpp.h>
|
||||
const char *poet_version = "@POET_VERSION@";
|
||||
|
||||
const char *CHEMISTRY_MODULE_NAME = "state_C";
|
||||
|
||||
|
||||
#endif // POET_H
|
||||
@ -18,7 +18,9 @@
|
||||
** Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "poet/SimParams.hpp"
|
||||
#include "Grid.hpp"
|
||||
#include "SimParams.hpp"
|
||||
|
||||
#include <RInside.h>
|
||||
#include <Rcpp.h>
|
||||
#include <algorithm>
|
||||
@ -26,7 +28,6 @@
|
||||
#include <cstdint>
|
||||
#include <new>
|
||||
#include <numeric>
|
||||
#include <poet/Grid.hpp>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@ -21,7 +21,8 @@
|
||||
#ifndef GRID_H
|
||||
#define GRID_H
|
||||
|
||||
#include "poet/SimParams.hpp"
|
||||
#include "SimParams.hpp"
|
||||
|
||||
#include <RInside.h>
|
||||
#include <Rcpp.h>
|
||||
#include <array>
|
||||
@ -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 <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <poet/SimParams.hpp>
|
||||
|
||||
#include <RInside.h>
|
||||
#include <Rcpp.h>
|
||||
@ -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 <cstdint>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
@ -28,10 +34,6 @@
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "DataStructures.hpp"
|
||||
#include "Macros.hpp"
|
||||
#include "RInsidePOET.hpp"
|
||||
#include "argh.hpp" // Argument handler https://github.com/adishavit/argh
|
||||
#include <RInside.h>
|
||||
#include <Rcpp.h>
|
||||
// BSD-licenced
|
||||
@ -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)
|
||||
@ -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 <PhreeqcRM.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
@ -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 <IrmResult.h>
|
||||
#include <PhreeqcRM.h>
|
||||
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
@ -1,5 +1,6 @@
|
||||
#include "PhreeqcRM.h"
|
||||
#include "poet/ChemistryModule.hpp"
|
||||
#include "ChemistryModule.hpp"
|
||||
|
||||
#include <PhreeqcRM.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
@ -16,8 +16,9 @@
|
||||
** Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "DHT.h"
|
||||
|
||||
#include <mpi.h>
|
||||
#include <poet/DHT.h>
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <math.h>
|
||||
@ -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 <algorithm>
|
||||
#include <cassert>
|
||||
@ -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.)
|
||||
|
||||
@ -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 <array>
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
@ -24,7 +24,7 @@
|
||||
** Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "poet/HashFunctions.hpp"
|
||||
#include "HashFunctions.hpp"
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
|
||||
@ -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 <cassert>
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
@ -17,11 +16,11 @@
|
||||
#include <mpi.h>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
extern "C" {
|
||||
#include "poet/DHT.h"
|
||||
#include "DHT.h"
|
||||
}
|
||||
|
||||
#include "poet/LookupKey.hpp"
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <unordered_map>
|
||||
@ -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 <Rcpp/vector/instantiation.h>
|
||||
#include "../../DataStructures/DataStructures.hpp"
|
||||
#include "DHT_Wrapper.hpp"
|
||||
#include "HashFunctions.hpp"
|
||||
#include "LookupKey.hpp"
|
||||
#include "Rounding.hpp"
|
||||
|
||||
#include <Rcpp.h>
|
||||
#include <Rinternals.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
@ -20,8 +22,9 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
extern "C" {
|
||||
#include "poet/DHT.h"
|
||||
#include "DHT.h"
|
||||
}
|
||||
|
||||
namespace poet {
|
||||
@ -3,7 +3,8 @@
|
||||
#ifndef LOOKUPKEY_H_
|
||||
#define LOOKUPKEY_H_
|
||||
|
||||
#include "poet/HashFunctions.hpp"
|
||||
#include "HashFunctions.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
@ -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 <cassert>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
@ -12,8 +13,9 @@
|
||||
#include <memory>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
extern "C" {
|
||||
#include "poet/DHT.h"
|
||||
#include "DHT.h"
|
||||
}
|
||||
|
||||
namespace poet {
|
||||
@ -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 <IrmResult.h>
|
||||
#include <algorithm>
|
||||
@ -1,7 +1,7 @@
|
||||
#ifndef DATASTRUCTURES_H_
|
||||
#define DATASTRUCTURES_H_
|
||||
|
||||
#include "enums.hpp"
|
||||
#include "../Chemistry/enums.hpp"
|
||||
|
||||
#include <Rcpp.h>
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace poet {
|
||||
|
||||
struct WorkPackage {
|
||||
@ -1,4 +1,5 @@
|
||||
#include "poet/DataStructures.hpp"
|
||||
#include "DataStructures.hpp"
|
||||
|
||||
#include <Rcpp.h>
|
||||
#include <Rinternals.h>
|
||||
#include <cstddef>
|
||||
|
||||
@ -18,15 +18,15 @@
|
||||
** Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "DiffusionModule.hpp"
|
||||
#include "../Macros.hpp"
|
||||
|
||||
#include <tug/BoundaryCondition.hpp>
|
||||
#include <tug/Diffusion.hpp>
|
||||
|
||||
#include <Rcpp.h>
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <poet/DiffusionModule.hpp>
|
||||
#include <poet/Grid.hpp>
|
||||
#include <poet/Macros.hpp>
|
||||
#include <poet/SimParams.hpp>
|
||||
#include <tug/BoundaryCondition.hpp>
|
||||
#include <tug/Diffusion.hpp>
|
||||
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
@ -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() {
|
||||
@ -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 <tug/BoundaryCondition.hpp>
|
||||
#include <tug/Diffusion.hpp>
|
||||
|
||||
#include <array>
|
||||
#include <cmath>
|
||||
#include <cstdint>
|
||||
#include <poet/Grid.hpp>
|
||||
#include <string>
|
||||
#include <tug/BoundaryCondition.hpp>
|
||||
#include <tug/Diffusion.hpp>
|
||||
#include <vector>
|
||||
|
||||
namespace poet {
|
||||
@ -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 <poet.h>
|
||||
|
||||
#include <Rcpp.h>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <poet/ChemistryModule.hpp>
|
||||
#include <poet/DiffusionModule.hpp>
|
||||
#include <poet/Grid.hpp>
|
||||
#include <poet/Macros.hpp>
|
||||
#include <poet/RInsidePOET.hpp>
|
||||
#include <poet/SimParams.hpp>
|
||||
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
@ -34,7 +37,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include <mpi.h>
|
||||
#include <poet.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace poet;
|
||||
8
src/poet.h.in
Normal file
8
src/poet.h.in
Normal file
@ -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
|
||||
Loading…
x
Reference in New Issue
Block a user