VTK: Filters/ParallelDIY2/vtkDIYKdTreeUtilities.h Source File

| VTK 9.3.1

vtkDIYKdTreeUtilities.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
12 #ifndef vtkDIYKdTreeUtilities_h
13 #define vtkDIYKdTreeUtilities_h
14
15 #include "vtkBoundingBox.h" // for vtkBoundingBox
16 #include "vtkDIYExplicitAssigner.h" // for vtkDIYExplicitAssigner
17 #include "vtkFiltersParallelDIY2Module.h" // for export macros
18 #include "vtkObject.h"
19 #include "vtkSmartPointer.h" // for vtkSmartPointer
20
21 #include <memory> // for std::shared_ptr
22 #include <vector> // for std::vector
23
24 VTK_ABI_NAMESPACE_BEGIN
25 class vtkDataObject;
26 class vtkDataSet;
27 class vtkIntArray;
28 class vtkMultiProcessController;
29 class vtkPartitionedDataSet;
30 class vtkPoints;
31 class vtkUnstructuredGrid;
32
33 class VTKFILTERSPARALLELDIY2_EXPORT vtkDIYKdTreeUtilities : public vtkObject
34 {
35 public:
36 vtkTypeMacro(vtkDIYKdTreeUtilities, vtkObject);
37 void PrintSelf(ostream& os, vtkIndent indent) override;
38
52 static std::vector<vtkBoundingBox> GenerateCuts(vtkDataObject* dobj, int number_of_partitions,
53 bool use_cell_centers, vtkMultiProcessController* controller = nullptr,
54 const double* local_bounds = nullptr);
55
60 static std::vector<vtkBoundingBox> GenerateCuts(const std::vector<vtkDataObject*>& dobjs,
61 int number_of_partitions, bool use_cell_centers,
62 vtkMultiProcessController* controller = nullptr, const double* local_bounds = nullptr);
63
77 static std::vector<vtkBoundingBox> GenerateCuts(
78 const std::vector<vtkSmartPointer<vtkPoints>>& points, int number_of_partitions,
79 vtkMultiProcessController* controller = nullptr, const double* local_bounds = nullptr);
80
100 static vtkSmartPointer<vtkPartitionedDataSet> Exchange(vtkPartitionedDataSet* parts,
101 vtkMultiProcessController* controller, std::shared_ptr<diy::Assigner> block_assigner = nullptr);
102
111 static bool GenerateGlobalCellIds(vtkPartitionedDataSet* parts,
112 vtkMultiProcessController* controller, vtkIdType* mb_offset = nullptr);
113
122 static std::vector<int> ComputeAssignments(int num_blocks, int num_ranks);
123
129 static vtkDIYExplicitAssigner CreateAssigner(diy::mpi::communicator& comm, int num_blocks);
130
139 static void ResizeCuts(std::vector<vtkBoundingBox>& cuts, int size);
140
141 protected:
142 vtkDIYKdTreeUtilities();
143 ~vtkDIYKdTreeUtilities() override;
144
145 private:
146 vtkDIYKdTreeUtilities(const vtkDIYKdTreeUtilities&) = delete;
147 void operator=(const vtkDIYKdTreeUtilities&) = delete;
148 };
149
150 VTK_ABI_NAMESPACE_END
151 #endif
vtkDIYExplicitAssigner
assigner for use with DIY
Definition: vtkDIYExplicitAssigner.h:40
vtkDIYKdTreeUtilities
collection of utility functions for DIY-based KdTree algorithm
Definition: vtkDIYKdTreeUtilities.h:34
vtkDIYKdTreeUtilities::GenerateCuts
static std::vector< vtkBoundingBox > GenerateCuts(const std::vector< vtkSmartPointer< vtkPoints >> &points, int number_of_partitions, vtkMultiProcessController *controller=nullptr, const double *local_bounds=nullptr)
Given a collection of points, this method will generate box cuts in the domain to approximately load ...
vtkDIYKdTreeUtilities::CreateAssigner
static vtkDIYExplicitAssigner CreateAssigner(diy::mpi::communicator &comm, int num_blocks)
Returns an assigner that assigns power-of-two blocks to an arbitrary number of ranks such that each r...
vtkDIYKdTreeUtilities::ResizeCuts
static void ResizeCuts(std::vector< vtkBoundingBox > &cuts, int size)
GenerateCuts returns a kd-tree with power of 2 nodes.
vtkDIYKdTreeUtilities::vtkDIYKdTreeUtilities
vtkDIYKdTreeUtilities()
vtkDIYKdTreeUtilities::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkDIYKdTreeUtilities::GenerateCuts
static std::vector< vtkBoundingBox > GenerateCuts(const std::vector< vtkDataObject * > &dobjs, int number_of_partitions, bool use_cell_centers, vtkMultiProcessController *controller=nullptr, const double *local_bounds=nullptr)
Another variant to GenerateCuts that simply takes in a vector of dataobjects, each can be a dataset o...
vtkDIYKdTreeUtilities::ComputeAssignments
static std::vector< int > ComputeAssignments(int num_blocks, int num_ranks)
GenerateCuts returns a kd-tree with power of 2 nodes.
vtkDIYKdTreeUtilities::GenerateCuts
static std::vector< vtkBoundingBox > GenerateCuts(vtkDataObject *dobj, int number_of_partitions, bool use_cell_centers, vtkMultiProcessController *controller=nullptr, const double *local_bounds=nullptr)
Given a dataset (or a composite dataset), this method will generate box cuts in the domain to approxi...
vtkDIYKdTreeUtilities::Exchange
static vtkSmartPointer< vtkPartitionedDataSet > Exchange(vtkPartitionedDataSet *parts, vtkMultiProcessController *controller, std::shared_ptr< diy::Assigner > block_assigner=nullptr)
Exchange parts in the partitioned dataset among ranks in the parallel group defined by the controller...
vtkDIYKdTreeUtilities::GenerateGlobalCellIds
static bool GenerateGlobalCellIds(vtkPartitionedDataSet *parts, vtkMultiProcessController *controller, vtkIdType *mb_offset=nullptr)
Generates and adds global cell ids to datasets in parts.
vtkDIYKdTreeUtilities::~vtkDIYKdTreeUtilities
~vtkDIYKdTreeUtilities() override
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:64
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkIntArray
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:44
vtkMultiProcessController
Multiprocessing communication superclass.
Definition: vtkMultiProcessController.h:72
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:61
vtkPartitionedDataSet
composite dataset to encapsulates a dataset consisting of partitions.
Definition: vtkPartitionedDataSet.h:39
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:38
vtkSmartPointer< vtkPoints >
vtkUnstructuredGrid
dataset represents arbitrary combinations of all possible cell types
Definition: vtkUnstructuredGrid.h:99
vtkX3D::points
@ points
Definition: vtkX3D.h:446
vtkX3D::vector
@ vector
Definition: vtkX3D.h:237
vtkX3D::size
@ size
Definition: vtkX3D.h:253
vtkBoundingBox.h
vtkDIYExplicitAssigner.h
vtkObject.h
vtkSmartPointer.h
vtkIdType
int vtkIdType
Definition: vtkType.h:315