Skip to content
Snippets Groups Projects
Commit 04941a0a authored by renchao.lu's avatar renchao.lu
Browse files

[CL] Get chemical formula of a component if given

parent 60545a63
No related branches found
No related tags found
No related merge requests found
......@@ -32,9 +32,13 @@ namespace PhreeqcIOData
{
struct Component
{
explicit Component(std::string name_) : name(std::move(name_)) {}
explicit Component(std::string name_, std::string chemical_formula_)
: name(std::move(name_)), chemical_formula(std::move(chemical_formula_))
{
}
std::string const name;
std::string const chemical_formula;
std::unique_ptr<GlobalVector> amount;
static const ItemType item_type = ItemType::Component;
};
......
......@@ -21,13 +21,18 @@ std::vector<Component> createSolutionComponents(
{
std::vector<Component> components;
//! \ogs_file_param{prj__chemical_system__solution__components}
auto comp_config = config.getConfigSubtree("components");
auto components_config = config.getConfigSubtree("components");
for (
auto const& component_name :
auto const& comp_config :
//! \ogs_file_param{prj__chemical_system__solution__components__component}
comp_config.getConfigParameterList<std::string>("component"))
components_config.getConfigSubtreeList("component"))
{
components.emplace_back(component_name);
auto const component_name = comp_config.getValue<std::string>();
auto const chemical_formula =
//! \ogs_file_attr{prj__chemical_system__solution__components__component__chemical_formula}
comp_config.getConfigAttribute<std::string>("chemical_formula", "");
components.emplace_back(component_name, chemical_formula);
}
return components;
......
chemical formula alternative to a component when defining water composition.
define the element in the aqueous solution.
define a list of elements in the initial solution.
define a list of elements in the aqueous solution.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment