From e27ce205fb38b65fca03230ad3af7315081e9b5f Mon Sep 17 00:00:00 2001 From: Max Luebke Date: Mon, 8 Apr 2024 20:47:38 +0000 Subject: [PATCH] Add minimal flag to importList function in InitialList --- src/Init/InitialList.cpp | 27 +++++++++++++++------------ src/Init/InitialList.hpp | 2 +- src/poet.cpp | 2 +- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/Init/InitialList.cpp b/src/Init/InitialList.cpp index 57ce957c2..9909906cc 100644 --- a/src/Init/InitialList.cpp +++ b/src/Init/InitialList.cpp @@ -15,7 +15,7 @@ void InitialList::initializeFromList(const Rcpp::List &setup) { initChemistry(setup[chemistry_key]); } -void InitialList::importList(const Rcpp::List &setup) { +void InitialList::importList(const Rcpp::List &setup, bool minimal) { this->dim = Rcpp::as(setup[static_cast(ExportList::GRID_DIM)]); Rcpp::NumericVector grid_specs = @@ -34,20 +34,23 @@ void InitialList::importList(const Rcpp::List &setup) { this->porosity = Rcpp::as>( setup[static_cast(ExportList::GRID_POROSITY)]); - this->initial_grid = - Rcpp::List(setup[static_cast(ExportList::GRID_INITIAL)]); + if (!minimal) { + this->initial_grid = + Rcpp::List(setup[static_cast(ExportList::GRID_INITIAL)]); + } this->transport_names = Rcpp::as>( setup[static_cast(ExportList::DIFFU_TRANSPORT)]); - this->boundaries = - Rcpp::List(setup[static_cast(ExportList::DIFFU_BOUNDARIES)]); - this->inner_boundaries = - Rcpp::List(setup[static_cast(ExportList::DIFFU_INNER_BOUNDARIES)]); - this->alpha_x = - Rcpp::List(setup[static_cast(ExportList::DIFFU_ALPHA_X)]); - this->alpha_y = - Rcpp::List(setup[static_cast(ExportList::DIFFU_ALPHA_Y)]); - + if (!minimal) { + this->boundaries = + Rcpp::List(setup[static_cast(ExportList::DIFFU_BOUNDARIES)]); + this->inner_boundaries = + Rcpp::List(setup[static_cast(ExportList::DIFFU_INNER_BOUNDARIES)]); + this->alpha_x = + Rcpp::List(setup[static_cast(ExportList::DIFFU_ALPHA_X)]); + this->alpha_y = + Rcpp::List(setup[static_cast(ExportList::DIFFU_ALPHA_Y)]); + } this->database = Rcpp::as(setup[static_cast(ExportList::CHEM_DATABASE)]); this->pqc_scripts = Rcpp::as>( diff --git a/src/Init/InitialList.hpp b/src/Init/InitialList.hpp index 74ee9de4b..532de6b74 100644 --- a/src/Init/InitialList.hpp +++ b/src/Init/InitialList.hpp @@ -31,7 +31,7 @@ public: void initializeFromList(const Rcpp::List &setup); - void importList(const Rcpp::List &setup); + void importList(const Rcpp::List &setup, bool minimal = false); Rcpp::List exportList(); Field getInitialGrid() const { return Field(this->initial_grid); } diff --git a/src/poet.cpp b/src/poet.cpp index 5c749aa7e..aa92a9f39 100644 --- a/src/poet.cpp +++ b/src/poet.cpp @@ -351,7 +351,7 @@ int main(int argc, char *argv[]) { } InitialList init_list(R); - init_list.importList(run_params.init_params); + init_list.importList(run_params.init_params, MY_RANK != 0); MSG("RInside initialized on process " + std::to_string(MY_RANK));