19 int const geometry_dimension,
21 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>& parameters,
24 std::unique_ptr<MathLib::PiecewiseLinearInterpolation>>
const&
32 if (phase_type_string.empty())
34 OGS_FATAL(
"Phase type is a mandatory field and cannot be empty.");
41 auto const phase_type =
fromString(phase_type_string);
48 local_coordinate_system, curves);
55 local_coordinate_system, curves);
57 if (components.empty() && !properties)
60 "Neither tag <components> nor tag <properties> has been set for "
65 return std::make_unique<Phase>(phase_type, std::move(components),
66 std::move(properties));
73 int const geometry_dimension,
74 std::optional<BaseLib::ConfigTree>
const& config,
75 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>& parameters,
78 std::unique_ptr<MathLib::PiecewiseLinearInterpolation>>
const&
86 std::vector<std::unique_ptr<Phase>> phases;
88 for (
auto phase_config :
90 config->getConfigSubtreeList(
"phase"))
92 auto phase = createPhase(geometry_dimension, phase_config, parameters,
93 local_coordinate_system, curves);
95 if (std::find_if(phases.begin(),
97 [phase_type = phase->phaseName](
auto const& p)
98 { return p->phaseName == phase_type; }) !=
101 OGS_FATAL(
"Found duplicates with the same phase name tag '{:s}'.",
105 phases.push_back(std::move(phase));
std::optional< ConfigTree > getConfigSubtreeOptional(std::string const &root) const
T getConfigParameter(std::string const ¶m) const
std::vector< std::unique_ptr< Component > > createComponents(int const geometry_dimension, std::optional< BaseLib::ConfigTree > const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > ¶meters, ParameterLib::CoordinateSystem const *const local_coordinate_system, std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation > > const &curves)
PhaseName fromString(std::string const &phase_name)
Convert string to phase enum. Throws if invalid phase name.
std::unique_ptr< PropertyArray > createProperties(int const geometry_dimension, std::optional< BaseLib::ConfigTree > const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > ¶meters, ParameterLib::CoordinateSystem const *const local_coordinate_system, std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation > > const &curves)
std::vector< std::unique_ptr< Phase > > createPhases(int const geometry_dimension, std::optional< BaseLib::ConfigTree > const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > ¶meters, ParameterLib::CoordinateSystem const *const local_coordinate_system, std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation > > const &curves)
std::string_view toString(PhaseName phase_name)
Convert phase enum to its string representation.
std::unique_ptr< MaterialPropertyLib::Phase > createPhase(int const geometry_dimension, BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > ¶meters, ParameterLib::CoordinateSystem const *const local_coordinate_system, std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation > > const &curves)
A local coordinate system used for tensor transformations.