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

Extract the field (block) component of a multi-component test/trial expression driven by the integration loop's DOF index. More...

#include <fe_expr_unary.hpp>

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

Classes

struct  FsTypeOf
struct  FsTypeOf< T, std::void_t< typename T::FeSpaceType > >

Public Types

using OutputType = double
using FeSpaceType = typename FsTypeOf<E>::type

Public Member Functions

constexpr FeExpressionFieldComponent (const E &expr)
template<typename U = E, typename = std::void_t<decltype(std::declval<const U&>().feSpace())>>
constexpr decltype(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
constexpr UpdateFlagsType computeUpdateFlags () const
constexpr std::size_t computeOrder () const
constexpr bool precompute (const FeValues< Dim > &fe_values, const CellsType< Dim > &cells) const
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, FeExpressionFieldComponent< 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 = E::k_index_begin
static constexpr std::size_t k_index_end = E::k_index_end

Protected Member Functions

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

Protected Attributes

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

Detailed Description

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

Extract the field (block) component of a multi-component test/trial expression driven by the integration loop's DOF index.

For a multi-field test function whose evaluate<J,I>() returns a vector of field values, this class extracts entry [I] (test), [J] (trial), or (J,I) (bilinear). The extraction index is NOT a compile-time constant – it is the DOF block index supplied by the integrator at each test/trial DOF, so the result is automatically diagonal across fields.

This is distinct from FeExpressionSpatialComponent, which extracts a fixed compile-time spatial direction (x, y, z) from a vector-output expression.

Typical use: assemble a scalar coefficient against a single field of a multi-component test function without writing separate forms per field:

// phi is a 2-component test function (field 0 = u, field 1 = v).
// fe::field_component(phi) at DOF I=0 returns phi_u, at I=1 returns phi_v.
// The assembled form is block-diagonal: p couples only to its own field.
TestFunction<FS, 0, 2> phi(fe_space);
auto wf = p_proj * fe::field_component(phi);
FeExpressionFieldComponent< Dim, E > field_component(const FeExpressionBase< Dim, E > &e)
Extract the block field component of a multi-component test/trial expression, driven by the integrati...
Definition fe_expr_unary.hpp:332
FeExpressionFunc< IndexBegin, IndexEnd, FeSpace::dim, FeSpace, true > TestFunction
Definition fe_expr_basis.hpp:169

Originally implemented by Matteo Caldana as FeExpressionComponentDth (commit ae371479, 2025-06-12); renamed 2026-06-10 and wired up for direct assembly 2026-06-11 by mirroring FeExpressionSpatialComponent: conditional FeSpaceType alias, feSpace() forwarding, and k_index_begin/end propagation from E. The block range is forwarded unchanged, so a vector TestFunction<FS, 0, N> keeps nblocks = N and the rhs integrator loop reaches every field block (each block I selects its own field via [I]).

Template Parameters
DimSpatial dimension.
EWrapped expression type (IsLinearTest, IsLinearTrial, or IsBilinear); IsNothing is not supported.

Member Typedef Documentation

◆ FeSpaceType

template<std::size_t Dim, typename E>
using vulpes::fe::FeExpressionFieldComponent< Dim, E >::FeSpaceType = typename FsTypeOf<E>::type

◆ OutputType

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

Constructor & Destructor Documentation

◆ FeExpressionFieldComponent()

template<std::size_t Dim, typename E>
vulpes::fe::FeExpressionFieldComponent< Dim, E >::FeExpressionFieldComponent ( const E & expr)
inlineexplicitconstexpr

Member Function Documentation

◆ computeOrder()

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

◆ computeUpdateFlags()

template<std::size_t Dim, typename E>
UpdateFlagsType vulpes::fe::FeExpressionFieldComponent< 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::FeExpressionFieldComponent< Dim, E >::evaluate ( const FeValues< Dim > & fe_values,
std::size_t j,
std::size_t i,
std::size_t q ) const
inline

◆ evaluatePoly()

decltype(auto) vulpes::fe::FeExpressionBase< Dim, FeExpressionFieldComponent< 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, FeExpressionFieldComponent< 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()

template<std::size_t Dim, typename E>
template<typename U = E, typename = std::void_t<decltype(std::declval<const U&>().feSpace())>>
decltype(auto) vulpes::fe::FeExpressionFieldComponent< Dim, E >::feSpace ( ) const
inlineconstexpr

◆ operator-()

FeExpressionUnaryMinus< Dim, FeExpressionFieldComponent< Dim, E > > vulpes::fe::FeExpressionBase< Dim, FeExpressionFieldComponent< 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::FeExpressionFieldComponent< Dim, E >::precompute ( const FeValues< Dim > & fe_values,
const CellsType< Dim > & cells ) const
inlineconstexpr

◆ self()

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

Member Data Documentation

◆ is_bilinear

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

◆ is_leaf

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

◆ k_index_begin

template<std::size_t Dim, typename E>
std::size_t vulpes::fe::FeExpressionFieldComponent< Dim, E >::k_index_begin = E::k_index_begin
staticconstexpr

◆ k_index_end

template<std::size_t Dim, typename E>
std::size_t vulpes::fe::FeExpressionFieldComponent< Dim, E >::k_index_end = E::k_index_end
staticconstexpr

◆ m_expr

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

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