![]() |
Vulpes
0.1.0
Versatile and parallel compUtational Library for high-order discontinuous Polytopal Element Simulations
|
Implements a quadrature-free finite element integrator. More...
#include <integrator_qfree.hpp>
Public Types | |
| using | WeakFormIntegratorBaseType |
| using | FeType |
| using | PolyType = FeType::FeSpaceType::PolynomialFast |
| The polynomial type used for standard basis functions. | |
| using | MonoType = PolyType::MonomialType |
| The monomial type for standard polynomials. | |
| using | PolyTypeLifted |
| The polynomial type "lifted" to a higher dimension. This is used for face integrals involving neighbor cell data, where the polynomial also depends on the coefficients of the affine map between reference cells. The extra 2*dim dimensions account for the diagonal Jacobian and translation vector. | |
| using | MonoTypeLifted = PolyTypeLifted::MonomialType |
| The monomial type for lifted polynomials. | |
| using | index_t = typename MeshType::index_t |
| The index type used by the mesh. | |
| using | GatheredPolynomial = std::vector<GatheredMonomial<dim>> |
| An uncompressed gathered polynomial for a single entry. | |
| using | GatheredPolynomialCoef = std::vector<std::pair<double, uint16_t>> |
| Coefficients for a compressed gathered polynomial. | |
| using | FlatPolyTypeLifted = datastructure::CrsMap<MonoTypeLifted, index_t> |
| A compressed representation of a list of lifted polynomials. | |
| using | FlatPolyType = datastructure::CrsMap<CompressedMonomial, index_t> |
| A compressed representation of a list of standard polynomials. | |
| using | CompressedListGatheredPoly |
| A compressed representation of a list of gathered polynomials. | |
| using | FeExpressionTupleBilinear |
| using | FeExpressionTupleLinear |
| using | FeExpressionTupleFaceBilinear |
| using | FeExpressionTupleFaceLinear |
| using | CellType |
| using | MappingType |
Public Member Functions | |
| WeakFormIntegratorQFree (const MeshType &mesh, CellManager< MeshType, FeType > &cell_manager, const FeExpressionTuple &fe_expression, const FeExpressionFaceTuple &fe_expression_face=FeExpressionFaceTuple{}) | |
| Constructs the quadrature-free integrator. | |
| void | integrate (index_t cell_id) |
| Performs the full integration process for a given cell. | |
| 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 |
| The spatial dimension of the mesh. | |
| static constexpr uint32_t | s_n_expr |
| The number of volume expressions. | |
| static constexpr uint32_t | s_n_face_expr |
| The number of face expressions. | |
| static constexpr uint32_t | s_n_expr_bilinear |
| The number of bilinear volume expressions. | |
| static constexpr uint32_t | s_n_expr_linear |
| The number of linear (RHS) volume expressions. | |
| static constexpr uint32_t | s_n_face_expr_bilinear |
| The number of bilinear face expressions. | |
| static constexpr uint32_t | s_n_face_expr_linear |
| The number of linear (RHS) face expressions. | |
| static constexpr index_t | s_n_blocks |
| The number of blocks for vector/tensor-valued problems. | |
| 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 | TypeIJ = std::array<Eigen::Index, 3> |
| Helper type for storing indices (i * s_n_blocks + bi, j * s_n_blocks + bj, k) for the bilinear lookup table. | |
| using | RepeatingTableIJ = datastructure::CrsMap<TypeIJ, index_t> |
| A compressed map used as a lookup table for repeated bilinear polynomials. | |
| using | TypeI = std::array<Eigen::Index, 2> |
| Helper type for storing indices (i * s_n_blocks + bi, k) for the linear (RHS) lookup table – no trial index. | |
| using | RepeatingTableI = datastructure::CrsMap<TypeI, index_t> |
| A compressed map used as a lookup table for repeated linear polynomials. | |
| using | CellNeighInfo |
Protected Member Functions | |
| FlatPolyType | compress (const datastructure::CrsMapUncompressed< MonoType > &uncompressed_table) |
| Compresses a table of polynomials. | |
| void | buildLookupTables () |
| Builds lookup tables to identify and reuse identical polynomials. | |
| std::array< std::vector< GatheredPolynomial >, s_n_face_expr_bilinear > | gatherUncompressedLiftedMonomials () |
| Gathers terms for lifted monomials from face expressions (uncompressed stage). | |
| std::vector< std::array< uint8_t, dim *2 > > | buildUniqueEvaTableLiftedMonomials (const std::array< std::vector< GatheredPolynomial >, s_n_face_expr_bilinear > &gathered_monos_table) |
| Scans all gathered (lifted) monomials to build a table of unique evaluation exponents. | |
| void | compressGatheredLiftedPolynomials (const std::array< std::vector< GatheredPolynomial >, s_n_face_expr_bilinear > &gathered_monos_table) |
| Compresses the gathered monomials into their final integer-ID-based format. | |
| void | gatherLiftedMonomials () |
| Orchestrates the gathering and compression of lifted monomials. | |
| Eigen::Matrix< double, dim, 2 > | computeRefToNeighRefMap () const |
| Computes the affine mapping from the current cell's reference space to a neighbor's reference space. | |
| void | integrateVolumeCell (const double *aints_data) |
| Integrates all volume expressions over the current cell. | |
| double | updateFaceNormalAndGetNanson () |
| Updates the face normal vector in m_fe_values and computes the Nanson's formula factor. | |
| void | precomputeMonomialCoefsForFace () |
| Precomputes the values of the evaluation parts of the gathered monomials for the current face. | |
| void | integrateFaceCell (const double *eints_data, double nanson) |
| Integrates all face expressions over the current face of the cell. | |
Protected Attributes | |
| std::array< FlatPolyType, s_n_expr_bilinear > | m_poly_table_flat |
| Polynomial tables for bilinear volume expressions. | |
| std::array< FlatPolyType, s_n_expr_bilinear > | m_poly_table_flat_nodupes |
| Unique polynomials for bilinear volume expressions, after deduplication. | |
| std::array< RepeatingTableIJ, s_n_expr_bilinear > | m_poly_table_flat_ijs_table |
| Lookup table mapping unique bilinear volume polynomials to (row, col, k) entries. | |
| std::array< FlatPolyType, s_n_expr_linear > | m_poly_table_flat_linear |
| Polynomial tables for linear volume expressions. | |
| std::array< FlatPolyType, s_n_expr_linear > | m_poly_table_flat_linear_nodupes |
| Unique polynomials for linear volume expressions, after deduplication. | |
| std::array< RepeatingTableI, s_n_expr_linear > | m_poly_table_flat_linear_ijs_table |
| Lookup table mapping unique linear volume polynomials to (row, k) entries. | |
| std::array< FlatPolyType, s_n_face_expr_bilinear > | m_poly_table_face_flat |
| Polynomial tables for bilinear face expressions (non-lifted). | |
| std::array< FlatPolyType, s_n_face_expr_bilinear > | m_poly_table_face_flat_nodupes |
| Unique polynomials for bilinear face expressions. | |
| std::array< RepeatingTableIJ, s_n_face_expr_bilinear > | m_poly_table_face_flat_ijs_table |
| Lookup table for bilinear face polynomials. | |
| std::array< FlatPolyType, s_n_face_expr_linear > | m_poly_table_face_flat_linear |
| Polynomial tables for linear face expressions (non-lifted). | |
| std::array< FlatPolyType, s_n_face_expr_linear > | m_poly_table_face_flat_linear_nodupes |
| Unique polynomials for linear face expressions. | |
| std::array< RepeatingTableI, s_n_face_expr_linear > | m_poly_table_face_flat_linear_ijs_table |
| Lookup table for linear face polynomials. | |
| std::array< FlatPolyTypeLifted, s_n_face_expr_bilinear > | m_poly_table_face_lifted_flat |
| Uncompressed polynomial tables for lifted bilinear face expressions. | |
| std::array< CompressedListGatheredPoly, s_n_face_expr_bilinear > | m_poly_table_face_lifted_gathered |
| Compressed and gathered version of m_poly_table_face_lifted_flat. | |
| std::array< CompressedListGatheredPoly, s_n_face_expr_bilinear > | m_poly_table_face_lifted_gathered_nodupes |
| Unique polynomials for lifted bilinear face expressions, after gathering and deduplication. | |
| std::array< RepeatingTableIJ, s_n_face_expr_bilinear > | m_poly_table_face_lifted_gathered_ijs_table |
| Lookup table for lifted bilinear face polynomials. | |
| std::vector< std::array< uint8_t, dim *2 > > | m_eva_idx_table |
| A table mapping a unique integer ID to a monomial exponent array. Used to evaluate the mapping-dependent parts of gathered monomials. | |
| datastructure::CrsMap< std::pair< double, uint16_t >, index_t > | m_gathered_monos |
| Stores the unique "gathered" parts of monomials. Each row corresponds to a gather_id and contains a list of (coefficient,
eval_id) pairs, representing a sum like \(\sum_i c_i M_i\), where \(M_i\) is an evaluation monomial and eval_id points to a row of m_eva_idx_table. | |
| std::vector< double > | m_gather_coef |
| Buffer storing the computed values of the gathered parts (from m_gathered_monos) for the current face. | |
| std::vector< double > | m_eval_table_ext |
| Buffer storing the computed values of the unique evaluation monomials (from m_eva_idx_table) for the current face. | |
| std::array< Eigen::Index, s_n_expr_bilinear > | m_npoly_comps_volume |
| Stores the number of polynomial components for each bilinear volume expression. | |
| std::array< Eigen::Index, s_n_expr_linear > | m_npoly_comps_volume_linear |
| Stores the number of polynomial components for each linear volume expression. | |
| std::array< Eigen::Index, s_n_face_expr_bilinear > | m_npoly_comps_face |
| Stores the number of polynomial components for each bilinear face expression. | |
| std::array< Eigen::Index, s_n_face_expr_linear > | m_npoly_comps_face_linear |
| Stores the number of polynomial components for each linear face expression. | |
| 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. | |
Implements a quadrature-free finite element integrator.
| MeshType | The type of the mesh. |
| FeExpressionTuple | A tuple of types representing the integrands for volume integrals. |
| FeExpressionFaceTuple | A tuple of types representing the integrands for face integrals. |
This class assembles local stiffness matrices on a cell-by-cell basis using a quadrature-free approach. Instead of relying on numerical quadrature points (like Gauss points), it leverages the fact that the integrands are polynomials. The integration is performed analytically by pre-calculating the integrals of all monomial bases over the reference element.
The core workflow involves several stages of optimization to minimize redundant computations, which is crucial for efficiency.
\[P(\hat{\mathbf{x}}) = \sum_{k} c_k \hat{\mathbf{x}}^{\alpha_k} \]
where \(\hat{\mathbf{x}}^{\alpha_k}\) is a monomial (e.g., in 2D, \(\hat{x}^{\alpha_{k,1}} \hat{y}^{\alpha_{k,2}}\)).\[\int_K P(\mathbf{x}) \,d\mathbf{x} = \int_{\hat{K}} P(\mathbf{F}(\hat{\mathbf{x}})) G(F) |\det(J)| \,d\hat{\mathbf{x}} \]
Here, \(G(F)\) represents the pullback. Indeed, the polynomial can be either a vector field or a covector field (e.g. gradient) that needs further transformation. This terms (like the derminant of the the Jacobian), changes on a cell by cell basis and depending of the part of the weak form considered (e.g. in a reaction-diffusion equation we have both a vector and a covector). For this reason, the FeExpression of a weak form does not return one polynomial, but a list of polynomials that summed represent the weak form. To each polynomial of the list is associated a coefficient \(G(F)\) that needs to be multiplied in order to have the correct transformation when applying the physical mapping of the cell. E.g., the inner(grad(u), grad(v)) weak form is made by two polynomials, one that represents de_x(u)de_x(v) and one de_y(u)de_y(v), which require as coefficient the inverse of the jacobian in the x and y components, respectively. The integral is further simplified to become a weighted sum of precomputed monomial integrals. The values \(\int_{\hat{K}} \hat{\mathbf{x}}^{\alpha_k} \,d\hat{\mathbf{x}}\) are computed beforehand for all necessary monomial powers \(\alpha_k\) via the quadrature free algorithm.
|
protectedinherited |
|
inherited |
| using vulpes::assemble::WeakFormIntegratorQFree< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::CompressedListGatheredPoly |
A compressed representation of a list of gathered polynomials.
|
inherited |
|
inherited |
|
inherited |
|
inherited |
| using vulpes::assemble::WeakFormIntegratorQFree< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::FeType |
| using vulpes::assemble::WeakFormIntegratorQFree< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::FlatPolyType = datastructure::CrsMap<CompressedMonomial, index_t> |
A compressed representation of a list of standard polynomials.
| using vulpes::assemble::WeakFormIntegratorQFree< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::FlatPolyTypeLifted = datastructure::CrsMap<MonoTypeLifted, index_t> |
A compressed representation of a list of lifted polynomials.
| using vulpes::assemble::WeakFormIntegratorQFree< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::GatheredPolynomial = std::vector<GatheredMonomial<dim>> |
An uncompressed gathered polynomial for a single entry.
| using vulpes::assemble::WeakFormIntegratorQFree< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::GatheredPolynomialCoef = std::vector<std::pair<double, uint16_t>> |
Coefficients for a compressed gathered polynomial.
| using vulpes::assemble::WeakFormIntegratorQFree< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::index_t = typename MeshType::index_t |
The index type used by the mesh.
|
inherited |
| using vulpes::assemble::WeakFormIntegratorQFree< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::MonoType = PolyType::MonomialType |
The monomial type for standard polynomials.
| using vulpes::assemble::WeakFormIntegratorQFree< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::MonoTypeLifted = PolyTypeLifted::MonomialType |
The monomial type for lifted polynomials.
| using vulpes::assemble::WeakFormIntegratorQFree< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::PolyType = FeType::FeSpaceType::PolynomialFast |
The polynomial type used for standard basis functions.
| using vulpes::assemble::WeakFormIntegratorQFree< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::PolyTypeLifted |
The polynomial type "lifted" to a higher dimension. This is used for face integrals involving neighbor cell data, where the polynomial also depends on the coefficients of the affine map between reference cells. The extra 2*dim dimensions account for the diagonal Jacobian and translation vector.
|
protected |
A compressed map used as a lookup table for repeated linear polynomials.
|
protected |
A compressed map used as a lookup table for repeated bilinear polynomials.
|
protected |
Helper type for storing indices (i * s_n_blocks + bi, k) for the linear (RHS) lookup table – no trial index.
|
protected |
Helper type for storing indices (i * s_n_blocks + bi, j * s_n_blocks + bj, k) for the bilinear lookup table.
| using vulpes::assemble::WeakFormIntegratorQFree< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::WeakFormIntegratorBaseType |
| vulpes::assemble::WeakFormIntegratorQFree< MeshType, FeExpressionTuple, FeExpressionFaceTuple >::WeakFormIntegratorQFree | ( | const MeshType & | mesh, |
| CellManager< MeshType, FeType > & | cell_manager, | ||
| const FeExpressionTuple & | fe_expression, | ||
| const FeExpressionFaceTuple & | fe_expression_face = FeExpressionFaceTuple{} ) |
Constructs the quadrature-free integrator.
| mesh | The mesh object. |
| cell_manager | Manages cell data and mappings. |
| fe_expression | A tuple of volume integrand expressions. |
| fe_expression_face | A tuple of face integrand expressions. |
|
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.
|
protected |
Builds lookup tables to identify and reuse identical polynomials.
This method analyzes the polynomial tables (m_poly_table_flat, m_poly_table_face_flat, m_poly_table_face_lifted_gathered) for volume and face expressions to find which entries (i, j, k, bi, bj),( where i, j are the basis index, k the index of the sum component to handle coef. of vector and covector, and bi, bj the block index for vectorial problems) share the exact same polynomial. It then creates a table of unique polynomials (_nodupes) and a corresponding index table (_ijs_table) that maps each unique polynomial back to all the original entries it corresponds to. This avoids re-calculating the integral for the same polynomial multiple times.
|
protected |
Scans all gathered (lifted) monomials to build a table of unique evaluation exponents.
| gathered_monos_table | The table of uncompressed gathered monomials. |
This function loops over all the possible monomial evaluations we have to do (in the lifted variables), both considering the evalut_id part and the monomials in the gather part. It builds a table that maps a unique id to an array representing the exponents of a certain monomial. This table makes it possible to compress the monomials, since we can substitute an exponent (i.e., array) with a unique id.
|
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.
|
protected |
Compresses a table of polynomials.
This function takes a table of uncompressed polynomials (represented by their full monomial lists) and performs two levels of compression:
| uncompressed_table | An CrsMapUncompressed map of MonoType monomials. |
|
protected |
Compresses the gathered monomials into their final integer-ID-based format.
| gathered_monos_table | The table of uncompressed gathered monomials. |
This method converts each GatheredMonomial into a CompressedGatheredMonomial by replacing exponent arrays and coefficient lists with unique integer IDs that point to entries in m_eva_idx_table and m_gathered_monos.
The gathered monomial are stored as three indexes: one that indicates the integral (with respect to the space variable), one that indicates an homogeneous term (e.g. the a in xa(b + 1)) and one the indicates the sum of other monomials, that is the index in the m_gathered_monos table
It is composed by two steps, in the first one, we substitute the std::array<uint8_t, Dim * 2> using the table m_eva_idx_table computed with buildUniqueEvaTable (in both the evalut_id and gather of GatheredMonomial). In the second, we build a table with the unique gathered parts (the gathered part is the sum of monomials times a coefficient); with this table, we substitute the std::vector<std::pair<double, int16_t>> representing the gather part with a unique id.
|
inlineinherited |
Compute the maximum polynomial order among all finite element expressions.
|
inlineprotected |
Computes the affine mapping from the current cell's reference space to a neighbor's reference space.
|
inlineinherited |
Compute the update flags indicating the values to be updated for each cell in the FEValues.
|
inlineinherited |
Find the neighboring cell across the current (local) face (m_face_id) and set up the ids for the neighbor FEValues if needed.
|
protected |
Orchestrates the gathering and compression of lifted monomials.
This is a key optimization for face integrals. It factors the lifted monomials to separate the parts that need integration from the parts that only depend on the geometric mapping. This significantly reduces the number of unique terms to compute.
It calls in order:
|
protected |
Gathers terms for lifted monomials from face expressions (uncompressed stage).
The method gathers each polynomial in the face expressions that need the neighbor (i.e., lifted polynomial). The process is composed by two steps:
|
inlineinherited |
Get the cell object for a given cell id.
| cell_id | Cell id of the considered cell in mesh (local MPI) enumeration |
| update_mapping | If true, update the internal mapping pointer to the mapping of the current cell |
|
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.
| expr | Pointer to the finite element expression for which to get the face integral. |
| expr_id | Index of the finite element expression in the tuple. |
|
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.
| expr | Pointer to the linear face expression. |
| expr_id | Index of this expression in the linear face tuple. |
|
inlineinherited |
Get a const reference to the (bilinear) face integrals buffer where both basis functions belong to this cell.
|
inlineinherited |
Get a const reference to the (bilinear) face integrals buffer where one basis function belongs to the neighboring cell.
|
inlineinherited |
Get the integral (matrix or vector) for the current cell.
| wf_ptr | Pointer to the finite element expression. |
| loc_neigh_id | Local 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. |
|
inlineinherited |
Get a const reference to the (bilinear) volume integrals buffer.
|
inlineinherited |
Get a const reference to the (linear) face right-hand side buffer.
|
inlineinherited |
Get a const reference to the (linear) face rhs buffer where the test function belongs to the neighboring cell.
|
inlineinherited |
Get a const reference to the (linear) volume right-hand side buffer.
|
virtual |
Performs the full integration process for a given cell.
| cell_id | The index of the cell to integrate over. |
Implements vulpes::assemble::WeakFormIntegratorBase< MeshType, FeExpressionTuple, std::tuple<> >.
|
protected |
Integrates all face expressions over the current face of the cell.
| eints_data | Pointer to the precomputed integrals of basis monomials over the reference face. |
| nanson | The scaling factor from Nanson's formula. |
|
protected |
Integrates all volume expressions over the current cell.
| aints_data | Pointer to the precomputed integrals of basis monomials over the cell volume. |
|
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.
|
protected |
Precomputes the values of the evaluation parts of the gathered monomials for the current face.
This function takes the current cell-to-neighbor mapping and evaluates all unique monomial terms (e.g., \(J^{\beta} T^{\gamma}\)) that were identified during the gathering process. The results are stored in m_eval_table_ext and m_gather_coef for fast lookup during integration.
|
protected |
Updates the face normal vector in m_fe_values and computes the Nanson's formula factor.
|
inlinestaticconstexpr |
The spatial dimension of the mesh.
|
protectedinherited |
Current cell id being integrated, in mesh MPI local enumeration.
|
protectedinherited |
The cell manager.
|
protectedinherited |
Information about the neighboring cell across the current face it might be empty if the neighbor is not needed or does not exist.
|
protected |
A table mapping a unique integer ID to a monomial exponent array. Used to evaluate the mapping-dependent parts of gathered monomials.
|
protected |
Buffer storing the computed values of the unique evaluation monomials (from m_eva_idx_table) for the current face.
|
protectedinherited |
Current face id being integrated, local to the cell.
|
protectedinherited |
Tensor to store the bilinear face integrals where both basis functions belong to this cell.
|
protectedinherited |
Tensor to store the bilinear face integrals where one basis function belongs to the neighboring cell.
|
protectedinherited |
Matrix to store the linear face right-hand side contributions.
|
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.
|
protectedinherited |
A tuple of pointers to the finite element expressions to compute the volume integrals.
|
protectedinherited |
A tuple of pointers to the finite element expressions to compute the face integrals.
|
protectedinherited |
A reference to the finite element space.
|
protectedinherited |
The FEValues object to cache ids, normals and the evaluation of shape functions and their derivatives.
|
protected |
Buffer storing the computed values of the gathered parts (from m_gathered_monos) for the current face.
|
protected |
Stores the unique "gathered" parts of monomials. Each row corresponds to a gather_id and contains a list of (coefficient, eval_id) pairs, representing a sum like \(\sum_i c_i M_i\), where \(M_i\) is an evaluation monomial and eval_id points to a row of m_eva_idx_table.
|
protectedinherited |
Tensor to store the bilinear volume integrals.
|
protectedinherited |
Pointer to the mapping of the current cell being integrated.
|
protectedinherited |
A reference to the underlying mesh.
|
protectedinherited |
Flags indicating whether neighboring cell information is needed.
|
protectedinherited |
Flags indicating whether neighboring cell values are needed, a subset of the above, so if this is true the above is true too.
|
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.
|
protected |
Stores the number of polynomial components for each bilinear face expression.
|
protected |
Stores the number of polynomial components for each linear face expression.
|
protected |
Stores the number of polynomial components for each bilinear volume expression.
|
protected |
Stores the number of polynomial components for each linear volume expression.
|
protectedinherited |
The maximum polynomial order of the finite element expressions integrated in the volume.
|
protectedinherited |
The maximum polynomial order of the finite element expressions integrated on the faces.
|
protected |
Polynomial tables for bilinear face expressions (non-lifted).
|
protected |
Lookup table for bilinear face polynomials.
|
protected |
Polynomial tables for linear face expressions (non-lifted).
|
protected |
Lookup table for linear face polynomials.
|
protected |
Unique polynomials for linear face expressions.
|
protected |
Unique polynomials for bilinear face expressions.
|
protected |
Uncompressed polynomial tables for lifted bilinear face expressions.
|
protected |
Compressed and gathered version of m_poly_table_face_lifted_flat.
|
protected |
Lookup table for lifted bilinear face polynomials.
|
protected |
Unique polynomials for lifted bilinear face expressions, after gathering and deduplication.
|
protected |
Polynomial tables for bilinear volume expressions.
|
protected |
Lookup table mapping unique bilinear volume polynomials to (row, col, k) entries.
|
protected |
Polynomial tables for linear volume expressions.
|
protected |
Lookup table mapping unique linear volume polynomials to (row, k) entries.
|
protected |
Unique polynomials for linear volume expressions, after deduplication.
|
protected |
Unique polynomials for bilinear volume expressions, after deduplication.
|
protectedinherited |
Matrix to store the linear volume right-hand side contributions.
|
protectedinherited |
Update flags indicating which values to update in FEValues for the volume integrals.
|
protectedinherited |
Update flags indicating which values to update in FEValues for the face integrals.
|
protectedinherited |
A map from finite element expression pointers to their corresponding data storage locations.
|
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).
|
inlinestaticconstexpr |
The number of blocks for vector/tensor-valued problems.
|
inlinestaticconstexpr |
The number of volume expressions.
|
inlinestaticconstexpr |
The number of bilinear volume expressions.
|
inlinestaticconstexpr |
The number of linear (RHS) volume expressions.
|
inlinestaticconstexpr |
The number of face expressions.
|
inlinestaticconstexpr |
The number of bilinear face expressions.
|
inlinestaticconstexpr |
The number of linear (RHS) face expressions.