From b0d6f00d8e7c39a2408d63b446518ad6fb8dbd2c Mon Sep 17 00:00:00 2001
From: renchao_lu <renchao.lu@gmail.com>
Date: Mon, 16 Sep 2019 13:41:11 +0200
Subject: [PATCH] [CL] Dropped time step size setter.

---
 ChemistryLib/ChemicalSolverInterface.h |  2 --
 ChemistryLib/PhreeqcIO.cpp             |  7 +++----
 ChemistryLib/PhreeqcIO.h               | 10 +++++++---
 ChemistryLib/PhreeqcKernel.h           |  4 ++--
 4 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/ChemistryLib/ChemicalSolverInterface.h b/ChemistryLib/ChemicalSolverInterface.h
index 9cce87bddf3..457b0ada10e 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 9bdb14e7da8..dd838877b30 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 ca931b88821..f150bfd6989 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 1d92991908f..2443af96cac 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;
-- 
GitLab