47 template<
class TIteratorType>
63 <<
"Expression number of entities mismatch. [ required number of entities = "
65 << p_expression->NumberOfEntities() <<
" ].\n"
68 <<
"Current = " << p_expression <<
"\n";
70 local_stride += p_expression->GetItemComponentCount();
76 <<
"No expressions were given.\n";
83 template<
class TIteratorType>
88 return Kratos::make_intrusive<UnaryCombineExpression>(Begin, End);
94 const IndexType ComponentIndex)
const override
100 if (ComponentIndex < current_stride) {
101 return mSourceExpressions[
i]->Evaluate(EntityIndex, EntityIndex * (current_stride - current_starting), ComponentIndex - current_starting);
103 current_starting = current_stride;
106 KRATOS_ERROR <<
"Component index is greater than the current expressions stride.\n";
113 return mStrides.size() == 1 &&
mStrides.back() == 1 ? std::vector<IndexType> {} : std::vector<IndexType> {
mStrides.back()};
120 max_depth =
std::max(max_depth, p_expression->GetMaxDepth());
122 return max_depth + 1;
125 std::string
Info()
const override
127 std::stringstream msg;
129 msg <<
"CombinedExpression: ";
132 msg <<
"\n\t" << *p_expression;
Base class or all the expression types.
Definition: expression.h:38
IndexType GetItemComponentCount() const
Get the Local Size of the expression.
Definition: expression.cpp:104
IndexType NumberOfEntities() const
Get the maximum number of entities allowed for this expression.
Definition: expression.h:181
Kratos::intrusive_ptr< Expression > Pointer
Definition: expression.h:44
std::size_t IndexType
Definition: expression.h:48
Use to create an expression which combines given input expressions list in the order given.
Definition: unary_combine_expression.h:36
const std::vector< IndexType > GetItemShape() const override
Get the Shape of the expression.
Definition: unary_combine_expression.h:111
UnaryCombineExpression(TIteratorType Begin, TIteratorType End)
Definition: unary_combine_expression.h:48
static Expression::Pointer Create(TIteratorType Begin, TIteratorType End)
Definition: unary_combine_expression.h:84
std::string Info() const override
Definition: unary_combine_expression.h:125
IndexType GetMaxDepth() const override
Get the Max Depth of the lazy expression tree.
Definition: unary_combine_expression.h:116
std::vector< IndexType > mStrides
Definition: unary_combine_expression.h:145
const std::vector< Expression::ConstPointer > mSourceExpressions
Definition: unary_combine_expression.h:143
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_combine_expression.h:91
#define KRATOS_ERROR
Definition: exception.h:161
#define KRATOS_ERROR_IF_NOT(conditional)
Definition: exception.h:163
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
static double max(double a, double b)
Definition: GeometryFunctions.h:79
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
integer i
Definition: TensorModule.f:17