22 #ifndef vtkPStructuredGridConnectivity_h
23 #define vtkPStructuredGridConnectivity_h
27 #include "vtkFiltersParallelGeometryModule.h"
35 VTK_ABI_NAMESPACE_BEGIN
81 int GetGridRank(
int gridID);
86 bool IsGridRemote(
int gridID);
91 bool IsGridLocal(
int gridID);
149 bool GridExtentsAreEqual(
int rhs[6],
int lhs[6]);
154 bool HasPointData(
int gridIdx);
159 bool HasCellData(
int gridIdx);
164 bool HasPoints(
int gridIdx);
169 void InitializeMessageCounters();
175 void ClearRemoteData();
180 void ClearRawBuffers();
186 void RegisterRemoteGrid(
int gridID,
int extents[6],
int process);
204 void PackGhostData();
210 void UnpackGhostData();
216 void DeserializeBufferSizesForProcess(
int* buffersizes,
vtkIdType N,
int processId);
222 void SerializeBufferSizes(
int*& sizesbuf,
vtkIdType& N);
228 void ExchangeBufferSizes();
235 void ExchangeGhostDataInit();
254 void CommunicateGhostData();
261 void ExchangeGhostDataPost();
266 void ExchangeGhostData();
284 void SerializeFieldData(
int sourceExtent[6],
int targetExtent[6],
vtkFieldData* fieldData,
285 vtkMultiProcessStream& bytestream);
291 void SerializeGhostPointData(
int gridIdx,
int ext[6], vtkMultiProcessStream& bytestream);
297 void SerializeGhostCellData(
int gridIdx,
int ext[6], vtkMultiProcessStream& bytestream);
303 void DeserializeGhostPoints(
int gridIdx,
int nei,
int ext[6], vtkMultiProcessStream& bytestream);
309 void DeserializeDataArray(vtkDataArray*&,
int,
int,
int, vtkMultiProcessStream&);
316 void DeserializeFieldData(
int ext[6],
vtkFieldData* fieldData, vtkMultiProcessStream& bytestream);
322 void DeserializeGhostPointData(
323 int gridIdx,
int nei,
int ext[6], vtkMultiProcessStream& bytestream);
329 void DeserializeGhostCellData(
330 int gridIdx,
int nei,
int ext[6], vtkMultiProcessStream& bytestream);
338 void SerializeGhostData(
339 int sndGridID,
int rcvGrid,
int sndext[6],
unsigned char*& buffer,
unsigned int&
size);
345 void DeserializeGhostData(
int gridID,
int neiListID,
int neiGridIdx,
int rcvext[6],
346 unsigned char* buffer,
unsigned int size);
352 void ExchangeGridExtents();
358 void SerializeGridExtents(
int*& sndbuffer,
vtkIdType& N);
364 void DeserializeGridExtentForProcess(
int* rcvbuffer,
vtkIdType& N,
int processId);
377 for (
int i = 0; i < 6; ++i)
379 if (rhs[i] != lhs[i])
391 assert(
"pre: grid index is out-of-bounds!" && (gridIdx >= 0) &&
392 (gridIdx < static_cast<int>(this->NumberOfGrids)));
394 if ((this->GridPointData[gridIdx] !=
nullptr) &&
395 (this->GridPointData[gridIdx]->GetNumberOfArrays() > 0))
406 assert(
"pre: grid index is out-of-bounds!" && (gridIdx >= 0) &&
407 (gridIdx < static_cast<int>(this->NumberOfGrids)));
409 if ((this->GridCellData[gridIdx] !=
nullptr) &&
410 (this->GridCellData[gridIdx]->GetNumberOfArrays() > 0))
421 assert(
"pre: grid index is out-of-bounds!" && (gridIdx >= 0) &&
422 (gridIdx < static_cast<int>(this->NumberOfGrids)));
424 if (this->GridPoints[gridIdx] !=
nullptr)
434 this->TotalNumberOfMsgs = this->TotalNumberOfRcvs = this->TotalNumberOfSends = 0;
440 this->SendBufferSizes.clear();
441 this->RcvBufferSizes.clear();
444 for (
unsigned int i = 0; i < this->SendBuffers.size(); ++i)
446 for (
unsigned int j = 0; j < this->SendBuffers[i].size(); ++j)
448 delete[] this->SendBuffers[i][j];
450 this->SendBuffers[i].clear();
452 this->SendBuffers.clear();
455 for (
unsigned int i = 0; i < this->RcvBuffers.size(); ++i)
457 for (
unsigned int j = 0; j < this->RcvBuffers[i].size(); ++j)
459 delete[] this->RcvBuffers[i][j];
461 this->RcvBuffers[i].clear();
463 this->RcvBuffers.clear();
470 for (
unsigned int i = 0; i < this->RemotePoints.size(); ++i)
472 for (
unsigned int j = 0; j < this->RemotePoints[i].size(); ++j)
474 if (this->RemotePoints[i][j] !=
nullptr)
476 this->RemotePoints[i][j]->Delete();
479 this->RemotePoints[i].clear();
481 this->RemotePoints.clear();
484 for (
unsigned int i = 0; i < this->RemotePointData.size(); ++i)
486 for (
unsigned int j = 0; j < this->RemotePointData[i].size(); ++j)
488 if (this->RemotePointData[i][j] !=
nullptr)
490 this->RemotePointData[i][j]->Delete();
493 this->RemotePointData[i].clear();
495 this->RemotePointData.clear();
498 for (
unsigned int i = 0; i < this->RemoteCellData.size(); ++i)
500 for (
unsigned int j = 0; j < this->RemoteCellData[i].size(); ++j)
502 if (this->RemoteCellData[i][j] !=
nullptr)
504 this->RemoteCellData[i][j]->Delete();
507 this->RemoteCellData[i].clear();
509 this->RemoteCellData.clear();
515 return (!this->IsGridLocal(gridID));
521 assert(
"pre: Instance has not been initialized!" && this->Initialized);
522 assert(
"pre: gridID is out-of-bounds" && (gridID >= 0) &&
523 (gridID < static_cast<int>(this->NumberOfGrids)));
525 "pre: GridRanks is not properly allocated" && this->NumberOfGrids == this->GridRanks.size());
526 return ((this->GridRanks[gridID] == this->Rank));
532 assert(
"pre: Instance has not been initialized!" && this->Initialized);
533 assert(
"pre: gridID out-of-bounds!" &&
534 (gridID >= 0 && gridID < static_cast<int>(this->NumberOfGrids)));
535 return (this->GridRanks[gridID]);
537 VTK_ABI_NAMESPACE_END
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.
bool HasPointData(int gridIdx)
Returns true iff the grid corresponding to the given ID has point data.
bool HasCellData(int gridIdx)
Returns true iff the grid corresponding to the given ID has cell data.
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...
represent and manipulate cell attribute data
virtual void TransferGhostDataFromNeighbors(int gridID)
This method transfers the fields (point data and cell data) to the ghost extents from the neighboring...
std::vector< int > GridIds
int GetGridRank(int gridID)
Returns the rank of the given gridID.
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 IsGridRemote(int gridID)
Returns true iff the grid is remote, otherwise false.
const std::string pointData
std::vector< std::vector< unsigned int > > SendBufferSizes
vtkStructuredGridConnectivity is a concrete instance of vtkObject that implements functionality for c...
void CreateGhostLayers(int N=1) override
Creates ghost layers.
virtual void RegisterGrid(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.
#define VTK_DEPRECATED_IN_9_6_0(reason)
vtkMultiProcessController * Controller
std::vector< std::vector< unsigned char * > > RcvBuffers
a simple class to control print indentation
static vtkStructuredGridConnectivity * New()
std::vector< std::vector< vtkCellData * > > RemoteCellData
abstract superclass for arrays of numeric data
Process communication using MPI.
void ClearRawBuffers()
Clears all raw send/rcv buffers.
dynamic, self-adjusting array of unsigned char
An internal, light-weight class used to store neighbor information.
std::vector< std::vector< vtkPoints * > > RemotePoints
std::vector< int > GridRanks
void SetNumberOfGrids(unsigned int N) override
Set/Get the total number of domains distributed among processors.
A concrete instance of vtkObject which provides functionality for serializing and de-serializing fiel...
void InitializeMessageCounters()
Sets all message counters to 0.
bool HasPoints(int gridIdx)
Returns true iff the grid corresponding to the given ID has points.
bool IsGridLocal(int gridID)
Returns true iff the grid corresponding to the given gridID is local.
std::vector< std::vector< unsigned int > > RcvBufferSizes
std::vector< std::vector< unsigned char * > > SendBuffers
std::vector< std::vector< vtkPointData * > > RemotePointData
represent and manipulate 3D points
Represents and manipulates a collection of data arrays.
Multiprocessing communication superclass.