35{
37
39 auto&& phase_type = config.getConfigParameter<std::string>("type");
40
41 if (phase_type.empty())
42 {
43 OGS_FATAL(
"Phase type is a mandatory field and cannot be empty.");
44 }
45
46 std::array<std::string, 5> const allowed_phase_types = {
47 {"Solid", "FrozenLiquid", "AqueousLiquid", "NonAqueousLiquid", "Gas"}};
48
49 if (std::none_of(allowed_phase_types.begin(),
50 allowed_phase_types.end(),
51 [&phase_type](std::string const& type)
52 { return phase_type == type; }))
53 {
54 ERR(
"Phase type should be one of:");
55 for (auto const& type : allowed_phase_types)
56 {
58 }
59 OGS_FATAL(
"Wrong phase type '{:s}' given.", phase_type);
60 }
61
62
64 geometry_dimension,
66 config.getConfigSubtreeOptional("components"), parameters,
67 local_coordinate_system, curves);
68
69
71 geometry_dimension,
73 config.getConfigSubtreeOptional("properties"), parameters,
74 local_coordinate_system, curves);
75
76 if (components.empty() && !properties)
77 {
79 "Neither tag <components> nor tag <properties> has been set for "
80 "the phase '{:s}'.",
81 phase_type);
82 }
83
84 return std::make_unique<Phase>(std::move(phase_type), std::move(components),
85 std::move(properties));
86}
void ERR(fmt::format_string< Args... > fmt, Args &&... args)
std::unique_ptr< PropertyArray > createProperties(int const geometry_dimension, std::optional< BaseLib::ConfigTree > const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const ¶meters, ParameterLib::CoordinateSystem const *const local_coordinate_system, std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation > > const &curves)
std::vector< std::unique_ptr< Component > > createComponents(int const geometry_dimension, std::optional< BaseLib::ConfigTree > const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const ¶meters, ParameterLib::CoordinateSystem const *const local_coordinate_system, std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation > > const &curves)