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

Extract a single scalar spatial component at compile-time index K from a vector-output FE expression. More...

#include <fe_expr_unary.hpp>

Inheritance diagram for vulpes::fe::FeExpressionSpatialComponent< K, Dim, E >:
[legend]
Collaboration diagram for vulpes::fe::FeExpressionSpatialComponent< K, 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 FeExpressionSpatialComponent (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, FeExpressionSpatialComponent< K, 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 FeExpressionSpatialComponent< K, Dim, E > & self () const

Protected Attributes

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

Detailed Description

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

Extract a single scalar spatial component at compile-time index K from a vector-output FE expression.

Works for all expression types (IsNothing, IsLinearTest, IsLinearTrial, IsBilinear) whose evaluate() returns a type supporting operator[K]. Returns the K-th spatial component as a double at every quadrature point.

Typical uses:

auto d_x_p = fe::spatial_component<0>(fe::grad_proj(p_vec, fe_space,
doh)); auto d_x_ph = fe::spatial_component<0>(fe::grad(phi)); // d/dx of
test fn auto d_y_ph = fe::spatial_component<1>(fe::grad(phi)); // d/dy of
test fn auto nx = fe::spatial_component<0>(fe::normal(fe_space)); // x
FeGradProjectionExpr< FeSpaceType::dim, FeSpaceType, DofHandlerType > grad_proj(const la::Vector &uh, const FeSpaceType &fe_space, const DofHandlerType &dof_handler)
Factory for FeGradProjectionExpr: gradient of a DG field.
Definition fe_expr_func.hpp:903
const auto normal(const FeSpace &)
Definition fe_expr_func.hpp:92
FeExpressionSpatialComponent< K, Dim, E > spatial_component(const FeExpressionBase< Dim, E > &e)
Extract the K-th scalar spatial component of a vector-output FE expression at every quadrature point.
Definition fe_expr_unary.hpp:313
FeExpressionGradFunc< IndexBegin, IndexEnd, Dim, FeSpace, IsTest > grad(const FeExpressionFunc< IndexBegin, IndexEnd, Dim, FeSpace, IsTest > &w)
Definition fe_expr_basis.hpp:315

For block-diagonal field extraction from a multi-component test/trial expression use fe::field_component instead.

Renamed from FeExpressionComponentK (2026-06-10); factory was fe::component<K>.

Template Parameters
KCompile-time spatial component index to extract (zero-based).
DimSpatial dimension.
EWrapped expression type; evaluate() must return a type supporting operator[].

Member Typedef Documentation

◆ FeSpaceType

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

◆ OutputType

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

Constructor & Destructor Documentation

◆ FeExpressionSpatialComponent()

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

Member Function Documentation

◆ computeOrder()

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

◆ computeUpdateFlags()

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

◆ evaluate()

template<std::size_t K, std::size_t Dim, typename E>
template<std::size_t J = 0, std::size_t I = 0>
decltype(auto) vulpes::fe::FeExpressionSpatialComponent< K, 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, FeExpressionSpatialComponent< K, 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, FeExpressionSpatialComponent< K, 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 K, std::size_t Dim, typename E>
template<typename U = E, typename = std::void_t<decltype(std::declval<const U&>().feSpace())>>
decltype(auto) vulpes::fe::FeExpressionSpatialComponent< K, Dim, E >::feSpace ( ) const
inlineconstexpr

◆ operator-()

FeExpressionUnaryMinus< Dim, FeExpressionSpatialComponent< K, Dim, E > > vulpes::fe::FeExpressionBase< Dim, FeExpressionSpatialComponent< K, 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 K, std::size_t Dim, typename E>
bool vulpes::fe::FeExpressionSpatialComponent< K, Dim, E >::precompute ( const FeValues< Dim > & fe_values,
const CellsType< Dim > & cells ) const
inlineconstexpr

◆ self()

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

Member Data Documentation

◆ is_bilinear

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

◆ is_leaf

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

◆ k_index_begin

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

◆ k_index_end

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

◆ m_expr

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

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