Vulpes  0.1.0
Versatile and parallel compUtational Library for high-order discontinuous Polytopal Element Simulations
Loading...
Searching...
No Matches
vulpes::fe::FeExpressionGradContrBlock< TestComp, TrialComp, IndexBegin, IndexEnd, Dim, FeSpace, FuncExpr, GradOnTest > Class Template Reference

Bilinear expression for a single (test, trial) component block. Two forms selected by GradOnTest: More...

#include <fe_expr_vector.hpp>

Inheritance diagram for vulpes::fe::FeExpressionGradContrBlock< TestComp, TrialComp, IndexBegin, IndexEnd, Dim, FeSpace, FuncExpr, GradOnTest >:
[legend]
Collaboration diagram for vulpes::fe::FeExpressionGradContrBlock< TestComp, TrialComp, IndexBegin, IndexEnd, Dim, FeSpace, FuncExpr, GradOnTest >:
[legend]

Public Types

using FeSpaceType = FeSpace
using PolynomialType = std::decay_t<decltype(FeSpace{0}.getBasis()[0])>

Public Member Functions

 FeExpressionGradContrBlock (const FuncExpr &func, const FeSpace &fe_space)
 Construct from a Dim-vector flux expression and the FE space.
constexpr const auto & feSpace () const
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 the (J, I) block contribution at quadrature point q.
constexpr UpdateFlagsType computeUpdateFlags () const
constexpr std::size_t computeOrder () const
decltype(auto) evaluatePoly (const FeValues< Dim > &, std::size_t, std::size_t, std::size_t, std::size_t) const
decltype(auto) evaluatePolyCoef (const auto &, const auto &, std::size_t, std::size_t) const
constexpr bool precompute (const FeValues< Dim > &fe_values, const CellsType< Dim > &cells) const
constexpr FeExpressionUnaryMinus< Dim, FeExpressionGradContrBlock< TestComp, TrialComp, IndexBegin, IndexEnd, Dim, FeSpace, FuncExpr, true > > operator- () const
 Unary minus operator for the FE expression.

Static Public Attributes

static constexpr bool is_leaf = false
static constexpr uint8_t is_bilinear = IsBilinear
static constexpr std::size_t k_index_begin = IndexBegin
static constexpr std::size_t k_index_end = IndexEnd

Protected Member Functions

const FeExpressionGradContrBlock< TestComp, TrialComp, IndexBegin, IndexEnd, Dim, FeSpace, FuncExpr, true > & self () const

Protected Attributes

std::conditional_t< FuncExpr::is_leaf, const FuncExpr &, const FuncExpr > m_func
const FeSpace & m_fe_space

Detailed Description

template<std::size_t TestComp, std::size_t TrialComp, std::size_t IndexBegin, std::size_t IndexEnd, std::size_t Dim, typename FeSpace, typename FuncExpr, bool GradOnTest = true>
class vulpes::fe::FeExpressionGradContrBlock< TestComp, TrialComp, IndexBegin, IndexEnd, Dim, FeSpace, FuncExpr, GradOnTest >

Bilinear expression for a single (test, trial) component block. Two forms selected by GradOnTest:

GradOnTest=true (default): int_K F(x) . grad(v_k) * u_l dK GradOnTest=false (adjoint): int_K v_k * F(x) . grad(u_l) dK

Activates exactly one block of the local matrix identified by (TestComp, TrialComp). All other (J, I) pairs return void and are skipped by the integrator.

When TestComp == TrialComp this is a diagonal block (same as one component of FeExpressionGradContr). When TestComp != TrialComp this is an off-diagonal block, expressing coupling between two distinct components.

A common use case is a linearized hyperbolic system where the flux Jacobian has off-diagonal entries A_{kl}(x) coupling test component k with trial component l: wf_kl = fe::grad_contr_block<k, l>(A_kl_expr, fe::grad(v), u);

The trial-gradient form (GradOnTest=false) assembles the adjoint stiffness: T_{ij} = int_K phi_i * F . grad(phi_j) dK which equals the transpose of the test-gradient form – no IBP, no face terms. Needed when the adjoint stiffness T_{ij} = int_K phi_i * F . grad(phi_j) dK is required directly: wf_kl = fe::grad_contr_block<k, l>(F_expr, v, fe::grad(u));

Note: evaluatePoly / evaluatePolyCoef are not implemented. This expression supports the simplexify (quadrature-based) integrator only.

Template Parameters
TestCompTest component index k (absolute, within [IndexBegin, IndexEnd)).
TrialCompTrial component index l (absolute, within [IndexBegin, IndexEnd)).
IndexBeginFirst component index of the function space range.
IndexEndOne past the last component index.
DimSpatial dimension.
FeSpaceFE space type.
FuncExprExpression type for F; must return an Eigen::Vector<double, Dim> from evaluate().
GradOnTesttrue = gradient on test function (default); false = gradient on trial function (adjoint form).

Member Typedef Documentation

◆ FeSpaceType

template<std::size_t TestComp, std::size_t TrialComp, std::size_t IndexBegin, std::size_t IndexEnd, std::size_t Dim, typename FeSpace, typename FuncExpr, bool GradOnTest = true>
using vulpes::fe::FeExpressionGradContrBlock< TestComp, TrialComp, IndexBegin, IndexEnd, Dim, FeSpace, FuncExpr, GradOnTest >::FeSpaceType = FeSpace

◆ PolynomialType

template<std::size_t TestComp, std::size_t TrialComp, std::size_t IndexBegin, std::size_t IndexEnd, std::size_t Dim, typename FeSpace, typename FuncExpr, bool GradOnTest = true>
using vulpes::fe::FeExpressionGradContrBlock< TestComp, TrialComp, IndexBegin, IndexEnd, Dim, FeSpace, FuncExpr, GradOnTest >::PolynomialType = std::decay_t<decltype(FeSpace{0}.getBasis()[0])>

Constructor & Destructor Documentation

◆ FeExpressionGradContrBlock()

template<std::size_t TestComp, std::size_t TrialComp, std::size_t IndexBegin, std::size_t IndexEnd, std::size_t Dim, typename FeSpace, typename FuncExpr, bool GradOnTest = true>
vulpes::fe::FeExpressionGradContrBlock< TestComp, TrialComp, IndexBegin, IndexEnd, Dim, FeSpace, FuncExpr, GradOnTest >::FeExpressionGradContrBlock ( const FuncExpr & func,
const FeSpace & fe_space )
inline

Construct from a Dim-vector flux expression and the FE space.

The factory functions extract the FE space from the non-gradient argument (u for GradOnTest=true, v for GradOnTest=false) and pass it here. The gradient wrapper is used only for factory overload resolution and is not stored; gradient values are read directly from fe_values at integration time.

Parameters
funcDim-vector expression F(x).
fe_spaceFE space (same for both test and trial in DG).

Member Function Documentation

◆ computeOrder()

template<std::size_t TestComp, std::size_t TrialComp, std::size_t IndexBegin, std::size_t IndexEnd, std::size_t Dim, typename FeSpace, typename FuncExpr, bool GradOnTest = true>
std::size_t vulpes::fe::FeExpressionGradContrBlock< TestComp, TrialComp, IndexBegin, IndexEnd, Dim, FeSpace, FuncExpr, GradOnTest >::computeOrder ( ) const
inlineconstexpr

◆ computeUpdateFlags()

template<std::size_t TestComp, std::size_t TrialComp, std::size_t IndexBegin, std::size_t IndexEnd, std::size_t Dim, typename FeSpace, typename FuncExpr, bool GradOnTest = true>
UpdateFlagsType vulpes::fe::FeExpressionGradContrBlock< TestComp, TrialComp, IndexBegin, IndexEnd, Dim, FeSpace, FuncExpr, GradOnTest >::computeUpdateFlags ( ) const
inlineconstexpr

◆ evaluate()

template<std::size_t TestComp, std::size_t TrialComp, std::size_t IndexBegin, std::size_t IndexEnd, std::size_t Dim, typename FeSpace, typename FuncExpr, bool GradOnTest = true>
template<std::size_t J = 0, std::size_t I = 0>
decltype(auto) vulpes::fe::FeExpressionGradContrBlock< TestComp, TrialComp, IndexBegin, IndexEnd, Dim, FeSpace, FuncExpr, GradOnTest >::evaluate ( const FeValues< Dim > & fe_values,
std::size_t j,
std::size_t i,
std::size_t q ) const
inline

Evaluate the (J, I) block contribution at quadrature point q.

J = D % nblocks is the trial component (col block index). I = D / nblocks is the test component (row block index). The integrator accumulates: row = j_basis * nblocks + I col = i_basis * nblocks + J This expression fires only when J == TrialComp and I == TestComp. All other (J, I) pairs return void.

GradOnTest=true: F(x_q) . grad(phi_i) * phi_j (gradient on test i) GradOnTest=false: phi_i * F(x_q) . grad(phi_j) (gradient on trial j)

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

◆ evaluatePoly()

template<std::size_t TestComp, std::size_t TrialComp, std::size_t IndexBegin, std::size_t IndexEnd, std::size_t Dim, typename FeSpace, typename FuncExpr, bool GradOnTest = true>
decltype(auto) vulpes::fe::FeExpressionGradContrBlock< TestComp, TrialComp, IndexBegin, IndexEnd, Dim, FeSpace, FuncExpr, GradOnTest >::evaluatePoly ( const FeValues< Dim > & ,
std::size_t ,
std::size_t ,
std::size_t ,
std::size_t  ) const
inline

◆ evaluatePolyCoef()

template<std::size_t TestComp, std::size_t TrialComp, std::size_t IndexBegin, std::size_t IndexEnd, std::size_t Dim, typename FeSpace, typename FuncExpr, bool GradOnTest = true>
decltype(auto) vulpes::fe::FeExpressionGradContrBlock< TestComp, TrialComp, IndexBegin, IndexEnd, Dim, FeSpace, FuncExpr, GradOnTest >::evaluatePolyCoef ( const auto & ,
const auto & ,
std::size_t ,
std::size_t  ) const
inline

◆ feSpace()

template<std::size_t TestComp, std::size_t TrialComp, std::size_t IndexBegin, std::size_t IndexEnd, std::size_t Dim, typename FeSpace, typename FuncExpr, bool GradOnTest = true>
const auto & vulpes::fe::FeExpressionGradContrBlock< TestComp, TrialComp, IndexBegin, IndexEnd, Dim, FeSpace, FuncExpr, GradOnTest >::feSpace ( ) const
inlineconstexpr

◆ operator-()

FeExpressionUnaryMinus< Dim, FeExpressionGradContrBlock< TestComp, TrialComp, IndexBegin, IndexEnd, Dim, FeSpace, FuncExpr, true > > vulpes::fe::FeExpressionBase< Dim, FeExpressionGradContrBlock< TestComp, TrialComp, IndexBegin, IndexEnd, Dim, FeSpace, FuncExpr, true > >::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 TestComp, std::size_t TrialComp, std::size_t IndexBegin, std::size_t IndexEnd, std::size_t Dim, typename FeSpace, typename FuncExpr, bool GradOnTest = true>
bool vulpes::fe::FeExpressionGradContrBlock< TestComp, TrialComp, IndexBegin, IndexEnd, Dim, FeSpace, FuncExpr, GradOnTest >::precompute ( const FeValues< Dim > & fe_values,
const CellsType< Dim > & cells ) const
inlineconstexpr

◆ self()

const FeExpressionGradContrBlock< TestComp, TrialComp, IndexBegin, IndexEnd, Dim, FeSpace, FuncExpr, true > & vulpes::fe::FeExpressionBase< Dim, FeExpressionGradContrBlock< TestComp, TrialComp, IndexBegin, IndexEnd, Dim, FeSpace, FuncExpr, true > >::self ( ) const
inlineprotectedinherited

Member Data Documentation

◆ is_bilinear

template<std::size_t TestComp, std::size_t TrialComp, std::size_t IndexBegin, std::size_t IndexEnd, std::size_t Dim, typename FeSpace, typename FuncExpr, bool GradOnTest = true>
uint8_t vulpes::fe::FeExpressionGradContrBlock< TestComp, TrialComp, IndexBegin, IndexEnd, Dim, FeSpace, FuncExpr, GradOnTest >::is_bilinear = IsBilinear
staticconstexpr

◆ is_leaf

template<std::size_t TestComp, std::size_t TrialComp, std::size_t IndexBegin, std::size_t IndexEnd, std::size_t Dim, typename FeSpace, typename FuncExpr, bool GradOnTest = true>
bool vulpes::fe::FeExpressionGradContrBlock< TestComp, TrialComp, IndexBegin, IndexEnd, Dim, FeSpace, FuncExpr, GradOnTest >::is_leaf = false
staticconstexpr

◆ k_index_begin

template<std::size_t TestComp, std::size_t TrialComp, std::size_t IndexBegin, std::size_t IndexEnd, std::size_t Dim, typename FeSpace, typename FuncExpr, bool GradOnTest = true>
std::size_t vulpes::fe::FeExpressionGradContrBlock< TestComp, TrialComp, IndexBegin, IndexEnd, Dim, FeSpace, FuncExpr, GradOnTest >::k_index_begin = IndexBegin
staticconstexpr

◆ k_index_end

template<std::size_t TestComp, std::size_t TrialComp, std::size_t IndexBegin, std::size_t IndexEnd, std::size_t Dim, typename FeSpace, typename FuncExpr, bool GradOnTest = true>
std::size_t vulpes::fe::FeExpressionGradContrBlock< TestComp, TrialComp, IndexBegin, IndexEnd, Dim, FeSpace, FuncExpr, GradOnTest >::k_index_end = IndexEnd
staticconstexpr

◆ m_fe_space

template<std::size_t TestComp, std::size_t TrialComp, std::size_t IndexBegin, std::size_t IndexEnd, std::size_t Dim, typename FeSpace, typename FuncExpr, bool GradOnTest = true>
const FeSpace& vulpes::fe::FeExpressionGradContrBlock< TestComp, TrialComp, IndexBegin, IndexEnd, Dim, FeSpace, FuncExpr, GradOnTest >::m_fe_space
protected

◆ m_func

template<std::size_t TestComp, std::size_t TrialComp, std::size_t IndexBegin, std::size_t IndexEnd, std::size_t Dim, typename FeSpace, typename FuncExpr, bool GradOnTest = true>
std:: conditional_t<FuncExpr::is_leaf, const FuncExpr&, const FuncExpr> vulpes::fe::FeExpressionGradContrBlock< TestComp, TrialComp, IndexBegin, IndexEnd, Dim, FeSpace, FuncExpr, GradOnTest >::m_func
protected

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