VTK
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 "vtkPolyDataAlgorithm.h"
52 
53 #include "vtkContourValues.h" // Needed for inline methods
54 
55 #include "vtkCutter.h" // for VTK_SORT_BY_VALUE and VTK_SORT_BY_CELL
56 
57 //#define VTK_SORT_BY_VALUE 0
58 //#define VTK_SORT_BY_CELL 1
59 // This does not really belong here, ut it is for a temporary
60 // fix until this filter can be converted to geernate unstructured grids.
61 //#define VTK_NUMBER_OF_CELL_TYPES 68
62 
65 class vtkHyperOctree;
68 class vtkTetra;
71 
73 {
74 public:
76  void PrintSelf(ostream& os, vtkIndent indent);
77 
80  static vtkHyperOctreeCutter *New();
81 
83 
85  void SetValue(int i, double value)
86  {this->ContourValues->SetValue(i,value);}
88 
90 
91  double GetValue(int i)
92  {return this->ContourValues->GetValue(i);}
94 
96 
98  double *GetValues()
99  {return this->ContourValues->GetValues();}
101 
103 
106  void GetValues(double *contourValues)
107  {this->ContourValues->GetValues(contourValues);}
109 
111 
114  void SetNumberOfContours(int number)
115  {this->ContourValues->SetNumberOfContours(number);}
117 
119 
121  {return this->ContourValues->GetNumberOfContours();}
123 
125 
127  void GenerateValues(int numContours, double range[2])
128  {this->ContourValues->GenerateValues(numContours, range);}
130 
132 
134  void GenerateValues(int numContours, double rangeStart, double rangeEnd)
135  {this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);}
137 
140  unsigned long GetMTime();
141 
143 
144  virtual void SetCutFunction(vtkImplicitFunction*);
145  vtkGetObjectMacro(CutFunction,vtkImplicitFunction);
147 
149 
152  vtkSetMacro(GenerateCutScalars,int);
153  vtkGetMacro(GenerateCutScalars,int);
154  vtkBooleanMacro(GenerateCutScalars,int);
156 
158 
160  void SetLocator(vtkIncrementalPointLocator *locator);
161  vtkGetObjectMacro(Locator,vtkIncrementalPointLocator);
163 
165 
175  vtkSetClampMacro(SortBy,int,VTK_SORT_BY_VALUE,VTK_SORT_BY_CELL);
176  vtkGetMacro(SortBy,int);
178  {this->SetSortBy(VTK_SORT_BY_VALUE);}
180  {this->SetSortBy(VTK_SORT_BY_CELL);}
182 
184 
185  const char *GetSortByAsString()
186  {
187  if ( this->SortBy == VTK_SORT_BY_VALUE )
188  {
189  return "SortByValue";
190  }
191  else
192  {
193  return "SortByCell";
194  }
195  }
197 
200  void CreateDefaultLocator();
201 
202 protected:
205 
209 
211 
213  void CutNode(vtkHyperOctreeCursor *cursor,
214  int level,
215  double bounds[6]);
217 
219 
220 
222  int SortBy;
225 
228 
229 
233 
238  vtkHyperOctreeCursor *Sibling; // to avoid allocation in the loop
239 
240  int Iter; // iterate over contour values in case of VTK_SORT_BY_CELL
241 
242 
246 
249 
250  vtkIdType CellTypeCounter[65536]; // up-to-65536 points per octant
252  vtkIdType TemplateCounter; // record the number of octants that succceed
253  // to use the template triangulator
254 
255  // in VTK_SORT_BY_VALUE case, rejection test need to combine all values.
256  int *AllLess;
259 
260 private:
261  vtkHyperOctreeCutter(const vtkHyperOctreeCutter&); // Not implemented.
262  void operator=(const vtkHyperOctreeCutter&); // Not implemented.
263 };
264 
265 #endif