OGS
Medium.h
Go to the documentation of this file.
1
12#pragma once
13
14#include <memory>
15#include <span>
16#include <string>
17#include <vector>
18
19#include "Phase.h"
20
21namespace MaterialPropertyLib
22{
23class Property;
24}
25namespace MaterialPropertyLib
26{
31class Medium final
32{
33public:
34 Medium(int const material_id,
35 std::vector<std::unique_ptr<Phase>>&& phases,
36 std::unique_ptr<PropertyArray>&& properties);
37
40 Phase const& phase(std::size_t index) const;
42 Phase const& phase(std::string const& phase_name) const;
43
45 bool hasPhase(std::string const& phase_name) const;
46
49 Property const& property(PropertyType const& p) const;
50
51 Property const& operator[](PropertyType const& p) const;
52
53 bool hasProperty(PropertyType const& p) const;
54
57 std::size_t numberOfPhases() const;
58
60 std::string description() const;
61
62 template <typename T>
63 T value(PropertyType const p) const
64 {
65 return property(p).template value<T>();
66 }
67
68 template <typename T>
69 T value(PropertyType const p, VariableArray const& variable_array) const
70 {
71 return property(p).template value<T>(variable_array);
72 }
73
74 template <typename T>
76 VariableArray const& variable_array,
77 Variable const variable) const
78 {
79 return property(p).template dValue<T>(variable_array, variable);
80 }
81
82 template <typename T>
84 VariableArray const& variable_array,
85 Variable const variable1,
86 Variable const variable2) const
87 {
88 return property(p).template d2Value<T>(variable_array, variable1,
89 variable2);
90 }
91
92private:
94 std::vector<std::unique_ptr<Phase>> const phases_;
102
105 int const material_id_;
106};
107
109 Medium const& medium,
110 std::span<PropertyType const> const required_properties);
111
113Phase const& fluidPhase(Medium const& medium);
114
115} // namespace MaterialPropertyLib
T value(PropertyType const p, VariableArray const &variable_array) const
Definition Medium.h:69
std::size_t numberOfPhases() const
Definition Medium.cpp:75
Phase const & phase(std::size_t index) const
Definition Medium.cpp:33
Medium(int const material_id, std::vector< std::unique_ptr< Phase > > &&phases, std::unique_ptr< PropertyArray > &&properties)
Definition Medium.cpp:21
std::vector< std::unique_ptr< Phase > > const phases_
The vector that holds the phases.
Definition Medium.h:94
bool hasPhase(std::string const &phase_name) const
A query for a named phase.
Definition Medium.cpp:47
T value(PropertyType const p) const
Definition Medium.h:63
PropertyArray properties_
Definition Medium.h:101
T d2Value(PropertyType const p, VariableArray const &variable_array, Variable const variable1, Variable const variable2) const
Definition Medium.h:83
Property const & property(PropertyType const &p) const
Definition Medium.cpp:54
bool hasProperty(PropertyType const &p) const
Definition Medium.cpp:70
Property const & operator[](PropertyType const &p) const
Definition Medium.cpp:65
T dValue(PropertyType const p, VariableArray const &variable_array, Variable const variable) const
Definition Medium.h:75
std::string description() const
Short description of the medium.
Definition Medium.cpp:80
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
Phase const & fluidPhase(Medium const &medium)
Returns a gas or aqueous liquid phase of the given medium.
Definition Medium.cpp:100