SERiF v0.0.1a
Stellar Evolution and Rotation in Four Dimensions
Loading...
Searching...
No Matches
serif::discretization::backend::mfem::DofMap Class Reference

A mapping from a full MFEM finite-element space to a reduced set of DOFs that are supporter by the given element support. That is to say that if one has some set of dofs D (perhaps it looks like [0, 1, 2, 3, 4] as a hypothetical) and dofs 0, 2, and 4 are associated to domain A while 1 and 3 are associated to domain B. Then if one were to construct a DofMap with element support [1, 0, 1, 0, 1] (where 1 indicates that the element is supported and 0 indicates that it is not) then the reduced dof map would be [0, 2, 4] and the full to reduced map would be [-1, -1, 0, -1, 1]. More...

#include <dof_map.hpp>

Inheritance diagram for serif::discretization::backend::mfem::DofMap:
[legend]
Collaboration diagram for serif::discretization::backend::mfem::DofMap:
[legend]

Classes

class  Elements
 Borrow element access for one traversal after checking the complete binding. More...
 

Public Member Functions

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.
 

Protected Member Functions

 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
 

Private Member Functions

void build_constrained_map ()
 Close material support over hanging-node dependencies and retain independent coordinates.
 
void validate_structure () const
 Check borrowed resource revisions in constant time before accessing their arrays.
 

Private Attributes

::mfem::FiniteElementSpace * m_space
 Borrowed pointer to the finite-element space associated with this dof map, or nullptr for a global scalar. This must outlive this class.
 
::mfem::Mesh & m_mesh
 Borrowed reference to the mesh associated with this dof map. This must outlive this class.
 
long m_space_sequence
 Sequence number of the finite-element space at construction, or -1 for a global scalar.
 
long m_mesh_sequence
 Sequence number of the mesh at construction.
 
::mfem::Array< int > m_attributes
 Array of attribute indices associated with this dof map.
 
::mfem::Array< int > m_element_support
 Array of 0/1 values indicating whether each element is supported by this dof map.
 
const ::mfem::SparseMatrix * m_prolongation {nullptr}
 Borrowed constraint matrix, guarded by the space revision.
 
::mfem::Array< int > m_true_to_reduced
 Independent coordinate to supported coordinate.
 
::mfem::Array< int > m_reduced_to_true
 Supported coordinate to independent coordinate.
 
::mfem::Array< int > m_reduced_to_full
 Mapping from reduced to full degrees of freedom.
 
::mfem::Array< int > m_full_to_reduced
 Mapping from full to reduced degrees of freedom.
 
std::optional<::mfem::Array< int > > m_boundary_attributes
 Reconstructed bindings depend on boundary labels.
 
std::shared_ptr< const ReconstructionPlan > m_reconstruction
 Immutable; a different representation requires a new binding.
 

Friends

class ElementCoordinates
 

Detailed Description

A mapping from a full MFEM finite-element space to a reduced set of DOFs that are supporter by the given element support. That is to say that if one has some set of dofs D (perhaps it looks like [0, 1, 2, 3, 4] as a hypothetical) and dofs 0, 2, and 4 are associated to domain A while 1 and 3 are associated to domain B. Then if one were to construct a DofMap with element support [1, 0, 1, 0, 1] (where 1 indicates that the element is supported and 0 indicates that it is not) then the reduced dof map would be [0, 2, 4] and the full to reduced map would be [-1, -1, 0, -1, 1].

Note
Solver coordinates are supported independent (true) DOFs. Element coefficients include hanging-node interpolation. Coefficient restriction and dual accumulation are separate operations. Distributed spaces are not supported.

Constructor & Destructor Documentation

◆ DofMap() [1/4]

serif::discretization::backend::mfem::DofMap::DofMap ( ::mfem::FiniteElementSpace & space,
const ::mfem::Array< int > & element_support,
std::shared_ptr< const ReconstructionPlan > reconstruction = {} )
inlineprotected

◆ DofMap() [2/4]

serif::discretization::backend::mfem::DofMap::DofMap ( ::mfem::Mesh & mesh,
const ::mfem::Array< int > & element_support )
inlineprotected

◆ ~DofMap()

serif::discretization::backend::mfem::DofMap::~DofMap ( )
protecteddefault

◆ DofMap() [3/4]

serif::discretization::backend::mfem::DofMap::DofMap ( const DofMap & )
delete

◆ DofMap() [4/4]

serif::discretization::backend::mfem::DofMap::DofMap ( DofMap && )
delete

Member Function Documentation

◆ accumulate_dual() [1/2]

::mfem::Vector serif::discretization::backend::mfem::DofMap::accumulate_dual ( const ::mfem::Vector & full) const
inlinenodiscard

Accumulate local dual contributions with the transpose of coefficient expansion.

◆ accumulate_dual() [2/2]

void serif::discretization::backend::mfem::DofMap::accumulate_dual ( const ::mfem::Vector & full,
::mfem::Vector & result ) const
inline

Accumulate local dual contributions while reusing caller storage.

◆ add_element()

void serif::discretization::backend::mfem::DofMap::add_element ( int element,
::mfem::Vector & values,
::mfem::Vector & full ) const

Apply dual orientation transforms and add an element residual.

Parameters
elementelement index
valuesvector of element coefficients
fullfull coefficient vector to which the element residual will be added

◆ build_constrained_map()

void serif::discretization::backend::mfem::DofMap::build_constrained_map ( )
inlineprivate

Close material support over hanging-node dependencies and retain independent coordinates.

◆ constrained()

bool serif::discretization::backend::mfem::DofMap::constrained ( ) const
inlinenodiscardnoexcept

Report whether local coefficients require hanging-node interpolation.

◆ element_values()

void serif::discretization::backend::mfem::DofMap::element_values ( int element,
const ::mfem::Vector & reduced,
::mfem::Vector & values ) const

Extract element coefficients, including primal orientation transforms.

Parameters
elementelement index
reducedvector of supported coefficients
valuesvector to store extracted element coefficients

◆ for_each_coefficient()

template<typename Visitor>
void serif::discretization::backend::mfem::DofMap::for_each_coefficient ( const int local_dof,
Visitor && visit ) const
inline

Visit the supported independent coefficients contributing to one unsigned local DOF.

◆ full_dof()

int serif::discretization::backend::mfem::DofMap::full_dof ( const int reduced) const
inlinenodiscard

Return the representative local coefficient selected for one supported independent coordinate.

◆ full_size()

int serif::discretization::backend::mfem::DofMap::full_size ( ) const
inlinenodiscardnoexcept

Return the number of full-space DOFs, including those not supported by the element support.

Returns
The number of full-space DOFs (not reduced by element support)

◆ gather() [1/2]

::mfem::Vector serif::discretization::backend::mfem::DofMap::gather ( const ::mfem::Vector & full) const
inlinenodiscard

Restrict a full coefficient vector to supported DOFs.

Parameters
fullfull coefficient vector
Returns
vector of supported coefficients

◆ gather() [2/2]

void serif::discretization::backend::mfem::DofMap::gather ( const ::mfem::Vector & full,
::mfem::Vector & result ) const
inline

Restrict supported coefficients while reusing the destination allocation.

◆ gather_true()

::mfem::Vector serif::discretization::backend::mfem::DofMap::gather_true ( const ::mfem::Vector & values) const
inlinenodiscard

Select supported coefficients from a full independent vector, without interpolation.

◆ mesh()

::mfem::Mesh & serif::discretization::backend::mfem::DofMap::mesh ( ) const
inlinenodiscardnoexcept

Return the borrowed mesh associated with this DOF map.

Returns
A reference to the mesh in m_mesh

◆ operator=() [1/2]

DofMap & serif::discretization::backend::mfem::DofMap::operator= ( const DofMap & )
delete

◆ operator=() [2/2]

DofMap & serif::discretization::backend::mfem::DofMap::operator= ( DofMap && )
delete

◆ reconstruction()

const std::shared_ptr< const ReconstructionPlan > & serif::discretization::backend::mfem::DofMap::reconstruction ( ) const
inlinenodiscardnoexcept

Read the immutable physical-field representation retained by this binding.

◆ reconstruction_element()

const ElementReconstruction * serif::discretization::backend::mfem::DofMap::reconstruction_element ( int element) const
inlinenodiscard

Select the reference adapter without adding work to ordinary elements.

◆ reduced_dof()

std::optional< int > serif::discretization::backend::mfem::DofMap::reduced_dof ( const int full_dof) const
inlinenodiscard

Locate a local coefficient represented by exactly one supported independent coordinate.

Parameters
full_dofindex of the dof in the full space
Returns
An optional index of the dof in the reduced space, or std::nullopt for an unsupported or weighted hanging coefficient.

◆ scatter()

::mfem::Vector serif::discretization::backend::mfem::DofMap::scatter ( const ::mfem::Vector & reduced) const
inlinenodiscard

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.

Parameters
reducedvector of supported coefficients
Returns
full local coefficient vector satisfying hanging-node interpolation

◆ scatter_true()

::mfem::Vector serif::discretization::backend::mfem::DofMap::scatter_true ( const ::mfem::Vector & values) const
inlinenodiscard

Expand supported coefficients into a full independent vector, without interpolation.

◆ size()

int serif::discretization::backend::mfem::DofMap::size ( ) const
inlinenodiscardnoexcept

Return the number of supported DOFs, which is the size of the reduced coefficient vector.

Returns
The number of supported DOFs (reduced by element support)

◆ space()

::mfem::FiniteElementSpace & serif::discretization::backend::mfem::DofMap::space ( ) const
inlinenodiscard

Return the borrowed finite-element space associated with this DOF map.

Returns
A reference to the finite-element space in m_space

◆ supports()

bool serif::discretization::backend::mfem::DofMap::supports ( const int element) const
inlinenodiscard

Check whether an element is supported by this dof map.

Parameters
elementelement index
Returns
true if element is supported by this dof map, false otherwise

◆ true_size()

int serif::discretization::backend::mfem::DofMap::true_size ( ) const
inlinenodiscardnoexcept

Return the full independent coordinate count before selecting material support.

◆ validate()

void serif::discretization::backend::mfem::DofMap::validate ( ) const
inline

Validate the dof map.

◆ validate_structure()

void serif::discretization::backend::mfem::DofMap::validate_structure ( ) const
inlineprivate

Check borrowed resource revisions in constant time before accessing their arrays.

◆ validate_values()

void serif::discretization::backend::mfem::DofMap::validate_values ( const ::mfem::Vector & values) const
inline

Check supported coefficient count and finiteness.

Parameters
valuesvector of coefficients to validate

◆ validated_elements()

Elements serif::discretization::backend::mfem::DofMap::validated_elements ( ) const
inlinenodiscard

Validate once before traversing elements without repeated mesh-wide scans.

Friends And Related Symbol Documentation

◆ ElementCoordinates

friend class ElementCoordinates
friend

Member Data Documentation

◆ m_attributes

::mfem::Array<int> serif::discretization::backend::mfem::DofMap::m_attributes
private

Array of attribute indices associated with this dof map.

◆ m_boundary_attributes

std::optional<::mfem::Array<int> > serif::discretization::backend::mfem::DofMap::m_boundary_attributes
private

Reconstructed bindings depend on boundary labels.

◆ m_element_support

::mfem::Array<int> serif::discretization::backend::mfem::DofMap::m_element_support
private

Array of 0/1 values indicating whether each element is supported by this dof map.

◆ m_full_to_reduced

::mfem::Array<int> serif::discretization::backend::mfem::DofMap::m_full_to_reduced
private

Mapping from full to reduced degrees of freedom.

◆ m_mesh

::mfem::Mesh& serif::discretization::backend::mfem::DofMap::m_mesh
private

Borrowed reference to the mesh associated with this dof map. This must outlive this class.

◆ m_mesh_sequence

long serif::discretization::backend::mfem::DofMap::m_mesh_sequence
private

Sequence number of the mesh at construction.

◆ m_prolongation

const ::mfem::SparseMatrix* serif::discretization::backend::mfem::DofMap::m_prolongation {nullptr}
private

Borrowed constraint matrix, guarded by the space revision.

◆ m_reconstruction

std::shared_ptr<const ReconstructionPlan> serif::discretization::backend::mfem::DofMap::m_reconstruction
private

Immutable; a different representation requires a new binding.

◆ m_reduced_to_full

::mfem::Array<int> serif::discretization::backend::mfem::DofMap::m_reduced_to_full
private

Mapping from reduced to full degrees of freedom.

◆ m_reduced_to_true

::mfem::Array<int> serif::discretization::backend::mfem::DofMap::m_reduced_to_true
private

Supported coordinate to independent coordinate.

◆ m_space

::mfem::FiniteElementSpace* serif::discretization::backend::mfem::DofMap::m_space
private

Borrowed pointer to the finite-element space associated with this dof map, or nullptr for a global scalar. This must outlive this class.

◆ m_space_sequence

long serif::discretization::backend::mfem::DofMap::m_space_sequence
private

Sequence number of the finite-element space at construction, or -1 for a global scalar.

◆ m_true_to_reduced

::mfem::Array<int> serif::discretization::backend::mfem::DofMap::m_true_to_reduced
private

Independent coordinate to supported coordinate.


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