|
| | SolverData (DofManager *aParent, DofData *aDofData, BlockData *aBlockData, SideSetData *aSideSetData) |
| | ~SolverData () |
| void | extract_graph_from_mesh (Vector< id_t > &aGraphData) |
| void | allocate_matrices (const Vector< id_t > &aGraphData, Graph &aFreeDofs, Graph &aFixedDofs) |
| | Allocates sparse matrices for the finite element system.
|
| void | compute_memory () |
| void | create_assembly_tables () |
| void | reset () |
| void | reset_convection () |
| void | reset_matrices (const bool aFullForce=false) |
| void | reset_rhs_vector () |
| void | reset_rhs_matrix () |
| void | assemble_jacobian (Element *aElement, const Matrix< real > &aJacobian) |
| void | assemble_full_matrices (Element *aElement, const Matrix< real > &aMass, const Matrix< real > &aStiffness) |
| void | assemble_newton (Element *aElement, const Matrix< real > &adJdx) |
| void | assemble_rhs (Element *aElement, const Vector< real > &aRHS) |
| void | assemble_volume_loads (Element *aElement, const Vector< real > &aRHS) |
| void | asseble_surface_loads (Element *aElement, const Vector< real > &aRHS) |
| void | assemble_rhs (Element *aElement, const Matrix< real > &aRHS) |
| void | collect_matrices (const bool aFullForce=false) |
| void | collect_rhs_vector () |
| void | collect_vector (Vector< real > &aVector) |
| void | collect_rhs_matrix () |
| void | update_field_values () |
| void | set_solver (const SolverParameters &aParams) |
| | set the solver type for this field
|
| Solver * | solver () |
| | expose the solver
|
| void | solve () |
| | solve the system.
|
| void | compute_residual () |
| | Phase 1 of the two-phase iterative solve: prepare the load-adjusted RHS b, capture ||b||, and overwrite mRhsVector with the residual r = A x - b of the COMMITTED state under the current assembly — without solving.
|
| void | solve_from_residual () |
| | Phase 2: consume the residual left by compute_residual(), run the linear solve and the algorithm's update ( relaxed / Anderson Picard, or the Newton step with its post-update recompute ).
|
| void | invalidate_residual () |
| | invalidate the two-phase handshake; called by a fresh assembly
|
| real | residual (const uint aIteration) |
| | return the residual
|
| real | absolute_residual () const |
| | absolute residual norm of the last residual() call ( rank-uniform, broadcast alongside the relative value )
|
| real | pre_update_residual () const |
| | pre-update residual of the entry state under the current assembly ( Newton iterates only, QUIET_NAN otherwise; rank-uniform after residual() ).
|
| real | fixed_point_residual () const |
| | fixed-point residual ||G(x)-x|| / ||x|| of the last Anderson update ( rank-uniform after residual() )
|
| void | set_anderson_depth (const uint aDepth) |
| | activate ( depth > 0 ) or deactivate ( depth = 0 ) Anderson mixing of the Picard branch; allocates the history registers
|
| void | anderson_commit () |
| | move the staged ( x, r ) pair into the history; called by the controller once the trial iterate is accepted.
|
| void | anderson_discard () |
| | drop the staged pair ( trial was rejected )
|
| void | anderson_clear () |
| | invalidate the history ( new attempt, algorithm switch, restore, ... ); also drops any staged pair
|
| SpMatrix * | system_matrix () |
| SpMatrix * | enforcement () |
| SpMatrix * | dirichlet () |
| SpMatrix * | imposition () |
| SpMatrix * | matrix (const MatrixType aType) |
| Cell< Vector< index_t > > & | tables (const MatrixType aType) |
| Vector< real > & | rhs_vector () |
| real | rhs_norm () |
| Vector< real > & | volume_loads () |
| Vector< real > & | surface_loads () |
| index_t | number_of_free_dofs () const |
| index_t | number_of_fixed_dofs () const |
| index_t | my_number_of_free_dofs () const |
| index_t | my_number_of_fixed_dofs () const |
| void | save_system (const string &aPath) |
| void | load_system (const string &aPath) |
| void | remember_initialization_values (const bool aSaveRHS) |
| void | use_reset_values (const bool aFlag) |
| void | use_jedi_force (const bool aFlag) |
| void | use_full_force (const bool aFlag) |
| void | populate_graph (const Vector< id_t > &aData, const MatrixType aMatrixType, Graph &aFreeDofs, Graph &aFixedDofs, bool aLinkToSelf=true) |
| | Builds vertex connectivity for sparse matrix sparsity patterns.
|
| void belfem::fem::dofmgr::SolverData::populate_graph |
( |
const Vector< id_t > & | aData, |
|
|
const MatrixType | aMatrixType, |
|
|
Graph & | aFreeDofs, |
|
|
Graph & | aFixedDofs, |
|
|
bool | aLinkToSelf = true ) |
Builds vertex connectivity for sparse matrix sparsity patterns.
Purpose:
- Creates graph connectivity by linking DOF vertices based on element topology
- Filters connections by DOF type (free/fixed) to match specific matrix structure
- Supports both JEDI Force matrices (J, D, E, I) and Full matrices (M, K)
- Optionally excludes self-connections for graph reordering algorithms
Matrix Type Mapping (rows × columns):
- Jacobian (J): free × free (standard stiffness, used for solving)
- Dirichlet (D): free × fixed (BC enforcement, negative sign in assembly)
- Enforcement (E): fixed × free (computes reaction forces at constraints)
- Imposition (I): fixed × fixed (self-coupling of prescribed DOFs)
- FullMass (M): all × all (eigenvalue analysis, combined index space)
- FullStiffness (K):all × all (eigenvalue analysis, combined index space)
Algorithm:
- Determine row/column DOF types from matrix type
- For each DOF in connectivity data: a. Check if DOF should be a row vertex (matches tRowIsFixed) b. Loop over all connected DOFs from elements c. Filter connections by column type (matches tColIsFixed) d. Mark connections in bitset using my_index + offset e. [Optional] Remove self-connection if aLinkToSelf=false f. Convert bitset to index list g. Insert vertex pointers into DOF's connectivity list
Index Space Handling:
- Free DOFs: my_index = 0..n-1, offset = 0
- Fixed DOFs: my_index = 0..m-1, offset = tMyNumberOfFreeDofs
- Bitset size: (n+m) to accommodate both types with offset
- For full matrices: uses combined space, fixed DOFs already offset
Bitset Mechanism:
- Efficiently tracks unique connections (prevents duplicates)
- Position i in bitset represents DOF with my_index i (or i-offset for fixed)
- bitset.where() extracts set positions into index list
Graph Vertex Container:
- Each Dof inherits from graph::Vertex
- Vertex has container of connected vertices (adjacency list)
- SpMatrix constructor reads this connectivity to build sparsity pattern
Parameters:
- Parameters
-
| aData | DOF-to-DOF connectivity from extract_graph_from_mesh() Format: [num_dofs, dof_id, num_connected, dof_id, ...] |
| aMatrixType | Which matrix to populate (J, D, E, I, FullMass, FullStiffness) |
| aFreeDofs | Graph vertices for free DOFs (indices 0..n-1) |
| aFixedDofs | Graph vertices for fixed DOFs (indices 0..m-1) |
| aLinkToSelf | Include diagonal connections (default true)
- true: Include self-connections (for matrix allocation)
- false: Exclude self-connections (for METIS/SCOTCH reordering)
|
Preconditions:
- aData contains complete DOF connectivity from extract_graph_from_mesh()
- aFreeDofs and aFixedDofs contain reordered DOF vertices
- Each DOF's my_index is set to its position in respective graph (0..n-1 or 0..m-1)
Postconditions:
- Each row DOF has vertex container populated with column DOF vertices
- Connectivity matches requested matrix type structure
- Ready for SpMatrix construction
Usage Example: // For Jacobian (free × free): populate_graph(graphData, Jacobian, freeDofs, fixedDofs, true); // Result: Each free DOF points to all connected free DOFs
// For Dirichlet (free × fixed): populate_graph(graphData, Dirichlet, freeDofs, fixedDofs, false); // Result: Each free DOF points to all connected fixed DOFs, no self-links