VTK
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  =========================================================================*/
25 #ifndef vtkExtentRCBPartitioner_h
26 #define vtkExtentRCBPartitioner_h
27 
28 #include "vtkCommonExecutionModelModule.h" // For export macro
29 #include "vtkObject.h"
30 #include <vector> // For STL vector
31 #include <cassert> // For assert
32 #include <string> // For std::string
33 
35 {
36  public:
37  static vtkExtentRCBPartitioner *New();
39  void PrintSelf(ostream &oss, vtkIndent indent );
40 
42 
43  void SetNumberOfPartitions( const int N )
44  {
45  assert( "pre: Number of partitions requested must be > 0" && (N >= 0) );
46  this->Reset();
47  this->NumberOfPartitions = N;
48  }
50 
52 
54  void SetGlobalExtent(int imin,int imax,int jmin,int jmax,int kmin,int kmax)
55  {
56  this->Reset();
57  this->GlobalExtent[0] = imin;
58  this->GlobalExtent[1] = imax;
59  this->GlobalExtent[2] = jmin;
60  this->GlobalExtent[3] = jmax;
61  this->GlobalExtent[4] = kmin;
62  this->GlobalExtent[5] = kmax;
63  }
64  void SetGlobalExtent( int ext[6] )
65  {
66  this->SetGlobalExtent( ext[0], ext[1], ext[2], ext[3], ext[4], ext[5] );
67  }
69 
71 
72  vtkSetMacro(DuplicateNodes,int);
73  vtkGetMacro(DuplicateNodes,int);
74  vtkBooleanMacro(DuplicateNodes,int);
76 
78 
79  vtkSetMacro(NumberOfGhostLayers,int);
80  vtkGetMacro(NumberOfGhostLayers,int);
82 
84 
85  vtkGetMacro(NumExtents,int);
87 
89  void Partition();
90 
92  void GetPartitionExtent( const int idx, int ext[6] );
93 
94  protected:
97 
99 
101  void Reset()
102  {
103  this->PartitionExtents.clear();
104  this->NumExtents = 0;
105  this->ExtentIsPartitioned = false;
106  }
108 
112  void ExtendGhostLayers( int ext[6] );
113 
115 
119  int ext[6], const int minIdx, const int maxIdx )
120  {
121  ext[minIdx]-=this->NumberOfGhostLayers;
122  ext[maxIdx]+=this->NumberOfGhostLayers;
123  ext[minIdx] = (ext[minIdx] < this->GlobalExtent[minIdx])?
124  this->GlobalExtent[minIdx] : ext[minIdx];
125  ext[maxIdx] = (ext[maxIdx] > this->GlobalExtent[maxIdx])?
126  this->GlobalExtent[maxIdx] : ext[maxIdx];
127  }
129 
132  void AcquireDataDescription();
133 
135  void GetExtent( const int idx, int ext[6] );
136 
138  void AddExtent(int ext[6]);
139 
142  void ReplaceExtent(const int idx, int ext[6]);
143 
145  void SplitExtent(int parent[6],int s1[6],int s2[6],int splitDimension);
146 
149  int GetNumberOfTotalExtents();
150 
153  int GetNumberOfNodes( int ext[6] );
154 
157  int GetNumberOfCells( int ext[6] );
158 
160  int GetLongestDimensionLength( int ext[6] );
161 
163  int GetLongestDimension( int ext[6] );
164 
166  void PrintExtent( std::string name, int ext[6] );
167 
170  int GlobalExtent[6];
173 
174  int DuplicateNodes; // indicates whether nodes are duplicated between
175  // partitions, so that they are abutting. This is
176  // set to true by default. If disabled, the resulting
177  // partitions will have gaps.
178 
180 
181  // BTX
182  std::vector<int> PartitionExtents;
183  // ETX
184 
185  private:
186  vtkExtentRCBPartitioner( const vtkExtentRCBPartitioner& );// Not implemented
187  void operator=( const vtkExtentRCBPartitioner& );// Not implemented
188 };
189 
190 #endif /* VTKEXTENTRCBPARTITIONER_H_ */
void SetGlobalExtent(int imin, int imax, int jmin, int jmax, int kmin, int kmax)
#define VTKCOMMONEXECUTIONMODEL_EXPORT
abstract base class for most VTK objects
Definition: vtkObject.h:61
void GetGhostedExtent(int ext[6], const int minIdx, const int maxIdx)
virtual void PrintSelf(ostream &os, vtkIndent indent)
a simple class to control print indentation
Definition: vtkIndent.h:38
void SetNumberOfPartitions(const int N)
std::vector< int > PartitionExtents
static vtkObject * New()