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 31 of file Phase.h.

#include <Phase.h>

Public Member Functions

 Phase (std::string &&phase_name, std::vector< std::unique_ptr< Component > > &&components, std::unique_ptr< PropertyArray > &&properties)
 The Phase constructor is called with the optional phase name.
 
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

std::string const name
 

Private Attributes

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

Constructor & Destructor Documentation

◆ Phase()

MaterialPropertyLib::Phase::Phase ( std::string && phase_name,
std::vector< std::unique_ptr< Component > > && components,
std::unique_ptr< PropertyArray > && properties )

The Phase constructor is called with the optional phase name.

Definition at line 22 of file Phase.cpp.

25 : name(std::move(phase_name)), components_(std::move(components))
26{
27 if (properties)
28 {
29 overwriteExistingProperties(properties_, *properties, this);
30 }
31}
PropertyArray properties_
Definition Phase.h:72
std::string const name
Definition Phase.h:62
std::vector< std::unique_ptr< Component > > const components_
Definition Phase.h:65
void overwriteExistingProperties(PropertyArray &properties, PropertyArray &new_properties, std::variant< Medium *, Phase *, Component * > scale_pointer)
Definition Property.h:322

References MaterialPropertyLib::overwriteExistingProperties(), and properties_.

Member Function Documentation

◆ component() [1/2]

◆ 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 43 of file Phase.cpp.

44{
47 [&name](
48 std::unique_ptr<MaterialPropertyLib::Component> const& component)
49 { return component->name == name; },
50 [&]() { OGS_FATAL("Could not find component named '{:s}.'", name); });
51}
#define OGS_FATAL(...)
Definition Error.h:26
Component const & component(std::size_t const &index) const
Definition Phase.cpp:33
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:77

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

◆ description()

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

Short description of the phase with its name.

Definition at line 79 of file Phase.cpp.

80{
81 return "phase '" + name + "'";
82}

References name.

Referenced by property().

◆ hasComponent()

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

Definition at line 38 of file Phase.cpp.

39{
40 return components_[index] != nullptr;
41}

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 74 of file Phase.cpp.

75{
76 return components_.size();
77}

References components_.

◆ operator[]()

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

Definition at line 64 of file Phase.cpp.

65{
66 return property(p);
67}
Property const & property(PropertyType const &p) const
Definition Phase.cpp:53

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 53 of file Phase.cpp.

54{
55 Property const* const property = properties_[p].get();
56 if (property == nullptr)
57 {
58 OGS_FATAL("Trying to access undefined property '{:s}' of {:s}",
60 }
61 return *properties_[p];
62}
std::string description() const
Short description of the phase with its name.
Definition Phase.cpp:79
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::TH2M::ConstitutiveRelations::SolidThermalExpansionModel< DisplacementDim >::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(), ProcessLib::LiquidFlow::getFluidDensityAndViscosity(), ProcessLib::ComponentTransport::LocalAssemblerData< ShapeFunction, GlobalDim >::getHeatEnergyCoefficient(), ProcessLib::HT::HTFEM< ShapeFunction, GlobalDim >::getHeatEnergyCoefficient(), 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 65 of file Phase.h.

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

◆ name

std::string const MaterialPropertyLib::Phase::name

◆ 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 72 of file Phase.h.

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


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