VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkPStructuredGridConnectivity.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 =========================================================================*/ 00064 #ifndef VTKPUNSTRUCTUREDGRIDCONNECTIVITY_H_ 00065 #define VTKPUNSTRUCTUREDGRIDCONNECTIVITY_H_ 00066 00067 #include "vtkFiltersParallelGeometryModule.h" // For export macro 00068 #include "vtkObject.h" 00069 00070 // Forward Declarations 00071 class vtkCell; 00072 class vtkCellData; 00073 class vtkIdList; 00074 class vtkIdTypeArray; 00075 class vtkMPIController; 00076 class vtkMultiProcessStream; 00077 class vtkPointData; 00078 class vtkPoints; 00079 class vtkUnstructuredGrid; 00080 00081 // Forward Declaration of internal data-structures 00082 namespace vtk 00083 { 00084 namespace details 00085 { 00086 00087 struct GridInfo; 00088 struct MeshLinks; 00089 struct CommunicationLinks; 00090 00091 } // END namespace details 00092 } // END namespace vkt 00093 00094 class VTKFILTERSPARALLELGEOMETRY_EXPORT vtkPUnstructuredGridConnectivity : 00095 public vtkObject 00096 { 00097 public: 00098 static vtkPUnstructuredGridConnectivity* New(); 00099 vtkTypeMacro(vtkPUnstructuredGridConnectivity,vtkObject); 00100 void PrintSelf(ostream& os, vtkIndent indent); 00101 00103 00104 vtkSetMacro(Controller,vtkMPIController*); 00105 vtkGetMacro(Controller,vtkMPIController*); 00107 00109 00111 vtkSetStringMacro(GlobalIDFieldName); 00112 vtkGetStringMacro(GlobalIDFieldName); 00114 00116 00117 vtkGetMacro(GhostedGrid,vtkUnstructuredGrid*); 00119 00121 void RegisterGrid(vtkUnstructuredGrid* gridPtr); 00122 00127 void BuildGhostZoneConnectivity(); 00128 00132 void UpdateGhosts(); 00133 00134 protected: 00135 vtkPUnstructuredGridConnectivity(); 00136 virtual ~vtkPUnstructuredGridConnectivity(); 00137 00138 char* GlobalIDFieldName; // The field of the global IDs. 00139 vtkUnstructuredGrid* InputGrid; // The input grid, to be ghosted. 00140 vtkUnstructuredGrid* GhostedGrid; // This is the output from this class. 00141 vtkMPIController* Controller; // Supplied MPI controller. 00142 00143 // BTX 00144 vtk::details::GridInfo* AuxiliaryData; // Data used to build the ghost zones. 00145 vtk::details::CommunicationLinks* CommLists; // Persistent comm lists. 00146 // ETX 00147 00149 00152 void FillGhostZoneCells( 00153 const int neiRank, 00154 vtkCellData* ghostData, 00155 vtkIdType* cellIdx, 00156 const unsigned int numGhostCells); 00158 00160 00163 void FillGhostZoneNodes( 00164 const int neiRank, 00165 vtkPointData* ghostData, 00166 vtkIdType* globalIdx, 00167 const unsigned int numGhostNodes); 00169 00173 void DeSerializeGhostZones(); 00174 00179 void CreatePersistentRcvBuffers(); 00180 00184 void SerializeGhostZones(); 00185 00188 void SynchLocalData(); 00189 00191 00193 void EnqueueNodeLinks( 00194 const int rmtRank, 00195 const vtkIdType ghostCell, 00196 const vtkIdType adjCell, 00197 vtkIdList* shared); 00199 00201 00207 bool IsCellConnected( 00208 vtkCell* c,vtkIdType* globalId, const vtkIdType N, 00209 vtkIdType& adjCell, 00210 vtkIdList* sharedIds); 00212 00214 00215 void InsertGhostCellNodes( 00216 vtkCell* ghostCell, 00217 vtkIdTypeArray* ghostGridGlobalIdx, 00218 vtkIdType* globalIdArray, 00219 vtkUnstructuredGrid* bGrid, 00220 vtkIdType* cellPts); 00222 00224 00226 void ProcessRemoteGrid( 00227 const int rmtRank,vtkUnstructuredGrid* bGrid); 00229 00231 void BuildGhostedGridAndCommLists(); 00232 00234 00235 void SerializeUnstructuredGrid( 00236 vtkUnstructuredGrid* g, vtkMultiProcessStream& bytestream); 00238 00240 00241 void DeSerializeUnstructuredGrid( 00242 vtkUnstructuredGrid* g, vtkMultiProcessStream& bytestream); 00244 00247 void WriteUnstructuredGrid(vtkUnstructuredGrid* grid, const char* fileName); 00248 00251 void ExtractSurfaceMesh(); 00252 00255 void MarkFaces(); 00256 00258 00260 void ExtractBoundaryCell( 00261 const vtkIdType cellIdx, 00262 const vtkIdType numCellNodes, 00263 vtkIdType* cellNodes, 00264 vtkPoints* nodes, 00265 vtkIdTypeArray* localIdx, 00266 vtkIdTypeArray* globaIdx 00267 ); 00269 00273 bool IsCellOnBoundary(vtkIdType* cellNodes, vtkIdType N); 00274 00276 void ExchangeBoundaryGrids(); 00277 00279 void ExchangeBoundaryGridSizes(int size); 00280 00285 void BoundingBoxCollision(); 00286 00290 void ExchangeGridBounds(); 00291 00294 void ExtractBoundaryGrid(); 00295 00296 private: 00297 vtkPUnstructuredGridConnectivity(const vtkPUnstructuredGridConnectivity&); // Not implemented 00298 void operator=(const vtkPUnstructuredGridConnectivity&); // Not implemented 00299 }; 00300 00301 #endif /* VTKPUNSTRUCTUREDGRIDCONNECTIVITY_H_ */