VTK  9.7.20260823
vtkRedistributeDataSetFilter.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
54#ifndef vtkRedistributeDataSetFilter_h
55#define vtkRedistributeDataSetFilter_h
56
58#include "vtkFiltersParallelDIY2Module.h" // for export macros
59#include "vtkPartitioningStrategy.h" // for PartitionInformation
60#include "vtkSmartPointer.h" // for vtkSmartPointer
61
62#include <memory> // for std::shared_ptr
63#include <vector> // for std::vector
64
65// clang-format off
66#include "vtk_diy2.h" // for DIY2 APIs
67#include VTK_DIY2(diy/assigner.hpp)
68// clang-format on
69
70VTK_ABI_NAMESPACE_BEGIN
72class vtkBoundingBox;
77class VTKFILTERSPARALLELDIY2_EXPORT vtkRedistributeDataSetFilter : public vtkDataObjectAlgorithm
78{
79public:
82 void PrintSelf(ostream& os, vtkIndent indent) override;
83
88
90
95 vtkGetObjectMacro(Controller, vtkMultiProcessController);
97
104
106
118 virtual void SetBoundaryMode(int mode);
121
122 vtkGetMacro(BoundaryMode, int);
130
132
138 bool GetUseExplicitCuts() const;
139 vtkBooleanMacro(UseExplicitCuts, bool);
141
143
146 void SetExplicitCuts(const std::vector<vtkBoundingBox>& boxes);
147 const std::vector<vtkBoundingBox>& GetExplicitCuts() const;
150 void AddExplicitCut(const double bbox[6]);
152 const vtkBoundingBox& GetExplicitCut(int index) const;
154
156
161 void SetAssigner(std::shared_ptr<diy::Assigner> assigner);
162 std::shared_ptr<diy::Assigner> GetAssigner();
163 std::shared_ptr<const diy::Assigner> GetAssigner() const;
164
166
178 vtkBooleanMacro(ExpandExplicitCuts, bool);
180
182
186 const std::vector<vtkBoundingBox>& GetCuts() const;
188
190
207
209
222 vtkSetMacro(PreservePartitionsInOutput, bool);
223 vtkGetMacro(PreservePartitionsInOutput, bool);
224 vtkBooleanMacro(PreservePartitionsInOutput, bool);
226
228
232 vtkSetMacro(GenerateGlobalCellIds, bool);
233 vtkGetMacro(GenerateGlobalCellIds, bool);
234 vtkBooleanMacro(GenerateGlobalCellIds, bool);
236
238
245 vtkSetMacro(EnableDebugging, bool);
246 vtkGetMacro(EnableDebugging, bool);
247 vtkBooleanMacro(EnableDebugging, bool);
249
251
261 vtkBooleanMacro(LoadBalanceAcrossAllBlocks, bool);
263
265
271
272protected:
275
276 int FillInputPortInformation(int port, vtkInformation* info) override;
279
280 /*
281 * A method with this signature used to exist. With the refactoring of this filter to accept
282 * different partitioning strategies, this method no longer had any meaning in the generic
283 * sense.
284 *
285 * If you inherited this filter and overrid this method, please implement a new partitioning
286 * strategy instead.
287 */
288 // virtual vtkSmartPointer<vtkPartitionedDataSet> SplitDataSet(
289 // vtkDataSet* dataset, const std::vector<vtkBoundingBox>& cuts);
290
291private:
293 void operator=(const vtkRedistributeDataSetFilter&) = delete;
294
304 virtual vtkSmartPointer<vtkPartitionedDataSet> SplitDataSet(
306
307 bool Redistribute(vtkPartitionedDataSetCollection* inputCollection,
308 vtkPartitionedDataSetCollection* outputCollection,
309 const std::vector<vtkPartitioningStrategy::PartitionInformation>& info,
310 bool preserve_input_hierarchy);
311
312 bool RedistributePTD(vtkPartitionedDataSet*, vtkPartitionedDataSet*,
313 const std::vector<vtkPartitioningStrategy::PartitionInformation>&, unsigned int*, vtkIdType*);
314
315 bool RedistributeDataSet(vtkDataSet* inputDS, vtkPartitionedDataSet* outputPDS,
317 vtkSmartPointer<vtkDataSet> ClipDataSet(vtkDataSet* dataset, const vtkBoundingBox& bbox);
318
319 void MarkGhostCells(vtkPartitionedDataSet* pieces);
320
321 vtkSmartPointer<vtkPartitionedDataSet> AssignGlobalCellIds(
322 vtkPartitionedDataSet* input, vtkIdType* mb_offset = nullptr);
323 vtkSmartPointer<vtkDataSet> AssignGlobalCellIds(
324 vtkDataSet* input, vtkIdType* mb_offset = nullptr);
325
326 void MarkValidDimensions(const vtkBoundingBox& gbounds);
327
328 std::shared_ptr<diy::Assigner> Assigner;
329
330 vtkMultiProcessController* Controller;
331 int BoundaryMode;
332 bool PreservePartitionsInOutput;
333 bool GenerateGlobalCellIds;
334 bool EnableDebugging;
335 bool ValidDim[3];
336
338};
339
340VTK_ABI_NAMESPACE_END
341#endif
Fast, simple class for representing and operating on 3D bounds.
provides implementation for most abstract methods in the superclass vtkCompositeDataSet
abstract class to specify dataset behavior
Definition vtkDataSet.h:165
a simple class to control print indentation
Definition vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Composite dataset that organizes datasets into blocks.
composite dataset to encapsulates pieces of dataset.
Multiprocessing communication superclass.
Composite dataset that groups datasets as a collection.
composite dataset to encapsulates a dataset consisting of partitions.
A strategy interface for partitioning meshes.
static vtkRedistributeDataSetFilter * New()
void SetBoundaryModeToAssignToAllIntersectingRegions()
Specify how cells on the boundaries are handled.
const vtkBoundingBox & GetExplicitCut(int index) const
Specify the cuts to use when UseExplicitCuts is true.
int RequestDataObject(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
void SetUseExplicitCuts(bool)
Specify whether to compute the load balancing automatically or use explicitly provided cuts.
void AddExplicitCut(const double bbox[6])
Specify the cuts to use when UseExplicitCuts is true.
const std::vector< vtkBoundingBox > & GetExplicitCuts() const
Specify the cuts to use when UseExplicitCuts is true.
vtkIdType GetNumberOfPartitions() const
Specify the number of partitions to split the input dataset into.
bool GetExpandExplicitCuts() const
Specify the DIY assigner used for distributing cuts.
void SetNumberOfPartitions(vtkIdType)
Specify the number of partitions to split the input dataset into.
int GetNumberOfExplicitCuts() const
Specify the cuts to use when UseExplicitCuts is true.
virtual int GetBoundaryModeMaxValue()
Specify how cells on the boundaries are handled.
void SetController(vtkMultiProcessController *)
Get/Set the controller to use.
bool GetLoadBalanceAcrossAllBlocks()
When UseExplicitCuts is false, and input is a vtkPartitionedDataSetCollection, set this to true to ge...
void SetExplicitCuts(const std::vector< vtkBoundingBox > &boxes)
Specify the cuts to use when UseExplicitCuts is true.
~vtkRedistributeDataSetFilter() override
virtual int GetBoundaryModeMinValue()
Specify how cells on the boundaries are handled.
void SetExpandExplicitCuts(bool)
When using explicit cuts, it possible that the bounding box defined by all the cuts is smaller than t...
void RemoveAllExplicitCuts()
Specify the cuts to use when UseExplicitCuts is true.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
const std::vector< vtkBoundingBox > & GetCuts() const
Returns the cuts used by the most recent RequestData call.
vtkPartitioningStrategy * GetStrategy()
Setter/Getter for Strategy.
vtkMTimeType GetMTime() override
Necessary to override this in order to take into account modifications to strategy.
void SetBoundaryModeToAssignToOneRegion()
Specify how cells on the boundaries are handled.
std::shared_ptr< const diy::Assigner > GetAssigner() const
Specify the DIY assigner used for distributing cuts.
bool GetUseExplicitCuts() const
Specify whether to compute the load balancing automatically or use explicitly provided cuts.
void AddExplicitCut(const vtkBoundingBox &bbox)
Specify the cuts to use when UseExplicitCuts is true.
void SetLoadBalanceAcrossAllBlocks(bool)
When UseExplicitCuts is false, and input is a vtkPartitionedDataSetCollection, set this to true to ge...
void SetAssigner(std::shared_ptr< diy::Assigner > assigner)
Specify the DIY assigner used for distributing cuts.
virtual void SetBoundaryMode(int mode)
Specify how cells on the boundaries are handled.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetBoundaryModeToSplitBoundaryCells()
Specify how cells on the boundaries are handled.
std::shared_ptr< diy::Assigner > GetAssigner()
Specify the DIY assigner used for distributing cuts.
void SetStrategy(vtkPartitioningStrategy *)
Setter/Getter for Strategy.
Hold a reference to a vtkObjectBase instance.
Encapsulation structure for describing the result of a partitioning calculation.
int vtkIdType
Definition vtkType.h:363
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:318