22#ifndef vtkPStructuredGridConnectivity_h
23#define vtkPStructuredGridConnectivity_h
27#include "vtkFiltersParallelGeometryModule.h"
35VTK_ABI_NAMESPACE_BEGIN
81 int GetGridRank(
int gridID);
86 bool IsGridRemote(
int gridID);
91 bool IsGridLocal(
int gridID);
339 int sndGridID,
int rcvGrid,
int sndext[6],
unsigned char*& buffer,
unsigned int& size);
346 unsigned char* buffer,
unsigned int size);
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) &&
406 assert(
"pre: grid index is out-of-bounds!" && (gridIdx >= 0) &&
421 assert(
"pre: grid index is out-of-bounds!" && (gridIdx >= 0) &&
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();
521 assert(
"pre: Instance has not been initialized!" && this->Initialized);
522 assert(
"pre: gridID is out-of-bounds" && (gridID >= 0) &&
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]);
std::vector< vtkCellData * > GridCellData
std::vector< vtkPointData * > GridPointData
std::vector< vtkPoints * > GridPoints
unsigned int NumberOfGrids
represent and manipulate cell attribute data
Represents and manipulates a collection of data arrays.
a simple class to control print indentation
Process communication using MPI.
Multiprocessing communication superclass.
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...
void SerializeDataArray(vtkDataArray *, vtkMultiProcessStream &)
Serializes the data array into a bytestream.
~vtkPStructuredGridConnectivity() override
std::vector< std::vector< unsigned int > > RcvBufferSizes
void TransferRemoteNeighborData(int gridIdx, int nei, const vtkStructuredNeighbor &Neighbor)
This method transfers all the remote neighbor data to the ghosted grid instance of the grid correspon...
virtual void SetController(vtkMultiProcessController *)
Set & Get the process controller.
bool GridExtentsAreEqual(int rhs[6], int lhs[6])
Returns true if the two extents are equal, otherwise false.
vtkMultiProcessController * Controller
bool IsGridLocal(int gridID)
Returns true iff the grid corresponding to the given gridID is local.
void DeserializeGhostPointData(int gridIdx, int nei, int ext[6], vtkMultiProcessStream &bytestream)
Helper method to de-serialize the ghost point data received from a remote process.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetNumberOfGrids(unsigned int N) override
Sets the total number of domains distributed among processors.
static vtkPStructuredGridConnectivity * New()
void DeserializeFieldData(int ext[6], vtkFieldData *fieldData, vtkMultiProcessStream &bytestream)
Helper method to de-serialize field data.
void RegisterRemoteGrid(int gridID, int extents[6], int process)
Registers a remote grid with the given grid Id, structured extents and process.
void ClearRawBuffers()
Clears all raw send/rcv buffers.
void SerializeGhostCellData(int gridIdx, int ext[6], vtkMultiProcessStream &bytestream)
Helper method to serialize ghost cell data.
vtkPStructuredGridConnectivity()
void ExchangeGhostDataPost()
Helper method for exchanging ghost data.
std::vector< int > GridRanks
void DeserializeGhostPoints(int gridIdx, int nei, int ext[6], vtkMultiProcessStream &bytestream)
Helper method to de-serialize the ghost points received from a remote process.
bool HasPoints(int gridIdx)
Returns true iff the grid corresponding to the given ID has points.
std::vector< std::vector< unsigned char * > > SendBuffers
bool IsGridRemote(int gridID)
Returns true iff the grid is remote, otherwise false.
std::vector< std::vector< vtkPoints * > > RemotePoints
vtkMPICommunicator::Request * MPIRequests
int GetGridRank(int gridID)
Returns the rank of the given gridID.
void ExchangeGhostData()
Exchanges ghost data of the grids owned by this process.
void CreateGhostLayers(int N=1) override
Creates ghost layers on the grids owned by this process using data from both local and remote block n...
void SerializeGhostPoints(int gridIdx, int ext[6], vtkMultiProcessStream &bytestream)
Helper method to serialize the ghost points to send to a remote process.
void PostSends()
Helper method to communicate ghost data.
void CommunicateGhostData()
Helper method for exchanging ghost data.
bool HasCellData(int gridIdx)
Returns true iff the grid corresponding to the given ID has cell data.
void DeserializeGhostCellData(int gridIdx, int nei, int ext[6], vtkMultiProcessStream &bytestream)
Helper method to de-serialize the ghost cell data received from a remote process.
void SerializeGhostData(int sndGridID, int rcvGrid, int sndext[6], unsigned char *&buffer, unsigned int &size)
Given a grid ID and the corresponding send extent, this method serializes the grid and data within th...
void TransferGhostDataFromNeighbors(int gridID) override
This method transfers the fields (point data and cell data) to the ghost extents from the neighboring...
void ExchangeGridExtents()
Exchanges the grid extents among all processes and fully populates the GridExtents vector.
void DeserializeBufferSizesForProcess(int *buffersizes, vtkIdType N, int processId)
Helper method to deserialize the buffer sizes coming from the given process.
void ClearRemoteData()
Clears all internal VTK data-structures that are used to store the remote ghost data.
void PackGhostData()
Helper method to pack all the ghost data into send buffers.
void ExchangeBufferSizes()
Helper method to exchange buffer sizes.Each process sends the send buffer size of each grid to each o...
void UnpackGhostData()
Helper method to unpack the raw ghost data from the receive buffers in to the VTK remote point data-s...
void SerializeGridExtents(int *&sndbuffer, vtkIdType &N)
Serializes the grid extents and information in a buffer to send over MPI The data is serialized as fo...
void RegisterGrid(int gridID, int extents[6], vtkUnsignedCharArray *nodesGhostArray, vtkUnsignedCharArray *cellGhostArray, vtkPointData *pointData, vtkCellData *cellData, vtkPoints *gridNodes) override
See vtkStructuredGridConnectivity::RegisterGrid.
void SerializeBufferSizes(int *&sizesbuf, vtkIdType &N)
Helper method to serialize the buffer sizes for the grids of this process to neighboring grids.
void DeserializeGhostData(int gridID, int neiListID, int neiGridIdx, int rcvext[6], unsigned char *buffer, unsigned int size)
Given the raw buffer consisting of ghost data, this method deserializes the object and returns the gr...
bool HasPointData(int gridIdx)
Returns true iff the grid corresponding to the given ID has point data.
std::vector< std::vector< unsigned int > > SendBufferSizes
void ExchangeGhostDataInit()
Helper method for exchanging ghost data.
void DeserializeDataArray(vtkDataArray *&, int, int, int, vtkMultiProcessStream &)
Helper method to deserialize the data array from a bytestream.
std::vector< std::vector< vtkCellData * > > RemoteCellData
void SerializeFieldData(int sourceExtent[6], int targetExtent[6], vtkFieldData *fieldData, vtkMultiProcessStream &bytestream)
Helper method to serialize field data.
void ComputeNeighbors() override
Computes the neighboring topology of a distributed structured grid data-set.
void PostReceives()
Helper method to communicate ghost data.
void Initialize()
Initializes this instance of vtkPStructuredGridConnectivity, essentially, the acquires the local proc...
void DeserializeGridExtentForProcess(int *rcvbuffer, vtkIdType &N, int processId)
Deserializes the received grid extent information to the GridExtents internal data-structures.
std::vector< int > GridIds
void SerializeGhostPointData(int gridIdx, int ext[6], vtkMultiProcessStream &bytestream)
Helper method to serialize ghost point data.
void InitializeMessageCounters()
Sets all message counters to 0.
std::vector< std::vector< vtkPointData * > > RemotePointData
std::vector< std::vector< unsigned char * > > RcvBuffers
represent and manipulate point attribute data
represent and manipulate 3D points
vtkStructuredGridConnectivity()
An internal, light-weight class used to store neighbor information.
dynamic, self-adjusting array of unsigned char
#define VTK_DEPRECATED_IN_9_6_0(reason)