diff --git a/ChemistryLib/ChemicalSolverInterface.h b/ChemistryLib/ChemicalSolverInterface.h index 9cce87bddf3e88a6993fa39162a81c8e6202bdd3..457b0ada10e43536dab43cd3ffec6390f54dde62 100644 --- a/ChemistryLib/ChemicalSolverInterface.h +++ b/ChemistryLib/ChemicalSolverInterface.h @@ -20,8 +20,6 @@ public: virtual void doWaterChemistryCalculation( std::vector<GlobalVector*>& process_solutions, double const dt) = 0; - virtual void setTimeStepSize(double const dt) = 0; - virtual ~ChemicalSolverInterface() = default; }; } // namespace ChemistryLib diff --git a/ChemistryLib/PhreeqcIO.cpp b/ChemistryLib/PhreeqcIO.cpp index 9bdb14e7da89a3f05bbec87ae8be74c1836b0232..dd838877b30f4188548170938ec53059aaf4972c 100644 --- a/ChemistryLib/PhreeqcIO.cpp +++ b/ChemistryLib/PhreeqcIO.cpp @@ -87,9 +87,8 @@ void PhreeqcIO::doWaterChemistryCalculation( { setAqueousSolutionsOrUpdateProcessSolutions( process_solutions, Status::SettingAqueousSolutions); - setTimeStepSize(dt); - writeInputsToFile(); + writeInputsToFile(dt); execute(); @@ -175,7 +174,7 @@ void PhreeqcIO::setAqueousSolutionsOrUpdateProcessSolutions( } } -void PhreeqcIO::writeInputsToFile() +void PhreeqcIO::writeInputsToFile(double const dt) { DBUG("Writing phreeqc inputs into file '%s'.", _phreeqc_input_file.c_str()); std::ofstream out(_phreeqc_input_file, std::ofstream::out); @@ -186,7 +185,7 @@ void PhreeqcIO::writeInputsToFile() _phreeqc_input_file.c_str()); } - out << *this; + out << (*this << dt); if (!out) { diff --git a/ChemistryLib/PhreeqcIO.h b/ChemistryLib/PhreeqcIO.h index ca931b88821606d46cae785cde70783dad4df66e..f150bfd69899b0beec52b334c918fb95331277ee 100644 --- a/ChemistryLib/PhreeqcIO.h +++ b/ChemistryLib/PhreeqcIO.h @@ -51,9 +51,7 @@ public: std::vector<GlobalVector*> const& process_solutions, Status const status); - void setTimeStepSize(double const dt) override { _dt = dt; } - - void writeInputsToFile(); + void writeInputsToFile(double const dt); void execute(); @@ -67,6 +65,12 @@ public: std::string const _phreeqc_input_file; private: + PhreeqcIO& operator<<(int dt) + { + _dt = dt; + return *this; + } + std::string const _database; std::vector<AqueousSolution> _aqueous_solutions; std::vector<EquilibriumPhase> _equilibrium_phases; diff --git a/ChemistryLib/PhreeqcKernel.h b/ChemistryLib/PhreeqcKernel.h index 1d92991908fc4e1431045a2ea1464ed406fe170a..2443af96cac64c5cb25135e3ea88b1eb123c3c1e 100644 --- a/ChemistryLib/PhreeqcKernel.h +++ b/ChemistryLib/PhreeqcKernel.h @@ -47,8 +47,6 @@ public: void setAqueousSolutions( std::vector<GlobalVector*> const& process_solutions); - void setTimeStepSize(double const dt) override; - void execute(std::vector<GlobalVector*>& process_solutions); void updateNodalProcessSolutions( @@ -70,6 +68,8 @@ private: return strcmp(element, "H") == 0 ? true : false; } + void setTimeStepSize(double const dt); + std::map<int, struct master*> _process_id_to_master_map; cxxISolution _initial_aqueous_solution; std::vector<ReactionRate> const _reaction_rates;