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:
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 
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 
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_ */
vtkExtentRCBPartitioner::DuplicateNodes
int DuplicateNodes
Definition: vtkExtentRCBPartitioner.h:174
vtkExtentRCBPartitioner::SetGlobalExtent
void SetGlobalExtent(int imin, int imax, int jmin, int jmax, int kmin, int kmax)
Definition: vtkExtentRCBPartitioner.h:54
VTKCOMMONEXECUTIONMODEL_EXPORT
#define VTKCOMMONEXECUTIONMODEL_EXPORT
Definition: vtkCommonExecutionModelModule.h:15
vtkExtentRCBPartitioner::NumberOfPartitions
int NumberOfPartitions
Definition: vtkExtentRCBPartitioner.h:171
vtkExtentRCBPartitioner::ReplaceExtent
void ReplaceExtent(const int idx, int ext[6])
vtkExtentRCBPartitioner::GetNumberOfTotalExtents
int GetNumberOfTotalExtents()
vtkExtentRCBPartitioner::GetExtent
void GetExtent(const int idx, int ext[6])
vtkExtentRCBPartitioner::~vtkExtentRCBPartitioner
~vtkExtentRCBPartitioner()
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkExtentRCBPartitioner::PrintExtent
void PrintExtent(std::string name, int ext[6])
vtkExtentRCBPartitioner::NumExtents
int NumExtents
Definition: vtkExtentRCBPartitioner.h:172
vtkCommonExecutionModelModule.h
vtkExtentRCBPartitioner::Partition
void Partition()
vtkExtentRCBPartitioner::GetPartitionExtent
void GetPartitionExtent(const int idx, int ext[6])
vtkExtentRCBPartitioner::GetGhostedExtent
void GetGhostedExtent(int ext[6], const int minIdx, const int maxIdx)
Definition: vtkExtentRCBPartitioner.h:118
vtkExtentRCBPartitioner::GetNumberOfNodes
int GetNumberOfNodes(int ext[6])
vtkgl::name
GLuint const GLchar * name
Definition: vtkgl.h:11983
vtkExtentRCBPartitioner::GetNumberOfCells
int GetNumberOfCells(int ext[6])
vtkExtentRCBPartitioner::AcquireDataDescription
void AcquireDataDescription()
vtkExtentRCBPartitioner::ExtentIsPartitioned
bool ExtentIsPartitioned
Definition: vtkExtentRCBPartitioner.h:179
vtkExtentRCBPartitioner
Definition: vtkExtentRCBPartitioner.h:35
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkExtentRCBPartitioner::AddExtent
void AddExtent(int ext[6])
vtkExtentRCBPartitioner::SetNumberOfPartitions
void SetNumberOfPartitions(const int N)
Definition: vtkExtentRCBPartitioner.h:43
vtkGetMacro
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:93
vtkExtentRCBPartitioner::GetLongestDimension
int GetLongestDimension(int ext[6])
vtkObject.h
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
vtkExtentRCBPartitioner::NumberOfGhostLayers
int NumberOfGhostLayers
Definition: vtkExtentRCBPartitioner.h:168
vtkExtentRCBPartitioner::PartitionExtents
std::vector< int > PartitionExtents
Definition: vtkExtentRCBPartitioner.h:182
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
vtkExtentRCBPartitioner::Reset
void Reset()
Definition: vtkExtentRCBPartitioner.h:101
vtkExtentRCBPartitioner::SplitExtent
void SplitExtent(int parent[6], int s1[6], int s2[6], int splitDimension)
vtkExtentRCBPartitioner::New
static vtkExtentRCBPartitioner * New()
vtkExtentRCBPartitioner::vtkExtentRCBPartitioner
vtkExtentRCBPartitioner()
vtkExtentRCBPartitioner::PrintSelf
void PrintSelf(ostream &oss, vtkIndent indent)
vtkExtentRCBPartitioner::DataDescription
int DataDescription
Definition: vtkExtentRCBPartitioner.h:169
vtkExtentRCBPartitioner::GetLongestDimensionLength
int GetLongestDimensionLength(int ext[6])
vtkgl::string
GLsizei const GLchar ** string
Definition: vtkgl.h:12011
vtkExtentRCBPartitioner::SetGlobalExtent
void SetGlobalExtent(int ext[6])
Definition: vtkExtentRCBPartitioner.h:64
vtkExtentRCBPartitioner::ExtendGhostLayers
void ExtendGhostLayers(int ext[6])