Commit e42bbf8f authored by George Zagaris's avatar George Zagaris

ENH: Implicit structured data connectivity

This commit introduces the vtkStructuredImplicitConnectivity class, intended
as a lower-level helper that provides functionality for resolving
situations where "gaps" are present in a distributed structured dataset. Gaps
are resolved by communicating the data (growing the grid to the right) as
necessary to close the gap. This situation is common with finite difference
grids that are partitioned with respect to the nodes of the grid, or when some
other post-processing filter, e.g., sampling the grid to reduce the resolution
introduces a gap.The present implementation requires one grid per process and
can deal with 2-D datasets -- XY,XZ,YZ -- as well as 3-D datasets. A test for
all 2-D and 3-D cases is also added.

Change-Id: I5260ce4fb5ced45434a719c8aacc2153253917a7
parent e4c0566b
vtk_module_library(vtkFiltersParallelMPI ${Module_SRCS})
This diff is collapsed.
......@@ -2,8 +2,13 @@ vtk_module(vtkFiltersParallelMPI
This diff is collapsed.
Program: Visualization Toolkit
Module: vtkStructuredImplicitConnectivity.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or for details.
This software is distributed WITHOUT ANY WARRANTY; without even
PURPOSE. See the above copyright notice for more information.
// .NAME vtkStructuredImplicitConnectivity -- Communicates data among a
// a distributed structured dataset that is implicitly connected among
// partitions without abutting. This creates a gap between partitions and
// introduces a cell that spans multiple zones. This typically arises with
// finite difference grids, which are partitioned with respect to the
// nodes of the grid, or, when a filter samples the grid, e.g., to get a
// lower resolution representation.
// .SECTION Description
// This class is intended as a lower-level helper for higher level VTK filters
// that provides functionality for resolving the implicit connectivity (gap)
// between two or more partitions of a distributed structured dataset.
// .SECTION Caveats
// The present implementation requires:
// <ul>
// <li> one block/grid per rank. </li>
// <li> 2-D (XY,YZ or XZ planes) or 3-D datasets. </li>
// <li> node-center fields must match across processes. </li>
// </ul>
#ifndef __vtkStructuredImplicitConnectivity_h
#define __vtkStructuredImplicitConnectivity_h
#include "vtkFiltersParallelMPIModule.h" // For export macro
#include "vtkObject.h"
// Forward declarations
class vtkMPIController;
class vtkMultiProcessStream;
class vtkPointData;
class vtkPoints;
class vtkStructuredGrid;
class vtkUniformGrid;
namespace vtk
namespace detail
class CommunicationManager;
struct DomainMetaData;
struct StructuredGrid;
} // END namespace detail
} // END namespace vtk
class VTKFILTERSPARALLELMPI_EXPORT vtkStructuredImplicitConnectivity :
public vtkObject
static vtkStructuredImplicitConnectivity* New();
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// \brief Sets the whole extent for the distributed structured domain.
// \param wholeExt the extent of the entire domain (in).
// \note All ranks must call this method with the same whole extent.
// \post this->DomainInfo != NULL
void SetWholeExtent(int wholeExt[6]);
// \brief Registers the structured grid dataset belonging to this process.
// \param gridID the ID of the grid in this rank.
// \param extent the [imin,imax,jmin,jmax,kmin,kmax] of the grid.
// \param gridPnts pointer to the points of the grid (NULL for uniform grid).
// \param pointData pointer to the node-centered fields of the grid.
// \pre gridID >= 0. The code uses values of gridID < -1 as flag internally.
// \pre vtkStructuredExtent::Smaller(extent,wholeExtent) == true.
// \note A rank with no or an empty grid, should not call this method.
void RegisterGrid(
const int gridID,
int extent[6],
vtkPoints* gridPnts,
vtkPointData* pointData
// Description:
// \brief Finds implicit connectivity for a distributed structured dataset.
// \note This is a collective operation, all ranks must call this method.
// \pre this->Controller != NULL
// \pre this->DomainInfo != NULL
void EstablishConnectivity();
// Description:
// \brief Checks if there is implicit connectivity.
// \return status true if implicit connectivity in one or more dimensions.
bool HasImplicitConnectivity();
// Description:
// \brief Exchanges one layer (row or column) of data between neighboring
// grids to fix the implicit connectivity.
// \note This is a collective operation, all ranks must call this method.
// \pre this->Controller != NULL
// \pre this->DomainInfo != NULL
void ExchangeData();
// Description:
// \brief Gets the output structured grid instance on this process.
// \param gridID the ID of the grid
// \param grid pointer to data-structure where to store the output.
void GetOutputStructuredGrid(const int gridID, vtkStructuredGrid* grid);
// Description:
// \brief Gets the output uniform grid instance on this process.
// \param gridID the ID of the grid.
// \param grid pointer to data-structure where to store the output.
void GetOutputUniformGrid(const int gridID, vtkUniformGrid* grid);
virtual ~vtkStructuredImplicitConnectivity();
vtkMPIController* Controller;
vtk::detail::DomainMetaData* DomainInfo;
vtk::detail::StructuredGrid* InputGrid;
vtk::detail::StructuredGrid* OutputGrid;
vtk::detail::CommunicationManager* CommManager;
// Description:
// \brief Checks if the data description matches globally.
bool GlobalDataDescriptionMatch();
// Description:
// \brief Packs the data to send into a bytestream
void PackData(int ext[6], vtkMultiProcessStream& bytestream);
// Description:
// \brief Unpacks the data to the output grid
void UnPackData(unsigned char* buffer, unsigned int size);
// Description:
// \brief Allocates send/rcv buffers needed to carry out the communication.
void AllocateBuffers(const int dim);
// Description:
// \brief Computes the neighbors with implicit connectivity.
void ComputeNeighbors();
// Description:
// \brief Constructs the output data-structures.
void ConstructOutput();
// Description:
// \brief Grows grid along a given dimension.
// \param dim the dimension in query.
void GrowGrid(const int dim);
// Description:
// \brief Updates the list of neighbors after growing the grid along the
// given dimension dim.
// \param dim the dimension in query.
void UpdateNeighborList(const int dim);
// Description:
// \brief Gets whether there is implicit connectivity across all processes.
void GetGlobalImplicitConnectivityState();
// Description:
// \brief Exchanges extents among processes.
// \pre this->Controller != NULL.
// \note This method is collective operation. All ranks must call it.
void ExchangeExtents();
vtkStructuredImplicitConnectivity(const vtkStructuredImplicitConnectivity&); // Not implemented
void operator=(const vtkStructuredImplicitConnectivity&); // Not implemented
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment