OGS
MaterialPropertyLib::Medium Class Referencefinal

Detailed Description

This class is for material objects on the Medium scale.

A Medium consists of an arbitrarily long vector of phases and an array of properties.

Definition at line 31 of file Medium.h.

#include <Medium.h>

Public Member Functions

 Medium (std::vector< std::unique_ptr< Phase >> &&phases, std::unique_ptr< PropertyArray > &&properties)
 
Phase const & phase (std::size_t index) const
 
Phase const & phase (std::string const &phase_name) const
 A get-function for a particular phase by phase name. More...
 
bool hasPhase (std::string const &phase_name) const
 A query for a named phase. More...
 
Property const & property (PropertyType const &p) const
 
Property const & operator[] (PropertyType const &p) const
 
bool hasProperty (PropertyType const &p) const
 
std::size_t numberOfPhases () const
 
template<typename T >
value (PropertyType const p) const
 
template<typename T >
value (PropertyType const p, VariableArray const &variable_array) const
 
template<typename T >
dValue (PropertyType const p, VariableArray const &variable_array, Variable const variable) const
 
template<typename T >
d2Value (PropertyType const p, VariableArray const &variable_array, Variable const variable1, Variable const variable2) const
 

Static Public Member Functions

static std::string description ()
 Short description of the medium. More...
 

Private Attributes

std::vector< std::unique_ptr< Phase > > const phases_
 The vector that holds the phases. More...
 
PropertyArray properties_
 

Constructor & Destructor Documentation

◆ Medium()

MaterialPropertyLib::Medium::Medium ( std::vector< std::unique_ptr< Phase >> &&  phases,
std::unique_ptr< PropertyArray > &&  properties 
)

Definition at line 20 of file Medium.cpp.

22  : phases_(std::move(phases))
23 {
24  if (properties)
25  {
26  overwriteExistingProperties(properties_, *properties, this);
27  }
28 }
std::vector< std::unique_ptr< Phase > > const phases_
The vector that holds the phases.
Definition: Medium.h:93
PropertyArray properties_
Definition: Medium.h:100
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

◆ d2Value()

template<typename T >
T MaterialPropertyLib::Medium::d2Value ( PropertyType const  p,
VariableArray const &  variable_array,
Variable const  variable1,
Variable const  variable2 
) const
inline

Definition at line 82 of file Medium.h.

86  {
87  return property(p).template d2Value<T>(variable_array, variable1,
88  variable2);
89  }
Property const & property(PropertyType const &p) const
Definition: Medium.cpp:51

References property().

◆ description()

std::string MaterialPropertyLib::Medium::description ( )
static

Short description of the medium.

Definition at line 77 of file Medium.cpp.

78 {
79  return "medium";
80 }

Referenced by property().

◆ dValue()

template<typename T >
T MaterialPropertyLib::Medium::dValue ( PropertyType const  p,
VariableArray const &  variable_array,
Variable const  variable 
) const
inline

Definition at line 74 of file Medium.h.

77  {
78  return property(p).template dValue<T>(variable_array, variable);
79  }

References property().

◆ hasPhase()

bool MaterialPropertyLib::Medium::hasPhase ( std::string const &  phase_name) const

A query for a named phase.

Definition at line 44 of file Medium.cpp.

45 {
46  return std::any_of(begin(phases_), end(phases_),
47  [&phase_name](auto const& phase)
48  { return phase->name == phase_name; });
49 }
Phase const & phase(std::size_t index) const
Definition: Medium.cpp:30
std::string const name
Definition: Phase.h:61

References MaterialPropertyLib::Phase::name, phase(), and phases_.

Referenced by MaterialPropertyLib::fluidPhase().

◆ hasProperty()

bool MaterialPropertyLib::Medium::hasProperty ( PropertyType const &  p) const

◆ numberOfPhases()

std::size_t MaterialPropertyLib::Medium::numberOfPhases ( ) const

A simple get-function for retrieving the number of phases the medium consists of.

Definition at line 72 of file Medium.cpp.

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

References phases_.

◆ operator[]()

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

Definition at line 62 of file Medium.cpp.

63 {
64  return property(p);
65 }

References property().

◆ phase() [1/2]

◆ phase() [2/2]

Phase const & MaterialPropertyLib::Medium::phase ( std::string const &  phase_name) const

A get-function for a particular phase by phase name.

Definition at line 35 of file Medium.cpp.

36 {
38  phases_.begin(), phases_.end(),
39  [&phase_name](std::unique_ptr<MaterialPropertyLib::Phase> const& phase)
40  { return phase->name == phase_name; },
41  "Could not find phase name '" + phase_name + "'.");
42 }
std::iterator_traits< InputIt >::reference findElementOrError(InputIt begin, InputIt end, Predicate predicate, std::string const &error="")
Definition: Algorithm.h:69

References BaseLib::findElementOrError(), phase(), and phases_.

◆ property()

Property const & MaterialPropertyLib::Medium::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 Medium.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
static std::string description()
Short description of the medium.
Definition: Medium.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 d2Value(), dValue(), operator[](), ProcessLib::RichardsMechanics::updateSwellingStressAndVolumetricStrain(), and value().

◆ value() [1/2]

template<typename T >
T MaterialPropertyLib::Medium::value ( PropertyType const  p) const
inline

Definition at line 62 of file Medium.h.

63  {
64  return property(p).template value<T>();
65  }

References property().

◆ value() [2/2]

template<typename T >
T MaterialPropertyLib::Medium::value ( PropertyType const  p,
VariableArray const &  variable_array 
) const
inline

Definition at line 68 of file Medium.h.

69  {
70  return property(p).template value<T>(variable_array);
71  }

References property().

Member Data Documentation

◆ phases_

std::vector<std::unique_ptr<Phase> > const MaterialPropertyLib::Medium::phases_
private

The vector that holds the phases.

Definition at line 93 of file Medium.h.

Referenced by hasPhase(), numberOfPhases(), and phase().

◆ properties_

PropertyArray MaterialPropertyLib::Medium::properties_
private

The array that holds the medium properties.

Currently, these defaults is the volume fraction average.

Most properties are fine with the volume fraction average, but special-defaults are allowed as well...

Definition at line 100 of file Medium.h.

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


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