DUNE-ACFEM (unstable)

Sub-expression support. More...

Functions

template<class T , class Functor = SExpForward, std::enable_if_t<(IsSubExpressionExpression< T >::value &&std::is_assignable< decltype(std::declval< T >().operand(0_c)), Operand< 1, T > >::value), int > = 0>
void Dune::ACFem::Expressions::evaluateSubExpression (T &&t, Functor &&f=Functor{})
 Copy the value of the contained sub-expression (operand no. More...
 
template<class T , class Functor = SExpForward, std::enable_if_t<(IsSubExpressionExpression< T >::value &&!std::is_assignable< decltype(std::declval< T >().operand(0_c)), Operand< 1, T > >::value), int > = 0>
void Dune::ACFem::Expressions::evaluateSubExpression (T &&t, Functor=Functor{})
 Do-nothing dummy for expressions where evaluateSubExpression() would fail otherwise. More...
 
template<class T , class Functor = SExpForward>
void Dune::ACFem::Expressions::evaluateAllSubExpressions (T &&t, Functor &&f=Functor{})
 Evaluate all contained subexpressions. More...
 
template<class T , class Optimize = OptimizeTop>
constexpr auto Dune::ACFem::Expressions::expandAllSubExpressions (T &&t, Optimize=Optimize{})
 Expand all contained sub-expressions.
 

Detailed Description

Sub-expression support.

Function Documentation

◆ evaluateAllSubExpressions()

template<class T , class Functor = SExpForward>
void Dune::ACFem::Expressions::evaluateAllSubExpressions ( T &&  t,
Functor &&  f = Functor{} 
)

Evaluate all contained subexpressions.

Note that references to constant sub-expressions are silently ignored.

Parameters
tJust some expression.
clearIf true then the caches are cleared instead of being filled with the evaluated sub-expressions.

◆ evaluateSubExpression() [1/2]

template<class T , class Functor = SExpForward, std::enable_if_t<(IsSubExpressionExpression< T >::value &&std::is_assignable< decltype(std::declval< T >().operand(0_c)), Operand< 1, T > >::value), int > = 0>
void Dune::ACFem::Expressions::evaluateSubExpression ( T &&  t,
Functor &&  f = Functor{} 
)

Copy the value of the contained sub-expression (operand no.

Strip a possible closure and recurse to the proper expression.

1) to operand 0 which acts as a cache. Of course, this can only work if operand 0 is mutable in the given context and if operand 1 can be assignt to operand 0.

Parameters
tThe subexpression expression.
clearDefaults to false. If set to true then the cache will be set to 0. It is assume that the cache is assignable from its canonical zero() object if it is assignable from the subexpression.

Referenced by Dune::ACFem::Expressions::CommonSubExpressionCascade< Traits, std::tuple< std::tuple< SExp... >, PrevSExp, SExpRest... > >::evaluate().

◆ evaluateSubExpression() [2/2]

template<class T , class Functor = SExpForward, std::enable_if_t<(IsSubExpressionExpression< T >::value &&!std::is_assignable< decltype(std::declval< T >().operand(0_c)), Operand< 1, T > >::value), int > = 0>
void Dune::ACFem::Expressions::evaluateSubExpression ( T &&  t,
Functor  = Functor{} 
)

Do-nothing dummy for expressions where evaluateSubExpression() would fail otherwise.

This makes it legal to to keep references to constant sub-expressions inside an expression in order to support common sub-expression "elimination". The underlying sub-expressions must then be updated separately (as they are references there must be an "external" object that is referenced).

Parameters
tAn expression which must be SubExpressionOperation.
clearIgnored.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (May 3, 22:32, 2024)