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.
unary_statistics_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 <string>
17 #include <limits>
18 
19 // Project includes
20 #include "expression/expression.h"
21 
22 namespace Kratos {
23 
26 
27 namespace UnaryStatisticOperations
28 {
29  struct Min { static inline constexpr double mInitial = std::numeric_limits<double>::max(); static inline constexpr double Evaluate(const double V1, const double V2) { return std::min(V1, V2); } };
30  struct Max { static inline constexpr double mInitial = std::numeric_limits<double>::lowest(); static inline constexpr double Evaluate(const double V1, const double V2) { return std::max(V1, V2); } };
31  struct Sum { static inline constexpr double mInitial = 0.0; static inline constexpr double Evaluate(const double V1, const double V2) { return V1 + V2; } };
32 }
33 
39 template<class TOperationType>
41 public:
44 
45  using IndexType = std::size_t;
46 
50 
52 
56 
58 
59  double Evaluate(
60  const IndexType EntityIndex,
61  const IndexType EntityDataBeginIndex,
62  const IndexType ComponentIndex) const override;
63 
64  const std::vector<IndexType> GetItemShape() const override;
65 
66  IndexType GetMaxDepth() const override;
67 
68  std::string Info() const override;
69 
71 
72 private:
75 
76  const IndexType mItemComponentCount;
77 
78  const Expression::ConstPointer mpSourceExpression;
79 
81 };
82 
83 } // namespace Kratos
Base class or all the expression types.
Definition: expression.h:38
Kratos::intrusive_ptr< Expression > Pointer
Definition: expression.h:44
std::size_t IndexType
Definition: expression.h:48
Kratos::intrusive_ptr< const Expression > ConstPointer
Definition: expression.h:46
Used to create lazy expression to get statistical quantities of entity values.
Definition: unary_statistics_expression.h:40
UnaryStatisticsExpression(Expression::ConstPointer pExpression)
Definition: unary_statistics_expression.cpp:24
std::string Info() const override
Definition: unary_statistics_expression.cpp:64
IndexType GetMaxDepth() const override
Get the Max Depth of the lazy expression tree.
Definition: unary_statistics_expression.cpp:58
double Evaluate(const IndexType EntityIndex, const IndexType EntityDataBeginIndex, const IndexType ComponentIndex) const override
Evalute the expression for the given entity data start index and component index and returns the valu...
Definition: unary_statistics_expression.cpp:38
const std::vector< IndexType > GetItemShape() const override
Get the Shape of the expression.
Definition: unary_statistics_expression.cpp:52
static Expression::Pointer Create(Expression::ConstPointer pExpression)
Definition: unary_statistics_expression.cpp:32
static double max(double a, double b)
Definition: GeometryFunctions.h:79
static double min(double a, double b)
Definition: GeometryFunctions.h:71
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
Definition: unary_statistics_expression.h:30
static constexpr double Evaluate(const double V1, const double V2)
Definition: unary_statistics_expression.h:30
static constexpr double mInitial
Definition: unary_statistics_expression.h:30
Definition: unary_statistics_expression.h:29
static constexpr double mInitial
Definition: unary_statistics_expression.h:29
static constexpr double Evaluate(const double V1, const double V2)
Definition: unary_statistics_expression.h:29
Definition: unary_statistics_expression.h:31
static constexpr double mInitial
Definition: unary_statistics_expression.h:31
static constexpr double Evaluate(const double V1, const double V2)
Definition: unary_statistics_expression.h:31