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.
c_array_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 <variant>
17 #include <vector>
18 
19 // Project includes
21 #include "expression/expression.h"
22 #include "expression/traits.h"
23 #include "includes/define.h"
24 #include "expression_io.h"
25 
26 namespace Kratos {
27 
28 class KRATOS_API(KRATOS_CORE) CArrayExpressionIO
29 {
30 public:
33 
34  class KRATOS_API(KRATOS_CORE) Input: public ExpressionInput
35  {
36  public:
39 
40  using IndexType = std::size_t;
41 
42  using RawArrayType = std::variant<int const*, double const*>;
43 
45 
49 
50  template<class TRawDataType>
51  KRATOS_API(KRATOS_CORE) Input(
52  TRawDataType const* pBegin,
53  const int NumberOfEntities,
54  int const* pShapeBegin,
55  const int ShapeSize);
56 
57  ~Input() override = default;
58 
62 
63  Expression::Pointer Execute() const override;
64 
66 
67  private:
70 
71  RawArrayType mpCArray;
72 
73  const int mNumberOfEntities;
74 
75  std::vector<IndexType> mShape;
76 
78  }; // class Input
79 
80 
81  class KRATOS_API(KRATOS_CORE) MoveInput : public ExpressionInput
82  {
83  public:
86 
87  using IndexType = std::size_t;
88 
89  using RawArrayType = std::variant<int*, double*>;
90 
92 
96 
97  template <class TRawDataType>
98  MoveInput(
99  TRawDataType* pBegin,
100  const int NumberOfEntities,
101  int const* pShapeBegin,
102  const int ShapeSize);
103 
104  ~MoveInput() override = default;
105 
109 
110  Expression::Pointer Execute() const override;
111 
113 
114  private:
117 
118  RawArrayType mpCArray;
119 
120  const int mNumberOfEntities;
121 
122  int const* const mpShapeBegin;
123 
124  const int mShapeSize;
125 
127  }; // class MoveInput
128 
129  class KRATOS_API(KRATOS_CORE) Output: public ExpressionOutput
130  {
131  public:
134 
135  using IndexType = std::size_t;
136 
137  using RawArrayType = std::variant<int*, double*>;
138 
140 
144 
145  template<class TRawDataType>
146  KRATOS_API(KRATOS_CORE) Output(
147  TRawDataType* pBegin,
148  const int mSize);
149 
150  ~Output() override = default;
151 
155 
156  void Execute(const Expression& rExpression) override;
157 
159 
160  private:
163 
164  RawArrayType mpCArray;
165 
166  const int mSize;
167 
169  }; // class Output
170 
174 
175  template<class TRawDataType, class TContainerType, MeshType TMeshType>
176  static void Read(
178  TRawDataType const* pBegin,
179  const int NumberOfEntities,
180  int const* pShapeBegin,
181  const int ShapeSize);
182 
183  template<class TContainerType, MeshType TMeshType>
184  static void Read(
186  const Vector& rValues,
187  const std::vector<IndexType>& rShape);
188 
189  template<class TRawDataType, class TContainerType, MeshType TMeshType>
190  static void Move(
192  TRawDataType* pBegin,
193  const int NumberOfEntities,
194  int const* pShapeBegin,
195  const int ShapeSize);
196 
197  template<class TContainerType, MeshType TMeshType>
198  static void Move(
200  Vector& rValues,
201  const std::vector<IndexType>& rShape);
202 
203  template<class TRawDataType, class TContainerType, MeshType TMeshType>
204  static void Write(
205  const ContainerExpression<TContainerType, TMeshType>& rContainerExpression,
206  TRawDataType* pBegin,
207  const int mSize);
208 
209  template<class TContainerType, MeshType TMeshType>
210  static void Write(
211  const ContainerExpression<TContainerType, TMeshType>& rContainerExpression,
212  Vector& rValues);
213 
215 };
216 
217 } // namespace Kratos
Definition: c_array_expression_io.h:35
std::variant< int const *, double const * > RawArrayType
Definition: c_array_expression_io.h:42
std::size_t IndexType
Definition: c_array_expression_io.h:40
Definition: c_array_expression_io.h:82
std::size_t IndexType
Definition: c_array_expression_io.h:87
std::variant< int *, double * > RawArrayType
Definition: c_array_expression_io.h:89
Definition: c_array_expression_io.h:130
std::size_t IndexType
Definition: c_array_expression_io.h:135
std::variant< int *, double * > RawArrayType
Definition: c_array_expression_io.h:137
Definition: c_array_expression_io.h:29
Container variable data holder.
Definition: container_expression.h:80
Base class or all the expression types.
Definition: expression.h:38
Kratos::intrusive_ptr< Expression > Pointer
Definition: expression.h:44
Definition: expression_io.h:25
Definition: expression_io.h:69
#define KRATOS_API(...)
Definition: kratos_export_api.h:40
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