VTK
dox/Graphics/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 "vtkPolyDataAlgorithm.h"
00054 
00055 #include "vtkContourValues.h" // Needed for inline methods
00056 #include "vtkCutter.h" // for VTK_SORT_BY_VALUE
00057 
00058 class vtkIncrementalPointLocator;
00059 class vtkHyperOctree;
00060 class vtkOrderedTriangulator;
00061 class vtkTetra;
00062 class vtkHyperOctreeCursor;
00063 
00064 class vtkUnstructuredGrid;
00065 class vtkUnsignedCharArray;
00066 class vtkIdTypeArray;
00067 class vtkHyperOctreeContourPointsGrabber;
00068 class vtkBitArray;
00069 
00070 class VTK_GRAPHICS_EXPORT vtkHyperOctreeContourFilter : public vtkPolyDataAlgorithm
00071 {
00072 public:
00073   vtkTypeMacro(vtkHyperOctreeContourFilter,vtkPolyDataAlgorithm);
00074   void PrintSelf(ostream& os, vtkIndent indent);
00075 
00078   static vtkHyperOctreeContourFilter *New();
00079 
00085   void SetValue(int i, double value)
00086     {
00087       this->ContourValues->SetValue(i,value);
00088     }
00090 
00092 
00093   double GetValue(int i)
00094     {
00095       return this->ContourValues->GetValue(i);
00096     }
00098 
00100 
00102   double *GetValues()
00103     {
00104       return this->ContourValues->GetValues();
00105     }
00107 
00109 
00112   void GetValues(double *contourValues)
00113     {
00114       this->ContourValues->GetValues(contourValues);
00115     }
00117 
00119 
00122   void SetNumberOfContours(int number)
00123     {
00124       this->ContourValues->SetNumberOfContours(number);
00125     }
00127 
00129 
00130   int GetNumberOfContours()
00131     {
00132       return this->ContourValues->GetNumberOfContours();
00133     }
00135   
00137 
00139   void GenerateValues(int numContours, double range[2])
00140     {
00141       this->ContourValues->GenerateValues(numContours, range);
00142     }
00144   
00146 
00148   void GenerateValues(int numContours, double
00149                       rangeStart, double rangeEnd)
00150     {
00151       this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);
00152     }
00154 
00156   unsigned long GetMTime();
00157 
00159 
00161   void SetLocator(vtkIncrementalPointLocator *locator);
00162   vtkGetObjectMacro(Locator,vtkIncrementalPointLocator);
00164 
00167   void CreateDefaultLocator();
00168 
00169 protected:
00170   vtkHyperOctreeContourFilter();
00171   ~vtkHyperOctreeContourFilter();
00172   
00173   virtual int RequestData(vtkInformation* request,
00174                           vtkInformationVector** inputVector,
00175                           vtkInformationVector* outputVector);
00176   virtual int RequestUpdateExtent(vtkInformation*,
00177                                   vtkInformationVector**,
00178                                   vtkInformationVector*);
00179   virtual int FillInputPortInformation(int port, vtkInformation *info);
00180 
00182   void ContourNode();
00183   
00185   double ComputePointValue(int ptIndices[3]);
00186   
00187   void ContourNode1D();
00188   
00189   vtkContourValues *ContourValues;
00190   vtkIncrementalPointLocator *Locator;
00191  
00192   vtkIdList *CellPts; // for 2D case
00193   
00194   vtkHyperOctree *Input;
00195   vtkPolyData *Output;
00196 
00197   vtkCellArray *NewVerts;
00198   vtkCellArray *NewLines;
00199   vtkCellArray *NewPolys;
00200   
00201   vtkCellData *InCD;
00202   vtkPointData *InPD;
00203   vtkCellData *OutCD;
00204   vtkPointData *OutPD;
00205   vtkOrderedTriangulator *Triangulator;
00206   
00207   vtkHyperOctreeCursor *Sibling; // to avoid allocation in the loop
00208   
00209   
00210   vtkDoubleArray *CellScalars;
00211   vtkTetra *Tetra;
00212   vtkDoubleArray *TetScalars;
00213   
00214   vtkPolygon *Polygon;
00215   
00216   vtkHyperOctreeCursor *Cursor;
00217   vtkHyperOctreeCursor *NeighborCursor;
00218   
00219   vtkIdType CellTypeCounter[65536]; // up-to-65536 points per octant
00220   vtkIdType TotalCounter;
00221   vtkIdType TemplateCounter; // record the number of octants that succceed
00222   // to use the template triangulator
00223   
00224   vtkDataArray *InScalars;
00225   vtkHyperOctreeContourPointsGrabber *Grabber;
00226   
00227   vtkDoubleArray *PointScalars;
00228   int SortBy;
00229   int Iter; // iterate over contour values in case of VTK_SORT_BY_CELL
00230 
00231   vtkLine *Line;
00232   double LeftValue;
00233   double LeftCoord;
00234   
00235   //BTX
00236   friend class vtkHyperOctreeContourPointsGrabber;
00237   //ETX
00238 private:
00239   vtkHyperOctreeContourFilter(const vtkHyperOctreeContourFilter&);  // Not implemented.
00240   void operator=(const vtkHyperOctreeContourFilter&);  // Not implemented.
00241 };
00242 #endif