WRApplication
External kratos "application" for multiscale time integration.
Loading...
Searching...
No Matches
DynamicEntityProxy.hpp
Go to the documentation of this file.
1
2
3#pragma once
4
5// --- Core Includes ---
6#include "includes/global_variables.h" // Globals::DataLocation
7#include "includes/model_part.h" // ModelPart::NodesContainerType, ModelPart::ElementsContainerType, ModelPart::ConditionsContainerType
8#include "includes/kratos_export_api.h" // KRATOS_API
9
10// --- WRApp Includes ---
11#include "wrapp/utils/inc/EntityProxy.hpp" // EntityProxy
12
13// --- STL Includes ---
14#include <variant> // variant
15
16
17namespace Kratos::WRApp {
18
19
24
25
27class KRATOS_API(WR_APPLICATION) DynamicEntityProxy
28{
29public:
30 DynamicEntityProxy() noexcept = default;
31
32 template <Globals::DataLocation TLocation>
33 DynamicEntityProxy(EntityProxy<TLocation,true> Proxy) noexcept : mProxy(Proxy) {}
34
35 DynamicEntityProxy(Globals::DataLocation Location, Node& rNode);
36
37 DynamicEntityProxy(Globals::DataLocation Location, Element& rElement);
38
39 DynamicEntityProxy(Globals::DataLocation Location, Condition& rCondition);
40
41 DynamicEntityProxy(Globals::DataLocation Location, ProcessInfo& rProcessInfo);
42
43 DynamicEntityProxy(Globals::DataLocation Location, ModelPart& rModelPart);
44
45 template <class TVariable>
46 bool HasValue(const TVariable& rVariable) const
47 {
48 KRATOS_TRY
49 return std::visit(
50 [&rVariable](auto Proxy){
51 return Proxy.HasValue(rVariable);
52 },
53 mProxy
54 );
55 KRATOS_CATCH("")
56 }
57
58 template <class TVariable>
59 typename TVariable::Type GetValue(const TVariable& rVariable) const
60 {
61 KRATOS_TRY
62 return std::visit(
63 [&rVariable](auto Proxy){
64 return Proxy.GetValue(rVariable);
65 },
66 mProxy
67 );
68 KRATOS_CATCH("")
69 }
70
71 template <class TVariable>
72 typename TVariable::Type& GetValue(const TVariable& rVariable)
73 {
74 KRATOS_TRY
75 return std::visit(
76 [&rVariable](auto Proxy){
77 return Proxy.GetValue(rVariable);
78 },
79 mProxy
80 );
81 KRATOS_CATCH("")
82 }
83
84 template <class TVariable>
85 void SetValue(const TVariable& rVariable, const typename TVariable::Type& rValue) const
86 {
87 KRATOS_TRY
88 return std::visit(
89 [&rVariable, &rValue](auto Proxy){
90 return Proxy.SetValue(rVariable, rValue);
91 },
92 mProxy
93 );
94 KRATOS_CATCH("")
95 }
96
97private:
98 std::variant<
105 > mProxy;
106}; // class DynamicEntityProxy
107
108
111
112
113} // namespace Kratos::WRApp
Runtime version of EntityProxy.
Definition DynamicEntityProxy.hpp:28
void SetValue(const TVariable &rVariable, const typename TVariable::Type &rValue) const
Definition DynamicEntityProxy.hpp:85
DynamicEntityProxy(Globals::DataLocation Location, ProcessInfo &rProcessInfo)
TVariable::Type GetValue(const TVariable &rVariable) const
Definition DynamicEntityProxy.hpp:59
DynamicEntityProxy(Globals::DataLocation Location, Element &rElement)
DynamicEntityProxy() noexcept=default
bool HasValue(const TVariable &rVariable) const
Definition DynamicEntityProxy.hpp:46
DynamicEntityProxy(Globals::DataLocation Location, Node &rNode)
DynamicEntityProxy(Globals::DataLocation Location, Condition &rCondition)
DynamicEntityProxy(Globals::DataLocation Location, ModelPart &rModelPart)
TVariable::Type & GetValue(const TVariable &rVariable)
Definition DynamicEntityProxy.hpp:72
Wrapper class providing a uniform interface for historical/non-historical Node, Element,...
Definition EntityProxy.hpp:48
Definition MPIUtils.hpp:9