VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vtkHyperOctreeCutter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkHyperOctreeCutter.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 =========================================================================*/
48 #ifndef __vtkHyperOctreeCutter_h
49 #define __vtkHyperOctreeCutter_h
50 
51 #include "vtkFiltersHyperTreeModule.h" // For export macro
52 #include "vtkPolyDataAlgorithm.h"
53 
54 #include "vtkContourValues.h" // Needed for inline methods
55 
56 #include "vtkCutter.h" // for VTK_SORT_BY_VALUE and VTK_SORT_BY_CELL
57 
58 //#define VTK_SORT_BY_VALUE 0
59 //#define VTK_SORT_BY_CELL 1
60 // This does not really belong here, ut it is for a temporary
61 // fix until this filter can be converted to geernate unstructured grids.
62 //#define VTK_NUMBER_OF_CELL_TYPES 68
63 
64 class vtkImplicitFunction;
65 class vtkIncrementalPointLocator;
66 class vtkHyperOctree;
67 class vtkOrderedTriangulator;
68 class vtkHyperOctreeCursor;
69 class vtkTetra;
70 class vtkDataSetAttributes;
72 
73 class VTKFILTERSHYPERTREE_EXPORT vtkHyperOctreeCutter : public vtkPolyDataAlgorithm
74 {
75 public:
76  vtkTypeMacro(vtkHyperOctreeCutter,vtkPolyDataAlgorithm);
77  void PrintSelf(ostream& os, vtkIndent indent);
78 
81  static vtkHyperOctreeCutter *New();
82 
84 
86  void SetValue(int i, double value)
87  {this->ContourValues->SetValue(i,value);}
89 
91 
92  double GetValue(int i)
93  {return this->ContourValues->GetValue(i);}
95 
97 
99  double *GetValues()
100  {return this->ContourValues->GetValues();}
102 
104 
107  void GetValues(double *contourValues)
108  {this->ContourValues->GetValues(contourValues);}
110 
112 
115  void SetNumberOfContours(int number)
116  {this->ContourValues->SetNumberOfContours(number);}
118 
120 
122  {return this->ContourValues->GetNumberOfContours();}
124 
126 
128  void GenerateValues(int numContours, double range[2])
129  {this->ContourValues->GenerateValues(numContours, range);}
131 
133 
135  void GenerateValues(int numContours, double rangeStart, double rangeEnd)
136  {this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);}
138 
141  unsigned long GetMTime();
142 
144 
145  virtual void SetCutFunction(vtkImplicitFunction*);
146  vtkGetObjectMacro(CutFunction,vtkImplicitFunction);
148 
150 
153  vtkSetMacro(GenerateCutScalars,int);
154  vtkGetMacro(GenerateCutScalars,int);
155  vtkBooleanMacro(GenerateCutScalars,int);
157 
159 
161  void SetLocator(vtkIncrementalPointLocator *locator);
162  vtkGetObjectMacro(Locator,vtkIncrementalPointLocator);
164 
166 
176  vtkSetClampMacro(SortBy,int,VTK_SORT_BY_VALUE,VTK_SORT_BY_CELL);
177  vtkGetMacro(SortBy,int);
179  {this->SetSortBy(VTK_SORT_BY_VALUE);}
181  {this->SetSortBy(VTK_SORT_BY_CELL);}
183 
185 
186  const char *GetSortByAsString()
187  {
188  if ( this->SortBy == VTK_SORT_BY_VALUE )
189  {
190  return "SortByValue";
191  }
192  else
193  {
194  return "SortByCell";
195  }
196  }
198 
201  void CreateDefaultLocator();
202 
203 protected:
204  vtkHyperOctreeCutter(vtkImplicitFunction *cf=NULL);
206 
207  virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
208  virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
209  virtual int FillInputPortInformation(int port, vtkInformation *info);
210 
212 
214  void CutNode(vtkHyperOctreeCursor *cursor,
215  int level,
216  double bounds[6]);
218 
219  vtkImplicitFunction *CutFunction;
220 
221 
222  vtkIncrementalPointLocator *Locator;
223  int SortBy;
224  vtkContourValues *ContourValues;
226 
227  vtkHyperOctree *Input;
228  vtkPolyData *Output;
229 
230 
231  vtkCellArray *NewVerts;
232  vtkCellArray *NewLines;
233  vtkCellArray *NewPolys;
234 
235  vtkDataSetAttributes *InCD;
236  vtkCellData *OutCD;
237  vtkPointData *OutPD;
238  vtkOrderedTriangulator *Triangulator;
239  vtkHyperOctreeCursor *Sibling; // to avoid allocation in the loop
240 
241  int Iter; // iterate over contour values in case of VTK_SORT_BY_CELL
242 
243 
244  vtkDoubleArray *CellScalars;
245  vtkTetra *Tetra;
246  vtkDoubleArray *TetScalars;
247 
248  vtkPoints *Pts;
249  vtkPolygon *Polygon;
250 
251  vtkIdType CellTypeCounter[65536]; // up-to-65536 points per octant
252  vtkIdType TotalCounter;
253  vtkIdType TemplateCounter; // record the number of octants that succceed
254  // to use the template triangulator
255 
256  // in VTK_SORT_BY_VALUE case, rejection test need to combine all values.
257  int *AllLess;
260 
261 private:
262  vtkHyperOctreeCutter(const vtkHyperOctreeCutter&); // Not implemented.
263  void operator=(const vtkHyperOctreeCutter&); // Not implemented.
264 };
265 
266 #endif
vtkImplicitFunction * CutFunction
void SetValue(int i, double value)
vtkDoubleArray * TetScalars
Cut vtkHyperOctree with user-specified implicit function.
A concrete implementation of vtkHyperOctreePointsGrabber used by vtkClipHyperOctree and vtkHyperOctre...
vtkHyperOctreeClipCutPointsGrabber * Grabber
vtkIncrementalPointLocator * Locator
void SetNumberOfContours(int number)
vtkDataSetAttributes * InCD
vtkContourValues * ContourValues
vtkDoubleArray * CellScalars
const char * GetSortByAsString()
vtkOrderedTriangulator * Triangulator
vtkHyperOctreeCursor * Sibling
#define VTK_SORT_BY_VALUE
Definition: vtkCutter.h:58
#define VTK_SORT_BY_CELL
Definition: vtkCutter.h:59
void GenerateValues(int numContours, double rangeStart, double rangeEnd)
void GenerateValues(int numContours, double range[2])
void GetValues(double *contourValues)