Parallel/DIY/vtkDIYGhostUtilities.cxx
bool SynchronizeGridExtents(const RectilinearGridBlockStructure& localBlockStructure,
  RectilinearGridBlockStructure& blockStructure)
{
  const ExtentType& extent = blockStructure.Extent;
  if (localBlockStructure.DataDimension != blockStructure.DataDimension ||
      extent[0] > extent[1] || extent[2] > extent[3] || extent[4] > extent[5])
  {
    return false;
  }
  const ExtentType& localExtent = localBlockStructure.Extent;

  const vtkSmartPointer<vtkDataArray>& localXCoordinates = localBlockStructure.XCoordinates;
  const vtkSmartPointer<vtkDataArray>& localYCoordinates = localBlockStructure.YCoordinates;
  const vtkSmartPointer<vtkDataArray>& localZCoordinates = localBlockStructure.ZCoordinates;

  const vtkSmartPointer<vtkDataArray>& xCoordinates = blockStructure.XCoordinates;
  const vtkSmartPointer<vtkDataArray>& yCoordinates = blockStructure.YCoordinates;
  const vtkSmartPointer<vtkDataArray>& zCoordinates = blockStructure.ZCoordinates;

  using Dispatcher = vtkArrayDispatch::Dispatch;
  RectilinearGridFittingWorker xWorker(xCoordinates), yWorker(yCoordinates), zWorker(zCoordinates);

  Dispatcher::Execute(localXCoordinates, xWorker);
  Dispatcher::Execute(localYCoordinates, yWorker);
  Dispatcher::Execute(localZCoordinates, zWorker);

  // The overlap between the 2 grids needs to have at least one degenerate dimension in order
  // for them to be adjacent.
  if ((!xWorker.Overlaps || !yWorker.Overlaps || !zWorker.Overlaps) &&
    (xWorker.MinId != xWorker.MaxId || yWorker.MinId != yWorker.MaxId ||
      zWorker.MinId != zWorker.MaxId))
  {
    return false;
  }

  int originDiff[3] = { extent[0] + xWorker.MinId - localExtent[0] - xWorker.LocalMinId,
    extent[2] + yWorker.MinId - localExtent[2] - yWorker.LocalMinId,
    extent[4] + zWorker.MinId - localExtent[4] - zWorker.LocalMinId };

  blockStructure.ShiftedExtent =
    ExtentType{ extent[0] + originDiff[0], extent[1] + originDiff[0], extent[2] + originDiff[1],
      extent[3] + originDiff[1], extent[4] + originDiff[2], extent[5] + originDiff[2] };
  return true;
}
//----------------------------------------------------------------------------
/**
 * Function to be overloaded for each supported input grid data sets.
 * This function will return true if 2 input block structures are adjacent, false otherwise.
 */
Function to be overloaded for each supported input grid data sets.
This function will return true if 2 input block structures are adjacent, false otherwise.
Function to be overloaded for each supported input grid data sets . This function will return true if 2 input block structures are adjacent false otherwise .
bool SynchronizeGridExtents(const RectilinearGridBlockStructure& localBlockStructure,
  RectilinearGridBlockStructure& blockStructure)
{
  const ExtentType& extent = blockStructure.Extent;
  if (localBlockStructure.DataDimension != blockStructure.DataDimension ||
      extent[0] > extent[1] || extent[2] > extent[3] || extent[4] > extent[5])
  {
    return false;
  }
  const ExtentType& localExtent = localBlockStructure.Extent;
  const vtkSmartPointer<vtkDataArray>& localXCoordinates = localBlockStructure.XCoordinates;
  const vtkSmartPointer<vtkDataArray>& localYCoordinates = localBlockStructure.YCoordinates;
  const vtkSmartPointer<vtkDataArray>& localZCoordinates = localBlockStructure.ZCoordinates;
  const vtkSmartPointer<vtkDataArray>& xCoordinates = blockStructure.XCoordinates;
  const vtkSmartPointer<vtkDataArray>& yCoordinates = blockStructure.YCoordinates;
  const vtkSmartPointer<vtkDataArray>& zCoordinates = blockStructure.ZCoordinates;
  using Dispatcher = vtkArrayDispatch::Dispatch;
  RectilinearGridFittingWorker xWorker(xCoordinates), yWorker(yCoordinates), zWorker(zCoordinates);
  Dispatcher::Execute(localXCoordinates, xWorker);
  Dispatcher::Execute(localYCoordinates, yWorker);
  Dispatcher::Execute(localZCoordinates, zWorker);
  if ((!xWorker.Overlaps || !yWorker.Overlaps || !zWorker.Overlaps) &&
    (xWorker.MinId != xWorker.MaxId || yWorker.MinId != yWorker.MaxId ||
      zWorker.MinId != zWorker.MaxId))
  {
    return false;
  }
  int originDiff[3] = { extent[0] + xWorker.MinId - localExtent[0] - xWorker.LocalMinId,
    extent[2] + yWorker.MinId - localExtent[2] - yWorker.LocalMinId,
    extent[4] + zWorker.MinId - localExtent[4] - zWorker.LocalMinId };
  blockStructure.ShiftedExtent =
    ExtentType{ extent[0] + originDiff[0], extent[1] + originDiff[0], extent[2] + originDiff[1],
      extent[3] + originDiff[1], extent[4] + originDiff[2], extent[5] + originDiff[2] };
  return true;
}
bool SynchronizeGridExtents ( const RectilinearGridBlockStructure & localBlockStructure , RectilinearGridBlockStructure & blockStructure ) { const ExtentType & extent = blockStructure . Extent ; if ( localBlockStructure . DataDimension != blockStructure . DataDimension || extent [ 0 ] > extent [ 1 ] || extent [ 2 ] > extent [ 3 ] || extent [ 4 ] > extent [ 5 ] ) { return false ; } const ExtentType & localExtent = localBlockStructure . Extent ; const vtkSmartPointer < vtkDataArray > & localXCoordinates = localBlockStructure . XCoordinates ; const vtkSmartPointer < vtkDataArray > & localYCoordinates = localBlockStructure . YCoordinates ; const vtkSmartPointer < vtkDataArray > & localZCoordinates = localBlockStructure . ZCoordinates ; const vtkSmartPointer < vtkDataArray > & xCoordinates = blockStructure . XCoordinates ; const vtkSmartPointer < vtkDataArray > & yCoordinates = blockStructure . YCoordinates ; const vtkSmartPointer < vtkDataArray > & zCoordinates = blockStructure . ZCoordinates ; using Dispatcher = vtkArrayDispatch :: Dispatch ; RectilinearGridFittingWorker xWorker ( xCoordinates ) , yWorker ( yCoordinates ) , zWorker ( zCoordinates ) ; Dispatcher :: Execute ( localXCoordinates , xWorker ) ; Dispatcher :: Execute ( localYCoordinates , yWorker ) ; Dispatcher :: Execute ( localZCoordinates , zWorker ) ; if ( ( ! xWorker . Overlaps || ! yWorker . Overlaps || ! zWorker . Overlaps ) && ( xWorker . MinId != xWorker . MaxId || yWorker . MinId != yWorker . MaxId || zWorker . MinId != zWorker . MaxId ) ) { return false ; } int originDiff [ 3 ] = { extent [ 0 ] + xWorker . MinId - localExtent [ 0 ] - xWorker . LocalMinId , extent [ 2 ] + yWorker . MinId - localExtent [ 2 ] - yWorker . LocalMinId , extent [ 4 ] + zWorker . MinId - localExtent [ 4 ] - zWorker . LocalMinId } ; blockStructure . ShiftedExtent = ExtentType { extent [ 0 ] + originDiff [ 0 ] , extent [ 1 ] + originDiff [ 0 ] , extent [ 2 ] + originDiff [ 1 ] , extent [ 3 ] + originDiff [ 1 ] , extent [ 4 ] + originDiff [ 2 ] , extent [ 5 ] + originDiff [ 2 ] } ; return true ; }
Function to be overloaded for each supported input grid data sets.
Function to be overloaded for each supported input grid data sets .
// The overlap between the 2 grids needs to have at least one degenerate dimension in order // for them to be adjacent.