From eb09cd2725635eba7285d7a9c60866283097ea3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20L=C3=BCbke?= Date: Thu, 19 Dec 2024 08:59:56 +0100 Subject: [PATCH] feat: add with_h0_o0 and with_redox parameters to ChemistryModule and related classes --- src/Chemistry/ChemistryModule.cpp | 3 ++- src/Init/ChemistryInit.cpp | 2 ++ src/Init/GridInit.cpp | 3 +++ src/Init/InitialList.cpp | 8 ++++++++ src/Init/InitialList.hpp | 6 ++++++ 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/Chemistry/ChemistryModule.cpp b/src/Chemistry/ChemistryModule.cpp index 32c14be90..c95796b79 100644 --- a/src/Chemistry/ChemistryModule.cpp +++ b/src/Chemistry/ChemistryModule.cpp @@ -171,7 +171,8 @@ poet::ChemistryModule::ChemistryModule( if (!is_master) { PhreeqcMatrix pqc_mat = - PhreeqcMatrix(chem_params.database, chem_params.pqc_script); + PhreeqcMatrix(chem_params.database, chem_params.pqc_script, + chem_params.with_h0_o0, chem_params.with_redox); this->pqc_runner = std::make_unique(pqc_mat.subset(chem_params.pqc_ids)); diff --git a/src/Init/ChemistryInit.cpp b/src/Init/ChemistryInit.cpp index b399671ed..db0b098d0 100644 --- a/src/Init/ChemistryInit.cpp +++ b/src/Init/ChemistryInit.cpp @@ -69,6 +69,8 @@ InitialList::ChemistryInit InitialList::getChemistryInit() const { chem_init.database = database; chem_init.pqc_script = pqc_script; chem_init.pqc_ids = pqc_ids; + chem_init.with_h0_o0 = with_h0_o0; + chem_init.with_redox = with_redox; // chem_init.pqc_scripts = pqc_scripts; // chem_init.pqc_ids = pqc_ids; diff --git a/src/Init/GridInit.cpp b/src/Init/GridInit.cpp index 52ce6943a..63b33a628 100644 --- a/src/Init/GridInit.cpp +++ b/src/Init/GridInit.cpp @@ -186,6 +186,9 @@ PhreeqcMatrix InitialList::prepareGrid(const Rcpp::List &grid_input, grid_input[GRID_MEMBER_STR(GridMembers::PQC_WITH_REDOX)]) : false; + this->with_h0_o0 = include_h0_o0; + this->with_redox = with_redox; + PhreeqcMatrix pqc_mat = PhreeqcMatrix(database, script, include_h0_o0, with_redox); diff --git a/src/Init/InitialList.cpp b/src/Init/InitialList.cpp index 88452a8c4..c6282977d 100644 --- a/src/Init/InitialList.cpp +++ b/src/Init/InitialList.cpp @@ -57,6 +57,10 @@ void InitialList::importList(const Rcpp::List &setup, bool minimal) { Rcpp::as(setup[static_cast(ExportList::CHEM_DATABASE)]); this->pqc_script = Rcpp::as( setup[static_cast(ExportList::CHEM_PQC_SCRIPT)]); + this->with_h0_o0 = + Rcpp::as(setup[static_cast(ExportList::CHEM_PQC_WITH_H0_O0)]); + this->with_redox = + Rcpp::as(setup[static_cast(ExportList::CHEM_PQC_WITH_REDOX)]); this->field_header = Rcpp::as>( setup[static_cast(ExportList::CHEM_FIELD_HEADER)]); this->pqc_ids = Rcpp::as>( @@ -113,6 +117,10 @@ Rcpp::List InitialList::exportList() { out[static_cast(ExportList::CHEM_DATABASE)] = Rcpp::wrap(this->database); out[static_cast(ExportList::CHEM_PQC_SCRIPT)] = Rcpp::wrap(this->pqc_script); + out[static_cast(ExportList::CHEM_PQC_WITH_H0_O0)] = + Rcpp::wrap(this->with_h0_o0); + out[static_cast(ExportList::CHEM_PQC_WITH_REDOX)] = + Rcpp::wrap(this->with_redox); out[static_cast(ExportList::CHEM_FIELD_HEADER)] = Rcpp::wrap(this->field_header); out[static_cast(ExportList::CHEM_PQC_IDS)] = Rcpp::wrap(this->pqc_ids); diff --git a/src/Init/InitialList.hpp b/src/Init/InitialList.hpp index 03132983e..64c2fd08c 100644 --- a/src/Init/InitialList.hpp +++ b/src/Init/InitialList.hpp @@ -52,6 +52,8 @@ private: DIFFU_ALPHA_Y, CHEM_DATABASE, CHEM_PQC_SCRIPT, + CHEM_PQC_WITH_H0_O0, + CHEM_PQC_WITH_REDOX, CHEM_PQC_IDS, CHEM_FIELD_HEADER, // CHEM_PQC_SCRIPTS, @@ -190,6 +192,8 @@ private: std::string database; std::string pqc_script; + bool with_h0_o0{false}; + bool with_redox{false}; // std::vector pqc_scripts; std::vector pqc_ids; @@ -220,6 +224,8 @@ public: std::string database; std::string pqc_script; + bool with_h0_o0; + bool with_redox; std::vector pqc_ids; // std::map pqc_input;