VTK
dox/Filters/HyperTree/vtkHyperOctreeContourFilter.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkHyperOctreeContourFilter.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00050 #ifndef __vtkHyperOctreeContourFilter_h
00051 #define __vtkHyperOctreeContourFilter_h
00052 
00053 #include "vtkFiltersHyperTreeModule.h" // For export macro
00054 #include "vtkPolyDataAlgorithm.h"
00055 
00056 #include "vtkContourValues.h" // Needed for inline methods
00057 #include "vtkCutter.h" // for VTK_SORT_BY_VALUE
00058 
00059 class vtkIncrementalPointLocator;
00060 class vtkHyperOctree;
00061 class vtkOrderedTriangulator;
00062 class vtkTetra;
00063 class vtkHyperOctreeCursor;
00064 
00065 class vtkUnstructuredGrid;
00066 class vtkUnsignedCharArray;
00067 class vtkIdTypeArray;
00068 class vtkHyperOctreeContourPointsGrabber;
00069 class vtkBitArray;
00070 
00071 class VTKFILTERSHYPERTREE_EXPORT vtkHyperOctreeContourFilter : public vtkPolyDataAlgorithm
00072 {
00073 public:
00074   vtkTypeMacro(vtkHyperOctreeContourFilter,vtkPolyDataAlgorithm);
00075   void PrintSelf(ostream& os, vtkIndent indent);
00076 
00079   static vtkHyperOctreeContourFilter *New();
00080 
00086   void SetValue(int i, double value)
00087     {
00088       this->ContourValues->SetValue(i,value);
00089     }
00091 
00093 
00094   double GetValue(int i)
00095     {
00096       return this->ContourValues->GetValue(i);
00097     }
00099 
00101 
00103   double *GetValues()
00104     {
00105       return this->ContourValues->GetValues();
00106     }
00108 
00110 
00113   void GetValues(double *contourValues)
00114     {
00115       this->ContourValues->GetValues(contourValues);
00116     }
00118 
00120 
00123   void SetNumberOfContours(int number)
00124     {
00125       this->ContourValues->SetNumberOfContours(number);
00126     }
00128 
00130 
00131   int GetNumberOfContours()
00132     {
00133       return this->ContourValues->GetNumberOfContours();
00134     }
00136 
00138 
00140   void GenerateValues(int numContours, double range[2])
00141     {
00142       this->ContourValues->GenerateValues(numContours, range);
00143     }
00145 
00147 
00149   void GenerateValues(int numContours, double
00150                       rangeStart, double rangeEnd)
00151     {
00152       this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);
00153     }
00155 
00157   unsigned long GetMTime();
00158 
00160 
00162   void SetLocator(vtkIncrementalPointLocator *locator);
00163   vtkGetObjectMacro(Locator,vtkIncrementalPointLocator);
00165 
00168   void CreateDefaultLocator();
00169 
00170 protected:
00171   vtkHyperOctreeContourFilter();
00172   ~vtkHyperOctreeContourFilter();
00173 
00174   virtual int RequestData(vtkInformation* request,
00175                           vtkInformationVector** inputVector,
00176                           vtkInformationVector* outputVector);
00177   virtual int RequestUpdateExtent(vtkInformation*,
00178                                   vtkInformationVector**,
00179                                   vtkInformationVector*);
00180   virtual int FillInputPortInformation(int port, vtkInformation *info);
00181 
00183   void ContourNode();
00184 
00186   double ComputePointValue(int ptIndices[3]);
00187 
00188   void ContourNode1D();
00189 
00190   vtkContourValues *ContourValues;
00191   vtkIncrementalPointLocator *Locator;
00192 
00193   vtkIdList *CellPts; // for 2D case
00194 
00195   vtkHyperOctree *Input;
00196   vtkPolyData *Output;
00197 
00198   vtkCellArray *NewVerts;
00199   vtkCellArray *NewLines;
00200   vtkCellArray *NewPolys;
00201 
00202   vtkCellData *InCD;
00203   vtkPointData *InPD;
00204   vtkCellData *OutCD;
00205   vtkPointData *OutPD;
00206   vtkOrderedTriangulator *Triangulator;
00207 
00208   vtkHyperOctreeCursor *Sibling; // to avoid allocation in the loop
00209 
00210 
00211   vtkDoubleArray *CellScalars;
00212   vtkTetra *Tetra;
00213   vtkDoubleArray *TetScalars;
00214 
00215   vtkPolygon *Polygon;
00216 
00217   vtkHyperOctreeCursor *Cursor;
00218   vtkHyperOctreeCursor *NeighborCursor;
00219 
00220   vtkIdType CellTypeCounter[65536]; // up-to-65536 points per octant
00221   vtkIdType TotalCounter;
00222   vtkIdType TemplateCounter; // record the number of octants that succceed
00223   // to use the template triangulator
00224 
00225   vtkDataArray *InScalars;
00226   vtkHyperOctreeContourPointsGrabber *Grabber;
00227 
00228   vtkDoubleArray *PointScalars;
00229   int SortBy;
00230   int Iter; // iterate over contour values in case of VTK_SORT_BY_CELL
00231 
00232   vtkLine *Line;
00233   double LeftValue;
00234   double LeftCoord;
00235 
00236   //BTX
00237   friend class vtkHyperOctreeContourPointsGrabber;
00238   //ETX
00239 private:
00240   vtkHyperOctreeContourFilter(const vtkHyperOctreeContourFilter&);  // Not implemented.
00241   void operator=(const vtkHyperOctreeContourFilter&);  // Not implemented.
00242 };
00243 #endif