Add space-filling curve mesh ordering - #4474
Open
garth-wells wants to merge 34 commits into
Open
Conversation
Base automatically changed from
garth/static-mdspan-assembly-extents
to
main
September 3, 2026 04:16
# Conflicts: # python/demo/demo_partition.py # python/dolfinx/wrappers/dolfinx_wrappers/mesh.h # python/test/unit/mesh/test_mesh.py
compute_cell_centroids performs a collective MPI::distribute_data call that can throw on a rank-local condition, but it was invoked outside the try/MPI_Allreduce guard added for cell reordering/partitioning, risking a deadlock if it failed asymmetrically. Fold it into the same guarded region in both create_mesh and partition_cells via new try_locally/mpi_check helpers, which also collapse three near-identical hand-rolled try/catch+Allreduce blocks into one implementation. Also split compute_cell_centroids into a serial cell_centroids_local (no MPI_Comm) plus a thin collective wrapper, add num_vertices_per_cell_type and owned_cell_vertices helpers to stop create_mesh and reorder_cells independently re-deriving the same owned/ghost cell-vertex views, fix a validation-order regression in graph::partition_sfc_* error messages, and make GeometricReorderer a type alias for OpaquePartitioner instead of reimplementing it. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
garth-wells
marked this pull request as ready for review
September 3, 2026 09:12
MPI::distribute_data's "non-empty data on null communicator" check was a rank-local throw sandwiched between two comm0-wide collectives, so a rank hitting it could exit before a later collective that other ranks still entered -- wrapping the call in try_locally at a higher level cannot fix a divergence inside the collective itself. Make the check collective: reduce it across comm0, unconditionally, before any other collective in the function, so every rank throws together or none do. Also fix scaled_target in the SFC partitioner: its two-term int64 split was justified by a comment claiming n and p are always int-bounded, which is false for the sample_size call site (global point/weight counts can exceed INT_MAX), silently producing a wrong result rather than overflowing loudly. Compute the product in 128 bits instead. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Validation
clang-format --dry-run --Werroron changed C++ sourcesruff checkandruff format --checkon changed Python sources-Wall -Werror -Wextra -pedanticAI assistance: I used Codex (GPT-5) to draft parts of this PR. I reviewed, edited, tested, and take responsibility for the final contribution.