Repository navigation
Conversation
The duplicate-visit flags of the surface connectivity sort were kept across markers, but boundary element indices restart at zero on each marker, so an element could be taken as already visited and dropped from the surface output. Reset the flags for each marker, and add a unit test with a box mesh. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6 tasks done
bigfooted
reviewed
Nov 30, 2026
|
|
||
| if (it != markerList.end()) { | ||
| /*--- Element indices restart at zero for each marker. ---*/ | ||
| std::fill(nElem_Flag, nElem_Flag + size, -1); |
Contributor
There was a problem hiding this comment.
Optional simplification: the target rank comes from the lowest global index over all nodes of the element, so it is the same on every jj iteration. Computing it once per element removes the jj loop, and with it the need for nElem_Flag and this per-marker reset.
Counting pass (replaces the ii loop here):
for (int ii = 0; ii < (int)geometry->GetnElem_Bound(iMarker); ii++) {
if (geometry->bound[iMarker][ii]->GetVTK_Type() == Elem_Type) {
/*--- Send the element to the rank owning its lowest global node index. ---*/
Global_Index = geometry->nodes->GetGlobalIndex(geometry->bound[iMarker][ii]->GetNode(0));
for (int kk = 1; kk < NODES_PER_ELEMENT; kk++) {
jPoint = geometry->bound[iMarker][ii]->GetNode(kk);
unsigned long newID = geometry->nodes->GetGlobalIndex(jPoint);
if (newID < Global_Index) Global_Index = newID;
}
iProcessor = linearPartitioner.GetRankContainingIndex(Global_Index);
nElem_Send[iProcessor+1]++;
}
}Send pass (replaces the ii loop at line 1265):
for (int ii = 0; ii < (int)geometry->GetnElem_Bound(iMarker); ii++) {
if (geometry->bound[iMarker][ii]->GetVTK_Type() == Elem_Type) {
/*--- Send the element to the rank owning its lowest global node index. ---*/
Global_Index = geometry->nodes->GetGlobalIndex(geometry->bound[iMarker][ii]->GetNode(0));
for (int kk = 1; kk < NODES_PER_ELEMENT; kk++) {
jPoint = geometry->bound[iMarker][ii]->GetNode(kk);
unsigned long newID = geometry->nodes->GetGlobalIndex(jPoint);
if (newID < Global_Index) Global_Index = newID;
}
iProcessor = linearPartitioner.GetRankContainingIndex(Global_Index);
/*--- Load connectivity into the buffer for sending ---*/
unsigned long nn = index[iProcessor];
unsigned long mm = haloIndex[iProcessor];
for (int kk = 0; kk < NODES_PER_ELEMENT; kk++) {
iPoint = geometry->bound[iMarker][ii]->GetNode(kk);
connSend[nn] = geometry->nodes->GetGlobalIndex(iPoint); nn++;
/*--- Flag the element as halo if any of its nodes is a halo node. ---*/
if (volumeSorter->GetHalo(iPoint)) haloSend[mm] = true;
}
index[iProcessor] += NODES_PER_ELEMENT;
haloIndex[iProcessor]++;
}
}With both passes changed, nElem_Flag is unused, so its allocation, the reset loop before the send pass, and its delete can be removed as well.
bigfooted
approved these changes
Nov 30, 2026
bigfooted
left a comment
Contributor
There was a problem hiding this comment.
LGTM, check my comment and see if it makes sense.
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.
Problem
The surface output can miss elements when
MARKER_PLOTTINGlists more than one marker.The surface sorter remembers the last element it visited. The element numbers restart at zero on each marker, but this memory was not reset between markers. So an element of the next marker could be taken as already visited and dropped.
Example: a 2x2x2 box mesh with all 6 faces as plotting markers writes only 1 face instead of 6.
All surface output formats are affected.
Fix
CSurfaceFVMDataSorter::SortSurfaceConnectivity.CPhysicalGeometryalready resets these flags per marker in the same kind of loop.Tests
UnitTests/SU2_CFD/output/CSurfaceFVMDataSorter_tests.cpp. It counts the surface elements of a box mesh for several marker lists.Related
PR Checklist
pre-commit run --allto format old commits.🤖 Generated with Claude Code