Skip to content

Commit 0762688

Browse files
committedJul 23, 2021
Ghost cells generator: point exchange optim in structured grids
Points at the interface between blocks were being exchange on structured data (including points position and point data). This exchange is unnecessary, so this commit removes it.
1 parent 7c2bc36 commit 0762688

File tree

1 file changed

+41
-13
lines changed

1 file changed

+41
-13
lines changed
 

‎Parallel/DIY/vtkDIYGhostUtilities.cxx

+41-13
Original file line numberDiff line numberDiff line change
@@ -2594,20 +2594,47 @@ vtkSmartPointer<vtkIdList> ComputeInterfacePointIdsForStructuredData(unsigned ch
25942594
kmin = std::max(extent[4], localExtent[4]);
25952595
kmax = std::min(extent[5], localExtent[5]);
25962596

2597-
// We give ownership of the non ghost version of a point to the most right / back / top grid.
2598-
// We do that by removing the most right / back / top layer of points of the intersection between
2599-
// the 2 input extents.
2600-
if (adjacencyMask & Adjacency::Right)
2601-
{
2602-
--imax;
2597+
constexpr unsigned char LR = Adjacency::Right | Adjacency::Left;
2598+
constexpr unsigned char BF = Adjacency::Back | Adjacency::Front;
2599+
constexpr unsigned char TB = Adjacency::Top | Adjacency::Bottom;
2600+
2601+
// Points on the interface do not need to be exchanged, so we shrink the extent at those
2602+
// interfaces.
2603+
// Since input mask can have had a bitwise not operator performed, we weed out couples 11
2604+
// (they should not exist anyway: you cannot be adjacent to Right and Left at the same time, for
2605+
// instance).
2606+
if ((adjacencyMask & LR) != LR)
2607+
{
2608+
if (adjacencyMask & Adjacency::Right)
2609+
{
2610+
--imax;
2611+
}
2612+
if (adjacencyMask & Adjacency::Left)
2613+
{
2614+
++imin;
2615+
}
26032616
}
2604-
if (adjacencyMask & Adjacency::Back)
2617+
if ((adjacencyMask & BF) != BF)
26052618
{
2606-
--jmax;
2619+
if (adjacencyMask & Adjacency::Back)
2620+
{
2621+
--jmax;
2622+
}
2623+
if (adjacencyMask & Adjacency::Front)
2624+
{
2625+
++jmin;
2626+
}
26072627
}
2608-
if (adjacencyMask & Adjacency::Top)
2628+
if ((adjacencyMask & TB) != TB)
26092629
{
2610-
--kmax;
2630+
if (adjacencyMask & Adjacency::Top)
2631+
{
2632+
--kmax;
2633+
}
2634+
if (adjacencyMask & Adjacency::Bottom)
2635+
{
2636+
++kmin;
2637+
}
26112638
}
26122639

26132640
const int* gridExtent = grid->GetExtent();
@@ -2668,9 +2695,10 @@ vtkSmartPointer<vtkIdList> ComputeOutputInterfacePointIdsForStructuredData(
26682695
ExtentType localExtent
26692696
{ gridExtent[0], gridExtent[1], gridExtent[2], gridExtent[3], gridExtent[4], gridExtent[5] };
26702697

2671-
// We do a bit shift on adjacencyMask to have the same adjacency mask as in the Input version of
2672-
// this function. It produces an axial symmetry on each dimension having an adjacency.
2673-
return ComputeInterfacePointIdsForStructuredData(adjacencyMask << 1, localExtent, extent, grid);
2698+
// We apply a bitwise NOT opeartion on adjacencyMask to have the same adjacency mask as
2699+
// in the Input version of this function. It produces an axial symmetry on each dimension
2700+
// having an adjacency.
2701+
return ComputeInterfacePointIdsForStructuredData(~(adjacencyMask | 0x40), localExtent, extent, grid);
26742702
}
26752703

26762704
//----------------------------------------------------------------------------

0 commit comments

Comments
 (0)
Please sign in to comment.