From 01218ac7707cad106ae09e50f614878173a326b6 Mon Sep 17 00:00:00 2001 From: renchao_lu <renchao.lu@gmail.com> Date: Sun, 31 May 2020 18:44:54 +0200 Subject: [PATCH] [CL] Get component list. --- ChemistryLib/ChemicalSolverInterface.h | 5 +++++ ChemistryLib/PhreeqcIO.cpp | 13 +++++++++++++ ChemistryLib/PhreeqcIO.h | 2 ++ 3 files changed, 20 insertions(+) diff --git a/ChemistryLib/ChemicalSolverInterface.h b/ChemistryLib/ChemicalSolverInterface.h index 80f1bd607f5..96cf73c504b 100644 --- a/ChemistryLib/ChemicalSolverInterface.h +++ b/ChemistryLib/ChemicalSolverInterface.h @@ -23,6 +23,11 @@ public: virtual void doWaterChemistryCalculation( std::vector<GlobalVector*>& process_solutions, double const dt) = 0; + virtual std::vector<std::string> const getComponentList() const + { + return {}; + } + virtual ~ChemicalSolverInterface() = default; }; } // namespace ChemistryLib diff --git a/ChemistryLib/PhreeqcIO.cpp b/ChemistryLib/PhreeqcIO.cpp index 8f6999744f2..cb6088a50e7 100644 --- a/ChemistryLib/PhreeqcIO.cpp +++ b/ChemistryLib/PhreeqcIO.cpp @@ -543,5 +543,18 @@ std::istream& operator>>(std::istream& in, PhreeqcIO& phreeqc_io) return in; } + +std::vector<std::string> const PhreeqcIO::getComponentList() const +{ + std::vector<std::string> component_names; + auto const& components = _aqueous_solutions.front().components; + std::transform(components.begin(), components.end(), + std::back_inserter(component_names), + [](auto const& c) { return c.name; }); + + component_names.push_back("H"); + + return component_names; +} } // namespace PhreeqcIOData } // namespace ChemistryLib diff --git a/ChemistryLib/PhreeqcIO.h b/ChemistryLib/PhreeqcIO.h index 2db34efab46..1835c743aa7 100644 --- a/ChemistryLib/PhreeqcIO.h +++ b/ChemistryLib/PhreeqcIO.h @@ -77,6 +77,8 @@ public: friend std::istream& operator>>(std::istream& in, PhreeqcIO& phreeqc_io); + std::vector<std::string> const getComponentList() const override; + std::string const _phreeqc_input_file; private: -- GitLab