VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkStructuredImplicitConnectivity.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00041 #ifndef vtkStructuredImplicitConnectivity_h 00042 #define vtkStructuredImplicitConnectivity_h 00043 00044 #include "vtkFiltersParallelMPIModule.h" // For export macro 00045 #include "vtkObject.h" 00046 00047 // Forward declarations 00048 class vtkDataArray; 00049 class vtkImageData; 00050 class vtkMPIController; 00051 class vtkMultiProcessStream; 00052 class vtkPointData; 00053 class vtkPoints; 00054 class vtkRectilinearGrid; 00055 class vtkStructuredGrid; 00056 00057 namespace vtk 00058 { 00059 namespace detail 00060 { 00061 00062 class CommunicationManager; 00063 struct DomainMetaData; 00064 struct StructuredGrid; 00065 00066 } // END namespace detail 00067 } // END namespace vtk 00068 00069 class VTKFILTERSPARALLELMPI_EXPORT vtkStructuredImplicitConnectivity : 00070 public vtkObject 00071 { 00072 public: 00073 static vtkStructuredImplicitConnectivity* New(); 00074 void PrintSelf(ostream& os, vtkIndent indent); 00075 vtkTypeMacro(vtkStructuredImplicitConnectivity,vtkObject); 00076 00081 void SetWholeExtent(int wholeExt[6]); 00082 00083 // \brief Registers the structured grid dataset belonging to this process. 00084 // \param gridID the ID of the grid in this rank. 00085 // \param extent the [imin,imax,jmin,jmax,kmin,kmax] of the grid. 00086 // \param gridPnts pointer to the points of the grid (NULL for uniform grid). 00087 // \param pointData pointer to the node-centered fields of the grid. 00088 // \pre gridID >= 0. The code uses values of gridID < -1 as flag internally. 00089 // \pre vtkStructuredExtent::Smaller(extent,wholeExtent) == true. 00090 // \note A rank with no or an empty grid, should not call this method. 00091 void RegisterGrid( 00092 const int gridID, 00093 int extent[6], 00094 vtkPoints* gridPnts, 00095 vtkPointData* pointData 00096 ); 00097 00098 // \brief Registers the rectilinear grid dataset belonging to this process. 00099 // \param gridID the ID of the in this rank. 00100 // \param extent the [imin,imax,jmin,jmax,kmin,kmax] of the grid. 00101 // \param xcoords the x-coordinates array of the rectilinear grid. 00102 // \param ycoords the y-coordinates array of the rectilinear grid. 00103 // \param zcoords the z-coordinates array of the rectilinear grid. 00104 // \param pointData pointer to the node-centered fields of the grid. 00105 // \pre gridID >= 0. The code uses values of gridID < -1 as flag internally. 00106 // \pre vtkStructuredExtent::Smaller(extent,wholeExtent) == true. 00107 // \note A rank with no or an empty grid, should not call this method. 00108 void RegisterRectilinearGrid( 00109 const int gridID, 00110 int extent[6], 00111 vtkDataArray* xcoords, 00112 vtkDataArray* ycoords, 00113 vtkDataArray* zcoords, 00114 vtkPointData* pointData 00115 ); 00116 00121 void EstablishConnectivity(); 00122 00125 bool HasImplicitConnectivity(); 00126 00131 void ExchangeData(); 00132 00136 void GetOutputStructuredGrid(const int gridID, vtkStructuredGrid* grid); 00137 00141 void GetOutputImageData(const int gridID, vtkImageData* grid); 00142 00146 void GetOutputRectilinearGrid(const int gridID, vtkRectilinearGrid* grid); 00147 00148 protected: 00149 vtkStructuredImplicitConnectivity(); 00150 virtual ~vtkStructuredImplicitConnectivity(); 00151 00152 vtkMPIController* Controller; 00153 00154 vtk::detail::DomainMetaData* DomainInfo; 00155 vtk::detail::StructuredGrid* InputGrid; 00156 vtk::detail::StructuredGrid* OutputGrid; 00157 vtk::detail::CommunicationManager* CommManager; 00158 00160 bool GlobalDataDescriptionMatch(); 00161 00163 void PackData(int ext[6], vtkMultiProcessStream& bytestream); 00164 00166 void UnPackData(unsigned char* buffer, unsigned int size); 00167 00170 void AllocateBuffers(const int dim); 00171 00173 void ComputeNeighbors(); 00174 00176 void ConstructOutput(); 00177 00180 void GrowGrid(const int dim); 00181 00184 void UpdateNeighborList(const int dim); 00185 00188 void GetGlobalImplicitConnectivityState(); 00189 00193 void ExchangeExtents(); 00194 00195 private: 00196 vtkStructuredImplicitConnectivity(const vtkStructuredImplicitConnectivity&); // Not implemented 00197 void operator=(const vtkStructuredImplicitConnectivity&); // Not implemented 00198 }; 00199 #endif