Conversation
02a3a4a to
028fefd
Compare
028fefd to
5f59b56
Compare
35d780d to
d01670a
Compare
d01670a to
9c264d9
Compare
9c264d9 to
c7b205f
Compare
|
@jhale can you check that this is correct for t joints or even larger joints? Ie sometimes where a facet is shared between 3 to N cells? |
d1d9191 to
a7ac2e0
Compare
|
The Therefore I asked CLAUDE (OPUS 5) to see if we could exploit this rewrite in Follow-up idea (not blocking):
|
| for i in range(dual_graph.num_nodes): | ||
| owner = (offset + i) % nparts | ||
| d = [owner] | ||
| if ghost: |
There was a problem hiding this comment.
This is a very cool way of doing ghosting, which I believe could be used to extend the number of layers one would search outwards in the dual graph! @IgorBaratta
|
Which use cases does this fix? For the here tested branching manifolds, there is no general concept of interior or exterior facet. |
1eab842 to
56600c5
Compare
The PR fixes the computation interior and exterior facets with Before the fix, The definition of interior and exterior is: Let Exterior facet: This definition already exists, from my understanding of the existing code. |
|
Thanks, should this not be managed in the
One other point, that I need to think more on: if the shared facet case worked before without this additional work path than there must be a no-op short cut to this computation at least in this case, which we should retain. |
Yes.
Indeed, an easy fix, I will implement it through lazy computation.
Agreed.
It can be gated on the same Edit: The old |
garth-wells
left a comment
There was a problem hiding this comment.
Comments inline.
No chance that we can get tdim==1 to follow the same code path as tdim>1?
| return entity_types; | ||
| } | ||
|
|
||
| /// @brief Compute inter-process vertices for a topology with tdim == 1, |
There was a problem hiding this comment.
It's not clear what an 'inter-process' vertex is.
There was a problem hiding this comment.
It's described in the docstring:
/// Matches the definition used by mesh::compute_entities for dim >= 1:
/// an entity is inter-process if cells owned by two or more ranks are
/// attached to it.
And is consistent with the interprocess_facets which is in the public API.
| } | ||
|
|
||
| // Send the verdict for owned vertices back to the ghosting ranks | ||
| std::ranges::transform(local_ind, buffer_local.begin(), |
There was a problem hiding this comment.
Use transforms in cases like this is harder to read than a plan loop.
| // Keep only the vertices attached to a cell owned by this rank | ||
| std::vector<std::int32_t> interprocess_vertices; | ||
| for (std::int32_t v = 0; v < num_local + num_ghosts; ++v) | ||
| if (interprocess[v] and attached[v]) |
56600c5 to
7ee68e1
Compare
7ee68e1 to
df4c041
Compare
df4c041 to
94eb31d
Compare
94eb31d to
80e20c2
Compare
80e20c2 to
41e25d9
Compare
Topology's tdim==1 constructor hack tried to derive inter-process facets (vertices, for a 1D mesh) via mesh::compute_entities(dim=0), but that function has always returned immediately for dim==0 since vertices are set up directly rather than computed on demand. The pushed (always-empty) vector satisfied interprocess_facets()'s "not computed" guard, so it silently returned an empty list for every 1D mesh instead of the true inter-process vertices, misclassifying partition-boundary vertices as exterior facets under GhostMode::none. Replace the hack with compute_interprocess_vertices, which reads the answer directly from the vertex IndexMap's own ownership/ghosting data instead of recomputing entity sharing: every vertex needed by a locally owned cell is already resolved there (owned or ghost), independently of GhostMode, so no extra communication round is needed. Drops the now-unused num_threads parameter from Topology's constructor. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Deriving the tdim == 1 inter-process facets from the vertex IndexMap's sharing alone over-reports: a vertex is shared whenever another rank holds it, including when that rank only holds it through a ghost cell. A domain-boundary vertex of a cell that is ghosted elsewhere was then marked inter-process and dropped by exterior_facet_indices, losing a true exterior facet. Under a partitioner that ghosts across the joint, every tip of a K-way joint mesh (and every end of a plain interval chain) was lost. Use instead the definition mesh::compute_entities applies for dim >= 1: an entity is inter-process if cells owned by two or more ranks are attached to it. Flags for vertices attached to an owned cell are reduced onto the vertex owner and the verdict scattered back, which also covers a sub-topology vertex whose owner has no attached owned cell. Add a branching-mesh regression test over a K-way joint distributed one cell per rank, with and without ghosting, checking both the exterior facet count and the inter-process vertices against a gathered reference. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Jørgen Schartum Dokken <dokken92@gmail.com>
Co-authored-by: Jørgen Schartum Dokken <dokken92@gmail.com>
Topology.cpp: the applied suggestion left a mangled lambda/indentation that clang-format could not parse as-is, and array() returns a std::vector so it needed wrapping in a span before slicing. test_branching_manifold.py: the applied suggestion dropped the c_to_v/v_map definitions that _interprocess_vertices_reference still uses, causing a NameError.
Co-authored-by: Jørgen Schartum Dokken <dokken92@gmail.com>
Co-authored-by: Jørgen Schartum Dokken <dokken92@gmail.com>
Co-authored-by: Jørgen Schartum Dokken <dokken92@gmail.com>
41e25d9 to
408fec2
Compare
Topology's tdim==1 constructor hack tried to derive inter-process
facets (vertices, for a 1D mesh) via mesh::compute_entities(dim=0),
but that function has always returned immediately for dim==0 since
vertices are set up directly rather than computed on demand. The
pushed (always-empty) vector satisfied interprocess_facets()'s "not
computed" guard, so it silently returned an empty list for every 1D
mesh instead of the true inter-process vertices, misclassifying
partition-boundary vertices as exterior facets under GhostMode::none.
Replace the hack with compute_interprocess_vertices, which reads the
answer directly from the vertex IndexMap's own ownership/ghosting
data instead of recomputing entity sharing: every vertex needed by a
locally owned cell is already resolved there (owned or ghost),
independently of GhostMode, so no extra communication round is
needed. Drops the now-unused num_threads parameter from Topology's
constructor.
Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com
Stack created with GitHub Stacks CLI • Give Feedback 💬