KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
collective_expression_io.h
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ `
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // Kratos default license: kratos/license.txt
9 //
10 // Main authors: Suneth Warnakulasuriya
11 //
12 
13 #pragma once
14 
15 // System includes
16 #include <vector>
17 
18 // Project includes
19 #include "includes/define.h"
20 
21 // Application includes
22 #include "collective_expression.h"
23 
24 namespace Kratos {
25 
26 class KRATOS_API(OPTIMIZATION_APPLICATION) CollectiveExpressionIO
27 {
28 public:
31 
32  using VariableType = std::variant<
33  const Variable<int>*,
34  const Variable<double>*,
39  const Variable<Vector>*,
40  const Variable<Matrix>*>;
41 
45 
47  {
48  public:
51 
53 
54  HistoricalVariable(const VariableType& rVariable): mVariable(rVariable) {}
55 
59 
61 
63  };
64 
66  {
67  public:
70 
72 
73  NonHistoricalVariable(const VariableType& rVariable): mVariable(rVariable) {}
74 
78 
80 
82  };
83 
85  {
86  public:
89 
91 
92  PropertiesVariable(const VariableType& rVariable): mVariable(rVariable) {}
93 
97 
99 
101  };
102 
103  using ContainerVariableType = std::variant<
104  HistoricalVariable::Pointer,
105  NonHistoricalVariable::Pointer,
106  PropertiesVariable::Pointer>;
107 
111 
112  template<class TRawDataType>
113  static void Read(
114  CollectiveExpression& rCollectiveExpression,
115  TRawDataType const* pBegin,
116  int const* NumberOfEntities,
117  int const** pListShapeBegin,
118  int const* ShapeSizes,
119  const int NumberOfContainers);
120 
121  template<class TRawDataType>
122  static void Move(
123  CollectiveExpression& rCollectiveExpression,
124  TRawDataType* pBegin,
125  int const* NumberOfEntities,
126  int const** pListShapeBegin,
127  int const* ShapeSizes,
128  const int NumberOfContainers);
129 
130  template<class TRawDataType>
131  static void Write(
132  const CollectiveExpression& rCollectiveExpression,
133  TRawDataType* pBegin,
134  const int Size);
135 
136  static void Read(
137  CollectiveExpression& rCollectiveExpression,
138  const ContainerVariableType& rContainerVariable);
139 
140  static void Read(
141  CollectiveExpression& rCollectiveExpression,
142  const std::vector<ContainerVariableType>& rContainerVariables);
143 
144  static void Write(
145  const CollectiveExpression& rCollectiveExpression,
146  const ContainerVariableType& rContainerVariable);
147 
148  static void Write(
149  const CollectiveExpression& rCollectiveExpression,
150  const std::vector<ContainerVariableType>& rContainerVariables);
151 
153 };
154 
155 } // namespace Kratos
Construct a new CollectiveExpression instance.
Definition: collective_expression.h:41
Definition: collective_expression_io.h:47
HistoricalVariable(const VariableType &rVariable)
Definition: collective_expression_io.h:54
const VariableType mVariable
Definition: collective_expression_io.h:60
Definition: collective_expression_io.h:66
NonHistoricalVariable(const VariableType &rVariable)
Definition: collective_expression_io.h:73
const VariableType mVariable
Definition: collective_expression_io.h:79
Definition: collective_expression_io.h:85
const VariableType mVariable
Definition: collective_expression_io.h:98
PropertiesVariable(const VariableType &rVariable)
Definition: collective_expression_io.h:92
Definition: collective_expression_io.h:27
std::variant< HistoricalVariable::Pointer, NonHistoricalVariable::Pointer, PropertiesVariable::Pointer > ContainerVariableType
Definition: collective_expression_io.h:106
std::variant< const Variable< int > *, const Variable< double > *, const Variable< array_1d< double, 3 > > *, const Variable< array_1d< double, 4 > > *, const Variable< array_1d< double, 6 > > *, const Variable< array_1d< double, 9 > > *, const Variable< Vector > *, const Variable< Matrix > * > VariableType
Definition: collective_expression_io.h:40
TSpaceType::IndexType Size(TSpaceType &dummy, typename TSpaceType::VectorType const &rV)
Definition: add_strategies_to_python.cpp:111
void Read(LiteralFlatExpression< std::conditional_t< std::is_same_v< TDataType, int >, int, double >> &rExpression, const IndexType EntityDataBeginIndex, const TDataType &rValue, std::index_sequence< TIndex... >)
Definition: variable_expression_data_io.cpp:31
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21