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.
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: Máté Kelemen
11 //
12 
13 #pragma once
14 
15 // Project includes
16 #include "expression/expression.h"
17 #include "includes/define.h"
19 
20 
21 namespace Kratos {
22 
23 
24 class KRATOS_API(KRATOS_CORE) ExpressionInput
25 {
26 public:
29 
31 
35 
36  virtual ~ExpressionInput() = default;
37 
41 
42  virtual Expression::Pointer Execute() const = 0;
43 
45  {
46  return this->Execute();
47  }
48 
50 
51 
52 protected:
55 
56  double EvaluateExpression(const Expression& rExpression,
57  Expression::IndexType EntityIndex,
58  Expression::IndexType EntityDataBeginIndex,
59  Expression::IndexType ComponentIndex) const
60  {
61  return rExpression.Evaluate(EntityIndex, EntityDataBeginIndex, ComponentIndex);
62  }
63 
65 }; // class ExpressionInput
66 
67 
68 class KRATOS_API(KRATOS_CORE) ExpressionOutput
69 {
70 public:
73 
75 
79 
80  virtual ~ExpressionOutput() = default;
81 
85 
86  virtual void Execute(const Expression& rExpression) = 0;
87 
88  void operator()(const Expression& rExpression)
89  {
90  this->Execute(rExpression);
91  }
92 
94 
95 protected:
98 
99  double EvaluateExpression(const Expression& rExpression,
100  Expression::IndexType EntityIndex,
101  Expression::IndexType EntityDataBeginIndex,
102  Expression::IndexType ComponentIndex) const
103  {
104  return rExpression.Evaluate(EntityIndex, EntityDataBeginIndex, ComponentIndex);
105  }
106 
108 }; // class ExpressionOutput
109 
110 
111 } // namespace Kratos
Base class or all the expression types.
Definition: expression.h:38
virtual double Evaluate(const IndexType EntityIndex, const IndexType EntityDataBeginIndex, const IndexType ComponentIndex) const =0
Evalute the expression for the given entity data start index and component index and returns the valu...
Kratos::intrusive_ptr< Expression > Pointer
Definition: expression.h:44
std::size_t IndexType
Definition: expression.h:48
Definition: expression_io.h:25
virtual ~ExpressionInput()=default
virtual Expression::Pointer Execute() const =0
double EvaluateExpression(const Expression &rExpression, Expression::IndexType EntityIndex, Expression::IndexType EntityDataBeginIndex, Expression::IndexType ComponentIndex) const
Definition: expression_io.h:56
Expression::Pointer operator()() const
Definition: expression_io.h:44
KRATOS_CLASS_POINTER_DEFINITION(ExpressionInput)
Definition: expression_io.h:69
virtual void Execute(const Expression &rExpression)=0
KRATOS_CLASS_POINTER_DEFINITION(ExpressionOutput)
virtual ~ExpressionOutput()=default
void operator()(const Expression &rExpression)
Definition: expression_io.h:88
double EvaluateExpression(const Expression &rExpression, Expression::IndexType EntityIndex, Expression::IndexType EntityDataBeginIndex, Expression::IndexType ComponentIndex) const
Definition: expression_io.h:99
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21