Repository navigation
Conversation
…multiplier conserving fluxes. Use all garth's demo.
… UFL for higher order degrees.
compute_facet_orientations no longer needs GhostMode::shared_facet. Each process reduces, per edge, the largest and smallest code 2 * (global cell index) + runs_up over its owned cells, and their count. One reverse and one forward scatter over the edge index map give every process holding an edge both of its cells, so owned and ghost cells are signed locally. Errors (an edge with more than two cells) are raised after the scatters, so no process is left waiting in them. - Topology::facet_orientations checks for a surface - FiniteElement::depends_on_cell_orientation -> depends_on_facet_orientations - FiniteElement::permute/permute_inv use the cached orientation mask - demo_manifold drops the vertex-ghosting partitioner; the eikonal and branching demos drop shared_facet; demo_mobius prints its -2 check - Tests: independent recomputation of the signs and of ghost consistency, unghosted surfaces and T-joints, shape checks, signed-facet assertions Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… facets of owned cells
…fy masks - Document that the non-manifold edge error is raised on every rank only in Developer and Debug builds. - Keep the full explanation once, in Topology::create_facet_orientations, and reference it elsewhere. - Fix stale cell-orientation wording in FunctionSpace and the bit-range comment in compute_cell_permutations. - Check the topological dimension once, in Topology; assert it in compute_facet_orientations. - Drop the derived _applied_orientation_mask from FiniteElement. - Use std::ranges::copy_n. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jhale
reviewed
Oct 21, 2026
jhale
reviewed
Oct 21, 2026
…a's proper description of encoding and decoding
Member
Author
|
Status update of PR
Algorithm
Properties:
Benchmark (ms, 8 processes, minimum of 7 calls)
This PR is faster on fragmented partitions. On ordinary ones it is slower, mainly because it builds the temporary edge-to-owned-cell list on every call; #4574 stored the connectivity. Decisions made in review
|
This branch has not been deployed
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.
After discussions with @jhale.
Required for a consistently oriented
CellNormal.This adds a demo illustrating where an oriented
CellNormalis useful.Summary
Adds
dolfinx.mesh.compute_cell_orientations(topology)(C++:mesh::compute_cell_orientations). It returns, for each owned and ghostcell of an orientable surface, the sign (
1or-1) that makes the normalsof all cells agree. Nothing is stored on the topology. Multiplying
ufl.CellNormalby the signs, through a DG0 function, gives a consistentnormal, as needed for the surface curl
dot(n, curl(w))in vorticityformulations. The new demo
demo_manifold_vorticity.pysolves mixed Poissonon the sphere with a rotated Nédélec flux and reproduces the Raviart-Thomas
solution to rounding.
#4574 computed the same orientation, stored it on the topology, and used it
for RT spaces. #4625 replaced that use with facet signs and removed the
function. This PR brings it back as a free function, with a new parallel
algorithm.
Algorithm compared with #4574
The result is the same, and so is the convention: each surface, i.e. each
set of cells connected through shared edges, is oriented by its cell with the
lowest global index, which gets
1. On every mesh benchmarked below, bothversions return identical arrays. The difference is in how the processes are
joined.
Allreducecompute_sharing_neighbourhoodScatterer(reverse, then forward) of[max code, -min code, count], withcode = 2 * label + directionNeighbor_alltoall+Neighbor_alltoallv+Allreduce; the number of rounds grows with the length of the chain of parts[status, part signs]with aScattervAllreduce+ 3 per round + the final checkGather, 2Gatherv,Scatterv, and the ghost scatterThe reduction gives the owner of each edge both of its cells, their parts and
their directions:
(a, b, r), meaning that partbhasrtimesthe orientation of part
a.A link that contradicts the others in the union-find also means the surface
is not orientable. The error status travels in the
Scattervreply, so everyprocess raises together in all build types. Process 0 receives at most one
link per part, typically a few per process, rather than one per edge between
processes.
reduce_edge_codes,runs_up,edge_rowandfold_codesare now sharedwith
compute_facet_orientations(#4625), which used the same reduction.Benchmark
Each time is the minimum of 7 calls, taking the slowest process for each
call. The #4574 times exclude creating its edge-to-cell connectivity, a
one-off cost of about 0.4 ms in serial on the strip; this PR builds its list
in every call.
On ordinary partitions #4574 is slightly faster, because it reuses the stored
connectivity. When the partition splits each process's cells into many parts
(the round-robin strip, or a surface submesh of a 3D partition), its rounds
add up. This PR's time stays flat, and it is 3–8 times faster.
Tests
triangle and quadrilateral surfaces, with and without ghost cells. Ghosts
are made by ghosting every cell on each process sharing one of its
vertices, since a facet submesh has none.
1.CellNormalpoints outward.(needs petsc4py, skipped otherwise).
AI disclosure statement
This PR has been created with the assistance of Claude (Opus 5.5). I have
revised the code and take responsibility for the contribution.