BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
belfem::fem::dofmgr::DofData Class Reference

#include <cl_FEM_DofMgr_DofData.hpp>

Public Member Functions

 DofData (DofManager *aParent, Parameters *aParams)
 ~DofData ()
void create_dofs (IWG *aIWG)
void create_field_map (IWG *aIwg)
Cell< Dof * > & dofs ()
 expose the dof container
Cell< Dof * > & hanging_dofs ()
 expose the hanging dof container
bool dof_exists (const id_t aID) const
 check if a dof exists, needed for bearing creation
index_t doftype_to_field_index (const index_t aDofType)
Dofdof (const id_t aID)
id_t node_dof_id (const id_t aNodeID, const uint aDofType) const
id_t edge_dof_id (const id_t aEdgeID, const uint aDofType) const
id_t face_dof_id (const id_t aFaceID, const uint aDofType) const
id_t cell_dof_id (const id_t aCellID, const uint aDofType) const
id_t lambda_dof_id (const id_t aFacetID, const uint aDofType) const
void init_dof_values (const bool aFreeDofsOnly=false)
void split_dof_container (Cell< graph::Vertex * > &aFreeDofs, Cell< graph::Vertex * > &aFixedDofs)
 Temporarily splits the unified DOF container (mDOFs) into separate free and fixed DOF graphs for independent reordering.
void restore_dof_container (Cell< graph::Vertex * > &aFreeDofs, Cell< graph::Vertex * > &aFixedDofs)
 Restores the unified DOF container (mDOFs) from separate free and fixed DOF graphs after reordering is complete.
void synchronize_dirichlet_bcs ()
void reorder_dofs (const Vector< id_t > &aGraphData, Graph &aFreeDofs, Graph &aFixedDofs)
 Reorders DOFs to optimize matrix bandwidth for efficient solving.
const index_tnumber_of_free_dofs () const
const index_tnumber_of_fixed_dofs () const
const index_tnumber_of_hanging_dofs () const
void reset ()
uint num_dofs_per_element (const id_t aBlockID) const
 computes the number of dofs per element on block
uint num_dofs_per_facet (const id_t aSideSetID) const
 computes the number of dofs per element on sideset
const Vector< index_t > & dof_indices (const uint aProc) const
void connect_dofs_to_mesh ()
void disconnect_dofs_from_mesh ()
void create_dofwise_t_matrices_master ()
void collect_hanging_dofs ()
Cell< Dof * > & abstract_dofs ()
void extract_abstract_dofs_from_mesh ()
const index_tmy_number_of_free_dofs () const
const index_tmy_number_of_fixed_dofs () const
const index_tmy_number_of_hanging_dofs () const

Constructor & Destructor Documentation

◆ DofData()

belfem::fem::dofmgr::DofData::DofData ( DofManager * aParent,
Parameters * aParams )

◆ ~DofData()

belfem::fem::dofmgr::DofData::~DofData ( )

Member Function Documentation

◆ abstract_dofs()

Cell< Dof * > & belfem::fem::dofmgr::DofData::abstract_dofs ( )
inline

◆ cell_dof_id()

id_t belfem::fem::dofmgr::DofData::cell_dof_id ( const id_t aCellID,
const uint aDofType ) const
inline

◆ collect_hanging_dofs()

void belfem::fem::dofmgr::DofData::collect_hanging_dofs ( )

◆ connect_dofs_to_mesh()

void belfem::fem::dofmgr::DofData::connect_dofs_to_mesh ( )

◆ create_dofs()

void belfem::fem::dofmgr::DofData::create_dofs ( IWG * aIWG)

◆ create_dofwise_t_matrices_master()

void belfem::fem::dofmgr::DofData::create_dofwise_t_matrices_master ( )

◆ create_field_map()

void belfem::fem::dofmgr::DofData::create_field_map ( IWG * aIwg)

◆ disconnect_dofs_from_mesh()

void belfem::fem::dofmgr::DofData::disconnect_dofs_from_mesh ( )

◆ dof()

Dof * belfem::fem::dofmgr::DofData::dof ( const id_t aID)
inline

◆ dof_exists()

bool belfem::fem::dofmgr::DofData::dof_exists ( const id_t aID) const
inline

check if a dof exists, needed for bearing creation

◆ dof_indices()

const Vector< index_t > & belfem::fem::dofmgr::DofData::dof_indices ( const uint aProc) const
inline

◆ dofs()

Cell< Dof * > & belfem::fem::dofmgr::DofData::dofs ( )
inline

expose the dof container

◆ doftype_to_field_index()

index_t belfem::fem::dofmgr::DofData::doftype_to_field_index ( const index_t aDofType)
inline

◆ edge_dof_id()

id_t belfem::fem::dofmgr::DofData::edge_dof_id ( const id_t aEdgeID,
const uint aDofType ) const
inline

◆ extract_abstract_dofs_from_mesh()

void belfem::fem::dofmgr::DofData::extract_abstract_dofs_from_mesh ( )

◆ face_dof_id()

id_t belfem::fem::dofmgr::DofData::face_dof_id ( const id_t aFaceID,
const uint aDofType ) const
inline

◆ hanging_dofs()

Cell< Dof * > & belfem::fem::dofmgr::DofData::hanging_dofs ( )
inline

expose the hanging dof container

◆ init_dof_values()

void belfem::fem::dofmgr::DofData::init_dof_values ( const bool aFreeDofsOnly = false)

copy values between dofs and fields. Free dofs read field -> dof; fixed dofs write dof -> field, unless aFreeDofsOnly is set ( seeding mode: the field is the truth, e.g. a restored memdump, and a fixed dof may still hold a factory dummy )

◆ lambda_dof_id()

id_t belfem::fem::dofmgr::DofData::lambda_dof_id ( const id_t aFacetID,
const uint aDofType ) const
inline

◆ my_number_of_fixed_dofs()

const index_t & belfem::fem::dofmgr::DofData::my_number_of_fixed_dofs ( ) const
inline

◆ my_number_of_free_dofs()

const index_t & belfem::fem::dofmgr::DofData::my_number_of_free_dofs ( ) const
inline

◆ my_number_of_hanging_dofs()

const index_t & belfem::fem::dofmgr::DofData::my_number_of_hanging_dofs ( ) const
inline

◆ node_dof_id()

id_t belfem::fem::dofmgr::DofData::node_dof_id ( const id_t aNodeID,
const uint aDofType ) const
inline

◆ num_dofs_per_element()

uint belfem::fem::dofmgr::DofData::num_dofs_per_element ( const id_t aBlockID) const

computes the number of dofs per element on block

◆ num_dofs_per_facet()

uint belfem::fem::dofmgr::DofData::num_dofs_per_facet ( const id_t aSideSetID) const

computes the number of dofs per element on sideset

◆ number_of_fixed_dofs()

const index_t & belfem::fem::dofmgr::DofData::number_of_fixed_dofs ( ) const
inline

◆ number_of_free_dofs()

const index_t & belfem::fem::dofmgr::DofData::number_of_free_dofs ( ) const
inline

◆ number_of_hanging_dofs()

const index_t & belfem::fem::dofmgr::DofData::number_of_hanging_dofs ( ) const
inline

◆ reorder_dofs()

void belfem::fem::dofmgr::DofData::reorder_dofs ( const Vector< id_t > & aGraphData,
Graph & aFreeDofs,
Graph & aFixedDofs )

Reorders DOFs to optimize matrix bandwidth for efficient solving.

Purpose:

  • Applies graph reordering algorithms to minimize matrix bandwidth
  • Reduces fill-in during factorization and improves cache locality
  • Handles free and fixed DOFs independently

Algorithm: Free DOFs:

  • Symmetric Reverse Cuthill-McKee (symrcm), bandwidth reduction only. Solver-internal nested dissection (STRUMPACK/ParMETIS) is applied by the solver wrapper, not here. Fixed DOFs:
  • symrcm (simpler, adequate for constraint equations)

Workflow - Master Rank (rank 0):

  1. Initialize indices in SEPARATE mode:
    • Free DOFs: index = my_index = 0, 1, ..., n-1
    • Fixed DOFs: index = my_index = 0, 1, ..., m-1
  2. Build Jacobian (free-free) sparsity pattern with aLinkToSelf=false
  3. Apply reordering algorithm to free DOFs (updates index and sorts graph)
  4. Build Imposition (fixed-fixed) sparsity pattern with aLinkToSelf=false
  5. Apply symrcm to fixed DOFs (updates index and sorts graph)
  6. For serial: Update my_index to match reordered positions and return
  7. For parallel:
    • Broadcast global DOF counts to all ranks
    • Collect DOF IDs from worker ranks
    • Look up reordered index for each worker's DOF
    • Distribute index tables back to workers

Workflow - Worker Ranks (rank > 0):

  1. Collect all local DOF IDs (free first, then fixed)
  2. Receive global DOF counts from master
  3. Send DOF IDs to master
  4. Receive reordered indices from master
  5. Apply indices to graphs:
    • Free DOFs: tDofIndices[0..n_local-1]
    • Fixed DOFs: tDofIndices[n_local..n_local+m_local-1] (NO counter reset!)
  6. Sort graphs by reordered index

Index Fields After Reordering:

  • index: Global matrix row/column index in SEPARATE mode (0..n-1 or 0..m-1)
  • my_index: Local position in graph (0..n_local-1 or 0..m_local-1)

Preconditions:

  • aFreeDofs and aFixedDofs populated from split_dof_container()
  • aGraphData contains global DOF-to-DOF connectivity

Postconditions:

  • Both graphs sorted by optimized index ordering
  • DOF index field contains final matrix indices (SEPARATE mode)
  • DOF my_index field contains local graph positions (SEPARATE mode)
  • mDofIndexTables populated for parallel assembly (master only)

Note on aLinkToSelf:

  • Set to false for reordering: METIS/SCOTCH require no self-loops
  • Matrix allocation later uses aLinkToSelf=true to include diagonals

◆ reset()

void belfem::fem::dofmgr::DofData::reset ( )

◆ restore_dof_container()

void belfem::fem::dofmgr::DofData::restore_dof_container ( Cell< graph::Vertex * > & aFreeDofs,
Cell< graph::Vertex * > & aFixedDofs )

Restores the unified DOF container (mDOFs) from separate free and fixed DOF graphs after reordering is complete.

Purpose:

  • Rebuilds mDOFs for use during assembly phase
  • Maintains consistent storage layout: free DOFs first, then fixed DOFs

Preconditions:

  • aFreeDofs and aFixedDofs must be sorted by their reordered index
  • Each DOF's my_index must be set to its final position (0..n-1 or 0..m-1)

Actions:

  1. Allocates mDOFs with size n+m
  2. Copies free DOFs to positions 0..n-1 (in iteration order)
  3. Copies fixed DOFs to positions n..n+m-1 (in iteration order)
  4. Clears input graph containers

Postconditions:

  • mDOFs contains all DOFs in sorted order
  • mDOFs[i] for i<n: free DOF with my_index=i
  • mDOFs[n+j] for j<m: fixed DOF with my_index=j
  • aFreeDofs and aFixedDofs are empty

Storage layout after restore: mDOFs[0..n-1] : free DOFs in reordered sequence mDOFs[n..n+m-1] : fixed DOFs in reordered sequence

Parameters
aFreeDofsInput: sorted graph of free DOFs (will be cleared)
aFixedDofsInput: sorted graph of fixed DOFs (will be cleared)

◆ split_dof_container()

void belfem::fem::dofmgr::DofData::split_dof_container ( Cell< graph::Vertex * > & aFreeDofs,
Cell< graph::Vertex * > & aFixedDofs )

Temporarily splits the unified DOF container (mDOFs) into separate free and fixed DOF graphs for independent reordering.

Purpose:

  • Enables independent application of graph reordering (symrcm) to free and fixed DOFs
  • Simplifies sorting by separating DOF types

Actions:

  1. Voids index and my_index of every regular DOF (gNoIndex) so that a stale index faults instead of aliasing; reorder_dofs() rebuilds them. Hanging DOFs get my_index = 0..h-1
  2. Populates the output containers in mDOFs order (fixed / free split)
  3. Clears mDOFs (restored by restore_dof_container())

Postconditions:

  • aFreeDofs contains all free DOFs (size = n)
  • aFixedDofs contains all fixed DOFs (size = m)
  • mDOFs is empty
  • index and my_index of every regular DOF are gNoIndex
Parameters
aFreeDofsOutput: graph container for free DOFs
aFixedDofsOutput: graph container for fixed DOFs

◆ synchronize_dirichlet_bcs()

void belfem::fem::dofmgr::DofData::synchronize_dirichlet_bcs ( )

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