20 return "AqueousLiquid";
24 return "FrozenLiquid";
31 if (phase_name ==
"Solid")
35 if (phase_name ==
"AqueousLiquid")
39 if (phase_name ==
"Gas")
43 if (phase_name ==
"FrozenLiquid")
47 OGS_FATAL(
"Unknown phase name '{}'", phase_name);
51 std::vector<std::unique_ptr<Component>>&& components,
52 std::unique_ptr<PropertyArray>&& properties)
76 std::unique_ptr<MaterialPropertyLib::Component>
const&
component)
78 [&]() {
OGS_FATAL(
"Could not find component named '{:s}'.",
name); });
86 OGS_FATAL(
"Trying to access undefined property '{:s}' of {:s}",
113 Phase const& phase, std::span<PropertyType const>
const required_properties)
115 for (
auto const& p : required_properties)
119 OGS_FATAL(
"The property '{:s}' is missing in the {:s} phase.",
This class defines components (substances).
Property const & property(PropertyType const &p) const
PropertyArray properties_
std::string description() const
Short description of the phase with its name.
std::size_t numberOfComponents() const
A get-function for retrieving the number of components in this phase.
std::vector< std::unique_ptr< Component > > const components_
Property const & operator[](PropertyType const &p) const
bool hasProperty(PropertyType const &p) const
bool hasComponent(std::size_t const &index) const
PhaseName const phaseName
Component const & component(std::size_t const &index) const
Phase(PhaseName phase_name, std::vector< std::unique_ptr< Component > > &&components, std::unique_ptr< PropertyArray > &&properties)
The Phase constructor is called with the phase type enum.
ranges::range_reference_t< Range > findElementOrError(Range &range, std::predicate< ranges::range_reference_t< Range > > auto &&predicate, std::invocable auto error_callback)
void overwriteExistingProperties(PropertyArray &properties, PropertyArray &new_properties, std::variant< Medium *, Phase *, Component * > scale_pointer)
PhaseName fromString(std::string const &phase_name)
Convert string to phase enum. Throws if invalid phase name.
void checkRequiredProperties(Component const &c, std::span< PropertyType const > const required_properties)
PhaseName
Enumeration of phase types.
static const std::array< std::string, PropertyType::number_of_properties > property_enum_to_string
std::string_view toString(PhaseName phase_name)
Convert phase enum to its string representation.