VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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  =========================================================================*/
22 #ifndef VTKEXTENTRCBPARTITIONER_H_
23 #define VTKEXTENTRCBPARTITIONER_H_
24 
25 #include "vtkCommonExecutionModelModule.h" // For export macro
26 #include "vtkObject.h"
27 #include <vector> // For STL vector
28 #include <cassert> // For assert
29 
30 class VTKCOMMONEXECUTIONMODEL_EXPORT vtkExtentRCBPartitioner : public vtkObject
31 {
32  public:
33  static vtkExtentRCBPartitioner *New();
34  vtkTypeMacro(vtkExtentRCBPartitioner,vtkObject);
35  void PrintSelf(ostream &oss, vtkIndent indent );
36 
38 
39  void SetNumberOfPartitions( const int N )
40  {
41  assert( "pre: Number of partitions requested must be > 0" && (N >= 0) );
42  this->Reset();
43  this->NumberOfPartitions = N;
44  }
46 
48 
50  void SetGlobalExtent(int imin,int imax,int jmin,int jmax,int kmin,int kmax)
51  {
52  this->Reset();
53  this->GlobalExtent[0] = imin;
54  this->GlobalExtent[1] = imax;
55  this->GlobalExtent[2] = jmin;
56  this->GlobalExtent[3] = jmax;
57  this->GlobalExtent[4] = kmin;
58  this->GlobalExtent[5] = kmax;
59  }
60  void SetGlobalExtent( int ext[6] )
61  {
62  this->SetGlobalExtent( ext[0], ext[1], ext[2], ext[3], ext[4], ext[5] );
63  }
65 
67 
68  vtkSetMacro(NumberOfGhostLayers,int);
69  vtkGetMacro(NumberOfGhostLayers,int);
71 
73 
74  vtkGetMacro(NumExtents,int);
76 
78  void Partition();
79 
81  void GetPartitionExtent( const int idx, int ext[6] );
82 
83  protected:
86 
88 
90  void Reset()
91  {
92  this->PartitionExtents.clear();
93  this->NumExtents = 0;
94  this->ExtentIsPartitioned = false;
95  }
97 
101  void ExtendGhostLayers( int ext[6] );
102 
104 
108  int ext[6], const int minIdx, const int maxIdx )
109  {
110  ext[minIdx]-=this->NumberOfGhostLayers;
111  ext[maxIdx]+=this->NumberOfGhostLayers;
112  ext[minIdx] = (ext[minIdx] < this->GlobalExtent[minIdx])?
113  this->GlobalExtent[minIdx] : ext[minIdx];
114  ext[maxIdx] = (ext[maxIdx] > this->GlobalExtent[maxIdx])?
115  this->GlobalExtent[maxIdx] : ext[maxIdx];
116  }
118 
121  void AcquireDataDescription();
122 
124  void GetExtent( const int idx, int ext[6] );
125 
127  void AddExtent(int ext[6]);
128 
131  void ReplaceExtent(const int idx, int ext[6]);
132 
134  void SplitExtent(int parent[6],int s1[6],int s2[6],int splitDimension);
135 
138  int GetNumberOfTotalExtents();
139 
142  int GetNumberOfNodes( int ext[6] );
143 
146  int GetNumberOfCells( int ext[6] );
147 
149  int GetLongestDimensionLength( int ext[6] );
150 
152  int GetLongestDimension( int ext[6] );
153 
155  void PrintExtent( std::string name, int ext[6] );
156 
159  int GlobalExtent[6];
163 
164  // BTX
165  std::vector<int> PartitionExtents;
166  // ETX
167 
168  private:
169  vtkExtentRCBPartitioner( const vtkExtentRCBPartitioner& );// Not implemented
170  void operator=( const vtkExtentRCBPartitioner& );// Not implemented
171 };
172 
173 #endif /* VTKEXTENTRCBPARTITIONER_H_ */
void SetGlobalExtent(int imin, int imax, int jmin, int jmax, int kmin, int kmax)
void GetGhostedExtent(int ext[6], const int minIdx, const int maxIdx)
void SetNumberOfPartitions(const int N)
std::vector< int > PartitionExtents