17 #include <type_traits>
116 template <
class TIterator>
119 TIterator NewShapeBegin,
120 TIterator NewShapeEnd)
122 static_assert(std::is_same_v<
typename std::iterator_traits<TIterator>::value_type,std::size_t>);
149 const std::vector<IndexType>& rNewShape);
207 template <
class TIterator>
211 || std::is_same_v<
typename std::iterator_traits<TIterator>::value_type,
Expression::Pointer>);
408 static double NormInf(
428 static double NormL2(
475 static double InnerProduct(
484 #ifndef KRATOS_EXPRESSION_UTILS_CEXP_METHOD_1
485 #define KRATOS_EXPRESSION_UTILS_CEXP_METHOD_1(METHOD_NAME) \
492 template <class TContainerType> \
493 static ContainerExpression<TContainerType> METHOD_NAME( \
494 const ContainerExpression<TContainerType>& rContainerExpression) \
496 auto copy = rContainerExpression; \
497 copy.SetExpression(METHOD_NAME(rContainerExpression.pGetExpression())); \
502 #ifndef KRATOS_EXPRESSION_UTILS_CEXP_METHOD_2
503 #define KRATOS_EXPRESSION_UTILS_CEXP_METHOD_2(METHOD_NAME) \
510 template <class TContainerType> \
511 static double METHOD_NAME(const ContainerExpression<TContainerType>& rContainerExpression) \
513 return METHOD_NAME( \
514 rContainerExpression.pGetExpression(), \
515 rContainerExpression.GetModelPart().GetCommunicator().GetDataCommunicator()); \
519 #ifndef KRATOS_EXPRESSION_UTILS_CEXP_METHOD_3
520 #define KRATOS_EXPRESSION_UTILS_CEXP_METHOD_3(METHOD_NAME) \
527 template <class TContainerType> \
528 static ContainerExpression<TContainerType> METHOD_NAME( \
529 const ContainerExpression<TContainerType>& rContainerExpression, const double Value) \
531 auto copy = rContainerExpression; \
532 copy.SetExpression(METHOD_NAME(rContainerExpression.pGetExpression(), Value)); \
542 template <class TContainerType> \
543 static ContainerExpression<TContainerType> METHOD_NAME( \
544 const ContainerExpression<TContainerType>& rContainerExpression1, \
545 const ContainerExpression<TContainerType>& rContainerExpression2) \
547 auto copy = rContainerExpression1; \
548 copy.SetExpression(METHOD_NAME(rContainerExpression1.pGetExpression(), \
549 rContainerExpression2.pGetExpression())); \
565 #undef KRATOS_EXPRESSION_UTILS_CEXP_METHOD_1
566 #undef KRATOS_EXPRESSION_UTILS_CEXP_METHOD_2
567 #undef KRATOS_EXPRESSION_UTILS_CEXP_METHOD_3
578 template<
class TContainerType>
584 auto copy = rContainerExpression;
599 template <
class TContainerType,
class TIterator>
602 TIterator NewShapeBegin,
603 TIterator NewShapeEnd)
605 auto copy = rContainerExpression;
618 template<
class TContainerType>
619 static ContainerExpression<TContainerType> Reshape(
620 const ContainerExpression<TContainerType>& rContainerExpression,
621 const std::vector<IndexType>& rNewShape)
623 return Reshape(rContainerExpression, rNewShape.begin(), rNewShape.end());
633 template <
class TContainerType>
636 std::vector<Expression::ConstPointer> exps;
637 std::transform(rpContainerExpressions.begin(), rpContainerExpressions.end(), std::back_inserter(exps), [](
const auto&
V) { return V->pGetExpression(); });
639 <<
"Empty container list provided for combing.";
640 auto copy = *rpContainerExpressions.front();
653 template <
class TContainerType>
669 template<
class TContainerType>
670 static double InnerProduct(
671 const ContainerExpression<TContainerType>& rContainerExpression1,
672 const ContainerExpression<TContainerType>& rContainerExpression2)
674 return InnerProduct(rContainerExpression1.pGetExpression(), rContainerExpression2.pGetExpression(), rContainerExpression1.GetModelPart().GetCommunicator().GetDataCommunicator());
virtual const DataCommunicator & GetDataCommunicator() const
Definition: communicator.cpp:340
Container variable data holder.
Definition: container_expression.h:80
ModelPart & GetModelPart()
Get the Model Part used in the container data.
Definition: container_expression.cpp:209
Expression::ConstPointer pGetExpression() const
Get the expression pointer.
Definition: container_expression.cpp:185
void SetExpression(Expression::ConstPointer pExpression)
Set the Expression of the container data.
Definition: container_expression.cpp:158
Serial (do-nothing) version of a wrapper class for MPI communication.
Definition: data_communicator.h:318
Kratos::intrusive_ptr< Expression > Pointer
Definition: expression.h:44
Kratos::intrusive_ptr< const Expression > ConstPointer
Definition: expression.h:46
Definition: expression_utils.h:35
std::size_t IndexType
Definition: expression_utils.h:40
static Expression::ConstPointer Comb(TIterator ExpressionBegin, TIterator ExpressionEnd)
Append the components of a set of expressions to the current expression's components.
Definition: expression_utils.h:208
static Expression::ConstPointer Reshape(const Expression::ConstPointer &rpExpression, TIterator NewShapeBegin, TIterator NewShapeEnd)
Construct an expression with identical data but interpreted with a new item shape.
Definition: expression_utils.h:117
Communicator & GetCommunicator()
Definition: model_part.h:1821
static Expression::Pointer Create(TIteratorType Begin, TIteratorType End)
Definition: unary_combine_expression.h:84
static Expression::Pointer Create(Expression::ConstPointer pExpression, TIteratorType Begin, TIteratorType End)
Definition: unary_reshape_expression.h:64
#define KRATOS_EXPRESSION_UTILS_CEXP_METHOD_3(METHOD_NAME)
Definition: expression_utils.h:510
#define KRATOS_EXPRESSION_UTILS_CEXP_METHOD_2(METHOD_NAME)
Definition: expression_utils.h:498
#define KRATOS_EXPRESSION_UTILS_CEXP_METHOD_1(METHOD_NAME)
Definition: expression_utils.h:485
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
V
Definition: generate_droplet_dynamics.py:256
Definition: quadrature.h:29