@@ -2594,20 +2594,47 @@ vtkSmartPointer<vtkIdList> ComputeInterfacePointIdsForStructuredData(unsigned ch
2594
2594
kmin = std::max (extent[4 ], localExtent[4 ]);
2595
2595
kmax = std::min (extent[5 ], localExtent[5 ]);
2596
2596
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
+ }
2603
2616
}
2604
- if (adjacencyMask & Adjacency::Back )
2617
+ if (( adjacencyMask & BF) != BF )
2605
2618
{
2606
- --jmax;
2619
+ if (adjacencyMask & Adjacency::Back)
2620
+ {
2621
+ --jmax;
2622
+ }
2623
+ if (adjacencyMask & Adjacency::Front)
2624
+ {
2625
+ ++jmin;
2626
+ }
2607
2627
}
2608
- if (adjacencyMask & Adjacency::Top )
2628
+ if (( adjacencyMask & TB) != TB )
2609
2629
{
2610
- --kmax;
2630
+ if (adjacencyMask & Adjacency::Top)
2631
+ {
2632
+ --kmax;
2633
+ }
2634
+ if (adjacencyMask & Adjacency::Bottom)
2635
+ {
2636
+ ++kmin;
2637
+ }
2611
2638
}
2612
2639
2613
2640
const int * gridExtent = grid->GetExtent ();
@@ -2668,9 +2695,10 @@ vtkSmartPointer<vtkIdList> ComputeOutputInterfacePointIdsForStructuredData(
2668
2695
ExtentType localExtent
2669
2696
{ gridExtent[0 ], gridExtent[1 ], gridExtent[2 ], gridExtent[3 ], gridExtent[4 ], gridExtent[5 ] };
2670
2697
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);
2674
2702
}
2675
2703
2676
2704
// ----------------------------------------------------------------------------
0 commit comments