OGS
MaterialPropertyLib::Component Class Reference

Detailed Description

This class defines components (substances).

The Component class is a base class used for not further specified components. Components are specified by the property 'name'. For specified components we derive special classes from this class (for clarity they are located in the 'components' subfolder).

Definition at line 25 of file Component.h.

#include <Component.h>

Inheritance diagram for MaterialPropertyLib::Component:
[legend]

Public Member Functions

 Component ()
 
 Component (std::string const &component_name, std::unique_ptr< PropertyArray > &&properties)
 Constructor for a custom component.
 
virtual ~Component ()=default
 
Property const & property (PropertyType const &) const
 A get-function for retrieving a certain property.
 
Property const & operator[] (PropertyType const &p) const
 
bool hasProperty (PropertyType const &p) 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
 
std::string description () const
 Short description of the component with its name.
 

Public Attributes

std::string const name
 

Protected Attributes

PropertyArray properties_
 The property array of the component.
 

Constructor & Destructor Documentation

◆ Component() [1/2]

MaterialPropertyLib::Component::Component ( )

Default constructor of Component. This constructor is used when the component is not specified via the 'name'-tag.

Definition at line 21 of file Component.cpp.

21{}

◆ Component() [2/2]

MaterialPropertyLib::Component::Component ( std::string const & component_name,
std::unique_ptr< PropertyArray > && properties )

Constructor for a custom component.

Definition at line 23 of file Component.cpp.

25 : name(component_name)
26{
27 if (properties)
28 {
29 overwriteExistingProperties(properties_, *properties, this);
30 }
31}
PropertyArray properties_
The property array of the component.
Definition Component.h:82
void overwriteExistingProperties(PropertyArray &properties, PropertyArray &new_properties, std::variant< Medium *, Phase *, Component * > scale_pointer)
Definition Property.h:322

References MaterialPropertyLib::overwriteExistingProperties(), and properties_.

◆ ~Component()

virtual MaterialPropertyLib::Component::~Component ( )
virtualdefault

Member Function Documentation

◆ d2Value()

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

Definition at line 65 of file Component.h.

69 {
70 return property(p).template d2Value<T>(variable_array, variable1,
71 variable2);
72 }
Property const & property(PropertyType const &) const
A get-function for retrieving a certain property.
Definition Component.cpp:33

References property().

◆ description()

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

Short description of the component with its name.

Definition at line 55 of file Component.cpp.

56{
57 return "component '" + name + "'";
58}

References name.

Referenced by property().

◆ dValue()

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

Definition at line 57 of file Component.h.

60 {
61 return property(p).template dValue<T>(variable_array, variable);
62 }

References property().

◆ hasProperty()

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

Definition at line 50 of file Component.cpp.

51{
52 return properties_[p] != nullptr;
53}

References properties_.

◆ operator[]()

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

Definition at line 45 of file Component.cpp.

46{
47 return property(p);
48}

References property().

◆ property()

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

A get-function for retrieving a certain property.

Definition at line 33 of file Component.cpp.

34{
35 Property const* const property = properties_[p].get();
36 if (property == nullptr)
37 {
38 OGS_FATAL("Trying to access undefined property '{:s}' of {:s}",
40 }
41
42 return *properties_[p];
43}
#define OGS_FATAL(...)
Definition Error.h:26
std::string description() const
Short description of the component with its name.
Definition Component.cpp:55
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 d2Value(), dValue(), ProcessLib::TH2M::ConstitutiveRelations::PhaseTransition::eval(), operator[](), property(), value(), and value().

◆ value() [1/2]

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

Definition at line 45 of file Component.h.

46 {
47 return property(p).template value<T>();
48 }

References property().

◆ value() [2/2]

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

Definition at line 51 of file Component.h.

52 {
53 return property(p).template value<T>(variable_array);
54 }

References property().

Member Data Documentation

◆ name

std::string const MaterialPropertyLib::Component::name

Definition at line 78 of file Component.h.

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

◆ properties_

PropertyArray MaterialPropertyLib::Component::properties_
protected

The property array of the component.

Definition at line 82 of file Component.h.

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


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