From 5c540af2bf309bdeb48b3f5be2e13a49a8c8275f Mon Sep 17 00:00:00 2001 From: Max Luebke Date: Thu, 13 Apr 2023 17:17:36 +0200 Subject: [PATCH 1/2] build: add benchmarks to install target --- CMakeLists.txt | 2 +- bench/CMakeLists.txt | 3 +++ bench/barite/CMakeLists.txt | 7 +++++++ bench/barite/barite.R | 6 +++--- bench/dolo_diffu_inner/CMakeLists.txt | 2 +- bench/surfex/CMakeLists.txt | 7 +++++++ bench/surfex/surfex.R | 6 +++--- 7 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 bench/CMakeLists.txt create mode 100644 bench/barite/CMakeLists.txt create mode 100644 bench/surfex/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 49861573b..bb87f3a7a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,7 @@ add_subdirectory(src) add_subdirectory(R_lib) add_subdirectory(data) add_subdirectory(app) -add_subdirectory(bench/dolo_diffu_inner) +add_subdirectory(bench) # as tug will also pull in doctest as a dependency set(TUG_ENABLE_TESTING OFF CACHE BOOL "" FORCE) diff --git a/bench/CMakeLists.txt b/bench/CMakeLists.txt new file mode 100644 index 000000000..a891897c0 --- /dev/null +++ b/bench/CMakeLists.txt @@ -0,0 +1,3 @@ +add_subdirectory(dolo_diffu_inner) +add_subdirectory(surfex) +add_subdirectory(barite) diff --git a/bench/barite/CMakeLists.txt b/bench/barite/CMakeLists.txt new file mode 100644 index 000000000..29982a1e0 --- /dev/null +++ b/bench/barite/CMakeLists.txt @@ -0,0 +1,7 @@ +install(FILES + barite.R + barite.pqi + db_barite.dat +DESTINATION + share/poet/bench/barite +) diff --git a/bench/barite/barite.R b/bench/barite/barite.R index 19ac896b7..1a215f467 100644 --- a/bench/barite/barite.R +++ b/bench/barite/barite.R @@ -1,7 +1,7 @@ -## Time-stamp: "Last modified 2023-04-11 14:29:51 delucia" +## Time-stamp: "Last modified 2023-04-13 17:10:30 mluebke" -database <- normalizePath("./db_barite.dat") -input_script <- normalizePath("./barite.pqi") +database <- normalizePath("../share/poet/bench/barite/db_barite.dat") +input_script <- normalizePath("../share/poet/bench/barite/barite.pqi") ################################################################# ## Section 1 ## diff --git a/bench/dolo_diffu_inner/CMakeLists.txt b/bench/dolo_diffu_inner/CMakeLists.txt index 633c71a11..cde190af0 100644 --- a/bench/dolo_diffu_inner/CMakeLists.txt +++ b/bench/dolo_diffu_inner/CMakeLists.txt @@ -3,5 +3,5 @@ install(FILES dolo_diffu_inner_large.R dolo_inner.pqi DESTINATION - share/poet/bench + share/poet/bench/dolo ) diff --git a/bench/surfex/CMakeLists.txt b/bench/surfex/CMakeLists.txt new file mode 100644 index 000000000..bda3f2353 --- /dev/null +++ b/bench/surfex/CMakeLists.txt @@ -0,0 +1,7 @@ +install(FILES + surfex.R + SurfExBase.pqi + SMILE_2021_11_01_TH.dat +DESTINATION + share/poet/bench/surfex +) diff --git a/bench/surfex/surfex.R b/bench/surfex/surfex.R index cc8e8592e..c2bd714c8 100644 --- a/bench/surfex/surfex.R +++ b/bench/surfex/surfex.R @@ -1,7 +1,7 @@ -## Time-stamp: "Last modified 2023-02-27 18:33:30 delucia" +## Time-stamp: "Last modified 2023-04-13 17:11:52 mluebke" -database <- normalizePath("./SMILE_2021_11_01_TH.dat") -input_script <- normalizePath("./SurfExBase.pqi") +database <- normalizePath("../share/poet/bench/surfex/SMILE_2021_11_01_TH.dat") +input_script <- normalizePath("../share/poet/bench/surfex/SurfExBase.pqi") cat(paste(":: R This is a test 1\n")) From 607b939208eeeaf0397a855d8ef730b7fa8721d2 Mon Sep 17 00:00:00 2001 From: Max Luebke Date: Thu, 13 Apr 2023 17:26:18 +0200 Subject: [PATCH 2/2] fix: remove unnecessary RoundToZero function from DiffusionModule --- include/poet/DiffusionModule.hpp | 2 -- src/DiffusionModule.cpp | 11 ----------- 2 files changed, 13 deletions(-) diff --git a/include/poet/DiffusionModule.hpp b/include/poet/DiffusionModule.hpp index 52d0199d0..63c514189 100644 --- a/include/poet/DiffusionModule.hpp +++ b/include/poet/DiffusionModule.hpp @@ -86,8 +86,6 @@ private: void initialize(poet::DiffusionParams args); - void RoundToZero(double *field, uint32_t cell_count) const; - Grid &grid; uint8_t dim; diff --git a/src/DiffusionModule.cpp b/src/DiffusionModule.cpp index b5a60ac25..bca4728d1 100644 --- a/src/DiffusionModule.cpp +++ b/src/DiffusionModule.cpp @@ -182,11 +182,6 @@ void DiffusionModule::simulate(double dt) { } else { tug::diffusion::ADI_2D(this->diff_input, in_field, in_alpha.data()); } - - // TODO: do not use hardcoded index for O, H and charge - if (i > 2) { - this->RoundToZero(in_field, this->n_cells_per_prop); - } } std::cout << " done!\n"; @@ -195,12 +190,6 @@ void DiffusionModule::simulate(double dt) { transport_t += sim_a_transport - sim_b_transport; } -inline void DiffusionModule::RoundToZero(double *field, - uint32_t cell_count) const { - for (uint32_t i = 0; i < cell_count; i++) { - field[i] = ((int32_t)(field[i] / ZERO_MULTIPLICATOR)) * ZERO_MULTIPLICATOR; - } -} void DiffusionModule::end() { // R["simtime_transport"] = transport_t;