VTK  9.3.20240916
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 vtkAlgorithm;
87class vtkCellArray;
88class vtkDataArray;
89class vtkDataSet;
90class vtkFieldData;
91class vtkIdList;
92class vtkIdTypeArray;
93class vtkImageData;
94class vtkMatrix3x3;
96class vtkPoints;
97class vtkPointSet;
98class vtkPolyData;
103
104class VTKPARALLELDIY_EXPORT vtkDIYGhostUtilities : public vtkObject
105{
106public:
108 void PrintSelf(ostream& os, vtkIndent indent) override;
109
111
114 using VectorType = std::array<double, 3>;
116 using ExtentType = std::array<int, 6>;
117 template <class T>
118 using BlockMapType = std::map<int, T>;
119 using Links = std::set<int>;
120 using LinkMap = std::vector<Links>;
122
127 template <class DataSetT>
129
130protected:
135 {
136 vtkSmartPointer<vtkFieldData> GhostCellData = nullptr;
137 vtkSmartPointer<vtkFieldData> GhostPointData = nullptr;
138 };
139
141 {
142 virtual ~DataSetInformation() = default;
143
147 virtual bool InputNeedsGhostsPeeledOff() const = 0;
148 };
149
154 {
158 GridBlockStructure(const int* extent, int dim);
159
163 ExtentType Extent = ExtentType{ 1, -1, 1, -1, 1, -1 };
164
170
175
176 ExtentType ReceivedGhostExtent = ExtentType{ 1, -1, 1, -1, 1, -1 };
177
182 unsigned char AdjacencyMask;
183
188 };
189
194 {
195 ~GridInformation() override = default;
196
197 bool InputNeedsGhostsPeeledOff() const override { return this->Extent != this->InputExtent; }
198
202 ExtentType Extent = ExtentType{ 1, -1, 1, -1, 1, -1 };
203
207 ExtentType InputExtent = ExtentType{ 1, -1, 1, -1, 1, -1 };
208
210 };
211
213 {
214 ~ImageDataInformation() override = default;
215
217 };
218
224 {
226
230 ImageDataBlockStructure(const int extent[6], int dim, const double origin[3],
231 const double spacing[3], const double orientationQuaternion[4]);
232 ImageDataBlockStructure(const int extent[6], int dim, const double origin[3],
233 const double spacing[3], vtkMatrix3x3* directionMatrix);
235
240
245
250
255 };
256
258 {
259 ~RectilinearGridInformation() override = default;
260
262
269
275 vtkSmartPointer<vtkDataArray> CoordinateGhosts[6];
276
278 };
279
285 {
290 RectilinearGridBlockStructure(const int extent[6], int dim, vtkDataArray* xCoordinates,
291 vtkDataArray* yCoordinates, vtkDataArray* zCoordinates);
292
297
299
306 };
307
309 {
310 ~StructuredGridInformation() override = default;
311
317 {
322
327 };
328
333 OuterPointLayersType OuterPointLayers[6];
334
339
341 };
342
348 {
353 StructuredGridBlockStructure(const int extent[6], int dim, vtkDataArray* points[6]);
354
359
363 vtkSmartPointer<vtkPoints> OuterPointLayers[6];
364
369 struct Grid2D
370 {
374 int StartX = 0;
375
379 int StartY = 0;
380
384 int EndX = 0;
385
389 int EndY = 0;
390
394 int XOrientation = 0;
395
399 int YOrientation = 0;
400
405 int ExtentId = -1;
406 };
407
414
419 };
420
422 {
424 {
425 return this->OutputToInputCellIdRedirectionMap != nullptr;
426 }
427
432
437 vtkSmartPointer<vtkIdList> OutputToInputCellIdRedirectionMap = nullptr;
438
440
444 vtkSmartPointer<vtkIdList> InputToOutputPointIdRedirectionMap = nullptr;
445 vtkSmartPointer<vtkIdList> OutputToInputPointIdRedirectionMap = nullptr;
447
454
461
466
471
473 /*
474 * This is a cursor telling the amount of points / cells information,
475 * that has
476 * already been added to the output. This variable is used at the very end of the pipeline.
477 */
481
483
489 };
490
492 {
498
504
510
514 vtkSmartPointer<vtkIdTypeArray> InterfacingGlobalPointIds = nullptr;
515
520 vtkSmartPointer<vtkIdTypeArray> GhostGlobalPointIds = nullptr;
521
526
532
534
543
548 std::map<vtkIdType, vtkIdType> RedirectionMapForDuplicatePointIds;
549
555
561 };
562
564 {
569 vtkIdType CurrentFacesSize = 0;
570
575 vtkIdType CurrentMaxFaceId = 0;
576
581 vtkIdType CurrentConnectivitySize = 0;
582
583 vtkCellArray* Faces = nullptr;
584 vtkCellArray* FaceLocations = nullptr;
585
587
591 vtkIdType InputConnectivitySize = 0;
592
596 vtkIdType InputFacesSize = 0;
597
601 vtkIdType InputNumberOfFaces = 0;
602 };
603
605 {
610 {
613 vtkSmartPointer<vtkCellArray> FaceLocations = nullptr;
615 };
616
619
621
624 vtkIdType FacesSize = 0;
625 vtkIdType FacesNum = 0;
626 vtkIdType ConnectivitySize = 0;
628 };
629
631 {
633
635
643
645
649 vtkIdType CurrentMaxPolyId = 0;
650 vtkIdType CurrentMaxStripId = 0;
651 vtkIdType CurrentMaxLineId = 0;
653
655
663
665
673
675
684 };
685
687 {
689
697
699 {
703 };
704
707
709
712 vtkIdType NumberOfPolysToSend = 0;
713 vtkIdType NumberOfStripsToSend = 0;
714 vtkIdType NumberOfLinesToSend = 0;
716
718
721 vtkIdType PolyConnectivitySize = 0;
722 vtkIdType StripConnectivitySize = 0;
723 vtkIdType LineConnectivitySize = 0;
725 };
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>
748 struct Block
749 {
751
754 typedef BlockStructureT BlockStructureType;
755 typedef InformationT InformationType;
757
762
768
770
772
775 };
776
778
788
796 static int SynchronizeGhostData(std::vector<vtkDataSet*>& inputsDS,
797 std::vector<vtkDataSet*>& outputsDS, vtkMultiProcessController* controller, bool syncCell,
798 bool SyncPoint);
799
808 template <class DataSetT>
809 static int GenerateGhostCells(std::vector<DataSetT*>& inputsDS, std::vector<DataSetT*>& outputsDS,
810 int outputGhostLevels, vtkMultiProcessController* controller);
811
813
818 static int GenerateGhostCellsImageData(std::vector<vtkImageData*>& inputs,
819 std::vector<vtkImageData*>& outputs, int outputGhostLevels,
820 vtkMultiProcessController* controller);
821 static int GenerateGhostCellsRectilinearGrid(std::vector<vtkRectilinearGrid*>& inputs,
822 std::vector<vtkRectilinearGrid*>& outputs, int outputGhostLevels,
823 vtkMultiProcessController* controller);
824 static int GenerateGhostCellsStructuredGrid(std::vector<vtkStructuredGrid*>& inputs,
825 std::vector<vtkStructuredGrid*>& outputs, int outputGhostLevels,
826 vtkMultiProcessController* controller);
827 static int GenerateGhostCellsPolyData(std::vector<vtkPolyData*>& inputs,
828 std::vector<vtkPolyData*>& outputs, int outputGhostLevels,
829 vtkMultiProcessController* controller);
830 static int GenerateGhostCellsUnstructuredGrid(std::vector<vtkUnstructuredGrid*>& inputs,
831 std::vector<vtkUnstructuredGrid*>& outputs, int outputGhostLevels,
832 vtkMultiProcessController* controller);
834
835protected:
838
840
844 static void CloneInputData(std::vector<vtkDataSet*>& inputs, std::vector<vtkDataSet*>& outputs,
845 bool syncCell, bool syncPoint);
846 static void CloneInputData(vtkDataSet* input, vtkDataSet* output, int fieldType);
848
850
853 static void InitializeBlocks(
854 diy::Master& master, std::vector<vtkDataSet*>& inputs, bool syncCell, bool syncPoint);
855 static void InitializeBlocks(
856 diy::Master& master, std::vector<vtkDataSet*>& inputs, int fieldType, unsigned char ghostFlag);
858
860
864 static void ExchangeNeededIds(
865 diy::Master& master, const vtkDIYExplicitAssigner& assigner, bool syncCell, bool syncPoint);
866 static void ExchangeNeededIds(
867 diy::Master& master, const vtkDIYExplicitAssigner& assigner, int fieldType);
869
871
876 const diy::Master& master, bool syncCell, bool syncPoint);
878 Links& links, vtkDIYGhostUtilities::DataSetBlock* block, int fieldType);
880
882
885 static void ExchangeFieldData(diy::Master& master, std::vector<vtkDataSet*>& inputs,
886 std::vector<vtkDataSet*>& outputs, bool syncCell, bool syncPoint);
887 static void ExchangeFieldData(diy::Master& master, std::vector<vtkDataSet*>& inputs,
888 std::vector<vtkDataSet*>& outputs, int fieldType);
890
894 static void ReinitializeSelectedBits(vtkUnsignedCharArray* ghosts, unsigned char mask);
895
900 template <class DataSetT>
902 typename DataSetTypeToBlockTypeConverter<DataSetT>::BlockType* block, DataSetT* output);
903
908 template <class DataSetT>
910 typename DataSetTypeToBlockTypeConverter<DataSetT>::BlockType* block, DataSetT* output);
911
913
917 std::vector<vtkImageData*>& inputs, std::vector<vtkImageData*>& outputs);
919 std::vector<vtkRectilinearGrid*>& inputs, std::vector<vtkRectilinearGrid*>& outputs);
921 std::vector<vtkStructuredGrid*>& inputs, std::vector<vtkStructuredGrid*>& outputs);
923 std::vector<vtkUnstructuredGrid*>& inputs, std::vector<vtkUnstructuredGrid*>& outputs);
925 std::vector<vtkPolyData*>& inputs, std::vector<vtkPolyData*>& outputs);
927
929
935 static void InitializeBlocks(diy::Master& master, std::vector<vtkImageData*>& inputs);
936 static void InitializeBlocks(diy::Master& master, std::vector<vtkRectilinearGrid*>& inputs);
937 static void InitializeBlocks(diy::Master& master, std::vector<vtkStructuredGrid*>& inputs);
938 static void InitializeBlocks(diy::Master& master, std::vector<vtkUnstructuredGrid*>& inputs);
939 static void InitializeBlocks(diy::Master& master, std::vector<vtkPolyData*>& inputs);
941
945 template <class DataSetT>
947 diy::Master& master, const vtkDIYExplicitAssigner& assigner, std::vector<DataSetT*>& inputs);
948
949 template <class BlockT>
950 static LinkMap ComputeLinkMapUsingBoundingBoxes(const diy::Master& master);
951
953
959 static void ExchangeBlockStructures(diy::Master& master, std::vector<vtkImageData*>& inputs);
961 diy::Master& master, std::vector<vtkRectilinearGrid*>& inputs);
962 static void ExchangeBlockStructures(diy::Master& master, std::vector<vtkStructuredGrid*>& inputs);
964 diy::Master& master, std::vector<vtkUnstructuredGrid*>& inputs);
965 static void ExchangeBlockStructures(diy::Master& master, std::vector<vtkPolyData*>& inputs);
967
969
975 const diy::Master& master, std::vector<vtkImageData*>& inputs, int outputGhostLevels);
977 const diy::Master& master, std::vector<vtkRectilinearGrid*>& inputs, int outputGhostLevels);
979 const diy::Master& master, std::vector<vtkStructuredGrid*>& inputs, int outputGhostLevels);
981 const diy::Master& master, std::vector<vtkUnstructuredGrid*>& inputs, int outputGhostLevels);
983 const diy::Master& master, std::vector<vtkPolyData*>& inputs, int outputGhostLevels);
985
987
991 static void EnqueueGhosts(const diy::Master::ProxyWithLink& cp, const diy::BlockID& blockId,
992 vtkImageData* input, ImageDataBlock* block);
993 static void EnqueueGhosts(const diy::Master::ProxyWithLink& cp, const diy::BlockID& blockId,
995 static void EnqueueGhosts(const diy::Master::ProxyWithLink& cp, const diy::BlockID& blockId,
997 static void EnqueueGhosts(const diy::Master::ProxyWithLink& cp, const diy::BlockID& blockId,
999 static void EnqueueGhosts(const diy::Master::ProxyWithLink& cp, const diy::BlockID& blockId,
1000 vtkPolyData* input, PolyDataBlock* block);
1002
1004
1009 static void DequeueGhosts(
1010 const diy::Master::ProxyWithLink& cp, int gid, ImageDataBlockStructure& blockStructure);
1011 static void DequeueGhosts(
1012 const diy::Master::ProxyWithLink& cp, int gid, RectilinearGridBlockStructure& blockStructure);
1013 static void DequeueGhosts(
1014 const diy::Master::ProxyWithLink& cp, int gid, StructuredGridBlockStructure& blockStructure);
1015 static void DequeueGhosts(
1016 const diy::Master::ProxyWithLink& cp, int gid, UnstructuredGridBlockStructure& blockStructure);
1017 static void DequeueGhosts(
1018 const diy::Master::ProxyWithLink& cp, int gid, PolyDataBlockStructure& blockStructure);
1020
1025 template <class DataSetT>
1026 static void CopyInputsAndAllocateGhosts(diy::Master& master, diy::Assigner& assigner,
1027 diy::RegularAllReducePartners& partners, std::vector<DataSetT*>& inputs,
1028 std::vector<DataSetT*>& outputs, int outputGhostLevels);
1029
1031
1037 ImageDataBlock* block, vtkImageData* input, vtkImageData* outputs);
1045 PolyDataBlock* block, vtkPolyData* input, vtkPolyData* outputs);
1047
1051 template <class DataSetT>
1052 static bool ExchangeGhosts(diy::Master& master, diy::Assigner& assigner,
1053 diy::RegularAllReducePartners& partners, std::vector<DataSetT*>& inputs);
1054
1058 template <class DataSetT>
1060 diy::Master& master, std::vector<DataSetT*>& outputs, int outputGhostLevels);
1061
1066 template <class DataSetT>
1067 static void AddGhostArrays(diy::Master& master, std::vector<DataSetT*>& outputs);
1068
1070
1073 static void FillGhostArrays(
1074 const diy::Master& master, std::vector<vtkImageData*>& outputs, int outputGhostLevels);
1075 static void FillGhostArrays(
1076 const diy::Master& master, std::vector<vtkRectilinearGrid*>& outputs, int outputGhostLevels);
1077 static void FillGhostArrays(
1078 const diy::Master& master, std::vector<vtkStructuredGrid*>& outputs, int outputGhostLevels);
1079 static void FillGhostArrays(
1080 const diy::Master& master, std::vector<vtkUnstructuredGrid*>& outputs, int outputGhostLevels);
1081 static void FillGhostArrays(
1082 const diy::Master& master, std::vector<vtkPolyData*>& outputs, int outputGhostLevels);
1084
1085private:
1087 void operator=(const vtkDIYGhostUtilities&) = delete;
1088
1090
1097 static void InflateBoundingBoxIfNecessary(
1098 vtkDataSet* vtkNotUsed(input), vtkBoundingBox& vtkNotUsed(bb));
1099 static void InflateBoundingBoxIfNecessary(vtkPointSet* input, vtkBoundingBox& bb);
1101};
1102
1103VTK_ABI_NAMESPACE_END
1104#include "vtkDIYGhostUtilities.txx" // for template implementations
1105
1106#endif
abstract class to quickly locate points in 3-space
Superclass for all sources, filters, and sinks in VTK.
Fast, simple class for representing and operating on 3D bounds.
object to represent cell connectivity
assigner for use with DIY
Utilities to produce ghost cells between a collection of data sets of same type.
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 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 DeepCopyInputAndAllocateGhosts(UnstructuredGridBlock *block, vtkUnstructuredGrid *input, vtkUnstructuredGrid *outputs)
Method to be overloaded for each supported input data set type, This method allocates ghosts in the o...
static void DeepCopyInputAndAllocateGhosts(PolyDataBlock *block, vtkPolyData *input, vtkPolyData *outputs)
Method to be overloaded for each supported input data set type, This method allocates ghosts in the o...
static void FillGhostArrays(const diy::Master &master, std::vector< vtkRectilinearGrid * > &outputs, int outputGhostLevels)
This method sets the ghost arrays in the output.
static void ExchangeBlockStructures(diy::Master &master, std::vector< vtkRectilinearGrid * > &inputs)
Method to be overloaded for each supported type of input data set.
static LinkMap ComputeLinkMap(const diy::Master &master, std::vector< vtkRectilinearGrid * > &inputs, int outputGhostLevels)
Method to be overloaded for each supported input data set type, that computes the minimal link map be...
static LinkMap ComputeLinkMap(const diy::Master &master, std::vector< vtkUnstructuredGrid * > &inputs, int outputGhostLevels)
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< 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 ComputeLinksUsingNeededIds(Links &links, vtkDIYGhostUtilities::DataSetBlock *block, int fieldType)
Compute link map using known information from blocks, eg.
static void InitializeBlocks(diy::Master &master, std::vector< vtkStructuredGrid * > &inputs)
Method to be overloaded for each supported type of input data set.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
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 int GenerateGhostCellsRectilinearGrid(std::vector< vtkRectilinearGrid * > &inputs, std::vector< vtkRectilinearGrid * > &outputs, int outputGhostLevels, vtkMultiProcessController *controller)
Method that can be used to avoid the compile-time overhead of the templated method GenerateGhostCells...
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.
static void DeepCopyInputAndAllocateGhosts(StructuredGridBlock *block, vtkStructuredGrid *input, vtkStructuredGrid *outputs)
Method to be overloaded for each supported input data set type, This method allocates ghosts in the o...
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.
static int GenerateGhostCellsStructuredGrid(std::vector< vtkStructuredGrid * > &inputs, std::vector< vtkStructuredGrid * > &outputs, int outputGhostLevels, vtkMultiProcessController *controller)
Method that can be used to avoid the compile-time overhead of the templated method GenerateGhostCells...
std::set< int > Links
Convenient typedefs.
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.
static void CopyInputsAndAllocateGhosts(diy::Master &master, diy::Assigner &assigner, diy::RegularAllReducePartners &partners, std::vector< DataSetT * > &inputs, std::vector< DataSetT * > &outputs, int outputGhostLevels)
Copy the inputs into the outputs.
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 ExchangeBoundingBoxes(diy::Master &master, const vtkDIYExplicitAssigner &assigner, std::vector< DataSetT * > &inputs)
This method exchanges the bounding boxes among blocks.
static void FillGhostArrays(const diy::Master &master, std::vector< vtkUnstructuredGrid * > &outputs, int outputGhostLevels)
This method sets the ghost arrays in the output.
static int GenerateGhostCellsPolyData(std::vector< vtkPolyData * > &inputs, std::vector< vtkPolyData * > &outputs, int outputGhostLevels, vtkMultiProcessController *controller)
Method that can be used to avoid the compile-time overhead of the templated method GenerateGhostCells...
static void DeepCopyInputAndAllocateGhosts(ImageDataBlock *block, vtkImageData *input, vtkImageData *outputs)
Method to be overloaded for each supported input data set type, This method allocates ghosts in the o...
~vtkDIYGhostUtilities() override
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.
static LinkMap ComputeLinkMap(const diy::Master &master, std::vector< vtkStructuredGrid * > &inputs, int outputGhostLevels)
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, vtkStructuredGrid *input, StructuredGridBlock *block)
This method enqueues ghosts between communicating blocks.
static int GenerateGhostCellsImageData(std::vector< vtkImageData * > &inputs, std::vector< vtkImageData * > &outputs, int outputGhostLevels, vtkMultiProcessController *controller)
Method that can be used to avoid the compile-time overhead of the templated method GenerateGhostCells...
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 ExchangeBlockStructures(diy::Master &master, std::vector< vtkImageData * > &inputs)
Method to be overloaded for each supported type of input data set.
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.
std::map< int, T > BlockMapType
Convenient typedefs.
std::array< int, 6 > ExtentType
Convenient typedefs.
static void ExchangeBlockStructures(diy::Master &master, std::vector< vtkPolyData * > &inputs)
Method to be overloaded for each supported type of input data set.
static void DequeueGhosts(const diy::Master::ProxyWithLink &cp, int gid, PolyDataBlockStructure &blockStructure)
This method dequeues ghosts sent between communicating blocks.
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< vtkUnstructuredGrid * > &inputs)
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.
static LinkMap ComputeLinkMap(const diy::Master &master, std::vector< vtkPolyData * > &inputs, int outputGhostLevels)
Method to be overloaded for each supported input data set type, that computes the minimal link map be...
std::vector< Links > LinkMap
Convenient 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 void EnqueueGhosts(const diy::Master::ProxyWithLink &cp, const diy::BlockID &blockId, vtkRectilinearGrid *input, RectilinearGridBlock *block)
This method enqueues ghosts between communicating blocks.
static int GenerateGhostCellsUnstructuredGrid(std::vector< vtkUnstructuredGrid * > &inputs, std::vector< vtkUnstructuredGrid * > &outputs, int outputGhostLevels, vtkMultiProcessController *controller)
Method that can be used to avoid the compile-time overhead of the templated method GenerateGhostCells...
static void DeepCopyInputAndAllocateGhosts(RectilinearGridBlock *block, vtkRectilinearGrid *input, vtkRectilinearGrid *outputs)
Method to be overloaded for each supported input data set type, This method allocates ghosts in the o...
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 LinkMap ComputeLinkMap(const diy::Master &master, std::vector< vtkImageData * > &inputs, int outputGhostLevels)
Method to be overloaded for each supported input data set type, that computes the minimal link map be...
static void InitializeBlocks(diy::Master &master, std::vector< vtkRectilinearGrid * > &inputs)
Method to be overloaded for each supported type of input data set.
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 int GenerateGhostCells(std::vector< DataSetT * > &inputsDS, std::vector< DataSetT * > &outputsDS, int outputGhostLevels, vtkMultiProcessController *controller)
Main pipeline generating ghosts.
static void ExchangeBlockStructures(diy::Master &master, std::vector< vtkStructuredGrid * > &inputs)
Method to be overloaded for each supported type of input data set.
abstract superclass for arrays of numeric data
abstract class to specify dataset behavior
Definition vtkDataSet.h:166
represent and manipulate fields of data
list of point or cell ids
Definition vtkIdList.h:133
dynamic, self-adjusting array of vtkIdType
topologically and geometrically regular array of data
a simple class to control print indentation
Definition vtkIndent.h:108
represent and manipulate 3x3 transformation matrices
Multiprocessing communication superclass.
Allocate and hold a VTK object.
Definition vtkNew.h:167
abstract base class for most VTK objects
Definition vtkObject.h:162
concrete class for storing a set of points
Definition vtkPointSet.h:98
represent and manipulate 3D points
Definition vtkPoints.h:139
concrete dataset represents vertices, lines, polygons, and triangle strips
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.
vtkSmartPointer< vtkUnsignedCharArray > GhostPointArray
BlockMapType< vtkBoundingBox > NeighborBoundingBoxes
BlockStructureT BlockStructureType
Typedef handle on block structure and block information.
vtkSmartPointer< vtkUnsignedCharArray > GhostCellArray
BlockMapType< BlockStructureType > BlockStructures
BlockStructures maps a neighboring block globald id to its block structure.
InformationT InformationType
Typedef handle on block structure and block information.
InformationType Information
InformationT holds any information from the current block that is necessary to exchange ghosts.
Base block structure for data sets.
virtual bool InputNeedsGhostsPeeledOff() const =0
This helper structure owns a typedef to the block type of DataSetT used with diy to generate ghosts.
Structure to inherit from for data sets having a structured grid topology.
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 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.
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...
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.
vtkNew< vtkIdList > PolyIdsToSend
This lists the ids of the cells that we own and need to send to the current neighboring block.
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.
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 > ZCoordinates
Point coordinates without ghosts.
Block structure storing information being communicated by neighboring blocks for vtkStructuredGrid.
vtkNew< vtkPoints > GhostPoints
Buffer to store received ghost points from neighboring blocks.
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.
vtkPoints * InputPoints
Handle on input points for current block.
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< 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.
vtkIdType NumberOfInputPoints
Number of input points / cell in the input when ghosts are removed.
vtkIdType NumberOfInputCells
Number of input points / cell in the input when ghosts are removed.
vtkDataArray * InterfacePoints
Handle to the points of the surface of the input.
vtkSmartPointer< vtkAlgorithm > InterfaceExtractor
Filter that is being used to extract the surface of the input.
vtkSmartPointer< vtkIdTypeArray > InterfaceGlobalPointIds
Handle to the point ids of the input surface, if present.
vtkBoundingBox BoundingBox
Bounding box of input.
int vtkIdType
Definition vtkType.h:315