Dof reindexing for FESpaces#1299
Conversation
|
@nichomueller this is what we talked about. I've added an API to do reordering of dofs after the space has been created. We can add more permutations if any are missing. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1299 +/- ##
==========================================
+ Coverage 88.84% 88.90% +0.05%
==========================================
Files 227 228 +1
Lines 29799 30030 +231
==========================================
+ Hits 26475 26698 +223
- Misses 3324 3332 +8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR introduces a new public API to reorder (reindex) free DOF IDs in FESpaces to improve assembled matrix sparsity characteristics (bandwidth/profile/fill-in), adding built-in graph-based algorithms (RCM, Sloan) plus a coordinate-based ordering, along with supporting infrastructure and tests.
Changes:
- Added
reindex_free_dof_ids/reindex_free_and_dirichlet_dof_idsAPIs and implementations forUnconstrainedFESpaceandPolytopalFESpace, keepingrenumber_free_and_dirichlet_dof_idsas a legacy wrapper. - Added
compute_adjacencyto build a symmetric DOF adjacency graph from cell-to-DOF connectivity, and internal permutation routines (RCM/Sloan/coordinates). - Added a dedicated testset covering API behavior and a basic end-to-end bandwidth reduction check; updated NEWS.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/FESpacesTests/runtests_2.jl | Registers the new reindexing testset in the FESpaces test suite. |
| test/FESpacesTests/FESpaceReindexingTests.jl | Adds tests for reindexing algorithms, custom coordinate keying, explicit adjacency reuse, and a bandwidth reduction sanity check. |
| src/Geometry/Geometry.jl | Exports compute_graph. |
| src/FESpaces/UnconstrainedFESpaces.jl | Renames the concrete renumbering implementation to the new reindex_free_and_dirichlet_dof_ids interface. |
| src/FESpaces/PolytopalFESpaces.jl | Same as above for PolytopalFESpace. |
| src/FESpaces/PatchFESpaces.jl | Updates internal call site to the new reindexing function name. |
| src/FESpaces/FESpaces.jl | Exports the new reindexing API and includes the new implementation file; imports compute_adjacency. |
| src/FESpaces/FESpaceReindexing.jl | New core implementation: abstract interface + RCM/Sloan/coordinates permutations + public entry point. |
| src/Arrays/Tables.jl | Adjusts inverse_table to skip nonpositive entries and adds compute_adjacency. |
| src/Arrays/Arrays.jl | Exports inverse_table. |
| Project.toml | Adds AMD to compat/extras/test target. |
| NEWS.md | Documents the new reindexing API under Unreleased. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Adds reindex_free_dof_ids(space, algorithm) to reorder the free DOF IDs of a FESpace to reduce the bandwidth, profile, or fill-in of the assembled stiffness matrix. Dirichlet DOF IDs are
left unchanged.
Algorithms
All algorithms are also reachable by calling reindex_free_dof_ids(space, iperm) directly with an externally computed permutation vector (e.g. from AMD).
New public API
renumber_free_and_dirichlet_dof_ids is kept as a legacy wrapper (to be deprecated in the next major release).
Internal additions