SERiF v0.0.1a
Stellar Evolution and Rotation in Four Dimensions
Loading...
Searching...
No Matches
serif::operators::backend::mfem::detail Namespace Reference

Classes

struct  CoefficientExpansion
 Weighted reduced coordinates of each local coordinate, as CSR: local i owns [offsets[i], offsets[i+1]). More...
 
struct  ConstrainedElementBlock
 One element's probed block on constrained bindings: column-major values and both constraint expansions. More...
 
struct  ProbedElementBlock
 One element's probed block: column c's integrated values for every local row, column-major. More...
 
struct  ProbeScratch
 Per-worker scratch for probing element blocks. More...
 
class  VolumeFieldOperator
 Retain accepted data while applying a single field coupling with reusable contraction scratch. More...
 

Functions

template<typename Field, typename Equation, typename Schema, typename Visit>
void for_each_field_element (const VolumeData< Equation, Schema > &data, Visit &&visit)
 Ignore a structurally absent field before gathering coefficients or touching contribution bases.
 
template<typename Field, typename Equation, typename Contribution>
void field_integrand (const ElementData< EquationPlan< Equation >::operand_count > &element, const ::mfem::Vector &direction, ::mfem::Vector &integrand, ::mfem::Vector &samples, BasisWorkspace &workspace)
 Contract only the requested physical field; geometry is frozen in this accepted linearization.
 
template<typename Field, typename Equation>
consteval std::size_t field_column ()
 Locate a physical field in the equation's unique coefficient columns.
 
std::shared_ptr< const ::mfem::SparseMatrix > make_csr (const std::vector< std::vector< int > > &row_columns, const std::vector< std::vector< double > > &row_values, const int height, const int width)
 Write MFEM-style CSR rows (already in Finalize() order) into an owning SparseMatrix.
 
std::shared_ptr< const ::mfem::SparseMatrix > finalize_probed_blocks (const std::vector< ProbedElementBlock > &blocks, const int height, const int width)
 SparseMatrix::Add for every probed entry followed by Finalize(), built without MFEM's linked rows.
 
std::shared_ptr< const ::mfem::SparseMatrix > finalize_constrained_blocks (const std::vector< ConstrainedElementBlock > &blocks, const int height, const int width)
 The constrained form of finalize_probed_blocks: SparseMatrix::Add(row_index, column_index, row_weight * value * column_weight) for every element, column, local row, row coefficient and column coefficient in that order, followed by Finalize().
 
template<typename ElementT, typename MakeT>
std::expected< ElementBatch< ElementT >, PreparationRejection > build_element_batch (const int count, Workspace &workspace, MakeT &&make)
 Build one immutable batch entry per index, concurrently, with one Workspace per worker.
 

Function Documentation

◆ build_element_batch()

template<typename ElementT, typename MakeT>
std::expected< ElementBatch< ElementT >, PreparationRejection > serif::operators::backend::mfem::detail::build_element_batch ( const int count,
Workspace & workspace,
MakeT && make )
nodiscard

Build one immutable batch entry per index, concurrently, with one Workspace per worker.

Note
make(index, workspace) must depend only on its index and write only that workspace, so the batch is identical for every thread count. Like the serial loop, the result is the batch or the first failure in index order (a rejection, or a rethrown exception). Indices after a known failure are skipped; every index before the first failure always runs.

◆ field_column()

template<typename Field, typename Equation>
std::size_t serif::operators::backend::mfem::detail::field_column ( )
nodiscardconsteval

Locate a physical field in the equation's unique coefficient columns.

◆ field_integrand()

template<typename Field, typename Equation, typename Contribution>
void serif::operators::backend::mfem::detail::field_integrand ( const ElementData< EquationPlan< Equation >::operand_count > & element,
const ::mfem::Vector & direction,
::mfem::Vector & integrand,
::mfem::Vector & samples,
BasisWorkspace & workspace )

Contract only the requested physical field; geometry is frozen in this accepted linearization.

◆ finalize_constrained_blocks()

std::shared_ptr< const ::mfem::SparseMatrix > serif::operators::backend::mfem::detail::finalize_constrained_blocks ( const std::vector< ConstrainedElementBlock > & blocks,
const int height,
const int width )
inlinenodiscard

The constrained form of finalize_probed_blocks: SparseMatrix::Add(row_index, column_index, row_weight * value * column_weight) for every element, column, local row, row coefficient and column coefficient in that order, followed by Finalize().

Note
Each global row replays its own insertions in the original order (see finalize_probed_blocks), so every sum, the column order and the dropped exact zeros match MFEM's linked-row assembly.

◆ finalize_probed_blocks()

std::shared_ptr< const ::mfem::SparseMatrix > serif::operators::backend::mfem::detail::finalize_probed_blocks ( const std::vector< ProbedElementBlock > & blocks,
const int height,
const int width )
inlinenodiscard

SparseMatrix::Add for every probed entry followed by Finalize(), built without MFEM's linked rows.

Note
MFEM keeps each row as a list with the newest column first, adds every value in insertion order starting from 0.0, and Finalize() writes the list head first while dropping exact zeros (a zero diagonal finds itself and is dropped too). Here each row replays its own insertions in the original global order (element, then column, then local row), so every sum, the column order and the dropped entries match. Rows are independent, so they are built concurrently.

◆ for_each_field_element()

template<typename Field, typename Equation, typename Schema, typename Visit>
void serif::operators::backend::mfem::detail::for_each_field_element ( const VolumeData< Equation, Schema > & data,
Visit && visit )

Ignore a structurally absent field before gathering coefficients or touching contribution bases.

◆ make_csr()

std::shared_ptr< const ::mfem::SparseMatrix > serif::operators::backend::mfem::detail::make_csr ( const std::vector< std::vector< int > > & row_columns,
const std::vector< std::vector< double > > & row_values,
const int height,
const int width )
inlinenodiscard

Write MFEM-style CSR rows (already in Finalize() order) into an owning SparseMatrix.