diff --git a/ChemistryLib/PhreeqcIO.cpp b/ChemistryLib/PhreeqcIO.cpp index 05f942f6376bd450c5d70d06817062dc6691c03f..14d991949461768776552bd881ea2867f460db16 100644 --- a/ChemistryLib/PhreeqcIO.cpp +++ b/ChemistryLib/PhreeqcIO.cpp @@ -220,12 +220,14 @@ std::ostream& operator<<(std::ostream& os, PhreeqcIO const& phreeqc_io) os << equilibrium_phases << "\n"; } - auto const& kinetic_reactants = - phreeqc_io._kinetic_reactants[chemical_system_id]; + auto const& kinetic_reactants = phreeqc_io._kinetic_reactants; if (!kinetic_reactants.empty()) { os << "KINETICS " << chemical_system_id + 1 << "\n"; - os << kinetic_reactants; + for (auto const& kinetic_reactant : kinetic_reactants) + { + kinetic_reactant.print(os, chemical_system_id); + } os << "-steps " << phreeqc_io._dt << "\n" << "\n"; } diff --git a/ChemistryLib/PhreeqcIOData/KineticReactant.cpp b/ChemistryLib/PhreeqcIOData/KineticReactant.cpp index 8f2ab34fd521a6c1ffd6a5daafc6772d40393348..f2d7402139b386aff44b6e2e25461b50d69986f0 100644 --- a/ChemistryLib/PhreeqcIOData/KineticReactant.cpp +++ b/ChemistryLib/PhreeqcIOData/KineticReactant.cpp @@ -13,28 +13,26 @@ namespace ChemistryLib { -std::ostream& operator<<(std::ostream& os, - KineticReactant const& kinetic_reactant) +void KineticReactant::print(std::ostream& os, + std::size_t const chemical_system_id) const { - os << kinetic_reactant.name << "\n"; + os << name << "\n"; - if (!kinetic_reactant.chemical_formula.empty()) + if (!chemical_formula.empty()) { - os << "-formula " << kinetic_reactant.chemical_formula << "\n"; + os << "-formula " << chemical_formula << "\n"; } - os << "-m " << kinetic_reactant.amount << "\n"; + os << "-m " << (*amount)[chemical_system_id] << "\n"; - if (!kinetic_reactant.parameters.empty()) + if (!parameters.empty()) { os << "-parms"; - for (auto const& parameter : kinetic_reactant.parameters) + for (auto const& parameter : parameters) { os << " " << parameter; } os << "\n"; } - - return os; } } // namespace ChemistryLib diff --git a/ChemistryLib/PhreeqcIOData/KineticReactant.h b/ChemistryLib/PhreeqcIOData/KineticReactant.h index 557582e1d36856d381b1d21b09c2149de3adcc3f..dc993e2f31d615b6feee7e75a5b9207b597785c3 100644 --- a/ChemistryLib/PhreeqcIOData/KineticReactant.h +++ b/ChemistryLib/PhreeqcIOData/KineticReactant.h @@ -32,8 +32,7 @@ struct KineticReactant { } - friend std::ostream& operator<<(std::ostream& os, - KineticReactant const& kinetic_reactant); + void print(std::ostream& os, std::size_t const chemical_system_id) const; std::string const name; std::string const chemical_formula;