OGS 6.2.1-499-g3b941532c.dirty.20191012113459
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 23 of file Component.h.

#include <Component.h>

Inheritance diagram for MaterialPropertyLib::Component:

Public Member Functions

 Component ()
 
 Component (std::string const &component_name, std::unique_ptr< PropertyArray > &&properties)
 Constructor for a custom component. More...
 
virtual ~Component ()=default
 
Property const & property (PropertyType const &) const
 A get-function for retrieving a certain property. More...
 
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 name () const
 

Protected Attributes

PropertyArray _properties
 The property array of the component. More...
 

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 19 of file Component.cpp.

References _properties, and MaterialPropertyLib::name.

20 {
21  // Some properties can be initialized by other default properties:
22  _properties[PropertyType::name] = std::make_unique<Constant>("no_name");
23 }
PropertyArray _properties
The property array of the component.
Definition: Component.h:72

◆ Component() [2/2]

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

Constructor for a custom component.

Definition at line 25 of file Component.cpp.

References _properties, MaterialPropertyLib::name, and MaterialPropertyLib::overwriteExistingProperties().

27 {
28  // Some properties can be initialized by other default properties:
30  std::make_unique<Constant>(component_name);
31 
32  if (properties)
33  {
34  overwriteExistingProperties(_properties, *properties, this);
35  }
36 }
void overwriteExistingProperties(PropertyArray &properties, PropertyArray &new_properties, std::variant< Medium *, Phase *, Component *> scale_pointer)
Definition: Property.h:115
PropertyArray _properties
The property array of the component.
Definition: Component.h:72

◆ ~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 59 of file Component.h.

References name(), and property().

63  {
64  return property(p).template d2Value<T>(variable_array, variable1,
65  variable2);
66  }
Property const & property(PropertyType const &) const
A get-function for retrieving a certain property.
Definition: Component.cpp:38
static const double p

◆ dValue()

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

Definition at line 51 of file Component.h.

References property().

54  {
55  return property(p).template dValue<T>(variable_array, variable);
56  }
Property const & property(PropertyType const &) const
A get-function for retrieving a certain property.
Definition: Component.cpp:38
static const double p

◆ name()

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

Definition at line 43 of file Component.cpp.

References _properties, and MaterialPropertyLib::name.

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

44 {
45  return std::get<std::string>(_properties[PropertyType::name]->value());
46 }
PropertyArray _properties
The property array of the component.
Definition: Component.h:72

◆ property()

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

A get-function for retrieving a certain property.

Definition at line 38 of file Component.cpp.

References _properties.

Referenced by d2Value(), dValue(), MaterialPropertyLib::molarMass(), and value().

39 {
40  return *_properties[p];
41 }
static const double p
PropertyArray _properties
The property array of the component.
Definition: Component.h:72

◆ value() [1/2]

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

Definition at line 39 of file Component.h.

References property().

40  {
41  return property(p).template value<T>();
42  }
Property const & property(PropertyType const &) const
A get-function for retrieving a certain property.
Definition: Component.cpp:38
static const double p

◆ value() [2/2]

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

Definition at line 45 of file Component.h.

References property().

46  {
47  return property(p).template value<T>(variable_array);
48  }
Property const & property(PropertyType const &) const
A get-function for retrieving a certain property.
Definition: Component.cpp:38
static const double p

Member Data Documentation

◆ _properties

PropertyArray MaterialPropertyLib::Component::_properties
protected

The property array of the component.

Definition at line 72 of file Component.h.

Referenced by Component(), name(), property(), and MaterialPropertyLib::Water::Water().


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