28 int const geometry_dimension,
30 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>
const& parameters,
33 std::unique_ptr<MathLib::PiecewiseLinearInterpolation>>
const&
41 if (phase_type.empty())
43 OGS_FATAL(
"Phase type is a mandatory field and cannot be empty.");
46 std::array<std::string, 4>
const allowed_phase_types = {
47 {
"Solid",
"AqueousLiquid",
"NonAqueousLiquid",
"Gas"}};
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; }))
54 ERR(
"Phase type should be one of:");
55 for (
auto const& type : allowed_phase_types)
59 OGS_FATAL(
"Wrong phase type '{:s}' given.", phase_type);
67 local_coordinate_system, curves);
74 local_coordinate_system, curves);
76 if (components.empty() && !properties)
79 "Neither tag <components> nor tag <properties> has been set for "
84 return std::make_unique<Phase>(std::move(phase_type), std::move(components),
85 std::move(properties));
92 int const geometry_dimension,
93 std::optional<BaseLib::ConfigTree>
const& config,
94 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>
const& parameters,
97 std::unique_ptr<MathLib::PiecewiseLinearInterpolation>>
const&
105 std::vector<std::unique_ptr<Phase>> phases;
107 for (
auto phase_config :
109 config->getConfigSubtreeList(
"phase"))
111 auto phase =
createPhase(geometry_dimension, phase_config, parameters,
112 local_coordinate_system, curves);
114 if (std::find_if(phases.begin(),
116 [phase_name = phase->name](
auto const& p)
117 { return p->name == phase_name; }) != phases.end())
119 OGS_FATAL(
"Found duplicates with the same phase name tag '{:s}'.",
123 phases.push_back(std::move(phase));
void ERR(char const *fmt, Args const &... args)
Definition of the PiecewiseLinearInterpolation class.
std::optional< ConfigTree > getConfigSubtreeOptional(std::string const &root) const
T getConfigParameter(std::string const ¶m) const
std::vector< std::unique_ptr< Phase > > createPhases(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)
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::unique_ptr< MaterialPropertyLib::Phase > createPhase(int const geometry_dimension, 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)