SERiF v0.0.1a
Stellar Evolution and Rotation in Four Dimensions
Loading...
Searching...
No Matches
serif::discretization::backend::mfem::TermBinding< TermT, SchemaT > Class Template Referencefinal

A runtime binding between a term descriptor and its MFEM finite-element space. This is used to project down the compile time term descriptors into runtime reinterpretations which can then be used to extract things like the list of dofs, the element support, and the mesh. Note that this is a child of DofMap, therefor all term bindings are also dof maps. More...

#include <term_binding.hpp>

Inheritance diagram for serif::discretization::backend::mfem::TermBinding< TermT, SchemaT >:
[legend]
Collaboration diagram for serif::discretization::backend::mfem::TermBinding< TermT, SchemaT >:
[legend]

Public Types

using Term = TermT
 
using Schema = SchemaT
 

Public Member Functions

 TermBinding (::mfem::FiniteElementSpace &space, std::shared_ptr< const ReconstructionPlan > reconstruction={})
 Construct a term binding from an MFEM finite-element space. This requires that the term be a valid spatial term (SpatialTerm)
 
 TermBinding (::mfem::Mesh &mesh)
 Construct a term binding from an MFEM mesh. This requires that the term be a valid global scalar term (GlobalScalarTerm). E.g. the only way you can construct such a term binding is for things like the total mass, angular momentum, etc...
 
- Public Member Functions inherited from serif::discretization::backend::mfem::DofMap
Elements validated_elements () const
 Validate once before traversing elements without repeated mesh-wide scans.
 
const std::shared_ptr< const ReconstructionPlan > & reconstruction () const noexcept
 Read the immutable physical-field representation retained by this binding.
 
const ElementReconstruction * reconstruction_element (int element) const
 Select the reference adapter without adding work to ordinary elements.
 
 DofMap (const DofMap &)=delete
 
DofMap & operator= (const DofMap &)=delete
 
 DofMap (DofMap &&)=delete
 
DofMap & operator= (DofMap &&)=delete
 
::mfem::FiniteElementSpace & space () const
 Return the borrowed finite-element space associated with this DOF map.
 
::mfem::Mesh & mesh () const noexcept
 Return the borrowed mesh associated with this DOF map.
 
int full_size () const noexcept
 Return the number of full-space DOFs, including those not supported by the element support.
 
int size () const noexcept
 Return the number of supported DOFs, which is the size of the reduced coefficient vector.
 
std::optional< int > reduced_dof (const int full_dof) const
 Locate a local coefficient represented by exactly one supported independent coordinate.
 
int full_dof (const int reduced) const
 Return the representative local coefficient selected for one supported independent coordinate.
 
bool constrained () const noexcept
 Report whether local coefficients require hanging-node interpolation.
 
int true_size () const noexcept
 Return the full independent coordinate count before selecting material support.
 
template<typename Visitor>
void for_each_coefficient (const int local_dof, Visitor &&visit) const
 Visit the supported independent coefficients contributing to one unsigned local DOF.
 
::mfem::Vector gather_true (const ::mfem::Vector &values) const
 Select supported coefficients from a full independent vector, without interpolation.
 
::mfem::Vector scatter_true (const ::mfem::Vector &values) const
 Expand supported coefficients into a full independent vector, without interpolation.
 
::mfem::Vector accumulate_dual (const ::mfem::Vector &full) const
 Accumulate local dual contributions with the transpose of coefficient expansion.
 
void accumulate_dual (const ::mfem::Vector &full, ::mfem::Vector &result) const
 Accumulate local dual contributions while reusing caller storage.
 
bool supports (const int element) const
 Check whether an element is supported by this dof map.
 
void validate () const
 Validate the dof map.
 
void validate_values (const ::mfem::Vector &values) const
 Check supported coefficient count and finiteness.
 
::mfem::Vector gather (const ::mfem::Vector &full) const
 Restrict a full coefficient vector to supported DOFs.
 
void gather (const ::mfem::Vector &full, ::mfem::Vector &result) const
 Restrict supported coefficients while reusing the destination allocation.
 
::mfem::Vector scatter (const ::mfem::Vector &reduced) const
 Expand supported independent coefficients into the constrained local field. Unsupported independent coordinates are zero. Interpolation can populate local coordinates outside the supported elements; element support still controls physical integration.
 
void element_values (int element, const ::mfem::Vector &reduced, ::mfem::Vector &values) const
 Extract element coefficients, including primal orientation transforms.
 
void add_element (int element, ::mfem::Vector &values, ::mfem::Vector &full) const
 Apply dual orientation transforms and add an element residual.
 

Private Member Functions

static ::mfem::Array< int > element_support (const ::mfem::Mesh &mesh)
 Translate the mesh into an element support array for the particular term binding.
 

Static Private Member Functions

::mfem::Mesh & checked_mesh (const ::mfem::FiniteElementSpace &space)
 Check that the mesh associated with a finite-element space is valid for term binding construction.
 

Additional Inherited Members

- Protected Member Functions inherited from serif::discretization::backend::mfem::DofMap
 DofMap (::mfem::FiniteElementSpace &space, const ::mfem::Array< int > &element_support, std::shared_ptr< const ReconstructionPlan > reconstruction={})
 
 DofMap (::mfem::Mesh &mesh, const ::mfem::Array< int > &element_support)
 
 ~DofMap ()=default
 

Detailed Description

template<typename TermT, domain::schema::IsSchema SchemaT>
requires (blocks::SpatialTerm<TermT> || blocks::GlobalScalarTerm<TermT>)
class serif::discretization::backend::mfem::TermBinding< TermT, SchemaT >

A runtime binding between a term descriptor and its MFEM finite-element space. This is used to project down the compile time term descriptors into runtime reinterpretations which can then be used to extract things like the list of dofs, the element support, and the mesh. Note that this is a child of DofMap, therefor all term bindings are also dof maps.

Template Parameters
TermTThe term descriptor type to bind to. Note that if the FiniteElementSpace is not a global scalar then this must be a spatial term descriptor (SpatialTerm)
SchemaTThe domain schema type to bind to. This must be a valid schema (IsSchema)

Member Typedef Documentation

◆ Schema

template<typename TermT, domain::schema::IsSchema SchemaT>
using serif::discretization::backend::mfem::TermBinding< TermT, SchemaT >::Schema = SchemaT

◆ Term

template<typename TermT, domain::schema::IsSchema SchemaT>
using serif::discretization::backend::mfem::TermBinding< TermT, SchemaT >::Term = TermT

Constructor & Destructor Documentation

◆ TermBinding() [1/2]

template<typename TermT, domain::schema::IsSchema SchemaT>
serif::discretization::backend::mfem::TermBinding< TermT, SchemaT >::TermBinding ( ::mfem::FiniteElementSpace & space,
std::shared_ptr< const ReconstructionPlan > reconstruction = {} )
inlineexplicit

Construct a term binding from an MFEM finite-element space. This requires that the term be a valid spatial term (SpatialTerm)

Parameters
spaceThe finite-element space to bind to.

◆ TermBinding() [2/2]

template<typename TermT, domain::schema::IsSchema SchemaT>
serif::discretization::backend::mfem::TermBinding< TermT, SchemaT >::TermBinding ( ::mfem::Mesh & mesh)
inlineexplicit

Construct a term binding from an MFEM mesh. This requires that the term be a valid global scalar term (GlobalScalarTerm). E.g. the only way you can construct such a term binding is for things like the total mass, angular momentum, etc...

Parameters
meshThe mesh to bind to, note that the mesh must be three-dimensional and have a space dimension of three.

Member Function Documentation

◆ checked_mesh()

template<typename TermT, domain::schema::IsSchema SchemaT>
::mfem::Mesh & serif::discretization::backend::mfem::TermBinding< TermT, SchemaT >::checked_mesh ( const ::mfem::FiniteElementSpace & space)
inlinestaticprivate

Check that the mesh associated with a finite-element space is valid for term binding construction.

Parameters
spaceThe finite-element space to check.
Returns
The mesh associated with the finite-element space.

◆ element_support()

template<typename TermT, domain::schema::IsSchema SchemaT>
static ::mfem::Array< int > serif::discretization::backend::mfem::TermBinding< TermT, SchemaT >::element_support ( const ::mfem::Mesh & mesh)
inlineprivate

Translate the mesh into an element support array for the particular term binding.

Parameters
meshthe mesh to translate into an element support array
Returns
An array where each entry is 1 if the corresponding element is supported by the term binding and 0 otherwise. This array is parallel to the mesh elements ordering array.

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