59 #ifndef vtkDIYGhostUtilities_h
60 #define vtkDIYGhostUtilities_h
67 #include "vtkParallelDIYModule.h"
74 #include <unordered_map>
79 #include VTK_DIY2(diy/assigner.hpp)
80 #include VTK_DIY2(diy/master.hpp)
81 #include VTK_DIY2(diy/partners/all-reduce.hpp)
84 VTK_ABI_NAMESPACE_BEGIN
127 template <
class DataSetT>
147 virtual bool InputNeedsGhostsPeeledOff()
const = 0;
231 const double spacing[3],
const double orientationQuaternion[4]);
233 const double spacing[3],
vtkMatrix3x3* directionMatrix);
394 int XOrientation = 0;
399 int YOrientation = 0;
425 return this->OutputToInputCellIdRedirectionMap !=
nullptr;
730 std::unordered_map<int, std::unordered_map<vtkIdType, vtkIdType>>
732 std::unordered_map<int, std::unordered_map<vtkIdType, vtkNew<vtkIdTypeArray>>>
734 std::unordered_map<int, std::unordered_map<vtkIdType, vtkNew<vtkIdTypeArray>>>
747 template <
class BlockStructureT,
class InformationT>
796 static int SynchronizeGhostData(std::vector<vtkDataSet*>& inputsDS,
811 template <
class DataSetT>
812 static int GenerateGhostCells(std::vector<DataSetT*>& inputsDS, std::vector<DataSetT*>& outputsDS,
821 static int GenerateGhostCellsImageData(std::vector<vtkImageData*>& inputs,
822 std::vector<vtkImageData*>& outputs,
int outputGhostLevels,
824 static int GenerateGhostCellsRectilinearGrid(std::vector<vtkRectilinearGrid*>& inputs,
825 std::vector<vtkRectilinearGrid*>& outputs,
int outputGhostLevels,
827 static int GenerateGhostCellsStructuredGrid(std::vector<vtkStructuredGrid*>& inputs,
828 std::vector<vtkStructuredGrid*>& outputs,
int outputGhostLevels,
830 static int GenerateGhostCellsPolyData(std::vector<vtkPolyData*>& inputs,
831 std::vector<vtkPolyData*>& outputs,
int outputGhostLevels,
833 static int GenerateGhostCellsUnstructuredGrid(std::vector<vtkUnstructuredGrid*>& inputs,
834 std::vector<vtkUnstructuredGrid*>& outputs,
int outputGhostLevels,
847 static void CloneInputData(std::vector<vtkDataSet*>& inputs, std::vector<vtkDataSet*>& outputs,
848 bool syncCell,
bool syncPoint);
856 static void InitializeBlocks(
857 diy::Master& master, std::vector<vtkDataSet*>& inputs,
bool syncCell,
bool syncPoint);
858 static void InitializeBlocks(
859 diy::Master& master, std::vector<vtkDataSet*>& inputs,
int fieldType,
unsigned char ghostFlag);
867 static void ExchangeNeededIds(
869 static void ExchangeNeededIds(
878 static LinkMap ComputeLinkMapUsingNeededIds(
879 const diy::Master& master,
bool syncCell,
bool syncPoint);
880 static void ComputeLinksUsingNeededIds(
881 Links& links, vtkDIYGhostUtilities::DataSetBlock* block,
int fieldType);
888 static void ExchangeFieldData(diy::Master& master, std::vector<vtkDataSet*>& inputs,
889 std::vector<vtkDataSet*>& outputs,
bool syncCell,
bool syncPoint);
890 static void ExchangeFieldData(diy::Master& master, std::vector<vtkDataSet*>& inputs,
891 std::vector<vtkDataSet*>& outputs,
int fieldType);
903 template <
class DataSetT>
904 static void InitializeGhostPointArray(
911 template <
class DataSetT>
912 static void InitializeGhostCellArray(
919 static void CloneGeometricStructures(
920 std::vector<vtkImageData*>& inputs, std::vector<vtkImageData*>& outputs);
921 static void CloneGeometricStructures(
922 std::vector<vtkRectilinearGrid*>& inputs, std::vector<vtkRectilinearGrid*>& outputs);
923 static void CloneGeometricStructures(
924 std::vector<vtkStructuredGrid*>& inputs, std::vector<vtkStructuredGrid*>& outputs);
925 static void CloneGeometricStructures(
926 std::vector<vtkUnstructuredGrid*>& inputs, std::vector<vtkUnstructuredGrid*>& outputs);
927 static void CloneGeometricStructures(
928 std::vector<vtkPolyData*>& inputs, std::vector<vtkPolyData*>& outputs);
938 static void InitializeBlocks(diy::Master& master, std::vector<vtkImageData*>& inputs);
939 static void InitializeBlocks(diy::Master& master, std::vector<vtkRectilinearGrid*>& inputs);
940 static void InitializeBlocks(diy::Master& master, std::vector<vtkStructuredGrid*>& inputs);
941 static void InitializeBlocks(diy::Master& master, std::vector<vtkUnstructuredGrid*>& inputs);
942 static void InitializeBlocks(diy::Master& master, std::vector<vtkPolyData*>& inputs);
948 template <
class DataSetT>
949 static void ExchangeBoundingBoxes(
952 template <
class BlockT>
953 static LinkMap ComputeLinkMapUsingBoundingBoxes(
const diy::Master& master);
962 static void ExchangeBlockStructures(diy::Master& master, std::vector<vtkImageData*>& inputs);
963 static void ExchangeBlockStructures(
964 diy::Master& master, std::vector<vtkRectilinearGrid*>& inputs);
965 static void ExchangeBlockStructures(diy::Master& master, std::vector<vtkStructuredGrid*>& inputs);
966 static void ExchangeBlockStructures(
967 diy::Master& master, std::vector<vtkUnstructuredGrid*>& inputs);
968 static void ExchangeBlockStructures(diy::Master& master, std::vector<vtkPolyData*>& inputs);
978 const diy::Master& master, std::vector<vtkImageData*>& inputs,
int outputGhostLevels);
980 const diy::Master& master, std::vector<vtkRectilinearGrid*>& inputs,
int outputGhostLevels);
982 const diy::Master& master, std::vector<vtkStructuredGrid*>& inputs,
int outputGhostLevels);
984 const diy::Master& master, std::vector<vtkUnstructuredGrid*>& inputs,
int outputGhostLevels);
986 const diy::Master& master, std::vector<vtkPolyData*>& inputs,
int outputGhostLevels);
994 static void EnqueueGhosts(
const diy::Master::ProxyWithLink& cp,
const diy::BlockID& blockId,
996 static void EnqueueGhosts(
const diy::Master::ProxyWithLink& cp,
const diy::BlockID& blockId,
998 static void EnqueueGhosts(
const diy::Master::ProxyWithLink& cp,
const diy::BlockID& blockId,
1000 static void EnqueueGhosts(
const diy::Master::ProxyWithLink& cp,
const diy::BlockID& blockId,
1002 static void EnqueueGhosts(
const diy::Master::ProxyWithLink& cp,
const diy::BlockID& blockId,
1012 static void DequeueGhosts(
1014 static void DequeueGhosts(
1016 static void DequeueGhosts(
1018 static void DequeueGhosts(
1020 static void DequeueGhosts(
1028 template <
class DataSetT>
1029 static void CopyInputsAndAllocateGhosts(diy::Master& master, diy::Assigner& assigner,
1030 diy::RegularAllReducePartners& partners, std::vector<DataSetT*>& inputs,
1031 std::vector<DataSetT*>& outputs,
int outputGhostLevels,
bool useImplicitArrays);
1041 static void DeepCopyInputAndAllocateGhosts(
1049 static void DeepCopyInputAndAllocateGhosts(
1056 template <
class DataSetT>
1057 static bool ExchangeGhosts(diy::Master& master, diy::Assigner& assigner,
1058 diy::RegularAllReducePartners& partners, std::vector<DataSetT*>& inputs);
1063 template <
class DataSetT>
1064 static void InitializeGhostArrays(
1065 diy::Master& master, std::vector<DataSetT*>& outputs,
int outputGhostLevels);
1071 template <
class DataSetT>
1072 static void AddGhostArrays(diy::Master& master, std::vector<DataSetT*>& outputs);
1078 static void FillGhostArrays(
1079 const diy::Master& master, std::vector<vtkImageData*>& outputs,
int outputGhostLevels);
1080 static void FillGhostArrays(
1081 const diy::Master& master, std::vector<vtkRectilinearGrid*>& outputs,
int outputGhostLevels);
1082 static void FillGhostArrays(
1083 const diy::Master& master, std::vector<vtkStructuredGrid*>& outputs,
int outputGhostLevels);
1084 static void FillGhostArrays(
1085 const diy::Master& master, std::vector<vtkUnstructuredGrid*>& outputs,
int outputGhostLevels);
1086 static void FillGhostArrays(
1087 const diy::Master& master, std::vector<vtkPolyData*>& outputs,
int outputGhostLevels);
1095 static void FillImplicitGhostArrays(
const diy::Master& master, std::vector<vtkImageData*>& inputs,
1096 std::vector<vtkImageData*>& outputs,
int outputGhostLevels);
1097 static void FillImplicitGhostArrays(
const diy::Master& master,
1098 std::vector<vtkRectilinearGrid*>& inputs, std::vector<vtkRectilinearGrid*>& outputs,
1099 int outputGhostLevels);
1100 static void FillImplicitGhostArrays(
const diy::Master& master,
1101 std::vector<vtkStructuredGrid*>& inputs, std::vector<vtkStructuredGrid*>& outputs,
1102 int outputGhostLevels);
1103 static void FillImplicitGhostArrays(
const diy::Master& master,
1104 std::vector<vtkUnstructuredGrid*>& inputs, std::vector<vtkUnstructuredGrid*>& outputs,
1105 int outputGhostLevels);
1106 static void FillImplicitGhostArrays(
const diy::Master& master, std::vector<vtkPolyData*>& inputs,
1107 std::vector<vtkPolyData*>& outputs,
int outputGhostLevels);
1122 static void InflateBoundingBoxIfNecessary(
1128 VTK_ABI_NAMESPACE_END
1129 #include "vtkDIYGhostUtilities.txx"
vtkNew< vtkCellArray > CellArray
int DataDimension
This stores the dimension of the grid (1D, 2D, or 3D).
vtkNew< vtkPoints > GhostPoints
Buffer to store received ghost points from neighboring blocks.
vtkBoundingBox BoundingBox
a dataset that is topologically regular with variable spacing in the three coordinate directions ...
abstract base class for most VTK objects
Grid2D GridInterface
2D grid interfacing 2 blocks.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkSmartPointer< vtkDataArray > YCoordinates
Point coordinate arrays of the rectilinear grid.
Structure to inherit from for data sets having a structured grid topology.
abstract class to specify dataset behavior
vtkNew< vtkPoints > GhostPoints
Ghost points sent by the current neighboring block.
vtkSmartPointer< vtkDataArray > ZCoordinates
Point coordinate arrays of the rectilinear grid.
InformationT InformationType
Typedef handle on block structure and block information.
vtkNew< vtkCellArray > Polys
unsigned char AdjacencyMask
Binary mask encoding the adjacency of the neighboring block w.r.t.
Grid interfacing with block's grid.
BlockStructureT BlockStructureType
Typedef handle on block structure and block information.
concrete class for storing a set of points
dynamic, self-adjusting array of vtkIdType
concrete dataset represents vertices, lines, polygons, and triangle strips
vtkNew< vtkIdTypeArray > SharedPointIds
It can happen that a point can be sent by multiple blocks.
TopologyBufferType SendBuffer
This helper structure owns a typedef to the block type of DataSetT used with diy to generate ghosts...
vtkNew< vtkIdList > RemappedMatchingReceivedPointIdsSortedLikeTarget
This array describes the same points as MatchingReceivedPointIds, but points are ordered like in the ...
vtkNew< vtkPoints > InterfacingPoints
These are the interfacing points sent by the current neighboring block.
vtkNew< vtkIdList > StripIdsToSend
This lists the ids of the cells that we own and need to send to the current neighboring block...
vtkNew< vtkIdList > LineIdsToSend
This lists the ids of the cells that we own and need to send to the current neighboring block...
std::set< int > Links
Convenient typedefs.
ExtentType ShiftedExtent
Extent of the neighboring block, shifted to match our mapping of the extent in the 3D world...
Superclass for all sources, filters, and sinks in VTK.
std::array< double, 3 > VectorType
Convenient typedefs.
vtkSmartPointer< vtkUnsignedCharArray > GhostCellArray
vtkNew< vtkIdList > PolyIdsToSend
This lists the ids of the cells that we own and need to send to the current neighboring block...
vtkSmartPointer< vtkUnsignedCharArray > GhostPointArray
a simple class to control print indentation
Utilities to produce ghost cells between a collection of data sets of same type.
abstract class to quickly locate points in 3-space
VectorType Spacing
Spacing of the neighboring vtkImageData.
topologically and geometrically regular array of data
list of point or cell ids
vtkSmartPointer< vtkDataArray > XCoordinates
Point coordinate arrays of the rectilinear grid.
std::map< int, T > BlockMapType
Convenient typedefs.
vtkSmartPointer< vtkFieldData > InterfacingPointData
Point data at the interface sent by our neighbor.
dataset represents arbitrary combinations of all possible cell types
abstract superclass for arrays of numeric data
vtkNew< vtkIdList > MatchingReceivedPointIds
This lists the matching point ids to the interfacing points that are exchanged with current neighbori...
InformationType Information
InformationT holds any information from the current block that is necessary to exchange ghosts...
std::array< int, 6 > ExtentType
Convenient typedefs.
VectorType Origin
Origin of the neighboring vtkImageData.
Base block structure for data sets.
dynamic, self-adjusting array of unsigned char
vtkNew< vtkCellArray > Lines
TopologyBufferType ReceiveBuffer
QuaternionType OrientationQuaternion
Orientation of the neighboring vtkImageData.
vtkNew< vtkIdList > PointIdsToSend
This lists the ids of the points that we own and need to send to the current neighboring block...
Block structure storing information being communicated by neighboring blocks for vtkImageData.
object to represent cell connectivity
std::vector< Links > LinkMap
Convenient typedefs.
Block structure to be used for diy communication.
topologically regular array of data
TopologyBufferType ReceiveBuffer
std::map< vtkIdType, vtkIdType > RedirectionMapForDuplicatePointIds
This is a mapping from points that have been sent by the current neighboring block and have already b...
Block structure storing information being communicated by neighboring blocks for vtkStructuredGrid.
ExtentType ShiftedExtentWithNewGhosts
Extent of neighboring block that include ghost layers, shifted to match our mapping of the extent in ...
vtkNew< vtkCellArray > Strips
represent and manipulate 3x3 transformation matrices
vtkSmartPointer< vtkIdTypeArray > ReceivedSharedPointIds
It can happen that a point can be sent by multiple blocks.
vtkNew< vtkIdList > CellIdsToSend
This lists the ids of the cells that we own and need to send to the current neighboring block...
BlockMapType< vtkBoundingBox > NeighborBoundingBoxes
Block structure storing information being communicated by neighboring blocks for vtkRectilinearGrid.
Topology information for cells to be exchanged.
represent and manipulate 3D points
Fast, simple class for representing and operating on 3D bounds.
assigner for use with DIY
Represents and manipulates a collection of data arrays.
BlockMapType< BlockStructureType > BlockStructures
BlockStructures maps a neighboring block globald id to its block structure.
TopologyBufferType SendBuffer
Multiprocessing communication superclass.