VTK  9.2.6
vtkExtentRCBPartitioner.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkExtentRCBPartitioner.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  =========================================================================*/
24 #ifndef vtkExtentRCBPartitioner_h
25 #define vtkExtentRCBPartitioner_h
26 
27 #include "vtkCommonExecutionModelModule.h" // For export macro
28 #include "vtkObject.h"
29 #include <cassert> // For assert
30 #include <string> // For std::string
31 #include <vector> // For STL vector
32 
33 class VTKCOMMONEXECUTIONMODEL_EXPORT vtkExtentRCBPartitioner : public vtkObject
34 {
35 public:
36  static vtkExtentRCBPartitioner* New();
38  void PrintSelf(ostream& oss, vtkIndent indent) override;
39 
41 
44  void SetNumberOfPartitions(const int N)
45  {
46  assert("pre: Number of partitions requested must be > 0" && (N >= 0));
47  this->Reset();
48  this->NumberOfPartitions = N;
49  }
51 
53 
58  void SetGlobalExtent(int imin, int imax, int jmin, int jmax, int kmin, int kmax)
59  {
60  this->Reset();
61  this->GlobalExtent[0] = imin;
62  this->GlobalExtent[1] = imax;
63  this->GlobalExtent[2] = jmin;
64  this->GlobalExtent[3] = jmax;
65  this->GlobalExtent[4] = kmin;
66  this->GlobalExtent[5] = kmax;
67  }
68  void SetGlobalExtent(int ext[6])
69  {
70  this->SetGlobalExtent(ext[0], ext[1], ext[2], ext[3], ext[4], ext[5]);
71  }
73 
75 
78  vtkSetMacro(DuplicateNodes, vtkTypeBool);
79  vtkGetMacro(DuplicateNodes, vtkTypeBool);
80  vtkBooleanMacro(DuplicateNodes, vtkTypeBool);
82 
84 
87  vtkSetMacro(NumberOfGhostLayers, int);
88  vtkGetMacro(NumberOfGhostLayers, int);
90 
92 
95  vtkGetMacro(NumExtents, int);
97 
101  void Partition();
102 
106  void GetPartitionExtent(const int idx, int ext[6]);
107 
108 protected:
110  ~vtkExtentRCBPartitioner() override;
111 
113 
117  void Reset()
118  {
119  this->PartitionExtents.clear();
120  this->NumExtents = 0;
121  this->ExtentIsPartitioned = false;
122  }
124 
130  void ExtendGhostLayers(int ext[6]);
131 
133 
138  void GetGhostedExtent(int ext[6], const int minIdx, const int maxIdx)
139  {
140  ext[minIdx] -= this->NumberOfGhostLayers;
141  ext[maxIdx] += this->NumberOfGhostLayers;
142  ext[minIdx] =
143  (ext[minIdx] < this->GlobalExtent[minIdx]) ? this->GlobalExtent[minIdx] : ext[minIdx];
144  ext[maxIdx] =
145  (ext[maxIdx] > this->GlobalExtent[maxIdx]) ? this->GlobalExtent[maxIdx] : ext[maxIdx];
146  }
148 
152  void AcquireDataDescription();
153 
157  void GetExtent(const int idx, int ext[6]);
158 
162  void AddExtent(int ext[6]);
163 
168  void ReplaceExtent(const int idx, int ext[6]);
169 
173  void SplitExtent(int parent[6], int s1[6], int s2[6], int splitDimension);
174 
179  int GetNumberOfTotalExtents();
180 
184  int GetNumberOfNodes(int ext[6]);
185 
189  int GetNumberOfCells(int ext[6]);
190 
194  int GetLongestDimensionLength(int ext[6]);
195 
199  int GetLongestDimension(int ext[6]);
200 
204  void PrintExtent(const std::string& name, int ext[6]);
205 
208  int GlobalExtent[6];
211 
212  vtkTypeBool DuplicateNodes; // indicates whether nodes are duplicated between
213  // partitions, so that they are abutting. This is
214  // set to true by default. If disabled, the resulting
215  // partitions will have gaps.
216 
218 
219  std::vector<int> PartitionExtents;
220 
221 private:
223  void operator=(const vtkExtentRCBPartitioner&) = delete;
224 };
225 
226 #endif /* VTKEXTENTRCBPARTITIONER_H_ */
void SetGlobalExtent(int imin, int imax, int jmin, int jmax, int kmin, int kmax)
Set/Get the global extent array to be partitioned.
abstract base class for most VTK objects
Definition: vtkObject.h:62
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetGlobalExtent(int ext[6])
Set/Get the global extent array to be partitioned.
int vtkTypeBool
Definition: vtkABI.h:69
This method partitions a global extent to N partitions where N is a user supplied parameter...
void GetGhostedExtent(int ext[6], const int minIdx, const int maxIdx)
Givent an extent and the min/max of the dimension we are looking at, this method will produce a ghost...
a simple class to control print indentation
Definition: vtkIndent.h:39
void SetNumberOfPartitions(const int N)
Set/Get the number of requested partitions.
std::vector< int > PartitionExtents
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
void Reset()
Resets the partitioner to the initial state, all previous partition extents are cleared.