OGS
MaterialPropertyLib::Phase Class Referencefinal

Detailed Description

This class defines material phases.

The Phase class consists of a vector of components and an array of properties.

Definition at line 36 of file Phase.h.

#include <Phase.h>

Public Member Functions

 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.
Component const & component (std::size_t const &index) const
bool hasComponent (std::size_t const &index) const
Component const & component (std::string const &name) const
 A get-function for a component by component name.
Property const & property (PropertyType const &p) const
Property const & operator[] (PropertyType const &p) const
bool hasProperty (PropertyType const &p) const
std::size_t numberOfComponents () const
 A get-function for retrieving the number of components in this phase.
std::string description () const
 Short description of the phase with its name.

Public Attributes

PhaseName const phaseName

Private Attributes

std::vector< std::unique_ptr< Component > > const components_
PropertyArray properties_

Constructor & Destructor Documentation

◆ Phase()

MaterialPropertyLib::Phase::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.

Definition at line 50 of file Phase.cpp.

53 : phaseName(phase_name), components_(std::move(components))
54{
55 if (properties)
56 {
57 overwriteExistingProperties(properties_, *properties, this);
58 }
59}
PropertyArray properties_
Definition Phase.h:77
std::vector< std::unique_ptr< Component > > const components_
Definition Phase.h:70
PhaseName const phaseName
Definition Phase.h:67
void overwriteExistingProperties(PropertyArray &properties, PropertyArray &new_properties, std::variant< Medium *, Phase *, Component * > scale_pointer)

References components_, MaterialPropertyLib::overwriteExistingProperties(), phaseName, and properties_.

Member Function Documentation

◆ component() [1/2]

Component const & MaterialPropertyLib::Phase::component ( std::size_t const & index) const

◆ component() [2/2]

Component const & MaterialPropertyLib::Phase::component ( std::string const & name) const

A get-function for a component by component name.

Definition at line 71 of file Phase.cpp.

72{
75 [&name](
76 std::unique_ptr<MaterialPropertyLib::Component> const& component)
77 { return component->name == name; },
78 [&]() { OGS_FATAL("Could not find component named '{:s}'.", name); });
79}
#define OGS_FATAL(...)
Definition Error.h:19
Component const & component(std::size_t const &index) const
Definition Phase.cpp:61
ranges::range_reference_t< Range > findElementOrError(Range &range, std::predicate< ranges::range_reference_t< Range > > auto &&predicate, std::invocable auto error_callback)
Definition Algorithm.h:74

References component(), components_, BaseLib::findElementOrError(), MaterialPropertyLib::name, and OGS_FATAL.

◆ description()

std::string MaterialPropertyLib::Phase::description ( ) const

Short description of the phase with its name.

Definition at line 107 of file Phase.cpp.

108{
109 return "phase '" + std::string(toString(phaseName)) + "'";
110}
std::string_view toString(PhaseName phase_name)
Convert phase enum to its string representation.
Definition Phase.cpp:13

References phaseName, and MaterialPropertyLib::toString().

Referenced by property().

◆ hasComponent()

bool MaterialPropertyLib::Phase::hasComponent ( std::size_t const & index) const

Definition at line 66 of file Phase.cpp.

67{
68 return components_[index] != nullptr;
69}

References components_.

◆ hasProperty()

◆ numberOfComponents()

std::size_t MaterialPropertyLib::Phase::numberOfComponents ( ) const

A get-function for retrieving the number of components in this phase.

Definition at line 102 of file Phase.cpp.

103{
104 return components_.size();
105}

References components_.

◆ operator[]()

Property const & MaterialPropertyLib::Phase::operator[] ( PropertyType const & p) const

Definition at line 92 of file Phase.cpp.

93{
94 return property(p);
95}
Property const & property(PropertyType const &p) const
Definition Phase.cpp:81

References property().

◆ property()

Property const & MaterialPropertyLib::Phase::property ( PropertyType const & p) const

A get-function for a property. The argument refers to the name of the property.

Definition at line 81 of file Phase.cpp.

82{
83 Property const* const property = properties_[p].get();
84 if (property == nullptr)
85 {
86 OGS_FATAL("Trying to access undefined property '{:s}' of {:s}",
88 }
89 return *properties_[p];
90}
std::string description() const
Short description of the phase with its name.
Definition Phase.cpp:107
static const std::array< std::string, PropertyType::number_of_properties > property_enum_to_string

References description(), OGS_FATAL, properties_, property(), and MaterialPropertyLib::property_enum_to_string.

Referenced by ProcessLib::ThermoRichardsFlow::ThermoRichardsFlowLocalAssembler< ShapeFunction, GlobalDim >::assemble(), ProcessLib::ThermoRichardsFlow::ThermoRichardsFlowLocalAssembler< ShapeFunction, GlobalDim >::assembleWithJacobian(), ProcessLib::LargeDeformation::SolidDensityModel::eval(), ProcessLib::SmallDeformation::SolidDensityModel::eval(), ProcessLib::ThermoRichardsMechanics::LiquidViscosityModel< DisplacementDim >::eval(), ProcessLib::ThermoRichardsMechanics::SolidDensityModel< DisplacementDim >::eval(), ProcessLib::ThermoRichardsMechanics::SolidThermalExpansionModel< DisplacementDim >::eval(), ProcessLib::ThermoRichardsMechanics::TRMHeatStorageAndFluxModel< DisplacementDim >::eval(), ProcessLib::ThermoRichardsMechanics::TRMVaporDiffusionModel< DisplacementDim >::eval(), MaterialPropertyLib::getFluidDensity(), MaterialPropertyLib::getLiquidThermalExpansivity(), operator[](), property(), and ProcessLib::RichardsMechanics::updateSwellingStressAndVolumetricStrain().

Member Data Documentation

◆ components_

std::vector<std::unique_ptr<Component> > const MaterialPropertyLib::Phase::components_
private

Definition at line 70 of file Phase.h.

Referenced by Phase(), component(), component(), hasComponent(), and numberOfComponents().

◆ phaseName

PhaseName const MaterialPropertyLib::Phase::phaseName

Definition at line 67 of file Phase.h.

Referenced by Phase(), MaterialPropertyLib::checkRequiredProperties(), and description().

◆ properties_

PropertyArray MaterialPropertyLib::Phase::properties_
private

Here, all for all properties listed in the Properties enumerator are initialized by mole average functions of value zero. However, 'special-default' properties are allowed to be set.

After this, other special properties can be set as exceptional defaults.

Definition at line 77 of file Phase.h.

Referenced by Phase(), hasProperty(), and property().


The documentation for this class was generated from the following files: