34 #ifndef vtkPStructuredGridConnectivity_h 35 #define vtkPStructuredGridConnectivity_h 38 #include "vtkFiltersParallelGeometryModule.h" 87 {
return static_cast<int>(this->GridIds.size()); };
95 int GetGridRank(
const int gridID );
100 bool IsGridRemote(
const int gridID );
105 bool IsGridLocal(
const int gridID );
163 bool GridExtentsAreEqual(
int rhs[6],
int lhs[6] );
168 bool HasPointData(
const int gridIdx);
173 bool HasCellData(
const int gridIdx);
178 bool HasPoints(
const int gridIdx);
183 void InitializeMessageCounters();
189 void ClearRemoteData();
194 void ClearRawBuffers();
200 void RegisterRemoteGrid(
const int gridID,
int extents[6],
int process );
206 void TransferRemoteNeighborData(
219 void PackGhostData();
225 void UnpackGhostData();
231 void DeserializeBufferSizesForProcess(
232 int *buffersizes,
vtkIdType N,
const int processId );
238 void SerializeBufferSizes(
int *&sizesbuf,
vtkIdType &N);
244 void ExchangeBufferSizes();
251 void ExchangeGhostDataInit();
270 void CommunicateGhostData();
277 void ExchangeGhostDataPost();
282 void ExchangeGhostData();
288 void SerializeGhostPoints(
294 void SerializeDataArray(
301 void SerializeFieldData(
302 int sourceExtent[6],
int targetExtent[6],
vtkFieldData *fieldData,
309 void SerializeGhostPointData(
316 void SerializeGhostCellData(
323 void DeserializeGhostPoints(
324 const int gridIdx,
const int nei,
330 void DeserializeDataArray(
332 const int numberOfTuples,
const int numberOfComponents,
339 void DeserializeFieldData(
347 void DeserializeGhostPointData(
348 const int gridIdx,
const int nei,
355 void DeserializeGhostCellData(
356 const int gridIdx,
const int nei,
365 void SerializeGhostData(
366 const int sndGridID,
const int rcvGrid,
int sndext[6],
367 unsigned char*& buffer,
unsigned int &
size);
373 void DeserializeGhostData(
374 const int gridID,
const int neiListID,
375 const int neiGridIdx,
int rcvext[6],
376 unsigned char *buffer,
unsigned int size );
382 void ExchangeGridExtents();
388 void SerializeGridExtents(
int *&sndbuffer,
vtkIdType &N );
394 void DeserializeGridExtentForProcess(
395 int *rcvbuffer,
vtkIdType &N,
const int processId );
408 int rhs[6],
int lhs[6] )
410 for(
int i=0; i < 6; ++i )
412 if( rhs[i] != lhs[i] )
424 assert(
"pre: grid index is out-of-bounds!" &&
425 (gridIdx >= 0) && (gridIdx < static_cast<int>(this->NumberOfGrids)));
427 if( (this->GridPointData[gridIdx] !=
nullptr) &&
428 (this->GridPointData[gridIdx]->GetNumberOfArrays() > 0) )
439 assert(
"pre: grid index is out-of-bounds!" &&
440 (gridIdx >= 0) && (gridIdx < static_cast<int>(this->NumberOfGrids)));
442 if( (this->GridCellData[gridIdx] !=
nullptr) &&
443 (this->GridCellData[gridIdx]->GetNumberOfArrays( ) > 0) )
454 assert(
"pre: grid index is out-of-bounds!" &&
455 (gridIdx >= 0) && (gridIdx < static_cast<int>(this->NumberOfGrids)));
457 if( this->GridPoints[gridIdx] !=
nullptr )
467 this->TotalNumberOfMsgs=this->TotalNumberOfRcvs=this->TotalNumberOfSends=0;
473 this->SendBufferSizes.clear();
474 this->RcvBufferSizes.clear();
477 for(
unsigned int i=0; i < this->SendBuffers.size(); ++i )
479 for(
unsigned int j=0; j < this->SendBuffers[i].size(); ++j )
481 delete [] this->SendBuffers[i][j];
483 this->SendBuffers[i].clear();
485 this->SendBuffers.clear();
488 for(
unsigned int i=0; i < this->RcvBuffers.size(); ++i )
490 for(
unsigned int j=0; j < this->RcvBuffers[i].size(); ++j )
492 delete [] this->RcvBuffers[i][j];
494 this->RcvBuffers[i].clear();
496 this->RcvBuffers.clear();
503 for(
unsigned int i=0; i < this->RemotePoints.size(); ++i )
505 for(
unsigned int j=0; j < this->RemotePoints[i].size(); ++j )
507 if( this->RemotePoints[ i ][ j ] !=
nullptr )
509 this->RemotePoints[ i ][ j ]->Delete();
512 this->RemotePoints[ i ].clear();
514 this->RemotePoints.clear();
517 for(
unsigned int i=0; i < this->RemotePointData.size(); ++i )
519 for(
unsigned int j=0; j < this->RemotePointData[i].size(); ++j )
521 if( this->RemotePointData[ i ][ j ] !=
nullptr )
523 this->RemotePointData[ i ][ j ]->Delete();
526 this->RemotePointData[ i ].clear();
528 this->RemotePointData.clear();
531 for(
unsigned int i=0; i < this->RemoteCellData.size(); ++i )
533 for(
unsigned int j=0; j < this->RemoteCellData[i].size(); ++j )
535 if( this->RemoteCellData[ i ][ j ] !=
nullptr )
537 this->RemoteCellData[ i ][ j ]->Delete();
540 this->RemoteCellData[ i ].clear();
542 this->RemoteCellData.clear();
548 return( !this->IsGridLocal(gridID) );
554 assert(
"pre: Instance has not been initialized!" && this->Initialized );
555 assert(
"pre: gridID is out-of-bounds" &&
556 (gridID >= 0) && (gridID < static_cast<int>(this->NumberOfGrids) ) );
557 assert(
"pre: GridRanks is not properly allocated" &&
558 this->NumberOfGrids == this->GridRanks.size() );
559 return( (this->GridRanks[ gridID ] == this->Rank) );
565 assert(
"pre: Instance has not been initialized!" && this->Initialized );
566 assert(
"pre: gridID out-of-bounds!" &&
567 (gridID >= 0 && gridID < static_cast<int>(this->NumberOfGrids)));
568 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.
std::vector< std::vector< unsigned int > > RcvBufferSizes
int GetNumberOfLocalGrids()
Returns the number of local grids registers by the process that owns the current vtkPStructuredGridCo...
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.
std::vector< int > GridIds
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.
std::vector< std::vector< vtkPoints * > > RemotePoints
vtkMPICommunicator::Request * MPIRequests
void ClearRemoteData()
Clears all internal VTK data-structures that are used to store the remote ghost data.
void ComputeNeighbors() override
Computes neighboring information.
bool GridExtentsAreEqual(int rhs[6], int lhs[6])
Returns true if the two extents are equal, otherwise false.
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...
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)
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.
void CreateGhostLayers(const int N=1) override
Creates ghost layers.
dynamic, self-adjusting array of unsigned char
An internal, light-weight class used to store neighbor information.
std::vector< int > GridRanks
virtual void TransferGhostDataFromNeighbors(const int gridID)
This method transfers the fields (point data and cell data) to the ghost extents from the neighboring...
void InitializeMessageCounters()
Sets all message counters to 0.
std::vector< std::vector< unsigned char * > > RcvBuffers
std::vector< std::vector< unsigned char * > > SendBuffers
std::vector< std::vector< unsigned int > > SendBufferSizes
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.