Vulpes  0.1.0
Versatile and parallel compUtational Library for high-order discontinuous Polytopal Element Simulations
Loading...
Searching...
No Matches
vulpes::assemble::WeakFormIntegratorSimplexify< MeshType, FeExpressionTuple, FeExpressionFaceTuple > Class Template Reference

Integrator that simplexifies cells and integrates weak forms on them. More...

#include <integrator_simplexify.hpp>

Inheritance diagram for vulpes::assemble::WeakFormIntegratorSimplexify< MeshType, FeExpressionTuple, FeExpressionFaceTuple >:
[legend]
Collaboration diagram for vulpes::assemble::WeakFormIntegratorSimplexify< MeshType, FeExpressionTuple, FeExpressionFaceTuple >:
[legend]

Classes

struct  CellCache

Public Types

using index_t = typename MeshType::index_t
 Index type taken from the MeshType.
using WeakFormIntegratorBaseType
 Base class alias.
using FeType = WeakFormIntegratorBaseType::FeType
 Finite element type alias (from base).
using CellType = geometry::Cell<dim, double, index_t>
 Cell type alias with compile-time dimension.
using MappingType = std::decay_t<decltype(FeType::getMapping(CellType{}))>
 Mapping type deduced from the FE type's getMapping.
using FeExpressionTupleBilinear
using FeExpressionTupleLinear
using FeExpressionTupleFaceBilinear
using FeExpressionTupleFaceLinear

Public Member Functions

 WeakFormIntegratorSimplexify (const MeshType &mesh, CellManager< MeshType, FeType > &cell_manager, const FeExpressionTuple &fe_expression, const FeExpressionFaceTuple &fe_expression_face=FeExpressionFaceTuple{})
 Construct the simplexifying integrator.
void integrate (index_t cell_id) override
 Perform integration for a single cell.
void setCellCache (bool enable)
void computeUpdateFlags ()
 Compute the update flags indicating the values to be updated for each cell in the FEValues.
void computeMaxOrder ()
 Compute the maximum polynomial order among all finite element expressions.
const CellType & getCell (index_t cell_id, bool update_mapping=false)
 Get the cell object for a given cell id.
void preallocate (index_t cell_id)
 Resize the internal storage of local integrals (matrices) to fit the number of finite element expressions taking into account which expressions are computed on the faces and which in the volume, and which expressions are bilinear or linear.
void findCellNeigh ()
 Find the neighboring cell across the current (local) face (m_face_id) and set up the ids for the neighbor FEValues if needed.
void applyBasisScaling ()
 Apply the basis scaling to the integrals and right-hand side contributions if needed.
Eigen::Map< Eigen::MatrixXd > getCurrFaceIntegral (const auto &expr, Eigen::Index expr_id)
 Get a map to the data corresponding to the face integral for the current cell and face being integrated. The data is a raw buffer that points to the correct location in the internal storage.
Eigen::Map< Eigen::VectorXd > getCurrFaceRhs (const auto &expr, Eigen::Index expr_id)
 Get a map to the rhs vector for the current face and expression.
void buildWeakFormPointerTable ()
 Build a lookup table that maps finite element expression pointers to their corresponding data storage locations for integrals and right-hand side contributions.
const auto & getIntegrals () const
 Get a const reference to the (bilinear) volume integrals buffer.
const auto & getRhsIntegrals () const
 Get a const reference to the (linear) volume right-hand side buffer.
const auto & getFaceIntegrals () const
 Get a const reference to the (bilinear) face integrals buffer where both basis functions belong to this cell.
const auto & getRhsFaceIntegrals () const
 Get a const reference to the (linear) face right-hand side buffer.
const auto & getFaceIntegralsNeigh () const
 Get a const reference to the (bilinear) face integrals buffer where one basis function belongs to the neighboring cell.
const auto & getRhsFaceIntegralsNeigh () const
 Get a const reference to the (linear) face rhs buffer where the test function belongs to the neighboring cell.
auto getIntegral (auto wf_ptr, index_t loc_neigh_id=-1) const
 Get the integral (matrix or vector) for the current cell.

Static Public Attributes

static constexpr std::size_t dim = MeshType::self_dim
 Spatial dimension of the mesh (compile-time).
static constexpr index_t s_n_expr
 Number of expressions (compile-time constants forwarded from base).
static constexpr index_t s_n_face_expr
static constexpr index_t s_n_expr_bilinear
static constexpr index_t s_n_expr_linear
static constexpr index_t s_n_face_expr_bilinear
static constexpr index_t s_n_face_expr_linear
static constexpr index_t s_n_blocks
static constexpr uint32_t nblocks
 Number of vector blocks in the system, e.g. for a scalar problem is 1, for an elasticity problem is dim (2 or 3).

Protected Types

using CellNeighInfo

Protected Member Functions

template<typename QRule>
void evalReferenceFrame (fe::FeValues< dim > &fe_values, const QRule &qrule)
template<typename SimplexMatrixType, typename VertexMatrixType>
void mapQuadraturePointsToSimplex (const SimplexMatrixType &simplexes, const VertexMatrixType &vertexes, int32_t k)
 Map quadrature nodes from the reference simplex to physical simplex k.
void integrateVolumeCell ()
 Integrate the volume (cell interior) over the currently mapped simplex.
template<typename FaceSubsimplexMatrix, typename SimplexPtsMatrix>
void updateQptsAndMappingForThisAndNeigh (const FaceSubsimplexMatrix &face_subsimplexes, const SimplexPtsMatrix &simplexification_pts, index_t k)
 Update boundary quadrature points & mappings for the current face subsimplex.
void integrateSurfaceSubcell ()
 Integrate the boundary contribution on the currently mapped face subsimplex.

Protected Attributes

bool m_cell_cache_enabled = false
std::vector< CellCache > m_cell_cache
CellCache * m_curr_cache = nullptr
std::size_t m_table_slot = 0
std::shared_ptr< qrule::QuadratureRule< double, dim > > m_qrule_d_ref = nullptr
 Shared pointer to the (volume) quadrature rule reference (cached).
qrule::QuadratureRule< double, dim > m_qrule_d
 Quadrature rule object for volume integrals (mutable, per-simplex).
std::shared_ptr< qrule::QuadratureRule< double, dim - 1 > > m_qrule_bndry_d_ref
 Shared pointer to the boundary quadrature rule (reference).
qrule::QuadratureRule< double, dim > m_qrule_bndry_d
 Quadrature rule object used for face/sub-simplex integration.
const MeshType & m_mesh
 A reference to the underlying mesh.
CellManager< MeshType, FeType > & m_cell_manager
 The cell manager.
FeExpressionTuple m_fe_expression
 A tuple of pointers to the finite element expressions to compute the volume integrals.
std::tuple<> m_fe_expression_face
 A tuple of pointers to the finite element expressions to compute the face integrals.
const FeType & m_fe_space
 A reference to the finite element space.
std::size_t m_order
 The maximum polynomial order of the finite element expressions integrated in the volume.
std::size_t m_order_face
 The maximum polynomial order of the finite element expressions integrated on the faces.
std::unordered_map< void *, double * > m_wf_ptr_table
 A map from finite element expression pointers to their corresponding data storage locations.
std::unordered_map< void *, Eigen::MatrixXd > m_neigh_sum_scratch
 Scratch buffers reused by getIntegral to accumulate the sum-over-neighbors case without a fresh heap allocation per call, keyed per weak-form pointer so two different neigh-summed forms queried on the same integrator cannot alias each other's result.
fe::UpdateFlagsType m_update_flags
 Update flags indicating which values to update in FEValues for the volume integrals.
fe::UpdateFlagsType m_update_flags_face
 Update flags indicating which values to update in FEValues for the face integrals.
Eigen::Tensor< double, 3 > m_integrals
 Tensor to store the bilinear volume integrals.
Eigen::MatrixXd m_rhs
 Matrix to store the linear volume right-hand side contributions.
Eigen::Tensor< double, 3 > m_face_integrals
 Tensor to store the bilinear face integrals where both basis functions belong to this cell.
Eigen::MatrixXd m_face_rhs
 Matrix to store the linear face right-hand side contributions.
Eigen::Tensor< double, 4 > m_face_integrals_neigh
 Tensor to store the bilinear face integrals where one basis function belongs to the neighboring cell.
Eigen::Tensor< double, 3 > m_face_rhs_neigh
 Tensor to store the linear face rhs contributions where the test function belongs to the neighboring cell; shape (nrows, s_n_face_expr, n_max_neigh) – dim1 uses s_n_face_expr (total) so getIntegral's slice_neigh_size = nrows * 1 * s_n_face_expr matches the tensor stride.
fe::FeValues< dim > m_fe_values
 The FEValues object to cache ids, normals and the evaluation of shape functions and their derivatives.
bool m_need_neigh_cell
 Flags indicating whether neighboring cell information is needed.
bool m_need_neigh_values
 Flags indicating whether neighboring cell values are needed, a subset of the above, so if this is true the above is true too.
index_t m_cell_id
 Current cell id being integrated, in mesh MPI local enumeration.
index_t m_face_id
 Current face id being integrated, local to the cell.
CellNeighInfo m_cell_neigh_info
 Information about the neighboring cell across the current face it might be empty if the neighbor is not needed or does not exist.
const MappingType * m_mapping
 Pointer to the mapping of the current cell being integrated.

Detailed Description

template<typename MeshType, typename FeExpressionTuple, typename FeExpressionFaceTuple = std::tuple<>>
class vulpes::assemble::WeakFormIntegratorSimplexify< MeshType, FeExpressionTuple, FeExpressionFaceTuple >

Integrator that simplexifies cells and integrates weak forms on them.

The WeakFormIntegratorSimplexify class extends WeakFormIntegratorBase and provides an integration algorithm that:

  • subdivides a possibly non-simplex cell into simplexes (via geometry::Simplexify),
  • maps quadrature points from a reference simplex to each physical simplex,
  • evaluates finite-element basis and expressions at quadrature points,
  • accumulates volume and boundary integrals into local element matrices / vectors.

The strategy avoids requiring the mesh cells themselves to be simplexes by working on the simplex subdivision explicitly. Boundary integrals are handled similarly by subdividing faces into lower-dimensional simplexes (edges in 2D, triangles in 3D).

The integrator therefore:

  1. computes the affine map \(A_\ell,b_\ell\) for each simplex,
  2. rescales quadrature weights by \(|\det(A_\ell)|\),
  3. evaluates FE basis and expressions at mapped quadrature points,
  4. accumulates contributions into bilinear forms (matrices) and linear functionals (rhs) using provided block structure (s_n_blocks).
Template Parameters
MeshTypemesh type providing index_t, self_dim, cells, etc.
FeExpressionTupletuple of expressions for volume integrals.
FeExpressionFaceTupletuple of expressions for face integrals.

Member Typedef Documentation

◆ CellNeighInfo

using vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::CellNeighInfo
protectedinherited

◆ CellType

template<typename MeshType, typename FeExpressionTuple, typename FeExpressionFaceTuple = std::tuple<>>
using vulpes::assemble::WeakFormIntegratorSimplexify< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::CellType = geometry::Cell<dim, double, index_t>

Cell type alias with compile-time dimension.

◆ FeExpressionTupleBilinear

using vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::FeExpressionTupleBilinear
inherited

◆ FeExpressionTupleFaceBilinear

using vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::FeExpressionTupleFaceBilinear
inherited

◆ FeExpressionTupleFaceLinear

using vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::FeExpressionTupleFaceLinear
inherited

◆ FeExpressionTupleLinear

using vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::FeExpressionTupleLinear
inherited

◆ FeType

template<typename MeshType, typename FeExpressionTuple, typename FeExpressionFaceTuple = std::tuple<>>
using vulpes::assemble::WeakFormIntegratorSimplexify< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::FeType = WeakFormIntegratorBaseType::FeType

Finite element type alias (from base).

◆ index_t

template<typename MeshType, typename FeExpressionTuple, typename FeExpressionFaceTuple = std::tuple<>>
using vulpes::assemble::WeakFormIntegratorSimplexify< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::index_t = typename MeshType::index_t

Index type taken from the MeshType.

◆ MappingType

template<typename MeshType, typename FeExpressionTuple, typename FeExpressionFaceTuple = std::tuple<>>
using vulpes::assemble::WeakFormIntegratorSimplexify< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::MappingType = std::decay_t<decltype(FeType::getMapping(CellType{}))>

Mapping type deduced from the FE type's getMapping.

◆ WeakFormIntegratorBaseType

template<typename MeshType, typename FeExpressionTuple, typename FeExpressionFaceTuple = std::tuple<>>
using vulpes::assemble::WeakFormIntegratorSimplexify< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::WeakFormIntegratorBaseType
Initial value:
MeshType,
FeExpressionTuple,
FeExpressionFaceTuple>
WeakFormIntegratorBase(const MeshType &mesh, CellManager< MeshType, FeType > &cell_manager, const FeExpressionTuple &fe_expression, const std::tuple<> &fe_expression_face)
Definition integrator_base.hpp:126

Base class alias.

Constructor & Destructor Documentation

◆ WeakFormIntegratorSimplexify()

template<typename MeshType, typename FeExpressionTuple, typename FeExpressionFaceTuple>
vulpes::assemble::WeakFormIntegratorSimplexify< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::WeakFormIntegratorSimplexify ( const MeshType & mesh,
CellManager< MeshType, FeType > & cell_manager,
const FeExpressionTuple & fe_expression,
const FeExpressionFaceTuple & fe_expression_face = FeExpressionFaceTuple{} )

Construct the simplexifying integrator.

Caches quadrature rules (volume and boundary) for the requested orders.

Parameters
meshMesh (const ref) used by the base integrator.
cell_managerCellManager instance managing cell mappings.
fe_expressionTuple of FE expressions for volume integrals.
fe_expression_faceTuple of FE expressions for face integrals (optional).

Member Function Documentation

◆ applyBasisScaling()

void vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::applyBasisScaling ( )
inlineinherited

Apply the basis scaling to the integrals and right-hand side contributions if needed.

This method checks if the finite element type requires basis scaling. If so, it computes the scaling factors based on the Jacobian determinant of the mapping and applies them to the stored integrals and right-hand side contributions.

◆ buildWeakFormPointerTable()

void vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::buildWeakFormPointerTable ( )
inlineinherited

Build a lookup table that maps finite element expression pointers to their corresponding data storage locations for integrals and right-hand side contributions.

This method populates an unordered map that associates each finite element expression pointer with a pointer to its corresponding data storage location in the internal tensors and matrices. It ensures that each expression is uniquely mapped and checks for duplicates, reporting an error if the same expression is used more than once.

◆ computeMaxOrder()

void vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::computeMaxOrder ( )
inlineinherited

Compute the maximum polynomial order among all finite element expressions.

Note
This is needed to choose the right quadrature rule or the order of monomial up to which we need to use the quadrature free algorithm.

◆ computeUpdateFlags()

void vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::computeUpdateFlags ( )
inlineinherited

Compute the update flags indicating the values to be updated for each cell in the FEValues.

◆ evalReferenceFrame()

template<typename MeshType, typename FeExpressionTuple, typename FeExpressionFaceTuple = std::tuple<>>
template<typename QRule>
void vulpes::assemble::WeakFormIntegratorSimplexify< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::evalReferenceFrame ( fe::FeValues< dim > & fe_values,
const QRule & qrule )
inlineprotected

◆ findCellNeigh()

void vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::findCellNeigh ( )
inlineinherited

Find the neighboring cell across the current (local) face (m_face_id) and set up the ids for the neighbor FEValues if needed.

◆ getCell()

const CellType & vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::getCell ( index_t cell_id,
bool update_mapping = false )
inlineinherited

Get the cell object for a given cell id.

Parameters
cell_idCell id of the considered cell in mesh (local MPI) enumeration
update_mappingIf true, update the internal mapping pointer to the mapping of the current cell
Returns
The cell object corresponding to the given cell id

◆ getCurrFaceIntegral()

Eigen::Map< Eigen::MatrixXd > vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::getCurrFaceIntegral ( const auto & expr,
Eigen::Index expr_id )
inlineinherited

Get a map to the data corresponding to the face integral for the current cell and face being integrated. The data is a raw buffer that points to the correct location in the internal storage.

This method returns an Eigen::Map to the face integral matrix for the current cell and face being integrated. It takes into account whether the finite element expression requires neighbor values and whether a neighbor cell exists.

Parameters
exprPointer to the finite element expression for which to get the face integral.
expr_idIndex of the finite element expression in the tuple.
Returns
Eigen::Map<Eigen::MatrixXd> Map to the face integral matrix. If there is no neighbor cell when needed, returns a null map.
Warning
The integral is not yet computed

◆ getCurrFaceRhs()

Eigen::Map< Eigen::VectorXd > vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::getCurrFaceRhs ( const auto & expr,
Eigen::Index expr_id )
inlineinherited

Get a map to the rhs vector for the current face and expression.

Returns a writable Eigen::Map into the correct per-neighbor slot of m_face_rhs_neigh (when the expression uses fe::neigh values) or into the flat m_face_rhs column (otherwise). Returns a null map (size 0) when a neighbor is required but absent, or when precompute() rejects this face.

Parameters
exprPointer to the linear face expression.
expr_idIndex of this expression in the linear face tuple.
Returns
Eigen::Map<Eigen::VectorXd> into the appropriate storage.

◆ getFaceIntegrals()

const auto & vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::getFaceIntegrals ( ) const
inlineinherited

Get a const reference to the (bilinear) face integrals buffer where both basis functions belong to this cell.

◆ getFaceIntegralsNeigh()

const auto & vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::getFaceIntegralsNeigh ( ) const
inlineinherited

Get a const reference to the (bilinear) face integrals buffer where one basis function belongs to the neighboring cell.

◆ getIntegral()

auto vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::getIntegral ( auto wf_ptr,
index_t loc_neigh_id = -1 ) const
inlineinherited

Get the integral (matrix or vector) for the current cell.

Parameters
wf_ptrPointer to the finite element expression.
loc_neigh_idLocal neighbor index (>= 0) to retrieve a single per-neighbor slice. Pass the default (-1) to obtain the sum over all neighbors for neigh-test forms, or the flat result for non-neigh forms.
Returns
A zero-copy view of the requested integral (for the non-summed case) or of an internal scratch accumulator (for the summed case). For linear weak forms the result has one column; for bilinear forms it is square. Valid only until the next getIntegral/integrate call on this integrator.

◆ getIntegrals()

const auto & vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::getIntegrals ( ) const
inlineinherited

Get a const reference to the (bilinear) volume integrals buffer.

◆ getRhsFaceIntegrals()

const auto & vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::getRhsFaceIntegrals ( ) const
inlineinherited

Get a const reference to the (linear) face right-hand side buffer.

◆ getRhsFaceIntegralsNeigh()

const auto & vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::getRhsFaceIntegralsNeigh ( ) const
inlineinherited

Get a const reference to the (linear) face rhs buffer where the test function belongs to the neighboring cell.

◆ getRhsIntegrals()

const auto & vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::getRhsIntegrals ( ) const
inlineinherited

Get a const reference to the (linear) volume right-hand side buffer.

◆ integrate()

template<typename MeshType, typename FeExpressionTuple, typename FeExpressionFaceTuple>
void vulpes::assemble::WeakFormIntegratorSimplexify< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::integrate ( index_t cell_id)
overridevirtual

Perform integration for a single cell.

This method:

  • preallocates storage for the current cell,
  • simplexifies the current cell (and optionally its boundary),
  • loops over simplexes computing volume integrals,
  • loops over faces and their subsimplexes computing boundary integrals,
  • applies basis scaling at the end.
Parameters
cell_idlocal id of the cell to integrate.

Implements vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >.

◆ integrateSurfaceSubcell()

template<typename MeshType, typename FeExpressionTuple, typename FeExpressionFaceTuple>
void vulpes::assemble::WeakFormIntegratorSimplexify< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::integrateSurfaceSubcell ( )
protected

Integrate the boundary contribution on the currently mapped face subsimplex.

Uses m_fe_values on the face-sub-simplex mapping to evaluate expressions and to accumulate face bilinear contributions into local face integrals and linear contributions into m_face_rhs.

◆ integrateVolumeCell()

template<typename MeshType, typename FeExpressionTuple, typename FeExpressionFaceTuple>
void vulpes::assemble::WeakFormIntegratorSimplexify< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::integrateVolumeCell ( )
protected

Integrate the volume (cell interior) over the currently mapped simplex.

This method:

  • precomputes FE expressions on the reference frame,
  • loops over quadrature nodes and local DoF pairs (i, j),
  • accumulates bilinear expression contributions into m_integrals,
  • accumulates linear expression contributions into m_rhs.

The method relies on this->m_fe_values to hold the FE basis evaluations and mapping information for the current simplex mapping.

◆ mapQuadraturePointsToSimplex()

template<typename MeshType, typename FeExpressionTuple, typename FeExpressionFaceTuple>
template<typename SimplexMatrixType, typename VertexMatrixType>
void vulpes::assemble::WeakFormIntegratorSimplexify< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::mapQuadraturePointsToSimplex ( const SimplexMatrixType & simplexes,
const VertexMatrixType & vertexes,
int32_t k )
protected

Map quadrature nodes from the reference simplex to physical simplex k.

Computes the affine transformation for simplex k using the provided vertexes and simplexes index array and writes mapped points & rescaled weights into m_qrule_d.

Template Parameters
SimplexMatrixTypematrix-like container type for simplex indices (rows = dim+1).
VertexMatrixTypematrix-like container type for vertex coordinates (cols = npoints).
Parameters
simplexescolumn-major container with simplex vertex indices (dim+1 x nSimplexes).
vertexescoordinates of points (dim x nPoints).
kindex of the simplex to map.

◆ preallocate()

void vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::preallocate ( index_t cell_id)
inlineinherited

Resize the internal storage of local integrals (matrices) to fit the number of finite element expressions taking into account which expressions are computed on the faces and which in the volume, and which expressions are bilinear or linear.

◆ setCellCache()

template<typename MeshType, typename FeExpressionTuple, typename FeExpressionFaceTuple = std::tuple<>>
void vulpes::assemble::WeakFormIntegratorSimplexify< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::setCellCache ( bool enable)
inline

Keeps, per local cell, the simplexification and the reference-frame tables of its quadrature (sub)simplexes, so that integrating a cell again skips their computation. Memory grows with the cells integrated. Tables that do not match the current basis or quadrature size are rebuilt, but a moved or changed mesh is not detected: call again to drop the cache.

◆ updateQptsAndMappingForThisAndNeigh()

template<typename MeshType, typename FeExpressionTuple, typename FeExpressionFaceTuple>
template<typename FaceSubsimplexMatrix, typename SimplexPtsMatrix>
void vulpes::assemble::WeakFormIntegratorSimplexify< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::updateQptsAndMappingForThisAndNeigh ( const FaceSubsimplexMatrix & face_subsimplexes,
const SimplexPtsMatrix & simplexification_pts,
index_t k )
protected

Update boundary quadrature points & mappings for the current face subsimplex.

Builds the transformation from reference (sub)simplex to the physical subsimplex and updates m_qrule_bndry_d, m_fe_values, and - if needed - neighbour evaluations (m_fe_values.neighValues()).

It also applies the Nanson rule to convert reference face measures into physical measures and rescales quadrature weights accordingly.

Template Parameters
FaceSubsimplexMatrixmatrix-like type holding subsimplex vertex indices.
SimplexPtsMatrixmatrix-like type holding simplexification points.
Parameters
face_subsimplexesmatrix whose columns define subsimplexes on the face.
simplexification_ptspoint list used to define subsimplex coordinates.
kindex of the subsimplex for the face.

Member Data Documentation

◆ dim

template<typename MeshType, typename FeExpressionTuple, typename FeExpressionFaceTuple = std::tuple<>>
std::size_t vulpes::assemble::WeakFormIntegratorSimplexify< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::dim = MeshType::self_dim
inlinestaticconstexpr

Spatial dimension of the mesh (compile-time).

◆ m_cell_cache

template<typename MeshType, typename FeExpressionTuple, typename FeExpressionFaceTuple = std::tuple<>>
std::vector<CellCache> vulpes::assemble::WeakFormIntegratorSimplexify< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::m_cell_cache
protected

◆ m_cell_cache_enabled

template<typename MeshType, typename FeExpressionTuple, typename FeExpressionFaceTuple = std::tuple<>>
bool vulpes::assemble::WeakFormIntegratorSimplexify< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::m_cell_cache_enabled = false
protected

◆ m_cell_id

index_t vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::m_cell_id
protectedinherited

Current cell id being integrated, in mesh MPI local enumeration.

◆ m_cell_manager

CellManager<MeshType, FeType>& vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::m_cell_manager
protectedinherited

The cell manager.

◆ m_cell_neigh_info

CellNeighInfo vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::m_cell_neigh_info
protectedinherited

Information about the neighboring cell across the current face it might be empty if the neighbor is not needed or does not exist.

◆ m_curr_cache

template<typename MeshType, typename FeExpressionTuple, typename FeExpressionFaceTuple = std::tuple<>>
CellCache* vulpes::assemble::WeakFormIntegratorSimplexify< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::m_curr_cache = nullptr
protected

◆ m_face_id

index_t vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::m_face_id
protectedinherited

Current face id being integrated, local to the cell.

◆ m_face_integrals

Eigen::Tensor<double, 3> vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::m_face_integrals
protectedinherited

Tensor to store the bilinear face integrals where both basis functions belong to this cell.

◆ m_face_integrals_neigh

Eigen::Tensor<double, 4> vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::m_face_integrals_neigh
protectedinherited

Tensor to store the bilinear face integrals where one basis function belongs to the neighboring cell.

◆ m_face_rhs

Eigen::MatrixXd vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::m_face_rhs
protectedinherited

Matrix to store the linear face right-hand side contributions.

◆ m_face_rhs_neigh

Eigen::Tensor<double, 3> vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::m_face_rhs_neigh
protectedinherited

Tensor to store the linear face rhs contributions where the test function belongs to the neighboring cell; shape (nrows, s_n_face_expr, n_max_neigh) – dim1 uses s_n_face_expr (total) so getIntegral's slice_neigh_size = nrows * 1 * s_n_face_expr matches the tensor stride.

◆ m_fe_expression

FeExpressionTuple vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::m_fe_expression
protectedinherited

A tuple of pointers to the finite element expressions to compute the volume integrals.

◆ m_fe_expression_face

std::tuple<> vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::m_fe_expression_face
protectedinherited

A tuple of pointers to the finite element expressions to compute the face integrals.

◆ m_fe_space

const FeType& vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::m_fe_space
protectedinherited

A reference to the finite element space.

◆ m_fe_values

fe::FeValues<dim> vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::m_fe_values
protectedinherited

The FEValues object to cache ids, normals and the evaluation of shape functions and their derivatives.

◆ m_integrals

Eigen::Tensor<double, 3> vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::m_integrals
protectedinherited

Tensor to store the bilinear volume integrals.

◆ m_mapping

const MappingType* vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::m_mapping
protectedinherited

Pointer to the mapping of the current cell being integrated.

◆ m_mesh

const MeshType& vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::m_mesh
protectedinherited

A reference to the underlying mesh.

◆ m_need_neigh_cell

bool vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::m_need_neigh_cell
protectedinherited

Flags indicating whether neighboring cell information is needed.

◆ m_need_neigh_values

bool vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::m_need_neigh_values
protectedinherited

Flags indicating whether neighboring cell values are needed, a subset of the above, so if this is true the above is true too.

◆ m_neigh_sum_scratch

std::unordered_map<void*, Eigen::MatrixXd> vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::m_neigh_sum_scratch
mutableprotectedinherited

Scratch buffers reused by getIntegral to accumulate the sum-over-neighbors case without a fresh heap allocation per call, keyed per weak-form pointer so two different neigh-summed forms queried on the same integrator cannot alias each other's result.

◆ m_order

std::size_t vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::m_order
protectedinherited

The maximum polynomial order of the finite element expressions integrated in the volume.

◆ m_order_face

std::size_t vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::m_order_face
protectedinherited

The maximum polynomial order of the finite element expressions integrated on the faces.

◆ m_qrule_bndry_d

template<typename MeshType, typename FeExpressionTuple, typename FeExpressionFaceTuple = std::tuple<>>
qrule::QuadratureRule<double, dim> vulpes::assemble::WeakFormIntegratorSimplexify< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::m_qrule_bndry_d
protected

Quadrature rule object used for face/sub-simplex integration.

Although declared as qrule::QuadratureRule<double, dim> for uniform storage semantics, it is populated with (dim-1)-dimensional mapped points.

◆ m_qrule_bndry_d_ref

template<typename MeshType, typename FeExpressionTuple, typename FeExpressionFaceTuple = std::tuple<>>
std::shared_ptr<qrule::QuadratureRule<double, dim - 1> > vulpes::assemble::WeakFormIntegratorSimplexify< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::m_qrule_bndry_d_ref
protected
Initial value:
=
nullptr

Shared pointer to the boundary quadrature rule (reference).

This points to the reference rule on a (dim-1)-simplex used to integrate faces.

◆ m_qrule_d

template<typename MeshType, typename FeExpressionTuple, typename FeExpressionFaceTuple = std::tuple<>>
qrule::QuadratureRule<double, dim> vulpes::assemble::WeakFormIntegratorSimplexify< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::m_qrule_d
protected

Quadrature rule object for volume integrals (mutable, per-simplex).

This stores the mapped nodes & weights for the currently active simplex.

◆ m_qrule_d_ref

template<typename MeshType, typename FeExpressionTuple, typename FeExpressionFaceTuple = std::tuple<>>
std::shared_ptr<qrule::QuadratureRule<double, dim> > vulpes::assemble::WeakFormIntegratorSimplexify< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::m_qrule_d_ref = nullptr
protected

Shared pointer to the (volume) quadrature rule reference (cached).

Points reflect the quadrature nodes on the reference simplex; weights are scaled for each simplex when mapping.

◆ m_rhs

Eigen::MatrixXd vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::m_rhs
protectedinherited

Matrix to store the linear volume right-hand side contributions.

◆ m_table_slot

template<typename MeshType, typename FeExpressionTuple, typename FeExpressionFaceTuple = std::tuple<>>
std::size_t vulpes::assemble::WeakFormIntegratorSimplexify< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::m_table_slot = 0
protected

◆ m_update_flags

fe::UpdateFlagsType vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::m_update_flags
protectedinherited

Update flags indicating which values to update in FEValues for the volume integrals.

◆ m_update_flags_face

fe::UpdateFlagsType vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::m_update_flags_face
protectedinherited

Update flags indicating which values to update in FEValues for the face integrals.

◆ m_wf_ptr_table

std::unordered_map<void*, double*> vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::m_wf_ptr_table
protectedinherited

A map from finite element expression pointers to their corresponding data storage locations.

◆ nblocks

uint32_t vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >::nblocks
inlinestaticconstexprinherited

Number of vector blocks in the system, e.g. for a scalar problem is 1, for an elasticity problem is dim (2 or 3).

◆ s_n_blocks

template<typename MeshType, typename FeExpressionTuple, typename FeExpressionFaceTuple = std::tuple<>>
index_t vulpes::assemble::WeakFormIntegratorSimplexify< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::s_n_blocks
inlinestaticconstexpr
Initial value:

Number of blocks used by the FE space (used for assembling block matrices).

◆ s_n_expr

template<typename MeshType, typename FeExpressionTuple, typename FeExpressionFaceTuple = std::tuple<>>
index_t vulpes::assemble::WeakFormIntegratorSimplexify< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::s_n_expr
inlinestaticconstexpr
Initial value:

Number of expressions (compile-time constants forwarded from base).

◆ s_n_expr_bilinear

template<typename MeshType, typename FeExpressionTuple, typename FeExpressionFaceTuple = std::tuple<>>
index_t vulpes::assemble::WeakFormIntegratorSimplexify< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::s_n_expr_bilinear
inlinestaticconstexpr

◆ s_n_expr_linear

template<typename MeshType, typename FeExpressionTuple, typename FeExpressionFaceTuple = std::tuple<>>
index_t vulpes::assemble::WeakFormIntegratorSimplexify< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::s_n_expr_linear
inlinestaticconstexpr

◆ s_n_face_expr

template<typename MeshType, typename FeExpressionTuple, typename FeExpressionFaceTuple = std::tuple<>>
index_t vulpes::assemble::WeakFormIntegratorSimplexify< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::s_n_face_expr
inlinestaticconstexpr

◆ s_n_face_expr_bilinear

template<typename MeshType, typename FeExpressionTuple, typename FeExpressionFaceTuple = std::tuple<>>
index_t vulpes::assemble::WeakFormIntegratorSimplexify< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::s_n_face_expr_bilinear
inlinestaticconstexpr

◆ s_n_face_expr_linear

template<typename MeshType, typename FeExpressionTuple, typename FeExpressionFaceTuple = std::tuple<>>
index_t vulpes::assemble::WeakFormIntegratorSimplexify< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::s_n_face_expr_linear
inlinestaticconstexpr

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