VTK  9.7.1
vtkHyperTreeGridRedistribute.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
11 #ifndef vtkHyperTreeGridRedistribute_h
12 #define vtkHyperTreeGridRedistribute_h
13 
15 
16 #include "vtkFiltersParallelMPIModule.h" // For export macro
17 #include "vtkSmartPointer.h" // For vtkSmartPointer
18 #include "vtkWeakPointer.h" // for vtkWeakPointer
19 
20 VTK_ABI_NAMESPACE_BEGIN
22 class vtkMPICommunicator;
23 class vtkBitArray;
24 
25 class VTKFILTERSPARALLELMPI_EXPORT vtkHyperTreeGridRedistribute : public vtkPassInputTypeAlgorithm
26 {
27 public:
30  void PrintSelf(ostream& os, vtkIndent indent) override;
31 
33 
37  virtual void SetController(vtkMultiProcessController*);
38  vtkMultiProcessController* GetController();
40 
41 protected:
43  ~vtkHyperTreeGridRedistribute() override;
44 
48  int FillInputPortInformation(int, vtkInformation*) override;
49 
54  int RequestData(vtkInformation* vtkNotUsed(request), vtkInformationVector** inputVector,
55  vtkInformationVector* outputVector) override;
56 
57 private:
59  void operator=(const vtkHyperTreeGridRedistribute&) = delete;
60 
64  int ProcessTrees(vtkHyperTreeGrid*, vtkDataObject*);
65 
69  int ProcessBlock(vtkDataObject*, vtkDataObject*);
70 
75  int ProcessComposite(vtkDataObject*, vtkDataObject*);
76 
77  /* Subroutines */
78 
82  bool ExchangeHTGMetadata();
83  void CollectLocalTreeIds();
84  void BuildTargetPartMap();
85  void ExchangeHyperTreeMetaData(vtkBitArray* descriptorSendBuffer,
86  std::vector<int>& descriptorSizesReceivedBuffer, std::vector<int>& treeSizesSendBuffer,
87  std::vector<int>& maskSizesSendBuffer, std::vector<int>& treeSizesReceivedBuffer,
88  std::vector<int>& maskSizesReceivedBuffer, std::vector<int>& descriptorsByteOffsets);
89  void BuildOutputTrees(vtkBitArray* descriptorSendBuffer,
90  std::vector<int>& descriptorSizesReceivedBuffer, std::vector<int>& descriptorsByteOffsets);
91  void ExchangeMask(
92  std::vector<int>& maskSizesSendBuffer, std::vector<int>& maskSizesReceivedBuffer);
93  void CollectCellArraySizes(std::vector<int>& treeSizesSendBuffer,
94  std::vector<int>& treeSizesReceivedBuffer, std::vector<int>& cellsSentPerPartOffset,
95  std::vector<int>& cellsReceivedPerPartOffset, std::vector<int>& nbCellDataSentPerPart,
96  std::vector<int>& nbCellDataReceivedPerPart);
97  void ExchangeCellArray(int arrayId, std::vector<int>& cellsSentPerPartOffset,
98  std::vector<int>& cellsReceivedPerPartOffset, std::vector<int>& nbCellDataSentPerPart,
99  std::vector<int>& nbCellDataReceivedPerPart);
100 
101  vtkHyperTreeGrid* InputHTG;
102  vtkHyperTreeGrid* OutputHTG;
104  bool HasMask = false;
105  int NumPartitions = 0;
106  int CurrentPiece = 0;
107 
108  std::vector<int> TreeTargetPartId; // Map Tree <-> Target Part Id
109  std::vector<int> TreeIdsReceivedBuffer;
110  std::vector<int> NbTreesReceivedPerPart;
111  std::vector<int> NbTreesSentPerPart;
112  std::vector<int> NbDescriptorsBytesPerPart;
113 
114  std::vector<vtkIdType> LocalTreeIds;
115  std::vector<std::vector<vtkIdType>> TreesToSend; // Trees ids to send to each process
116 
117  vtkMPICommunicator* MPIComm = nullptr;
119 };
120 
121 VTK_ABI_NAMESPACE_END
122 #endif /* vtkHyperTreeGridRedistribute */
Redistribute input HyperTreeGrid into requested number of partitions.
Superclass for algorithms that produce output of the same type as input.
Store vtkAlgorithm input/output information.
A dataset containing a grid of vtkHyperTree instances arranged as a rectilinear grid.
Class for creating user defined MPI communicators.
a simple class to control print indentation
Definition: vtkIndent.h:28
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
dynamic, self-adjusting array of bits
Definition: vtkBitArray.h:32
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Store zero or more vtkInformation instances.
general representation of visualization data
Definition: vtkDataObject.h:55
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called within ProcessRequest when a request asks the algorithm to do its work.
static vtkPassInputTypeAlgorithm * New()
Multiprocessing communication superclass.