Commit 19f6c8eb authored by renchao.lu's avatar renchao.lu
Browse files

[CL] Chemical formula of a phase.

parent ec151d49
......@@ -29,6 +29,11 @@ std::vector<KineticReactant> createKineticReactants(
//! \ogs_file_param{prj__chemical_system__kinetic_reactants__kinetic_reactant__name}
auto name = reactant_config.getConfigParameter<std::string>("name");
auto chemical_formula =
//! \ogs_file_param{prj__chemical_system__kinetic_reactants__kinetic_reactant__chemical_formula}
reactant_config.getConfigParameter<std::string>("chemical_formula",
"");
double const initial_amount =
//! \ogs_file_param{prj__chemical_system__kinetic_reactants__kinetic_reactant__initial_amount}
reactant_config.getConfigParameter<double>("initial_amount");
......@@ -38,8 +43,10 @@ std::vector<KineticReactant> createKineticReactants(
reactant_config.getConfigParameterOptional<std::vector<double>>(
"parameters");
kinetic_reactants.emplace_back(
std::move(name), initial_amount, std::move(parameters));
kinetic_reactants.emplace_back(std::move(name),
std::move(chemical_formula),
initial_amount,
std::move(parameters));
}
return kinetic_reactants;
......
......@@ -20,6 +20,11 @@ std::ofstream& operator<<(std::ofstream& out,
{
out << kinetic_reactant.name << "\n";
if (!kinetic_reactant.chemical_formula.empty())
{
out << "-formula " << kinetic_reactant.chemical_formula << "\n";
}
out << "-m " << kinetic_reactant.amount << "\n";
if (!kinetic_reactant.parameters.empty())
......
......@@ -21,10 +21,12 @@ namespace ChemistryLib
struct KineticReactant
{
KineticReactant(std::string name_,
std::string&& chemical_formula_,
double amount_,
boost::optional<std::vector<double>>
parameters_)
: name(std::move(name_)),
chemical_formula(std::move(chemical_formula_)),
amount(amount_),
parameters(parameters_ ? std::move(*parameters_)
: std::vector<double>{})
......@@ -36,6 +38,7 @@ struct KineticReactant
std::vector<KineticReactant> const& kinetic_reactants);
std::string const name;
std::string const chemical_formula;
double amount;
std::vector<double> const parameters;
static const ItemType item_type = ItemType::KineticReactant;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment