OGS
CreateSecondaryVariables.cpp
Go to the documentation of this file.
1
12
13#include "BaseLib/ConfigTree.h"
14#include "SecondaryVariable.h"
15
16namespace ProcessLib
17{
19 SecondaryVariableCollection& secondary_variables)
20{
21 auto sec_vars_config =
23 config.getConfigSubtreeOptional("secondary_variables");
24 if (!sec_vars_config)
25 {
26 return;
27 }
28
29 for (
30 auto sec_var_config :
32 sec_vars_config->getConfigSubtreeList("secondary_variable"))
33 {
34 auto const type =
36 sec_var_config.getConfigAttributeOptional<std::string>("type");
37 if (type)
38 {
39 WARN(
40 "Secondary variable type specification is deprecated and is "
41 "ignored. All secondary variable types are 'static'.");
42 }
43
44 auto const internal_name =
46 sec_var_config.getConfigAttribute<std::string>("internal_name");
47 auto const output_name =
49 sec_var_config.getConfigAttribute<std::string>("output_name");
50
51 secondary_variables.addNameMapping(internal_name, output_name);
52 }
53}
54
55} // namespace ProcessLib
void WARN(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:40
std::optional< ConfigTree > getConfigSubtreeOptional(std::string const &root) const
Handles configuration of several secondary variables from the project file.
void addNameMapping(std::string const &internal_name, std::string const &external_name)
Register a variable with the given internal and external names.
void createSecondaryVariables(BaseLib::ConfigTree const &config, SecondaryVariableCollection &secondary_variables)