33 #ifndef VTKPSTRUCTUREDGRIDCONNECTIVITY_H_ 34 #define VTKPSTRUCTUREDGRIDCONNECTIVITY_H_ 81 {
return static_cast<int>(this->GridIds.size()); };
88 int GetGridRank(
const int gridID );
91 bool IsGridRemote(
const int gridID );
94 bool IsGridLocal(
const int gridID );
146 bool GridExtentsAreEqual(
int rhs[6],
int lhs[6] );
150 bool HasPointData(
const int gridIdx);
154 bool HasCellData(
const int gridIdx);
157 bool HasPoints(
const int gridIdx);
160 void InitializeMessageCounters();
164 void ClearRemoteData();
167 void ClearRawBuffers();
171 void RegisterRemoteGrid(
const int gridID,
int extents[6],
int process );
176 void TransferRemoteNeighborData(
186 void PackGhostData();
190 void UnpackGhostData();
195 void DeserializeBufferSizesForProcess(
196 int *buffersizes,
vtkIdType N,
const int processId );
201 void SerializeBufferSizes(
int *&sizesbuf,
vtkIdType &N);
205 void ExchangeBufferSizes();
210 void ExchangeGhostDataInit();
223 void CommunicateGhostData();
228 void ExchangeGhostDataPost();
231 void ExchangeGhostData();
236 void SerializeGhostPoints(
242 void SerializeDataArray(
249 void SerializeFieldData(
250 int sourceExtent[6],
int targetExtent[6],
vtkFieldData *fieldData,
257 void SerializeGhostPointData(
264 void SerializeGhostCellData(
271 void DeserializeGhostPoints(
272 const int gridIdx,
const int nei,
278 void DeserializeDataArray(
280 const int numberOfTuples,
const int numberOfComponents,
287 void DeserializeFieldData(
295 void DeserializeGhostPointData(
296 const int gridIdx,
const int nei,
303 void DeserializeGhostCellData(
304 const int gridIdx,
const int nei,
313 void SerializeGhostData(
314 const int sndGridID,
const int rcvGrid,
int sndext[6],
322 void DeserializeGhostData(
323 const int gridID,
const int neiListID,
324 const int neiGridIdx,
int rcvext[6],
330 void ExchangeGridExtents();
335 void SerializeGridExtents(
int *&sndbuffer,
vtkIdType &N );
340 void DeserializeGridExtentForProcess(
341 int *rcvbuffer,
vtkIdType &N,
const int processId );
355 int rhs[6],
int lhs[6] )
357 for(
int i=0; i < 6; ++i )
359 if( rhs[i] != lhs[i] )
371 assert(
"pre: grid index is out-of-bounds!" &&
372 (gridIdx >= 0) && (gridIdx < static_cast<int>(this->NumberOfGrids)));
374 if( (this->GridPointData[gridIdx] != NULL) &&
375 (this->GridPointData[gridIdx]->GetNumberOfArrays() > 0) )
386 assert(
"pre: grid index is out-of-bounds!" &&
387 (gridIdx >= 0) && (gridIdx < static_cast<int>(this->NumberOfGrids)));
389 if( (this->GridCellData[gridIdx] != NULL) &&
390 (this->GridCellData[gridIdx]->GetNumberOfArrays( ) > 0) )
401 assert(
"pre: grid index is out-of-bounds!" &&
402 (gridIdx >= 0) && (gridIdx < static_cast<int>(this->NumberOfGrids)));
404 if( this->GridPoints[gridIdx] != NULL )
414 this->TotalNumberOfMsgs=this->TotalNumberOfRcvs=this->TotalNumberOfSends=0;
420 this->SendBufferSizes.clear();
421 this->RcvBufferSizes.clear();
424 for(
unsigned int i=0; i < this->SendBuffers.size(); ++i )
426 for(
unsigned int j=0; j < this->SendBuffers[i].size(); ++j )
428 delete [] this->SendBuffers[i][j];
430 this->SendBuffers[i].clear();
432 this->SendBuffers.clear();
435 for(
unsigned int i=0; i < this->RcvBuffers.size(); ++i )
437 for(
unsigned int j=0; j < this->RcvBuffers[i].size(); ++j )
439 delete [] this->RcvBuffers[i][j];
441 this->RcvBuffers[i].clear();
443 this->RcvBuffers.clear();
450 for(
unsigned int i=0; i < this->RemotePoints.size(); ++i )
452 for(
unsigned int j=0; j < this->RemotePoints[i].size(); ++j )
454 if( this->RemotePoints[ i ][ j ] != NULL )
456 this->RemotePoints[ i ][ j ]->Delete();
459 this->RemotePoints[ i ].clear();
461 this->RemotePoints.clear();
464 for(
unsigned int i=0; i < this->RemotePointData.size(); ++i )
466 for(
unsigned int j=0; j < this->RemotePointData[i].size(); ++j )
468 if( this->RemotePointData[ i ][ j ] != NULL )
470 this->RemotePointData[ i ][ j ]->Delete();
473 this->RemotePointData[ i ].clear();
475 this->RemotePointData.clear();
478 for(
unsigned int i=0; i < this->RemoteCellData.size(); ++i )
480 for(
unsigned int j=0; j < this->RemoteCellData[i].size(); ++j )
482 if( this->RemoteCellData[ i ][ j ] != NULL )
484 this->RemoteCellData[ i ][ j ]->Delete();
487 this->RemoteCellData[ i ].clear();
489 this->RemoteCellData.clear();
495 return( !this->IsGridLocal(gridID) );
501 assert(
"pre: Instance has not been intialized!" && this->Initialized );
502 assert(
"pre: gridID is out-of-bounds" &&
503 (gridID >= 0) && (gridID < static_cast<int>(this->NumberOfGrids) ) );
504 assert(
"pre: GridRanks is not properly allocated" &&
505 this->NumberOfGrids == this->GridRanks.size() );
506 return( (this->GridRanks[ gridID ] == this->Rank) );
512 assert(
"pre: Instance has not been intialized!" && this->Initialized );
513 assert(
"pre: gridID out-of-bounds!" &&
514 (gridID >= 0 && gridID < static_cast<int>(this->NumberOfGrids)));
515 return( this->GridRanks[ gridID ] );
represent and manipulate point attribute data
stream used to pass data across processes using vtkMultiProcessController.
std::vector< std::vector< unsigned int > > RcvBufferSizes
#define vtkGetMacro(name, type)
int GetNumberOfLocalGrids()
represent and manipulate cell attribute data
bool HasCellData(const int gridIdx)
bool HasPointData(const int gridIdx)
std::vector< int > GridIds
bool HasPoints(const int gridIdx)
virtual void RegisterGrid(const int gridID, int extents[6], vtkUnsignedCharArray *nodesGhostArray, vtkUnsignedCharArray *cellGhostArray, vtkPointData *pointData, vtkCellData *cellData, vtkPoints *gridNodes)
std::vector< std::vector< vtkPoints * > > RemotePoints
vtkMPICommunicator::Request * MPIRequests
#define vtkTypeMacro(thisClass, superclass)
bool GridExtentsAreEqual(int rhs[6], int lhs[6])
virtual void ComputeNeighbors()
std::vector< std::vector< vtkPointData * > > RemotePointData
vtkMultiProcessController * Controller
std::vector< std::vector< vtkCellData * > > RemoteCellData
a simple class to control print indentation
int GetGridRank(const int gridID)
static vtkStructuredGridConnectivity * New()
abstract superclass for arrays of numeric data
bool IsGridRemote(const int gridID)
Process communication using MPI.
dynamic, self-adjusting array of unsigned char
std::vector< int > GridRanks
virtual void CreateGhostLayers(const int N=1)
virtual void TransferGhostDataFromNeighbors(const int gridID)
void InitializeMessageCounters()
#define VTKFILTERSPARALLELGEOMETRY_EXPORT
std::vector< std::vector< unsigned char * > > RcvBuffers
void PrintSelf(ostream &os, vtkIndent indent)
std::vector< std::vector< unsigned char * > > SendBuffers
std::vector< std::vector< unsigned int > > SendBufferSizes
bool IsGridLocal(const int gridID)
represent and manipulate 3D points
virtual void SetNumberOfGrids(const unsigned int N)
represent and manipulate fields of data
#define vtkSetMacro(name, type)
Multiprocessing communication superclass.