VTK  9.7.20261107
vtkDIYGhostUtilities.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
59#ifndef vtkDIYGhostUtilities_h
60#define vtkDIYGhostUtilities_h
61
62#include "vtkBoundingBox.h" // For ComputeLinkMap
63#include "vtkDIYExplicitAssigner.h" // For DIY assigner
64#include "vtkDIYUtilities.h" // For Block
65#include "vtkNew.h" // For vtkNew
66#include "vtkObject.h"
67#include "vtkParallelDIYModule.h" // For export macros
68#include "vtkQuaternion.h" // For vtkImageData
69#include "vtkSmartPointer.h" // For vtkSmartPointer
70
71#include <array> // For VectorType and ExtentType
72#include <map> // For BlockMapType
73#include <set> // For Link
74#include <unordered_map> // For BlockMapType
75#include <vector> // For LinkMap
76
77// clang-format off
78#include "vtk_diy2.h" // Third party include
79#include VTK_DIY2(diy/assigner.hpp)
80#include VTK_DIY2(diy/master.hpp)
81#include VTK_DIY2(diy/partners/all-reduce.hpp)
82// clang-format on
83
84VTK_ABI_NAMESPACE_BEGIN
86class vtkCellArray;
87class vtkDataArray;
88class vtkDataSet;
89class vtkFieldData;
90class vtkIdList;
91class vtkIdTypeArray;
92class vtkImageData;
93class vtkMatrix3x3;
95class vtkPoints;
96class vtkPointSet;
97class vtkPolyData;
103
104class VTKPARALLELDIY_EXPORT vtkDIYGhostUtilities : public vtkObject
105{
106public:
108
110
113 using VectorType = std::array<double, 3>;
115 using ExtentType = std::array<int, 6>;
116 template <class T>
117 using BlockMapType = std::map<int, T>;
118 using Links = std::set<int>;
119 using LinkMap = std::vector<Links>;
121
126 template <class DataSetT>
128
129protected:
138
140 {
141 virtual ~DataSetInformation() = default;
142
146 virtual bool InputNeedsGhostsPeeledOff() const = 0;
147 };
148
153 {
157 GridBlockStructure(const int* extent, int dim);
158
162 ExtentType Extent = ExtentType{ 1, -1, 1, -1, 1, -1 };
163
169
174
175 ExtentType ReceivedGhostExtent = ExtentType{ 1, -1, 1, -1, 1, -1 };
176
181 unsigned char AdjacencyMask;
182
187 };
188
193 {
194 ~GridInformation() override = default;
195
196 bool InputNeedsGhostsPeeledOff() const override { return this->Extent != this->InputExtent; }
197
201 ExtentType Extent = ExtentType{ 1, -1, 1, -1, 1, -1 };
202
206 ExtentType InputExtent = ExtentType{ 1, -1, 1, -1, 1, -1 };
207
209 };
210
212 {
213 ~ImageDataInformation() override = default;
214
216 };
217
223 {
225
229 ImageDataBlockStructure(const int extent[6], int dim, const double origin[3],
230 const double spacing[3], const double orientationQuaternion[4]);
231 ImageDataBlockStructure(const int extent[6], int dim, const double origin[3],
232 const double spacing[3], vtkMatrix3x3* directionMatrix);
234
239
244
249
254 };
255
278
306
341
347 {
352 StructuredGridBlockStructure(const int extent[6], int dim, vtkDataArray* points[6]);
353
358
363
368 struct Grid2D
369 {
373 int StartX = 0;
374
378 int StartY = 0;
379
383 int EndX = 0;
384
388 int EndY = 0;
389
394
399
404 int ExtentId = -1;
405 };
406
413
418 };
419
489
561
604
629
685
726
727private:
728 struct DataSetBlock
729 {
730 std::unordered_map<int, std::unordered_map<vtkIdType, vtkIdType>>
731 GlobalToLocalIds; // Per attribute
732 std::unordered_map<int, std::unordered_map<vtkIdType, vtkNew<vtkIdTypeArray>>>
733 NeededGidsForBlocks; // Ghosts of this block per process id (per attribute)
734 std::unordered_map<int, std::unordered_map<vtkIdType, vtkNew<vtkIdTypeArray>>>
735 GhostGidsFromBlocks; // Ghosts of other blocks per partition id (per attribute)
736 };
737
738public:
747 template <class BlockStructureT, class InformationT>
776
778
788
796 static int SynchronizeGhostData(std::vector<vtkDataSet*>& inputsDS,
797 std::vector<vtkDataSet*>& outputsDS, vtkMultiProcessController* controller, bool syncCell,
798 bool SyncPoint);
799
811 template <class DataSetT>
812 static int GenerateGhostCells(std::vector<DataSetT*>& inputsDS, std::vector<DataSetT*>& outputsDS,
813 int outputGhostLevels, vtkMultiProcessController* controller, bool useImplicitArrays,
814 double tolerance = 0);
815
817
822 static int GenerateGhostCellsImageData(std::vector<vtkImageData*>& inputs,
823 std::vector<vtkImageData*>& outputs, int outputGhostLevels,
824 vtkMultiProcessController* controller, bool useImplicitArrays = false, double tolerance = 0);
825 static int GenerateGhostCellsRectilinearGrid(std::vector<vtkRectilinearGrid*>& inputs,
826 std::vector<vtkRectilinearGrid*>& outputs, int outputGhostLevels,
827 vtkMultiProcessController* controller, bool useImplicitArrays = false, double tolerance = 0);
828 static int GenerateGhostCellsStructuredGrid(std::vector<vtkStructuredGrid*>& inputs,
829 std::vector<vtkStructuredGrid*>& outputs, int outputGhostLevels,
830 vtkMultiProcessController* controller, bool useImplicitArrays = false, double tolerance = 0);
831 static int GenerateGhostCellsPolyData(std::vector<vtkPolyData*>& inputs,
832 std::vector<vtkPolyData*>& outputs, int outputGhostLevels,
833 vtkMultiProcessController* controller, bool useImplicitArrays = false, double tolerance = 0);
834 static int GenerateGhostCellsUnstructuredGrid(std::vector<vtkUnstructuredGrid*>& inputs,
835 std::vector<vtkUnstructuredGrid*>& outputs, int outputGhostLevels,
836 vtkMultiProcessController* controller, bool useImplicitArrays = false, double tolerance = 0);
838
839protected:
841 ~vtkDIYGhostUtilities() override = default;
842
844
848 static void CloneInputData(std::vector<vtkDataSet*>& inputs, std::vector<vtkDataSet*>& outputs,
849 bool syncCell, bool syncPoint);
850 static void CloneInputData(vtkDataSet* input, vtkDataSet* output, int fieldType);
852
854
857 static void InitializeBlocks(
858 diy::Master& master, std::vector<vtkDataSet*>& inputs, bool syncCell, bool syncPoint);
859 static void InitializeBlocks(
860 diy::Master& master, std::vector<vtkDataSet*>& inputs, int fieldType, unsigned char ghostFlag);
862
864
868 static void ExchangeNeededIds(
869 diy::Master& master, const vtkDIYExplicitAssigner& assigner, bool syncCell, bool syncPoint);
870 static void ExchangeNeededIds(
871 diy::Master& master, const vtkDIYExplicitAssigner& assigner, int fieldType);
873
875
880 const diy::Master& master, bool syncCell, bool syncPoint);
882 Links& links, vtkDIYGhostUtilities::DataSetBlock* block, int fieldType);
884
886
889 static void ExchangeFieldData(diy::Master& master, std::vector<vtkDataSet*>& inputs,
890 std::vector<vtkDataSet*>& outputs, bool syncCell, bool syncPoint);
891 static void ExchangeFieldData(diy::Master& master, std::vector<vtkDataSet*>& inputs,
892 std::vector<vtkDataSet*>& outputs, int fieldType);
894
898 static void ReinitializeSelectedBits(vtkUnsignedCharArray* ghosts, unsigned char mask);
899
904 template <class DataSetT>
906 typename DataSetTypeToBlockTypeConverter<DataSetT>::BlockType* block, DataSetT* output);
907
912 template <class DataSetT>
914 typename DataSetTypeToBlockTypeConverter<DataSetT>::BlockType* block, DataSetT* output);
915
917
921 std::vector<vtkImageData*>& inputs, std::vector<vtkImageData*>& outputs);
923 std::vector<vtkRectilinearGrid*>& inputs, std::vector<vtkRectilinearGrid*>& outputs);
925 std::vector<vtkStructuredGrid*>& inputs, std::vector<vtkStructuredGrid*>& outputs);
927 std::vector<vtkUnstructuredGrid*>& inputs, std::vector<vtkUnstructuredGrid*>& outputs);
929 std::vector<vtkPolyData*>& inputs, std::vector<vtkPolyData*>& outputs);
931
933
939 static void InitializeBlocks(diy::Master& master, std::vector<vtkImageData*>& inputs);
940 static void InitializeBlocks(diy::Master& master, std::vector<vtkRectilinearGrid*>& inputs);
941 static void InitializeBlocks(diy::Master& master, std::vector<vtkStructuredGrid*>& inputs);
942 static void InitializeBlocks(diy::Master& master, std::vector<vtkUnstructuredGrid*>& inputs);
943 static void InitializeBlocks(diy::Master& master, std::vector<vtkPolyData*>& inputs);
945
950 template <class DataSetT>
951 static void ExchangeBoundingBoxes(diy::Master& master, const vtkDIYExplicitAssigner& assigner,
952 std::vector<DataSetT*>& inputs, double tolerance = 0);
953
954 template <class BlockT>
955 static LinkMap ComputeLinkMapUsingBoundingBoxes(const diy::Master& master);
956
958
966 diy::Master& master, std::vector<vtkImageData*>& inputs, double tolerance = 0);
968 diy::Master& master, std::vector<vtkRectilinearGrid*>& inputs, double tolerance = 0);
970 diy::Master& master, std::vector<vtkStructuredGrid*>& inputs, double tolerance = 0);
972 diy::Master& master, std::vector<vtkUnstructuredGrid*>& inputs, double tolerance = 0);
974 diy::Master& master, std::vector<vtkPolyData*>& inputs, double tolerance = 0);
976
978
983 static LinkMap ComputeLinkMap(const diy::Master& master, std::vector<vtkImageData*>& inputs,
984 int outputGhostLevels, double tolerance = 0);
985 static LinkMap ComputeLinkMap(const diy::Master& master, std::vector<vtkRectilinearGrid*>& inputs,
986 int outputGhostLevels, double tolerance = 0);
987 static LinkMap ComputeLinkMap(const diy::Master& master, std::vector<vtkStructuredGrid*>& inputs,
988 int outputGhostLevels, double tolerance = 0);
989 static LinkMap ComputeLinkMap(const diy::Master& master,
990 std::vector<vtkUnstructuredGrid*>& inputs, int outputGhostLevels, double tolerance = 0);
991 static LinkMap ComputeLinkMap(const diy::Master& master, std::vector<vtkPolyData*>& inputs,
992 int outputGhostLevels, double tolerance = 0);
994
996
1000 static void EnqueueGhosts(const diy::Master::ProxyWithLink& cp, const diy::BlockID& blockId,
1001 vtkImageData* input, ImageDataBlock* block);
1002 static void EnqueueGhosts(const diy::Master::ProxyWithLink& cp, const diy::BlockID& blockId,
1004 static void EnqueueGhosts(const diy::Master::ProxyWithLink& cp, const diy::BlockID& blockId,
1005 vtkStructuredGrid* input, StructuredGridBlock* block);
1006 static void EnqueueGhosts(const diy::Master::ProxyWithLink& cp, const diy::BlockID& blockId,
1008 static void EnqueueGhosts(const diy::Master::ProxyWithLink& cp, const diy::BlockID& blockId,
1009 vtkPolyData* input, PolyDataBlock* block);
1011
1013
1018 static void DequeueGhosts(
1019 const diy::Master::ProxyWithLink& cp, int gid, ImageDataBlockStructure& blockStructure);
1020 static void DequeueGhosts(
1021 const diy::Master::ProxyWithLink& cp, int gid, RectilinearGridBlockStructure& blockStructure);
1022 static void DequeueGhosts(
1023 const diy::Master::ProxyWithLink& cp, int gid, StructuredGridBlockStructure& blockStructure);
1024 static void DequeueGhosts(
1025 const diy::Master::ProxyWithLink& cp, int gid, UnstructuredGridBlockStructure& blockStructure);
1026 static void DequeueGhosts(
1027 const diy::Master::ProxyWithLink& cp, int gid, PolyDataBlockStructure& blockStructure);
1029
1034 template <class DataSetT>
1035 static void CopyInputsAndAllocateGhosts(diy::Master& master, diy::Assigner& assigner,
1036 diy::RegularAllReducePartners& partners, std::vector<DataSetT*>& inputs,
1037 std::vector<DataSetT*>& outputs, int outputGhostLevels, bool useImplicitArrays,
1038 double tolerance = 0);
1039
1041
1049 vtkImageData* outputs, bool cloneArrays, double tolerance = 0);
1051 vtkRectilinearGrid* outputs, bool cloneArrays, double tolerance = 0);
1053 vtkStructuredGrid* outputs, bool cloneArrays, double tolerance = 0);
1055 vtkUnstructuredGrid* input, vtkUnstructuredGrid* outputs, bool cloneArrays,
1056 double tolerance = 0);
1058 vtkPolyData* outputs, bool cloneArrays, double tolerance = 0);
1060
1064 template <class DataSetT>
1065 static bool ExchangeGhosts(diy::Master& master, diy::Assigner& assigner,
1066 diy::RegularAllReducePartners& partners, std::vector<DataSetT*>& inputs);
1067
1071 template <class DataSetT>
1073 diy::Master& master, std::vector<DataSetT*>& outputs, int outputGhostLevels);
1074
1079 template <class DataSetT>
1080 static void AddGhostArrays(diy::Master& master, std::vector<DataSetT*>& outputs);
1081
1083
1086 static void FillGhostArrays(
1087 const diy::Master& master, std::vector<vtkImageData*>& outputs, int outputGhostLevels);
1088 static void FillGhostArrays(
1089 const diy::Master& master, std::vector<vtkRectilinearGrid*>& outputs, int outputGhostLevels);
1090 static void FillGhostArrays(
1091 const diy::Master& master, std::vector<vtkStructuredGrid*>& outputs, int outputGhostLevels);
1092 static void FillGhostArrays(
1093 const diy::Master& master, std::vector<vtkUnstructuredGrid*>& outputs, int outputGhostLevels);
1094 static void FillGhostArrays(
1095 const diy::Master& master, std::vector<vtkPolyData*>& outputs, int outputGhostLevels);
1097
1099
1103 static void FillImplicitGhostArrays(const diy::Master& master, std::vector<vtkImageData*>& inputs,
1104 std::vector<vtkImageData*>& outputs, int outputGhostLevels);
1105 static void FillImplicitGhostArrays(const diy::Master& master,
1106 std::vector<vtkRectilinearGrid*>& inputs, std::vector<vtkRectilinearGrid*>& outputs,
1107 int outputGhostLevels);
1108 static void FillImplicitGhostArrays(const diy::Master& master,
1109 std::vector<vtkStructuredGrid*>& inputs, std::vector<vtkStructuredGrid*>& outputs,
1110 int outputGhostLevels);
1111 static void FillImplicitGhostArrays(const diy::Master& master,
1112 std::vector<vtkUnstructuredGrid*>& inputs, std::vector<vtkUnstructuredGrid*>& outputs,
1113 int outputGhostLevels);
1114 static void FillImplicitGhostArrays(const diy::Master& master, std::vector<vtkPolyData*>& inputs,
1115 std::vector<vtkPolyData*>& outputs, int outputGhostLevels);
1117
1118private:
1120 void operator=(const vtkDIYGhostUtilities&) = delete;
1121
1123
1130 static void InflateBoundingBoxIfNecessary(
1131 vtkDataSet* vtkNotUsed(input), vtkBoundingBox& vtkNotUsed(bb), double vtkNotUsed(tolerance));
1132 static void InflateBoundingBoxIfNecessary(
1133 vtkPointSet* input, vtkBoundingBox& bb, double tolerance);
1135};
1136
1137VTK_ABI_NAMESPACE_END
1138#include "vtkDIYGhostUtilities.txx" // for template implementations
1139
1140#endif
abstract class to quickly locate points in 3-space
Fast, simple class for representing and operating on 3D bounds.
object to represent cell connectivity
assigner for use with DIY
static void EnqueueGhosts(const diy::Master::ProxyWithLink &cp, const diy::BlockID &blockId, vtkImageData *input, ImageDataBlock *block)
This method enqueues ghosts between communicating blocks.
static void InitializeGhostPointArray(typename DataSetTypeToBlockTypeConverter< DataSetT >::BlockType *block, DataSetT *output)
This method will set all ghosts points in output to zero.
static int GenerateGhostCellsStructuredGrid(std::vector< vtkStructuredGrid * > &inputs, std::vector< vtkStructuredGrid * > &outputs, int outputGhostLevels, vtkMultiProcessController *controller, bool useImplicitArrays=false, double tolerance=0)
Method that can be used to avoid the compile-time overhead of the templated method GenerateGhostCells...
static void FillGhostArrays(const diy::Master &master, std::vector< vtkImageData * > &outputs, int outputGhostLevels)
This method sets the ghost arrays in the output.
static void InitializeBlocks(diy::Master &master, std::vector< vtkDataSet * > &inputs, bool syncCell, bool syncPoint)
Initialize vtkDataSet blocks for synchronizing ghost data.
static void DequeueGhosts(const diy::Master::ProxyWithLink &cp, int gid, RectilinearGridBlockStructure &blockStructure)
This method dequeues ghosts sent between communicating blocks.
static void InitializeGhostCellArray(typename DataSetTypeToBlockTypeConverter< DataSetT >::BlockType *block, DataSetT *output)
This method will set all ghosts cells in output to zero.
static void FillGhostArrays(const diy::Master &master, std::vector< vtkRectilinearGrid * > &outputs, int outputGhostLevels)
This method sets the ghost arrays in the output.
static int GenerateGhostCellsImageData(std::vector< vtkImageData * > &inputs, std::vector< vtkImageData * > &outputs, int outputGhostLevels, vtkMultiProcessController *controller, bool useImplicitArrays=false, double tolerance=0)
Method that can be used to avoid the compile-time overhead of the templated method GenerateGhostCells...
static void FillImplicitGhostArrays(const diy::Master &master, std::vector< vtkStructuredGrid * > &inputs, std::vector< vtkStructuredGrid * > &outputs, int outputGhostLevels)
This method create the implicit arrays in the output using the inputs array and the ghost data.
static void FillGhostArrays(const diy::Master &master, std::vector< vtkStructuredGrid * > &outputs, int outputGhostLevels)
This method sets the ghost arrays in the output.
static void DequeueGhosts(const diy::Master::ProxyWithLink &cp, int gid, UnstructuredGridBlockStructure &blockStructure)
This method dequeues ghosts sent between communicating blocks.
static void CopyInputsAndAllocateGhosts(diy::Master &master, diy::Assigner &assigner, diy::RegularAllReducePartners &partners, std::vector< DataSetT * > &inputs, std::vector< DataSetT * > &outputs, int outputGhostLevels, bool useImplicitArrays, double tolerance=0)
Copy the inputs into the outputs.
static void ExchangeBlockStructures(diy::Master &master, std::vector< vtkUnstructuredGrid * > &inputs, double tolerance=0)
Method to be overloaded for each supported type of input data set.
static void ComputeLinksUsingNeededIds(Links &links, vtkDIYGhostUtilities::DataSetBlock *block, int fieldType)
Compute link map using known information from blocks, eg.
static void DeepCopyInputAndAllocateGhosts(PolyDataBlock *block, vtkPolyData *input, vtkPolyData *outputs, bool cloneArrays, double tolerance=0)
Method to be overloaded for each supported input data set type, This method allocates ghosts in the o...
static int GenerateGhostCellsRectilinearGrid(std::vector< vtkRectilinearGrid * > &inputs, std::vector< vtkRectilinearGrid * > &outputs, int outputGhostLevels, vtkMultiProcessController *controller, bool useImplicitArrays=false, double tolerance=0)
Method that can be used to avoid the compile-time overhead of the templated method GenerateGhostCells...
static void InitializeBlocks(diy::Master &master, std::vector< vtkStructuredGrid * > &inputs)
Method to be overloaded for each supported type of input data set.
static void ExchangeBlockStructures(diy::Master &master, std::vector< vtkPolyData * > &inputs, double tolerance=0)
Method to be overloaded for each supported type of input data set.
static void CloneGeometricStructures(std::vector< vtkUnstructuredGrid * > &inputs, std::vector< vtkUnstructuredGrid * > &outputs)
static void InitializeBlocks(diy::Master &master, std::vector< vtkUnstructuredGrid * > &inputs)
Method to be overloaded for each supported type of input data set.
static void CloneGeometricStructures(std::vector< vtkImageData * > &inputs, std::vector< vtkImageData * > &outputs)
static void FillImplicitGhostArrays(const diy::Master &master, std::vector< vtkRectilinearGrid * > &inputs, std::vector< vtkRectilinearGrid * > &outputs, int outputGhostLevels)
This method create the implicit arrays in the output using the inputs array and the ghost data.
Block< RectilinearGridBlockStructure, RectilinearGridInformation > RectilinearGridBlock
Block typedefs.
static void ReinitializeSelectedBits(vtkUnsignedCharArray *ghosts, unsigned char mask)
Reinitializes the bits that match the input bit mask in the input array to zero.
static void CloneInputData(vtkDataSet *input, vtkDataSet *output, int fieldType)
Clone input data into output.
vtkDIYGhostUtilities()=default
static void CloneGeometricStructures(std::vector< vtkPolyData * > &inputs, std::vector< vtkPolyData * > &outputs)
static void InitializeBlocks(diy::Master &master, std::vector< vtkImageData * > &inputs)
Method to be overloaded for each supported type of input data set.
static void CloneGeometricStructures(std::vector< vtkStructuredGrid * > &inputs, std::vector< vtkStructuredGrid * > &outputs)
static bool ExchangeGhosts(diy::Master &master, diy::Assigner &assigner, diy::RegularAllReducePartners &partners, std::vector< DataSetT * > &inputs)
This method exchanges ghosts between connected blocks.
std::set< int > Links
Convenient typedefs.
static void FillImplicitGhostArrays(const diy::Master &master, std::vector< vtkUnstructuredGrid * > &inputs, std::vector< vtkUnstructuredGrid * > &outputs, int outputGhostLevels)
This method create the implicit arrays in the output using the inputs array and the ghost data.
static void DequeueGhosts(const diy::Master::ProxyWithLink &cp, int gid, ImageDataBlockStructure &blockStructure)
This method dequeues ghosts sent between communicating blocks.
static void ExchangeNeededIds(diy::Master &master, const vtkDIYExplicitAssigner &assigner, int fieldType)
Exchange global ids of data that needs to be synced to owners of the data.
static void EnqueueGhosts(const diy::Master::ProxyWithLink &cp, const diy::BlockID &blockId, vtkPolyData *input, PolyDataBlock *block)
This method enqueues ghosts between communicating blocks.
~vtkDIYGhostUtilities() override=default
static int GenerateGhostCells(std::vector< DataSetT * > &inputsDS, std::vector< DataSetT * > &outputsDS, int outputGhostLevels, vtkMultiProcessController *controller, bool useImplicitArrays, double tolerance=0)
Main pipeline generating ghosts.
static LinkMap ComputeLinkMap(const diy::Master &master, std::vector< vtkImageData * > &inputs, int outputGhostLevels, double tolerance=0)
Method to be overloaded for each supported input data set type, that computes the minimal link map be...
Block< PolyDataBlockStructure, PolyDataInformation > PolyDataBlock
Block typedefs.
static void ExchangeBoundingBoxes(diy::Master &master, const vtkDIYExplicitAssigner &assigner, std::vector< DataSetT * > &inputs, double tolerance=0)
This method exchanges the bounding boxes among blocks, inflated with tolerance, the tolerance of the ...
static void InitializeBlocks(diy::Master &master, std::vector< vtkPolyData * > &inputs)
Method to be overloaded for each supported type of input data set.
static void InitializeGhostArrays(diy::Master &master, std::vector< DataSetT * > &outputs, int outputGhostLevels)
This methods allocate a point and cell ghost array and fills it with 0.
static void DeepCopyInputAndAllocateGhosts(ImageDataBlock *block, vtkImageData *input, vtkImageData *outputs, bool cloneArrays, double tolerance=0)
Method to be overloaded for each supported input data set type, This method allocates ghosts in the o...
static LinkMap ComputeLinkMap(const diy::Master &master, std::vector< vtkUnstructuredGrid * > &inputs, int outputGhostLevels, double tolerance=0)
Method to be overloaded for each supported input data set type, that computes the minimal link map be...
static void FillGhostArrays(const diy::Master &master, std::vector< vtkUnstructuredGrid * > &outputs, int outputGhostLevels)
This method sets the ghost arrays in the output.
static int GenerateGhostCellsUnstructuredGrid(std::vector< vtkUnstructuredGrid * > &inputs, std::vector< vtkUnstructuredGrid * > &outputs, int outputGhostLevels, vtkMultiProcessController *controller, bool useImplicitArrays=false, double tolerance=0)
Method that can be used to avoid the compile-time overhead of the templated method GenerateGhostCells...
static int GenerateGhostCellsPolyData(std::vector< vtkPolyData * > &inputs, std::vector< vtkPolyData * > &outputs, int outputGhostLevels, vtkMultiProcessController *controller, bool useImplicitArrays=false, double tolerance=0)
Method that can be used to avoid the compile-time overhead of the templated method GenerateGhostCells...
static void ExchangeNeededIds(diy::Master &master, const vtkDIYExplicitAssigner &assigner, bool syncCell, bool syncPoint)
Exchange global ids of data that needs to be synced to owners of the data.
static void EnqueueGhosts(const diy::Master::ProxyWithLink &cp, const diy::BlockID &blockId, vtkUnstructuredGrid *input, UnstructuredGridBlock *block)
This method enqueues ghosts between communicating blocks.
static void ExchangeFieldData(diy::Master &master, std::vector< vtkDataSet * > &inputs, std::vector< vtkDataSet * > &outputs, int fieldType)
This method exchanges ghost data across partitions.
vtkQuaternion< double > QuaternionType
Convenient typedefs.
static void EnqueueGhosts(const diy::Master::ProxyWithLink &cp, const diy::BlockID &blockId, vtkStructuredGrid *input, StructuredGridBlock *block)
This method enqueues ghosts between communicating blocks.
static void CloneGeometricStructures(std::vector< vtkRectilinearGrid * > &inputs, std::vector< vtkRectilinearGrid * > &outputs)
static void FillGhostArrays(const diy::Master &master, std::vector< vtkPolyData * > &outputs, int outputGhostLevels)
This method sets the ghost arrays in the output.
static void DequeueGhosts(const diy::Master::ProxyWithLink &cp, int gid, StructuredGridBlockStructure &blockStructure)
This method dequeues ghosts sent between communicating blocks.
static void InitializeBlocks(diy::Master &master, std::vector< vtkDataSet * > &inputs, int fieldType, unsigned char ghostFlag)
Initialize vtkDataSet blocks for synchronizing ghost data.
std::array< double, 3 > VectorType
Convenient typedefs.
Block< UnstructuredDataBlockStructure, UnstructuredDataInformation > UnstructuredDataBlock
Block typedefs.
std::map< int, T > BlockMapType
Convenient typedefs.
Block< UnstructuredGridBlockStructure, UnstructuredGridInformation > UnstructuredGridBlock
Block typedefs.
Block< StructuredGridBlockStructure, StructuredGridInformation > StructuredGridBlock
Block typedefs.
static void ExchangeBlockStructures(diy::Master &master, std::vector< vtkStructuredGrid * > &inputs, double tolerance=0)
Method to be overloaded for each supported type of input data set.
static void ExchangeBlockStructures(diy::Master &master, std::vector< vtkImageData * > &inputs, double tolerance=0)
Method to be overloaded for each supported type of input data set.
std::array< int, 6 > ExtentType
Convenient typedefs.
static LinkMap ComputeLinkMap(const diy::Master &master, std::vector< vtkRectilinearGrid * > &inputs, int outputGhostLevels, double tolerance=0)
Method to be overloaded for each supported input data set type, that computes the minimal link map be...
static void DequeueGhosts(const diy::Master::ProxyWithLink &cp, int gid, PolyDataBlockStructure &blockStructure)
This method dequeues ghosts sent between communicating blocks.
static void FillImplicitGhostArrays(const diy::Master &master, std::vector< vtkPolyData * > &inputs, std::vector< vtkPolyData * > &outputs, int outputGhostLevels)
This method create the implicit arrays in the output using the inputs array and the ghost data.
static int SynchronizeGhostData(std::vector< vtkDataSet * > &inputsDS, std::vector< vtkDataSet * > &outputsDS, vtkMultiProcessController *controller, bool syncCell, bool SyncPoint)
Synchronize ghost data to match non-ghost data.
static void ExchangeBlockStructures(diy::Master &master, std::vector< vtkRectilinearGrid * > &inputs, double tolerance=0)
Method to be overloaded for each supported type of input data set.
static void CloneInputData(std::vector< vtkDataSet * > &inputs, std::vector< vtkDataSet * > &outputs, bool syncCell, bool syncPoint)
Clone input data into output.
std::vector< Links > LinkMap
Convenient typedefs.
static void DeepCopyInputAndAllocateGhosts(UnstructuredGridBlock *block, vtkUnstructuredGrid *input, vtkUnstructuredGrid *outputs, bool cloneArrays, double tolerance=0)
Method to be overloaded for each supported input data set type, This method allocates ghosts in the o...
Block< ImageDataBlockStructure, ImageDataInformation > ImageDataBlock
Block typedefs.
static void AddGhostArrays(diy::Master &master, std::vector< DataSetT * > &outputs)
Adds ghost arrays, which are present in blocks of master, to outputs point and / or cell data.
static LinkMap ComputeLinkMap(const diy::Master &master, std::vector< vtkStructuredGrid * > &inputs, int outputGhostLevels, double tolerance=0)
Method to be overloaded for each supported input data set type, that computes the minimal link map be...
static void EnqueueGhosts(const diy::Master::ProxyWithLink &cp, const diy::BlockID &blockId, vtkRectilinearGrid *input, RectilinearGridBlock *block)
This method enqueues ghosts between communicating blocks.
static LinkMap ComputeLinkMapUsingNeededIds(const diy::Master &master, bool syncCell, bool syncPoint)
Compute link map using known information from blocks, eg.
static LinkMap ComputeLinkMapUsingBoundingBoxes(const diy::Master &master)
static void InitializeBlocks(diy::Master &master, std::vector< vtkRectilinearGrid * > &inputs)
Method to be overloaded for each supported type of input data set.
static void DeepCopyInputAndAllocateGhosts(RectilinearGridBlock *block, vtkRectilinearGrid *input, vtkRectilinearGrid *outputs, bool cloneArrays, double tolerance=0)
Method to be overloaded for each supported input data set type, This method allocates ghosts in the o...
static void FillImplicitGhostArrays(const diy::Master &master, std::vector< vtkImageData * > &inputs, std::vector< vtkImageData * > &outputs, int outputGhostLevels)
This method create the implicit arrays in the output using the inputs array and the ghost data.
static void ExchangeFieldData(diy::Master &master, std::vector< vtkDataSet * > &inputs, std::vector< vtkDataSet * > &outputs, bool syncCell, bool syncPoint)
This method exchanges ghost data across partitions.
static LinkMap ComputeLinkMap(const diy::Master &master, std::vector< vtkPolyData * > &inputs, int outputGhostLevels, double tolerance=0)
Method to be overloaded for each supported input data set type, that computes the minimal link map be...
static void DeepCopyInputAndAllocateGhosts(StructuredGridBlock *block, vtkStructuredGrid *input, vtkStructuredGrid *outputs, bool cloneArrays, double tolerance=0)
Method to be overloaded for each supported input data set type, This method allocates ghosts in the o...
abstract class to specify dataset behavior
Definition vtkDataSet.h:165
Represents and manipulates a collection of data arrays.
list of point or cell ids
Definition vtkIdList.h:135
dynamic, self-adjusting array of vtkIdType
topologically and geometrically regular array of data
represent and manipulate 3x3 transformation matrices
Multiprocessing communication superclass.
Allocate and hold a VTK object.
Definition vtkNew.h:168
concrete class for storing a set of points
Definition vtkPointSet.h:98
represent and manipulate 3D points
Definition vtkPoints.h:140
concrete dataset represents vertices, lines, polygons, and triangle strips
object to represent the faces of polyhedral cells
templated base type for storage of quaternions.
a dataset that is topologically regular with variable spacing in the three coordinate directions
Hold a reference to a vtkObjectBase instance.
topologically regular array of data
dynamic, self-adjusting array of unsigned char
dataset represents arbitrary combinations of all possible cell types
Block structure to be used for diy communication.
BlockStructureT BlockStructureType
Typedef handle on block structure and block information.
InformationT InformationType
Typedef handle on block structure and block information.
Base block structure for data sets.
vtkSmartPointer< vtkFieldData > GhostCellData
vtkSmartPointer< vtkFieldData > GhostPointData
virtual bool InputNeedsGhostsPeeledOff() const =0
This helper structure owns a typedef to the block type of DataSetT used with diy to generate ghosts.
GridBlockStructure(const int *extent, int dim)
GridBlockStructure constructor.
ExtentType ShiftedExtentWithNewGhosts
Extent of neighboring block that include ghost layers, shifted to match our mapping of the extent in ...
ExtentType Extent
Extent of neighboring block with no ghosts.
ExtentType ShiftedExtent
Extent of the neighboring block, shifted to match our mapping of the extent in the 3D world.
int DataDimension
This stores the dimension of the grid (1D, 2D, or 3D).
unsigned char AdjacencyMask
Binary mask encoding the adjacency of the neighboring block w.r.t.
Structure storing information needed by a block on it's own grid structure.
ExtentType Extent
Extent without ghost layers.
ExtentType InputExtent
Input extent without any modification.
Block structure storing information being communicated by neighboring blocks for vtkImageData.
VectorType Origin
Origin of the neighboring vtkImageData.
ImageDataBlockStructure(vtkImageData *image, const ImageDataInformation &info)
Copy constructor.
VectorType Spacing
Spacing of the neighboring vtkImageData.
ImageDataBlockStructure(const int extent[6], int dim, const double origin[3], const double spacing[3], vtkMatrix3x3 *directionMatrix)
Constructor taking the extent (without ghosts) of the neighboring vtkImageData, as well as well as th...
QuaternionType OrientationQuaternion
Orientation of the neighboring vtkImageData.
ImageDataBlockStructure(const int extent[6], int dim, const double origin[3], const double spacing[3], const double orientationQuaternion[4])
Constructor taking the extent (without ghosts) of the neighboring vtkImageData, as well as well as th...
vtkIdType NumberOfStripsToSend
Handle on the number of cells to send of the corresponding type.
vtkNew< vtkIdList > StripIdsToSend
This lists the ids of the cells that we own and need to send to the current neighboring block.
vtkIdType StripConnectivitySize
Handle on the number of cells of corresponding type to be sent to the neighbor block.
vtkIdType PolyConnectivitySize
Handle on the number of cells of corresponding type to be sent to the neighbor block.
vtkNew< vtkIdList > LineIdsToSend
This lists the ids of the cells that we own and need to send to the current neighboring block.
vtkIdType NumberOfLinesToSend
Handle on the number of cells to send of the corresponding type.
vtkIdType LineConnectivitySize
Handle on the number of cells of corresponding type to be sent to the neighbor block.
vtkIdType NumberOfPolysToSend
Handle on the number of cells to send of the corresponding type.
vtkNew< vtkIdList > PolyIdsToSend
This lists the ids of the cells that we own and need to send to the current neighboring block.
vtkIdType CurrentMaxStripId
This is a cursor telling how many cells of corresponding types have been added so far.
vtkIdType CurrentMaxPolyId
This is a cursor telling how many cells of corresponding types have been added so far.
vtkIdType CurrentPolyConnectivitySize
This is a cursor telling how much the corresponding output connectivity array is filled.
vtkIdType NumberOfInputPolys
Number of cells of respective type when the input has its ghost cells removed.
vtkIdType NumberOfInputVerts
Number of cells of respective type when the input has its ghost cells removed.
vtkIdType CurrentLineConnectivitySize
This is a cursor telling how much the corresponding output connectivity array is filled.
vtkIdType NumberOfInputStrips
Number of cells of respective type when the input has its ghost cells removed.
vtkNew< vtkIdList > OutputToInputLineCellIdRedirectionMap
Cell connectivity array size of the input if ghost cells are removed.
vtkNew< vtkIdList > OutputToInputStripCellIdRedirectionMap
Cell connectivity array size of the input if ghost cells are removed.
vtkIdType CurrentStripConnectivitySize
This is a cursor telling how much the corresponding output connectivity array is filled.
vtkIdType InputPolyConnectivitySize
Cell connectivity array size of the input if ghost cells are removed.
vtkIdType NumberOfInputLines
Number of cells of respective type when the input has its ghost cells removed.
vtkIdType InputStripConnectivitySize
Cell connectivity array size of the input if ghost cells are removed.
vtkNew< vtkIdList > OutputToInputVertCellIdRedirectionMap
In the event that the input has ghost cells, this maps the output cells (with input ghosts removed) t...
vtkIdType InputLineConnectivitySize
Cell connectivity array size of the input if ghost cells are removed.
vtkIdType CurrentMaxLineId
This is a cursor telling how many cells of corresponding types have been added so far.
vtkNew< vtkIdList > OutputToInputPolyCellIdRedirectionMap
Cell connectivity array size of the input if ghost cells are removed.
vtkIdType InputVertConnectivitySize
Cell connectivity array size of the input if ghost cells are removed.
Block structure storing information being communicated by neighboring blocks for vtkRectilinearGrid.
vtkSmartPointer< vtkDataArray > ZCoordinates
Point coordinate arrays of the rectilinear grid.
vtkSmartPointer< vtkDataArray > YCoordinates
Point coordinate arrays of the rectilinear grid.
vtkSmartPointer< vtkDataArray > XCoordinates
Point coordinate arrays of the rectilinear grid.
RectilinearGridBlockStructure(vtkRectilinearGrid *grid, const RectilinearGridInformation &info)
Copy constructor.
RectilinearGridBlockStructure(const int extent[6], int dim, vtkDataArray *xCoordinates, vtkDataArray *yCoordinates, vtkDataArray *zCoordinates)
Constructor taking the extent (without ghosts) of the neighboring vtkRectilinearGrid,...
vtkSmartPointer< vtkDataArray > YCoordinates
Point coordinates without ghosts.
vtkSmartPointer< vtkDataArray > XCoordinates
Point coordinates without ghosts.
vtkSmartPointer< vtkDataArray > CoordinateGhosts[6]
Coordinates of ghosts copied from connected neighbors.
vtkSmartPointer< vtkDataArray > ZCoordinates
Point coordinates without ghosts.
int ExtentId
Index of the extent of the current grid.
int EndY
End point extent coordinate in the y dimension.
int StartY
Start point extent coordinate in the y dimension.
int EndX
End point extent coordinate in the x dimension.
int StartX
Start point extent coordinate in the x dimension.
Block structure storing information being communicated by neighboring blocks for vtkStructuredGrid.
vtkNew< vtkPoints > GhostPoints
Buffer to store received ghost points from neighboring blocks.
vtkSmartPointer< vtkPoints > OuterPointLayers[6]
Point coordinate arrays of the structured grid.
StructuredGridBlockStructure(vtkStructuredGrid *grid, const StructuredGridInformation &info)
Copy constructor.
StructuredGridBlockStructure(const int extent[6], int dim, vtkDataArray *points[6])
Constructor taking the extent (without ghosts) of the neighboring vtkStructuredGrid,...
This structure represents the set of points and their corresponding extent of an external face of the...
ExtentType Extent
Extent (which represents a 2D, 1D, or 0D grid), of an external face.
vtkSmartPointer< vtkPoints > Points
Points of an external face.
OuterPointLayersType OuterPointLayers[6]
Array of 6 external faces.
vtkPoints * InputPoints
Handle on input points for current block.
vtkSmartPointer< vtkIdTypeArray > GhostGlobalPointIds
Point global ids sent to us by neighboring block, if present.
std::map< vtkIdType, vtkIdType > RedirectionMapForDuplicatePointIds
This is a mapping from points that have been sent by the current neighboring block and have already b...
vtkNew< vtkIdList > PointIdsToSend
This lists the ids of the points that we own and need to send to the current neighboring block.
vtkSmartPointer< vtkIdTypeArray > ReceivedSharedPointIds
It can happen that a point can be sent by multiple blocks.
vtkNew< vtkIdTypeArray > SharedPointIds
It can happen that a point can be sent by multiple blocks.
vtkNew< vtkIdList > MatchingReceivedPointIds
This lists the matching point ids to the interfacing points that are exchanged with current neighbori...
vtkNew< vtkIdList > CellIdsToSend
This lists the ids of the cells that we own and need to send to the current neighboring block.
vtkNew< vtkIdList > RemappedMatchingReceivedPointIdsSortedLikeTarget
This array describes the same points as MatchingReceivedPointIds, but points are ordered like in the ...
vtkNew< vtkPoints > GhostPoints
Ghost points sent by the current neighboring block.
vtkNew< vtkPoints > InterfacingPoints
These are the interfacing points sent by the current neighboring block.
vtkSmartPointer< vtkIdTypeArray > InterfacingGlobalPointIds
Point global ids of the interfacing surface sent to us by corresponding block, if present.
vtkSmartPointer< vtkFieldData > InterfacingPointData
Point data at the interface sent by our neighbor.
vtkIdTypeArray * InterfacePointIds
Handle to the local point ids of the surface of the input.
vtkSmartPointer< vtkIdList > InputToOutputPointIdRedirectionMap
When the input has ghosts, this map is being used to copy input points / point data into the output (...
vtkIdType NumberOfInputPoints
Number of input points / cell in the input when ghosts are removed.
vtkSmartPointer< vtkIdList > OutputToInputCellIdRedirectionMap
When the input has ghosts, this map is being used to copy input cells / cell data into the output (wi...
vtkIdType NumberOfInputCells
Number of input points / cell in the input when ghosts are removed.
vtkSmartPointer< vtkPointSet > Interface
The interface of the input: the points of its surface, which may be shared with its neighboring block...
vtkDataArray * InterfacePoints
Handle to the points of the surface of the input.
vtkSmartPointer< vtkIdTypeArray > InterfaceGlobalPointIds
Handle to the point ids of the input surface, if present.
vtkSmartPointer< vtkIdList > OutputToInputPointIdRedirectionMap
When the input has ghosts, this map is being used to copy input points / point data into the output (...
vtkBoundingBox BoundingBox
Bounding box of input.
vtkIdType FacesSize
Handle to the faces / connectivity size that we have to send to the neighboring block.
vtkIdType ConnectivitySize
Handle to the faces / connectivity size that we have to send to the neighboring block.
vtkIdType FacesNum
Handle to the faces / connectivity size that we have to send to the neighboring block.
vtkIdType InputConnectivitySize
Cell connectivity array size of the input if the ghost cells are removed.
vtkPolyhedronCellArray * Polyhedra
The polyhedra of the input, nullptr if it has none.
vtkIdType CurrentConnectivitySize
This is a cursor telling how much the output connectivity array is filled.
vtkIdType InputFacesSize
Faces array size of the input if the ghost cells are removed.
vtkIdType CurrentFacesSize
This is a cursor telling the amount of faces information, that has already been added to the output.
vtkIdType InputNumberOfFaces
Number of Faces stored in Faces array of the input if the ghost cells are removed.
vtkIdType CurrentMaxFaceId
This is a cursor telling the amount of faces information, that has already been added to the output.
#define vtkDataArray
int vtkIdType
Definition vtkType.h:366