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 30 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. More...
 
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. More...
 
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. More...
 
std::string description () const
 Short description of the phase with its name. More...
 

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

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

References MaterialPropertyLib::overwriteExistingProperties(), 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 42 of file Phase.cpp.

43 {
45  components_.begin(), components_.end(),
46  [&name](std::unique_ptr<Component> const& component)
47  { return component->name == name; },
48  "Could not find component name '" + name + "'.");
49 }
Component const & component(std::size_t const &index) const
Definition: Phase.cpp:32
std::iterator_traits< InputIt >::reference findElementOrError(InputIt begin, InputIt end, Predicate predicate, std::string const &error="")
Definition: Algorithm.h:69

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

◆ description()

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

Short description of the phase with its name.

Definition at line 77 of file Phase.cpp.

78 {
79  return "phase '" + name + "'";
80 }

References name.

Referenced by property().

◆ hasComponent()

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

Definition at line 37 of file Phase.cpp.

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

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

73 {
74  return components_.size();
75 }

References components_.

◆ operator[]()

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

Definition at line 62 of file Phase.cpp.

63 {
64  return property(p);
65 }
Property const & property(PropertyType const &p) const
Definition: Phase.cpp:51

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

52 {
53  Property const* const property = properties_[p].get();
54  if (property == nullptr)
55  {
56  OGS_FATAL("Trying to access undefined property '{:s}' of {:s}",
58  }
59  return *properties_[p];
60 }
#define OGS_FATAL(...)
Definition: Error.h:26
std::string description() const
Short description of the phase with its name.
Definition: Phase.cpp:77
static const std::array< std::string, PropertyType::number_of_properties > property_enum_to_string
Definition: PropertyType.h:111

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

Referenced by ProcessLib::ThermoRichardsFlow::ThermoRichardsFlowLocalAssembler< ShapeFunction, IntegrationMethod, GlobalDim >::assemble(), ProcessLib::ThermoRichardsFlow::ThermoRichardsFlowLocalAssembler< ShapeFunction, IntegrationMethod, GlobalDim >::assembleWithJacobian(), MaterialPropertyLib::getLiquidThermalExpansivity(), operator[](), and ProcessLib::RichardsMechanics::updateSwellingStressAndVolumetricStrain().

Member Data Documentation

◆ components_

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

Definition at line 64 of file Phase.h.

Referenced by 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 71 of file Phase.h.

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


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