VTK  9.0.1
vtkRedistributeDataSetFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkRedistributeDataSetFilter.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
50 #ifndef vtkRedistributeDataSetFilter_h
51 #define vtkRedistributeDataSetFilter_h
52 
53 #include "vtkDataObjectAlgorithm.h"
54 #include "vtkFiltersParallelDIY2Module.h" // for export macros
55 #include "vtkSmartPointer.h" // for vtkSmartPointer
56 #include <vector> // for std::vector
57 
59 class vtkBoundingBox;
63 
64 class VTKFILTERSPARALLELDIY2_EXPORT vtkRedistributeDataSetFilter : public vtkDataObjectAlgorithm
65 {
66 public:
69  void PrintSelf(ostream& os, vtkIndent indent) override;
70 
72 
76  void SetController(vtkMultiProcessController*);
77  vtkGetObjectMacro(Controller, vtkMultiProcessController);
79 
81  {
82  ASSIGN_TO_ONE_REGION = 0,
83  ASSIGN_TO_ALL_INTERSECTING_REGIONS = 1,
84  SPLIT_BOUNDARY_CELLS = 2
85  };
86 
88 
100  vtkSetClampMacro(BoundaryMode, int, ASSIGN_TO_ONE_REGION, SPLIT_BOUNDARY_CELLS);
101  vtkGetMacro(BoundaryMode, int);
102  void SetBoundaryModeToAssignToOneRegion() { this->SetBoundaryMode(ASSIGN_TO_ONE_REGION); }
104  {
105  this->SetBoundaryMode(ASSIGN_TO_ALL_INTERSECTING_REGIONS);
106  }
107  void SetBoundaryModeToSplitBoundaryCells() { this->SetBoundaryMode(SPLIT_BOUNDARY_CELLS); }
109 
111 
116  vtkSetMacro(UseExplicitCuts, bool);
117  vtkGetMacro(UseExplicitCuts, bool);
118  vtkBooleanMacro(UseExplicitCuts, bool);
120 
122 
125  void SetExplicitCuts(const std::vector<vtkBoundingBox>& boxes);
126  const std::vector<vtkBoundingBox>& GetExplicitCuts() const { return this->ExplicitCuts; }
127  void RemoveAllExplicitCuts();
128  void AddExplicitCut(const vtkBoundingBox& bbox);
129  void AddExplicitCut(const double bbox[6]);
130  int GetNumberOfExplicitCuts() const;
131  const vtkBoundingBox& GetExplicitCut(int index) const;
133 
135 
145  vtkSetMacro(ExpandExplicitCuts, bool);
146  vtkGetMacro(ExpandExplicitCuts, bool);
147  vtkBooleanMacro(ExpandExplicitCuts, bool);
149 
151 
155  const std::vector<vtkBoundingBox>& GetCuts() const { return this->Cuts; }
156 
158 
176  vtkSetClampMacro(NumberOfPartitions, int, 0, VTK_INT_MAX);
177  vtkGetMacro(NumberOfPartitions, int);
179 
181 
194  vtkSetMacro(PreservePartitionsInOutput, bool);
195  vtkGetMacro(PreservePartitionsInOutput, bool);
196  vtkBooleanMacro(PreservePartitionsInOutput, bool);
198 
200 
204  vtkSetMacro(GenerateGlobalCellIds, bool);
205  vtkGetMacro(GenerateGlobalCellIds, bool);
206  vtkBooleanMacro(GenerateGlobalCellIds, bool);
208 
215  std::vector<vtkBoundingBox> ExpandCuts(
216  const std::vector<vtkBoundingBox>& cuts, const vtkBoundingBox& bounds);
217 
219 
226  vtkSetMacro(EnableDebugging, bool);
227  vtkGetMacro(EnableDebugging, bool);
228  vtkBooleanMacro(EnableDebugging, bool);
230 
231 protected:
233  ~vtkRedistributeDataSetFilter() override;
234 
235  int FillInputPortInformation(int port, vtkInformation* info) override;
238 
248  virtual std::vector<vtkBoundingBox> GenerateCuts(vtkDataObject* data);
249 
260  virtual vtkSmartPointer<vtkPartitionedDataSet> SplitDataSet(
261  vtkDataSet* dataset, const std::vector<vtkBoundingBox>& cuts);
262 
263 private:
265  void operator=(const vtkRedistributeDataSetFilter&) = delete;
266 
267  bool Redistribute(vtkDataObject* inputDO, vtkPartitionedDataSet* outputPDS,
268  const std::vector<vtkBoundingBox>& cuts, vtkIdType* mb_offset = nullptr);
269  bool RedistributeDataSet(
270  vtkDataSet* inputDS, vtkPartitionedDataSet* outputPDS, const std::vector<vtkBoundingBox>& cuts);
271  int RedistributeMultiBlockDataSet(
272  vtkMultiBlockDataSet* input, vtkMultiBlockDataSet* output, vtkIdType* mb_offset = nullptr);
273  int RedistributeMultiPieceDataSet(
274  vtkMultiPieceDataSet* input, vtkMultiPieceDataSet* output, vtkIdType* mb_offset = nullptr);
275  vtkSmartPointer<vtkDataSet> ClipDataSet(vtkDataSet* dataset, const vtkBoundingBox& bbox);
276 
277  void MarkGhostCells(vtkPartitionedDataSet* pieces);
278 
279  vtkSmartPointer<vtkPartitionedDataSet> AssignGlobalCellIds(
280  vtkPartitionedDataSet* input, vtkIdType* mb_offset = nullptr);
281  vtkSmartPointer<vtkDataSet> AssignGlobalCellIds(
282  vtkDataSet* input, vtkIdType* mb_offset = nullptr);
283 
284  void MarkValidDimensions(vtkDataObject* inputDO);
285 
286  std::vector<vtkBoundingBox> ExplicitCuts;
287  std::vector<vtkBoundingBox> Cuts;
288 
289  vtkMultiProcessController* Controller;
290  int BoundaryMode;
291  int NumberOfPartitions;
292  bool PreservePartitionsInOutput;
293  bool GenerateGlobalCellIds;
294  bool UseExplicitCuts;
295  bool ExpandExplicitCuts;
296  bool EnableDebugging;
297  bool ValidDim[3];
298 };
299 
300 #endif
virtual int RequestDataObject(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
composite dataset to encapsulates a dataset consisting of partitions.
Store vtkAlgorithm input/output information.
const std::vector< vtkBoundingBox > & GetExplicitCuts() const
Specify the cuts to use when UseExplicitCuts is true.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
static vtkDataObjectAlgorithm * New()
void SetBoundaryModeToSplitBoundaryCells()
Specify how cells on the boundaries are handled.
#define VTK_INT_MAX
Definition: vtkType.h:155
const std::vector< vtkBoundingBox > & GetCuts() const
Returns the cuts used by the most recent RequestData call.
Hold a reference to a vtkObjectBase instance.
Definition: vtkMeta.h:32
int vtkIdType
Definition: vtkType.h:338
a simple class to control print indentation
Definition: vtkIndent.h:33
void SetBoundaryModeToAssignToOneRegion()
Specify how cells on the boundaries are handled.
composite dataset to encapsulates pieces of dataset.
Superclass for algorithms that produce only data object as output.
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Composite dataset that organizes datasets into blocks.
Store zero or more vtkInformation instances.
void SetBoundaryModeToAssignToAllIntersectingRegions()
Specify how cells on the boundaries are handled.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
redistributes input dataset into requested number of partitions
general representation of visualization data
Definition: vtkDataObject.h:59
Fast, simple class for dealing with 3D bounds.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Multiprocessing communication superclass.