OGS
Component.h
Go to the documentation of this file.
1
12#pragma once
13
14#include <span>
15
16#include "Property.h"
17
18namespace MaterialPropertyLib
19{
26{
27public:
30 Component();
31
33 Component(std::string const& component_name,
34 std::unique_ptr<PropertyArray>&& properties);
35 virtual ~Component() = default;
36
38 Property const& property(PropertyType const& /*p*/) const;
39
40 Property const& operator[](PropertyType const& p) const;
41
42 bool hasProperty(PropertyType const& p) const;
43
44 template <typename T>
45 T value(PropertyType const p) const
46 {
47 return property(p).template value<T>();
48 }
49
50 template <typename T>
51 T value(PropertyType const p, VariableArray const& variable_array) const
52 {
53 return property(p).template value<T>(variable_array);
54 }
55
56 template <typename T>
58 VariableArray const& variable_array,
59 Variable const variable) const
60 {
61 return property(p).template dValue<T>(variable_array, variable);
62 }
63
64 template <typename T>
66 VariableArray const& variable_array,
67 Variable const variable1,
68 Variable const variable2) const
69 {
70 return property(p).template d2Value<T>(variable_array, variable1,
71 variable2);
72 }
73
75 std::string description() const;
76
77public:
78 std::string const name;
79
80protected:
83};
84
93std::unique_ptr<Component> newComponent(std::string const& component_name,
94 bool& isCustomComponent);
95
97 Component const& c,
98 std::span<PropertyType const> const required_properties);
99
100} // namespace MaterialPropertyLib
This class defines components (substances).
Definition Component.h:26
T dValue(PropertyType const p, VariableArray const &variable_array, Variable const variable) const
Definition Component.h:57
Property const & property(PropertyType const &) const
A get-function for retrieving a certain property.
Definition Component.cpp:33
T d2Value(PropertyType const p, VariableArray const &variable_array, Variable const variable1, Variable const variable2) const
Definition Component.h:65
Property const & operator[](PropertyType const &p) const
Definition Component.cpp:45
T value(PropertyType const p) const
Definition Component.h:45
virtual ~Component()=default
T value(PropertyType const p, VariableArray const &variable_array) const
Definition Component.h:51
PropertyArray properties_
The property array of the component.
Definition Component.h:82
bool hasProperty(PropertyType const &p) const
Definition Component.cpp:50
std::string description() const
Short description of the component with its name.
Definition Component.cpp:55
void checkRequiredProperties(Component const &c, std::span< PropertyType const > const required_properties)
Definition Component.cpp:60
std::array< std::unique_ptr< Property >, PropertyType::number_of_properties > PropertyArray
std::unique_ptr< Component > newComponent(std::string const &component_name, bool &isCustomComponent)