VTK  9.3.0
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 "vtkObject.h"
66 #include "vtkParallelDIYModule.h" // For export macros
67 #include "vtkQuaternion.h" // For vtkImageData
68 #include "vtkSmartPointer.h" // For vtkSmartPointer
69 
70 #include <array> // For VectorType and ExtentType
71 #include <map> // For BlockMapType
72 #include <set> // For Link
73 #include <vector> // For LinkMap
74 
75 // clang-format off
76 #include "vtk_diy2.h" // Third party include
77 #include VTK_DIY2(diy/assigner.hpp)
78 #include VTK_DIY2(diy/master.hpp)
79 #include VTK_DIY2(diy/partners/all-reduce.hpp)
80 // clang-format on
81 
82 VTK_ABI_NAMESPACE_BEGIN
84 class vtkAlgorithm;
85 class vtkCellArray;
86 class vtkDataArray;
87 class vtkDataSet;
88 class vtkFieldData;
89 class vtkIdList;
90 class vtkIdTypeArray;
91 class vtkImageData;
92 class vtkMatrix3x3;
94 class vtkPoints;
95 class vtkPointSet;
96 class vtkPolyData;
97 class vtkRectilinearGrid;
98 class vtkStructuredGrid;
100 class vtkUnstructuredGrid;
101 
102 class VTKPARALLELDIY_EXPORT vtkDIYGhostUtilities : public vtkObject
103 {
104 public:
106  void PrintSelf(ostream& os, vtkIndent indent) override;
107 
109 
112  using VectorType = std::array<double, 3>;
114  using ExtentType = std::array<int, 6>;
115  template <class T>
116  using BlockMapType = std::map<int, T>;
117  using Links = std::set<int>;
118  using LinkMap = std::vector<Links>;
120 
125  template <class DataSetT>
127 
128 protected:
133  {
134  vtkSmartPointer<vtkFieldData> GhostCellData = nullptr;
135  vtkSmartPointer<vtkFieldData> GhostPointData = nullptr;
136  };
137 
139  {
140  virtual ~DataSetInformation() = default;
141 
145  virtual bool InputNeedsGhostsPeeledOff() const = 0;
146  };
147 
152  {
156  GridBlockStructure(const int* extent, int dim);
157 
161  ExtentType Extent = ExtentType{ 1, -1, 1, -1, 1, -1 };
162 
168 
173 
174  ExtentType ReceivedGhostExtent = ExtentType{ 1, -1, 1, -1, 1, -1 };
175 
180  unsigned char AdjacencyMask;
181 
186  };
187 
192  {
193  ~GridInformation() override = default;
194 
195  bool InputNeedsGhostsPeeledOff() const override { return this->Extent != this->InputExtent; }
196 
200  ExtentType Extent = ExtentType{ 1, -1, 1, -1, 1, -1 };
201 
205  ExtentType InputExtent = ExtentType{ 1, -1, 1, -1, 1, -1 };
206 
208  };
209 
211  {
212  ~ImageDataInformation() override = default;
213 
215  };
216 
222  {
224 
228  ImageDataBlockStructure(const int extent[6], int dim, const double origin[3],
229  const double spacing[3], const double orientationQuaternion[4]);
230  ImageDataBlockStructure(const int extent[6], int dim, const double origin[3],
231  const double spacing[3], vtkMatrix3x3* directionMatrix);
233 
238 
243 
248 
253  };
254 
256  {
257  ~RectilinearGridInformation() override = default;
258 
260 
267 
273  vtkSmartPointer<vtkDataArray> CoordinateGhosts[6];
274 
276  };
277 
283  {
288  RectilinearGridBlockStructure(const int extent[6], int dim, vtkDataArray* xCoordinates,
289  vtkDataArray* yCoordinates, vtkDataArray* zCoordinates);
290 
295 
297 
304  };
305 
307  {
308  ~StructuredGridInformation() override = default;
309 
315  {
320 
325  };
326 
331  OuterPointLayersType OuterPointLayers[6];
332 
337 
339  };
340 
346  {
352 
357 
361  vtkSmartPointer<vtkPoints> OuterPointLayers[6];
362 
367  struct Grid2D
368  {
372  int StartX = 0;
373 
377  int StartY = 0;
378 
382  int EndX = 0;
383 
387  int EndY = 0;
388 
392  int XOrientation = 0;
393 
397  int YOrientation = 0;
398 
403  int ExtentId = -1;
404  };
405 
412 
417  };
418 
420  {
422  {
423  return this->OutputToInputCellIdRedirectionMap != nullptr;
424  };
425 
430 
435  vtkSmartPointer<vtkIdList> OutputToInputCellIdRedirectionMap = nullptr;
436 
438 
442  vtkSmartPointer<vtkIdList> InputToOutputPointIdRedirectionMap = nullptr;
443  vtkSmartPointer<vtkIdList> OutputToInputPointIdRedirectionMap = nullptr;
445 
452 
459 
464 
469 
471  /*
472  * This is a cursor telling the amount of points / cells information,
473  * that has
474  * already been added to the output. This variable is used at the very end of the pipeline.
475  */
479 
481 
487  };
488 
490  {
496 
502 
508 
512  vtkSmartPointer<vtkIdTypeArray> InterfacingGlobalPointIds = nullptr;
513 
518  vtkSmartPointer<vtkIdTypeArray> GhostGlobalPointIds = nullptr;
519 
524 
530 
532 
541 
546  std::map<vtkIdType, vtkIdType> RedirectionMapForDuplicatePointIds;
547 
553 
559  };
560 
562  {
567  vtkIdType CurrentFacesSize = 0;
568 
573  vtkIdType CurrentConnectivitySize = 0;
574 
575  vtkIdTypeArray* Faces = nullptr;
576  vtkIdTypeArray* FaceLocations = nullptr;
577 
579 
583  vtkIdType InputConnectivitySize = 0;
584 
588  vtkIdType InputFacesSize = 0;
589  };
590 
592  {
597  {
600  vtkSmartPointer<vtkIdTypeArray> FaceLocations = nullptr;
602  };
603 
606 
608 
611  vtkIdType FacesSize = 0;
612  vtkIdType ConnectivitySize = 0;
614  };
615 
617  {
619 
621 
629 
631 
635  vtkIdType CurrentMaxPolyId = 0;
636  vtkIdType CurrentMaxStripId = 0;
637  vtkIdType CurrentMaxLineId = 0;
639 
641 
649 
651 
659 
661 
670  };
671 
673  {
675 
683 
685  {
689  };
690 
693 
695 
698  vtkIdType NumberOfPolysToSend = 0;
699  vtkIdType NumberOfStripsToSend = 0;
700  vtkIdType NumberOfLinesToSend = 0;
702 
704 
707  vtkIdType PolyConnectivitySize = 0;
708  vtkIdType StripConnectivitySize = 0;
709  vtkIdType LineConnectivitySize = 0;
711  };
712 
713 public:
722  template <class BlockStructureT, class InformationT>
723  struct Block
724  {
726 
729  typedef BlockStructureT BlockStructureType;
730  typedef InformationT InformationType;
732 
737 
743 
745 
747 
750  };
751 
753 
763 
772  template <class DataSetT>
773  static int GenerateGhostCells(std::vector<DataSetT*>& inputsDS, std::vector<DataSetT*>& outputsDS,
774  int outputGhostLevels, vtkMultiProcessController* controller);
775 
777 
782  static int GenerateGhostCellsImageData(std::vector<vtkImageData*>& inputs,
783  std::vector<vtkImageData*>& outputs, int outputGhostLevels,
784  vtkMultiProcessController* controller);
785  static int GenerateGhostCellsRectilinearGrid(std::vector<vtkRectilinearGrid*>& inputs,
786  std::vector<vtkRectilinearGrid*>& outputs, int outputGhostLevels,
787  vtkMultiProcessController* controller);
788  static int GenerateGhostCellsStructuredGrid(std::vector<vtkStructuredGrid*>& inputs,
789  std::vector<vtkStructuredGrid*>& outputs, int outputGhostLevels,
790  vtkMultiProcessController* controller);
791  static int GenerateGhostCellsPolyData(std::vector<vtkPolyData*>& inputs,
792  std::vector<vtkPolyData*>& outputs, int outputGhostLevels,
793  vtkMultiProcessController* controller);
794  static int GenerateGhostCellsUnstructuredGrid(std::vector<vtkUnstructuredGrid*>& inputs,
795  std::vector<vtkUnstructuredGrid*>& outputs, int outputGhostLevels,
796  vtkMultiProcessController* controller);
798 
799 protected:
802 
806  static void ReinitializeSelectedBits(vtkUnsignedCharArray* ghosts, unsigned char mask);
807 
812  template <class DataSetT>
814  typename DataSetTypeToBlockTypeConverter<DataSetT>::BlockType* block, DataSetT* output);
815 
820  template <class DataSetT>
822  typename DataSetTypeToBlockTypeConverter<DataSetT>::BlockType* block, DataSetT* output);
823 
825 
829  std::vector<vtkImageData*>& inputs, std::vector<vtkImageData*>& outputs);
831  std::vector<vtkRectilinearGrid*>& inputs, std::vector<vtkRectilinearGrid*>& outputs);
833  std::vector<vtkStructuredGrid*>& inputs, std::vector<vtkStructuredGrid*>& outputs);
835  std::vector<vtkUnstructuredGrid*>& inputs, std::vector<vtkUnstructuredGrid*>& outputs);
837  std::vector<vtkPolyData*>& inputs, std::vector<vtkPolyData*>& outputs);
839 
841 
847  static void InitializeBlocks(diy::Master& master, std::vector<vtkImageData*>& inputs);
848  static void InitializeBlocks(diy::Master& master, std::vector<vtkRectilinearGrid*>& inputs);
849  static void InitializeBlocks(diy::Master& master, std::vector<vtkStructuredGrid*>& inputs);
850  static void InitializeBlocks(diy::Master& master, std::vector<vtkUnstructuredGrid*>& inputs);
851  static void InitializeBlocks(diy::Master& master, std::vector<vtkPolyData*>& inputs);
853 
857  template <class DataSetT>
859  diy::Master& master, const vtkDIYExplicitAssigner& assigner, std::vector<DataSetT*>& inputs);
860 
861  template <class BlockT>
862  static LinkMap ComputeLinkMapUsingBoundingBoxes(const diy::Master& master);
863 
865 
871  static void ExchangeBlockStructures(diy::Master& master, std::vector<vtkImageData*>& inputs);
873  diy::Master& master, std::vector<vtkRectilinearGrid*>& inputs);
874  static void ExchangeBlockStructures(diy::Master& master, std::vector<vtkStructuredGrid*>& inputs);
876  diy::Master& master, std::vector<vtkUnstructuredGrid*>& inputs);
877  static void ExchangeBlockStructures(diy::Master& master, std::vector<vtkPolyData*>& inputs);
879 
881 
887  const diy::Master& master, std::vector<vtkImageData*>& inputs, int outputGhostLevels);
889  const diy::Master& master, std::vector<vtkRectilinearGrid*>& inputs, int outputGhostLevels);
891  const diy::Master& master, std::vector<vtkStructuredGrid*>& inputs, int outputGhostLevels);
893  const diy::Master& master, std::vector<vtkUnstructuredGrid*>& inputs, int outputGhostLevels);
895  const diy::Master& master, std::vector<vtkPolyData*>& inputs, int outputGhostLevels);
897 
899 
903  static void EnqueueGhosts(const diy::Master::ProxyWithLink& cp, const diy::BlockID& blockId,
904  vtkImageData* input, ImageDataBlock* block);
905  static void EnqueueGhosts(const diy::Master::ProxyWithLink& cp, const diy::BlockID& blockId,
907  static void EnqueueGhosts(const diy::Master::ProxyWithLink& cp, const diy::BlockID& blockId,
908  vtkStructuredGrid* input, StructuredGridBlock* block);
909  static void EnqueueGhosts(const diy::Master::ProxyWithLink& cp, const diy::BlockID& blockId,
911  static void EnqueueGhosts(const diy::Master::ProxyWithLink& cp, const diy::BlockID& blockId,
912  vtkPolyData* input, PolyDataBlock* block);
914 
916 
921  static void DequeueGhosts(
922  const diy::Master::ProxyWithLink& cp, int gid, ImageDataBlockStructure& blockStructure);
923  static void DequeueGhosts(
924  const diy::Master::ProxyWithLink& cp, int gid, RectilinearGridBlockStructure& blockStructure);
925  static void DequeueGhosts(
926  const diy::Master::ProxyWithLink& cp, int gid, StructuredGridBlockStructure& blockStructure);
927  static void DequeueGhosts(
928  const diy::Master::ProxyWithLink& cp, int gid, UnstructuredGridBlockStructure& blockStructure);
929  static void DequeueGhosts(
930  const diy::Master::ProxyWithLink& cp, int gid, PolyDataBlockStructure& blockStructure);
932 
937  template <class DataSetT>
938  static void CopyInputsAndAllocateGhosts(diy::Master& master, diy::Assigner& assigner,
939  diy::RegularAllReducePartners& partners, std::vector<DataSetT*>& inputs,
940  std::vector<DataSetT*>& outputs, int outputGhostLevels);
941 
943 
949  ImageDataBlock* block, vtkImageData* input, vtkImageData* outputs);
953  StructuredGridBlock* block, vtkStructuredGrid* input, vtkStructuredGrid* outputs);
957  PolyDataBlock* block, vtkPolyData* input, vtkPolyData* outputs);
959 
963  template <class DataSetT>
964  static bool ExchangeGhosts(diy::Master& master, diy::Assigner& assigner,
965  diy::RegularAllReducePartners& partners, std::vector<DataSetT*>& inputs);
966 
970  template <class DataSetT>
972  diy::Master& master, std::vector<DataSetT*>& outputs, int outputGhostLevels);
973 
978  template <class DataSetT>
979  static void AddGhostArrays(diy::Master& master, std::vector<DataSetT*>& outputs);
980 
982 
985  static void FillGhostArrays(
986  const diy::Master& master, std::vector<vtkImageData*>& outputs, int outputGhostLevels);
987  static void FillGhostArrays(
988  const diy::Master& master, std::vector<vtkRectilinearGrid*>& outputs, int outputGhostLevels);
989  static void FillGhostArrays(
990  const diy::Master& master, std::vector<vtkStructuredGrid*>& outputs, int outputGhostLevels);
991  static void FillGhostArrays(
992  const diy::Master& master, std::vector<vtkUnstructuredGrid*>& outputs, int outputGhostLevels);
993  static void FillGhostArrays(
994  const diy::Master& master, std::vector<vtkPolyData*>& outputs, int outputGhostLevels);
996 
997 private:
999  void operator=(const vtkDIYGhostUtilities&) = delete;
1000 
1002 
1009  static void InflateBoundingBoxIfNecessary(
1010  vtkDataSet* vtkNotUsed(input), vtkBoundingBox& vtkNotUsed(bb));
1011  static void InflateBoundingBoxIfNecessary(vtkPointSet* input, vtkBoundingBox& bb);
1013 };
1014 
1015 VTK_ABI_NAMESPACE_END
1016 #include "vtkDIYGhostUtilities.txx" // for template implementations
1017 
1018 #endif
abstract class to quickly locate points in 3-space
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:52
Fast, simple class for representing and operating on 3D bounds.
object to represent cell connectivity
Definition: vtkCellArray.h:176
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 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 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 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 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 EnqueueGhosts(const diy::Master::ProxyWithLink &cp, const diy::BlockID &blockId, vtkUnstructuredGrid *input, UnstructuredGridBlock *block)
This method enqueues ghosts between communicating blocks.
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.
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 void ExchangeBlockStructures(diy::Master &master, std::vector< vtkUnstructuredGrid * > &inputs)
Method to be overloaded for each supported type of input data set.
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 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 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
Definition: vtkDataArray.h:45
abstract class to specify dataset behavior
Definition: vtkDataSet.h:53
represent and manipulate fields of data
Definition: vtkFieldData.h:52
list of point or cell ids
Definition: vtkIdList.h:23
dynamic, self-adjusting array of vtkIdType
topologically and geometrically regular array of data
Definition: vtkImageData.h:43
a simple class to control print indentation
Definition: vtkIndent.h:29
represent and manipulate 3x3 transformation matrices
Definition: vtkMatrix3x3.h:26
Multiprocessing communication superclass.
abstract base class for most VTK objects
Definition: vtkObject.h:52
concrete class for storing a set of points
Definition: vtkPointSet.h:59
represent and manipulate 3D points
Definition: vtkPoints.h:29
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:80
a dataset that is topologically regular with variable spacing in the three coordinate directions
topologically regular array of data
dynamic, self-adjusting array of unsigned char
dataset represents arbitrary combinations of all possible cell types
@ points
Definition: vtkX3D.h:446
@ info
Definition: vtkX3D.h:376
@ extent
Definition: vtkX3D.h:345
@ spacing
Definition: vtkX3D.h:481
@ image
Definition: vtkX3D.h:374
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,...
Grid2D GridInterface
2D grid interfacing 2 blocks.
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