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.
container_expression.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 <cmath>
17 #include <string>
18 #include <variant>
19 #include <vector>
20 #include <optional>
21 
22 // Project includes
23 #include "includes/define.h"
24 #include "includes/model_part.h"
25 #include "expression/expression.h"
27 #include "expression/traits.h"
28 
29 namespace Kratos {
30 
33 
79 template <class TContainerType, MeshType TMeshType = MeshType::Local>
80 class KRATOS_API(KRATOS_CORE) ContainerExpression {
81 public:
84 
85  using IndexType = std::size_t;
86 
88 
92 
94  ContainerExpression(ModelPart& rModelPart);
95 
98 
101 
102  virtual ~ContainerExpression() = default;
103 
107 
117  ContainerExpression::Pointer Clone() const;
118 
129  void CopyFrom(const ContainerExpression<TContainerType, TMeshType>& rOther);
130 
134 
140  void SetExpression(Expression::ConstPointer pExpression);
141 
148  bool HasExpression() const;
149 
155  const Expression& GetExpression() const;
156 
163 
171  const std::vector<IndexType> GetItemShape() const;
172 
180  IndexType GetItemComponentCount() const;
181 
187  ModelPart* pGetModelPart() const;
188 
194  ModelPart& GetModelPart();
195 
201  const ModelPart& GetModelPart() const;
202 
212  TContainerType& GetContainer();
213 
223  const TContainerType& GetContainer() const;
224 
232  IndexType GetMaxDepth() const;
233 
239  virtual std::string Info() const;
240 
246  std::string PrintData() const;
247 
251 
252  ContainerExpression& operator+=(const double Value);
253 
255 
256  ContainerExpression& operator-=(const double Value);
257 
259 
260  ContainerExpression& operator*=(const double Value);
261 
263 
264  ContainerExpression& operator/=(const double Value);
265 
267 
269 protected:
272 
273  std::optional<Expression::ConstPointer> mpExpression;
274 
276 
278 };
279 
283 
285 template<class TContainerType, MeshType TMeshType>
286 inline std::ostream& operator<<(
287  std::ostream& rOStream,
289 {
290  return rOStream << rThis.Info();
291 }
292 
294 
295 } // namespace Kratos
PeriodicInterfaceProcess & operator=(const PeriodicInterfaceProcess &)=delete
std::string Info() const override
Turn back information as a string.
Definition: periodic_interface_process.hpp:93
Container variable data holder.
Definition: container_expression.h:80
ContainerExpression & operator/=(const ContainerExpression &Value)
ContainerExpression & operator-=(const double Value)
virtual std::string Info() const
Get the info string.
Definition: container_expression.cpp:239
std::optional< Expression::ConstPointer > mpExpression
Definition: container_expression.h:273
ModelPart *const mpModelPart
Definition: container_expression.h:275
virtual ~ContainerExpression()=default
std::size_t IndexType
Definition: container_expression.h:85
KRATOS_CLASS_POINTER_DEFINITION(ContainerExpression)
ContainerExpression & operator/=(const double Value)
ContainerExpression & operator-=(const ContainerExpression &Value)
ContainerExpression & operator+=(const double Value)
ContainerExpression & operator*=(const double Value)
ContainerExpression & operator*=(const ContainerExpression &Value)
ContainerExpression & operator+=(const ContainerExpression &Value)
Base class or all the expression types.
Definition: expression.h:38
Kratos::intrusive_ptr< const Expression > ConstPointer
Definition: expression.h:46
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
TContainerType & GetContainer(ModelPart::MeshType &rMesh)
std::string GetItemShape(const std::vector< IndexType > &rShape)
Definition: binary_expression.cpp:27
const Expression * pGetExpression(const ContainerExpression< TContainerType, TMeshType > &rContainerExpression)
Definition: vtu_output.cpp:93
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432