Vulpes  0.1.0
Versatile and parallel compUtational Library for high-order discontinuous Polytopal Element Simulations
Loading...
Searching...
No Matches
vulpes::fe::FeExpressionShift< Dim, E > Class Template Reference

Add a constant offset to an FE expression at every quadrature point. More...

#include <fe_expr_op.hpp>

Inheritance diagram for vulpes::fe::FeExpressionShift< Dim, E >:
[legend]
Collaboration diagram for vulpes::fe::FeExpressionShift< Dim, E >:
[legend]

Public Types

using OutputType = typename E::OutputType
using FeSpaceType
 Type of the associated Finite Element Space.

Public Member Functions

 FeExpressionShift (const OutputType &c, const E &expr)
 Construct with a constant offset and the expression to shift.
template<std::size_t J = 0, std::size_t I = 0>
decltype(auto) evaluate (const FeValues< Dim > &fe_values, std::size_t j, std::size_t i, std::size_t q) const
 Evaluate m_c + expr at quadrature point q.
constexpr std::size_t computeOrder () const
constexpr UpdateFlagsType computeUpdateFlags () const
constexpr bool precompute (const FeValues< Dim > &fe_values, const CellsType< Dim > &cells) const
constexpr const auto & feSpace () const
 Get the associated Finite Element Space.
decltype(auto) evaluatePoly (const FeValues< Dim > &fe_values, std::size_t j, std::size_t i, std::size_t bi, std::size_t bj) const
 Compute the polynomial associated to the expression for basis i and j and block bi and bj.
decltype(auto) evaluatePolyCoef (const auto &mapping, const auto &fe_values, std::size_t bi, std::size_t bj) const
 Compute the coefficients of the polynomial associated to the expression for basis i and j and block bi and bj.
constexpr FeExpressionUnaryMinus< Dim, FeExpressionShift< Dim, E > > operator- () const
 Unary minus operator for the FE expression.

Static Public Attributes

static constexpr bool is_leaf = false
static constexpr uint8_t is_bilinear = E::is_bilinear
static constexpr std::size_t k_index_begin
 Index the block of the expression starts from (for vectorial problems).
static constexpr std::size_t k_index_end
 Index the block of the expression ends to (for vectorial problems).

Protected Member Functions

const FeExpressionShift< Dim, E > & self () const

Protected Attributes

OutputType m_c
std::conditional_t< E::is_leaf, const E &, const E > m_expr

Detailed Description

template<std::size_t Dim, typename E>
class vulpes::fe::FeExpressionShift< Dim, E >

Add a constant offset to an FE expression at every quadrature point.

Wraps any expression E and returns m_c + E.evaluate<J,I>(q). The stored constant m_c has the same type as E::OutputType, so the class works uniformly for:

  • Scalar expressions (OutputType = double): offset is a double.
  • Vector expressions (OutputType = Eigen::Vector<double,N>): offset is an Eigen::Vector<double,N> and addition is component-wise.

All update flags, precompute logic, and polynomial order are delegated to the wrapped expression.

For scalar expressions the natural operator+ / operator- syntax is available. For vector expressions use the named factory fe::shift.

Typical use:

auto wf = fe::inner(a_proj + b_const, v); // scalar shift
auto wf = fe::inner(fe::shift(p_vec, p_bg), V); // vector shift
FeExpressionShift< Dim, E > shift(const typename E::OutputType &c, const FeExpressionBase< Dim, E > &e)
General shift factory: c + expr, works for any OutputType.
Definition fe_expr_op.hpp:1037
FeExpressionInner< Dim, FeExpressionU, FeExpressionV > inner(const FeExpressionBase< Dim, FeExpressionU > &u, const FeExpressionBase< Dim, FeExpressionV > &v)
Definition fe_expr_op.hpp:224
Template Parameters
DimSpatial dimension.
EWrapped expression type; must expose OutputType.

Member Typedef Documentation

◆ FeSpaceType

using vulpes::fe::FeExpressionBase< Dim, FeExpressionShift< Dim, E > >::FeSpaceType
inherited

Type of the associated Finite Element Space.

◆ OutputType

template<std::size_t Dim, typename E>
using vulpes::fe::FeExpressionShift< Dim, E >::OutputType = typename E::OutputType

Constructor & Destructor Documentation

◆ FeExpressionShift()

template<std::size_t Dim, typename E>
vulpes::fe::FeExpressionShift< Dim, E >::FeExpressionShift ( const OutputType & c,
const E & expr )
inline

Construct with a constant offset and the expression to shift.

Parameters
cConstant offset; type matches E::OutputType (double or Eigen::Vector).
exprWrapped FE expression.

Member Function Documentation

◆ computeOrder()

template<std::size_t Dim, typename E>
std::size_t vulpes::fe::FeExpressionShift< Dim, E >::computeOrder ( ) const
inlineconstexpr

◆ computeUpdateFlags()

template<std::size_t Dim, typename E>
UpdateFlagsType vulpes::fe::FeExpressionShift< Dim, E >::computeUpdateFlags ( ) const
inlineconstexpr

◆ evaluate()

template<std::size_t Dim, typename E>
template<std::size_t J = 0, std::size_t I = 0>
decltype(auto) vulpes::fe::FeExpressionShift< Dim, E >::evaluate ( const FeValues< Dim > & fe_values,
std::size_t j,
std::size_t i,
std::size_t q ) const
inline

Evaluate m_c + expr at quadrature point q.

Template Parameters
JTrial component index (compile-time constant).
ITest component index (compile-time constant).

◆ evaluatePoly()

decltype(auto) vulpes::fe::FeExpressionBase< Dim, FeExpressionShift< Dim, E > >::evaluatePoly ( const FeValues< Dim > & fe_values,
std::size_t j,
std::size_t i,
std::size_t bi,
std::size_t bj ) const
inlineinherited

Compute the polynomial associated to the expression for basis i and j and block bi and bj.

Parameters
fe_valuesFinite element values at quadrature points
jIndex of the trial function basis
iIndex of the test function basis
biBlock index of the trial function
bjBlock index of the test function
Returns
Matrix of polynomials associated to the expression

We use the convention that in the result, each row corresponds to a spatial direction (this extends also to tensors, by unrolling them), while each column corresponds to a addendum of the expression requiring a particular pullback/pushforward transformation. These coefficients are computed by the evaluatePolyCoef method.

◆ evaluatePolyCoef()

decltype(auto) vulpes::fe::FeExpressionBase< Dim, FeExpressionShift< Dim, E > >::evaluatePolyCoef ( const auto & mapping,
const auto & fe_values,
std::size_t bi,
std::size_t bj ) const
inlineinherited

Compute the coefficients of the polynomial associated to the expression for basis i and j and block bi and bj.

Parameters
mappingThe mapping used for the FE
fe_valuesFinite element values at quadrature points
biBlock index of the trial function
bjBlock index of the test function
Returns
Matrix of coefficients associated to the polynomial expression

The coefficients are the pullback/pushforward needed by each of the polynomial returned by evaluatePoly. Each column corresponds to an addendum of the expression requiring a particular pullback/pushforward transformation. Each row corresponds to a spatial direction (this extends also to tensors, by unrolling them).

◆ feSpace()

const auto & vulpes::fe::FeExpressionBase< Dim, FeExpressionShift< Dim, E > >::feSpace ( ) const
inlineconstexprinherited

Get the associated Finite Element Space.

◆ operator-()

FeExpressionUnaryMinus< Dim, FeExpressionShift< Dim, E > > vulpes::fe::FeExpressionBase< Dim, FeExpressionShift< Dim, E > >::operator- ( ) const
inlineconstexprinherited

Unary minus operator for the FE expression.

Returns
New FE expression representing the negation of the current one

◆ precompute()

template<std::size_t Dim, typename E>
bool vulpes::fe::FeExpressionShift< Dim, E >::precompute ( const FeValues< Dim > & fe_values,
const CellsType< Dim > & cells ) const
inlineconstexpr

◆ self()

const FeExpressionShift< Dim, E > & vulpes::fe::FeExpressionBase< Dim, FeExpressionShift< Dim, E > >::self ( ) const
inlineprotectedinherited

Member Data Documentation

◆ is_bilinear

template<std::size_t Dim, typename E>
uint8_t vulpes::fe::FeExpressionShift< Dim, E >::is_bilinear = E::is_bilinear
staticconstexpr

◆ is_leaf

template<std::size_t Dim, typename E>
bool vulpes::fe::FeExpressionShift< Dim, E >::is_leaf = false
staticconstexpr

◆ k_index_begin

std::size_t vulpes::fe::FeExpressionBase< Dim, FeExpressionShift< Dim, E > >::k_index_begin
inlinestaticconstexprinherited

Index the block of the expression starts from (for vectorial problems).

◆ k_index_end

std::size_t vulpes::fe::FeExpressionBase< Dim, FeExpressionShift< Dim, E > >::k_index_end
inlinestaticconstexprinherited

Index the block of the expression ends to (for vectorial problems).

◆ m_c

template<std::size_t Dim, typename E>
OutputType vulpes::fe::FeExpressionShift< Dim, E >::m_c
protected

◆ m_expr

template<std::size_t Dim, typename E>
std::conditional_t<E::is_leaf, const E&, const E> vulpes::fe::FeExpressionShift< Dim, E >::m_expr
protected

The documentation for this class was generated from the following file: