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.
binary_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 <vector>
19 
20 // Project includes
21 #include "expression/expression.h"
22 
23 namespace Kratos {
24 
27 
28 namespace BinaryOperations
29 {
30  struct Addition { static inline constexpr double Evaluate(const double V1, const double V2) { return V1 + V2; } };
31  struct Substraction { static inline constexpr double Evaluate(const double V1, const double V2) { return V1 - V2; } };
32  struct Multiplication { static inline constexpr double Evaluate(const double V1, const double V2) { return V1 * V2; } };
33  struct Division { static inline constexpr double Evaluate(const double V1, const double V2) { return V1 / V2; } };
34  struct Power { static inline double Evaluate(const double V1, const double V2) { return std::pow(V1, V2); } };
35 }
36 
37 
38 template <class TOperationType>
39 class KRATOS_API(KRATOS_CORE) BinaryExpression : public Expression {
40 public:
43 
44  using IndexType = std::size_t;
45 
49 
53 
57 
61 
62  double Evaluate(
63  const IndexType EntityIndex,
64  const IndexType EntityDataBeginIndex,
65  const IndexType ComponentIndex) const override;
66 
67  const std::vector<IndexType> GetItemShape() const override;
68 
69  IndexType GetMaxDepth() const override;
70 
71  std::string Info() const override;
72 
74 protected:
77 
79 
81 
83 };
84 
85 } // namespace Kratos
std::string Info() const override
Turn back information as a string.
Definition: periodic_interface_process.hpp:93
Definition: binary_expression.h:39
const Expression::ConstPointer mpRight
Definition: binary_expression.h:80
std::size_t IndexType
Definition: binary_expression.h:44
const Expression::ConstPointer mpLeft
Definition: binary_expression.h:78
Base class or all the expression types.
Definition: expression.h:38
Kratos::intrusive_ptr< Expression > Pointer
Definition: expression.h:44
Kratos::intrusive_ptr< const Expression > ConstPointer
Definition: expression.h:46
std::string GetItemShape(const std::vector< IndexType > &rShape)
Definition: binary_expression.cpp:27
Modeler::Pointer Create(const std::string &ModelerName, Model &rModel, const Parameters ModelParameters)
Checks if the modeler is registered.
Definition: modeler_factory.cpp:30
double Evaluate(const PolynomialType &rPolynomial, double x)
Definition: polynomial_utilities.cpp:77
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
Definition: binary_expression.h:30
static constexpr double Evaluate(const double V1, const double V2)
Definition: binary_expression.h:30
Definition: binary_expression.h:33
static constexpr double Evaluate(const double V1, const double V2)
Definition: binary_expression.h:33
Definition: binary_expression.h:32
static constexpr double Evaluate(const double V1, const double V2)
Definition: binary_expression.h:32
Definition: binary_expression.h:34
static double Evaluate(const double V1, const double V2)
Definition: binary_expression.h:34
Definition: binary_expression.h:31
static constexpr double Evaluate(const double V1, const double V2)
Definition: binary_expression.h:31