OGS 6.2.1-499-g3b941532c.dirty.20191012113459
Component.h
Go to the documentation of this file.
1 
12 #pragma once
13 
14 #include "Property.h"
15 
16 namespace MaterialPropertyLib
17 {
23 class Component
24 {
25 public:
28  Component();
29 
31  Component(std::string const& component_name,
32  std::unique_ptr<PropertyArray>&& properties);
33  virtual ~Component() = default;
34 
36  Property const& property(PropertyType const& /*p*/) const;
37 
38  template <typename T>
39  T value(PropertyType const p) const
40  {
41  return property(p).template value<T>();
42  }
43 
44  template <typename T>
45  T value(PropertyType const p, VariableArray const& variable_array) const
46  {
47  return property(p).template value<T>(variable_array);
48  }
49 
50  template <typename T>
51  T dValue(PropertyType const p,
52  VariableArray const& variable_array,
53  Variable const variable) const
54  {
55  return property(p).template dValue<T>(variable_array, variable);
56  }
57 
58  template <typename T>
59  T d2Value(PropertyType const p,
60  VariableArray const& variable_array,
61  Variable const variable1,
62  Variable const variable2) const
63  {
64  return property(p).template d2Value<T>(variable_array, variable1,
65  variable2);
66  }
67 
68  std::string name() const;
69 
70 protected:
73 };
74 
83 std::unique_ptr<Component> newComponent(std::string const& component_name,
84  bool& isCustomComponent);
85 
86 } // namespace MaterialPropertyLib
Property const & property(PropertyType const &) const
A get-function for retrieving a certain property.
Definition: Component.cpp:38
T dValue(PropertyType const p, VariableArray const &variable_array, Variable const variable) const
Definition: Component.h:51
std::unique_ptr< Component > newComponent(std::string const &component_name, bool &isCustomComponent)
virtual ~Component()=default
T value(PropertyType const p) const
Definition: Component.h:39
This class defines components (substances).
Definition: Component.h:23
T d2Value(PropertyType const p, VariableArray const &variable_array, Variable const variable1, Variable const variable2) const
Definition: Component.h:59
T value(PropertyType const p, VariableArray const &variable_array) const
Definition: Component.h:45
std::string name() const
Definition: Component.cpp:43
std::array< VariableType, static_cast< int >(Variable::number_of_variables)> VariableArray
Definition: VariableType.h:62
std::array< std::unique_ptr< Property >, PropertyType::number_of_properties > PropertyArray
PropertyArray _properties
The property array of the component.
Definition: Component.h:72