31 #ifndef vtkPStructuredGridConnectivity_h 32 #define vtkPStructuredGridConnectivity_h 35 #include "vtkFiltersParallelGeometryModule.h" 84 {
return static_cast<int>(this->GridIds.size()); };
92 int GetGridRank(
const int gridID );
97 bool IsGridRemote(
const int gridID );
102 bool IsGridLocal(
const int gridID );
122 virtual
void CreateGhostLayers( const
int N=1 ) VTK_OVERRIDE;
150 int TotalNumberOfSends;
151 int TotalNumberOfRcvs;
152 int TotalNumberOfMsgs;
160 bool GridExtentsAreEqual(
int rhs[6],
int lhs[6] );
165 bool HasPointData(const
int gridIdx);
170 bool HasCellData(const
int gridIdx);
175 bool HasPoints(const
int gridIdx);
180 void InitializeMessageCounters();
186 void ClearRemoteData();
191 void ClearRawBuffers();
197 void RegisterRemoteGrid( const
int gridID,
int extents[6],
int process );
203 void TransferRemoteNeighborData(
211 virtual
void TransferGhostDataFromNeighbors(const
int gridID) VTK_OVERRIDE;
216 void PackGhostData();
222 void UnpackGhostData();
228 void DeserializeBufferSizesForProcess(
229 int *buffersizes,
vtkIdType N, const
int processId );
235 void SerializeBufferSizes(
int *&sizesbuf,
vtkIdType &N);
241 void ExchangeBufferSizes();
248 void ExchangeGhostDataInit();
267 void CommunicateGhostData();
274 void ExchangeGhostDataPost();
279 void ExchangeGhostData();
285 void SerializeGhostPoints(
291 void SerializeDataArray(
298 void SerializeFieldData(
299 int sourceExtent[6],
int targetExtent[6],
vtkFieldData *fieldData,
306 void SerializeGhostPointData(
313 void SerializeGhostCellData(
320 void DeserializeGhostPoints(
321 const
int gridIdx, const
int nei,
327 void DeserializeDataArray(
329 const
int numberOfTuples, const
int numberOfComponents,
336 void DeserializeFieldData(
344 void DeserializeGhostPointData(
345 const
int gridIdx, const
int nei,
352 void DeserializeGhostCellData(
353 const
int gridIdx, const
int nei,
362 void SerializeGhostData(
363 const
int sndGridID, const
int rcvGrid,
int sndext[6],
364 unsigned char*& buffer,
unsigned int &
size);
370 void DeserializeGhostData(
371 const
int gridID, const
int neiListID,
372 const
int neiGridIdx,
int rcvext[6],
373 unsigned char *buffer,
unsigned int size );
379 void ExchangeGridExtents();
385 void SerializeGridExtents(
int *&sndbuffer,
vtkIdType &N );
391 void DeserializeGridExtentForProcess(
392 int *rcvbuffer,
vtkIdType &N, const
int processId );
405 int rhs[6],
int lhs[6] )
407 for(
int i=0; i < 6; ++i )
409 if( rhs[i] != lhs[i] )
421 assert(
"pre: grid index is out-of-bounds!" &&
422 (gridIdx >= 0) && (gridIdx < static_cast<int>(this->NumberOfGrids)));
424 if( (this->GridPointData[gridIdx] != NULL) &&
425 (this->GridPointData[gridIdx]->GetNumberOfArrays() > 0) )
436 assert(
"pre: grid index is out-of-bounds!" &&
437 (gridIdx >= 0) && (gridIdx < static_cast<int>(this->NumberOfGrids)));
439 if( (this->GridCellData[gridIdx] != NULL) &&
440 (this->GridCellData[gridIdx]->GetNumberOfArrays( ) > 0) )
451 assert(
"pre: grid index is out-of-bounds!" &&
452 (gridIdx >= 0) && (gridIdx < static_cast<int>(this->NumberOfGrids)));
454 if( this->GridPoints[gridIdx] != NULL )
464 this->TotalNumberOfMsgs=this->TotalNumberOfRcvs=this->TotalNumberOfSends=0;
470 this->SendBufferSizes.clear();
471 this->RcvBufferSizes.clear();
474 for(
unsigned int i=0; i < this->SendBuffers.size(); ++i )
476 for(
unsigned int j=0; j < this->SendBuffers[i].size(); ++j )
478 delete [] this->SendBuffers[i][j];
480 this->SendBuffers[i].clear();
482 this->SendBuffers.clear();
485 for(
unsigned int i=0; i < this->RcvBuffers.size(); ++i )
487 for(
unsigned int j=0; j < this->RcvBuffers[i].size(); ++j )
489 delete [] this->RcvBuffers[i][j];
491 this->RcvBuffers[i].clear();
493 this->RcvBuffers.clear();
500 for(
unsigned int i=0; i < this->RemotePoints.size(); ++i )
502 for(
unsigned int j=0; j < this->RemotePoints[i].size(); ++j )
504 if( this->RemotePoints[ i ][ j ] != NULL )
506 this->RemotePoints[ i ][ j ]->Delete();
509 this->RemotePoints[ i ].clear();
511 this->RemotePoints.clear();
514 for(
unsigned int i=0; i < this->RemotePointData.size(); ++i )
516 for(
unsigned int j=0; j < this->RemotePointData[i].size(); ++j )
518 if( this->RemotePointData[ i ][ j ] != NULL )
520 this->RemotePointData[ i ][ j ]->Delete();
523 this->RemotePointData[ i ].clear();
525 this->RemotePointData.clear();
528 for(
unsigned int i=0; i < this->RemoteCellData.size(); ++i )
530 for(
unsigned int j=0; j < this->RemoteCellData[i].size(); ++j )
532 if( this->RemoteCellData[ i ][ j ] != NULL )
534 this->RemoteCellData[ i ][ j ]->Delete();
537 this->RemoteCellData[ i ].clear();
539 this->RemoteCellData.clear();
545 return( !this->IsGridLocal(gridID) );
551 assert(
"pre: Instance has not been initialized!" && this->Initialized );
552 assert(
"pre: gridID is out-of-bounds" &&
553 (gridID >= 0) && (gridID < static_cast<int>(this->NumberOfGrids) ) );
554 assert(
"pre: GridRanks is not properly allocated" &&
555 this->NumberOfGrids == this->GridRanks.size() );
556 return( (this->GridRanks[ gridID ] == this->Rank) );
562 assert(
"pre: Instance has not been initialized!" && this->Initialized );
563 assert(
"pre: gridID out-of-bounds!" &&
564 (gridID >= 0 && gridID < static_cast<int>(this->NumberOfGrids)));
565 return( this->GridRanks[ gridID ] );
vtkPStructuredGridConnectivity inherits from vtkStructuredGridConnectivity and implements functionali...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
represent and manipulate point attribute data
stream used to pass data across processes using vtkMultiProcessController.
int GetNumberOfLocalGrids()
Returns the number of local grids registers by the process that owns the current vtkPStructuredGridCo...
Class for creating user defined MPI communicators.
represent and manipulate cell attribute data
bool HasCellData(const int gridIdx)
Returns true iff the grid corresponding to the given ID has cell data.
bool HasPointData(const int gridIdx)
Returns true iff the grid corresponding to the given ID has point data.
bool HasPoints(const int gridIdx)
Returns true iff the grid corresponding to the given ID has points.
virtual void RegisterGrid(const int gridID, int extents[6], vtkUnsignedCharArray *nodesGhostArray, vtkUnsignedCharArray *cellGhostArray, vtkPointData *pointData, vtkCellData *cellData, vtkPoints *gridNodes)
Registers the current grid corresponding to the grid ID by its global extent w.r.t.
void ClearRemoteData()
Clears all internal VTK data-structures that are used to store the remote ghost data.
void ComputeNeighbors() override
Computes neighboring information.
void SetNumberOfGrids(const unsigned int N) override
Set/Get the total number of domains distributed among processors.
vtkStructuredGridConnectivity is a concrete instance of vtkObject that implements functionality for c...
a simple class to control print indentation
int GetGridRank(const int gridID)
Returns the rank of the given gridID.
static vtkStructuredGridConnectivity * New()
abstract superclass for arrays of numeric data
bool IsGridRemote(const int gridID)
Returns true iff the grid is remote, otherwise false.
Process communication using MPI.
void ClearRawBuffers()
Clears all raw send/rcv buffers.
dynamic, self-adjusting array of unsigned char
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
An internal, light-weight class used to store neighbor information.
void InitializeMessageCounters()
Sets all message counters to 0.
bool IsGridLocal(const int gridID)
Returns true iff the grid corresponding to the given gridID is local.
represent and manipulate 3D points
represent and manipulate fields of data
Multiprocessing communication superclass.