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.
literal_expression_input.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 incldues
16 #include <variant>
17 
18 // Project includes
19 #include "containers/array_1d.h"
21 #include "expression/traits.h"
22 #include "containers/variable.h"
23 #include "expression_io.h"
24 #include "includes/define.h"
25 #include "includes/model_part.h"
27 
28 namespace Kratos {
29 
30 
31 class KRATOS_API(KRATOS_CORE) LiteralExpressionIO
32 {
33 public:
36 
37  using DataType = std::variant<
38  int,
39  double,
44  Vector,
45  Matrix>;
46 
47  using VariableType = std::variant<
48  const Variable<int>*,
49  const Variable<double>*,
54  const Variable<Vector>*,
55  const Variable<Matrix>*>;
56 
60 
61  class KRATOS_API(KRATOS_CORE) Input : public ExpressionInput
62  {
63  public:
66 
68 
72 
73  Input(
74  const ModelPart& rModelPart,
75  const DataType& rValue,
76  Globals::DataLocation CurrentLocation,
77  MeshType CurrentMeshType = MeshType::Local);
78 
79  ~Input() override = default;
80 
84 
85  Expression::Pointer Execute() const override;
86 
88 
89  private:
92 
93  ModelPart const * mpModelPart;
94 
95  DataType mValue;
96 
97  Globals::DataLocation mDataLocation;
98 
99  MeshType mMeshType;
100 
102 
103  };
104 
108 
109  template<class TContainerType, MeshType TMeshType = MeshType::Local>
110  static void SetData(
112  const DataType& rValue);
113 
114  template<class TContainerType, MeshType TMeshType = MeshType::Local>
115  static void SetDataToZero(
117  const VariableType& rVariable);
118 
120 
121 }; // class ExpressionIO
122 
123 } // namespace Kratos
Container variable data holder.
Definition: container_expression.h:80
Kratos::intrusive_ptr< Expression > Pointer
Definition: expression.h:44
Definition: expression_io.h:25
Definition: literal_expression_input.h:62
Definition: literal_expression_input.h:32
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: literal_expression_input.h:55
std::variant< int, double, array_1d< double, 3 >, array_1d< double, 4 >, array_1d< double, 6 >, array_1d< double, 9 >, Vector, Matrix > DataType
Definition: literal_expression_input.h:45
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
DataLocation
Enum for location of data.
Definition: global_variables.h:48
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
Internals::Matrix< double, AMatrix::dynamic, 1 > Vector
Definition: amatrix_interface.h:472
MeshType
Definition: traits.h:19
@ Local
Definition: traits.h:20
REACTION_CHECK_STIFFNESS_FACTOR int
Definition: contact_structural_mechanics_application_variables.h:75
TABLE_NUMBER_ANGULAR_VELOCITY TABLE_NUMBER_MOMENT I33 BEAM_INERTIA_ROT_UNIT_LENGHT_Y KRATOS_DEFINE_APPLICATION_VARIABLE(DEM_APPLICATION, double, BEAM_INERTIA_ROT_UNIT_LENGHT_Z) typedef std double
Definition: DEM_application_variables.h:182