Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

Servers/Filters/vtkStreamingTessellator.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkStreamingTessellator.h,v $
00005   Language:  C++
00006 
00007   Copyright 2003 Sandia Corporation.
00008   Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00009   license for use of this work by or on behalf of the
00010   U.S. Government. Redistribution and use in source and binary forms, with
00011   or without modification, are permitted provided that this Notice and any
00012   statement of authorship are reproduced on all copies.
00013 
00014 =========================================================================*/
00077 #ifndef vtkStreamingTessellator_h
00078 #define vtkStreamingTessellator_h
00079 
00080 #include "vtkObject.h"
00081 
00082 #undef PARAVIEW_DEBUG_TESSELLATOR
00083 
00084 class vtkSubdivisionAlgorithm;
00085 
00086 class VTK_EXPORT vtkStreamingTessellator : public vtkObject
00087 {
00088   public:
00089     vtkTypeRevisionMacro(vtkStreamingTessellator,vtkObject);
00090     static vtkStreamingTessellator* New();
00091     virtual void PrintSelf( ostream& os, vtkIndent indent );
00092 
00093     //BTX
00094     typedef void (*EdgeProcessorFunction)( const double*, const double*, vtkSubdivisionAlgorithm*, void*, const void* );
00095     typedef void (*TriangleProcessorFunction)( const double*, const double*, const double*, vtkSubdivisionAlgorithm*, void*, const void* );
00096     typedef void (*TetrahedronProcessorFunction)( const double*, const double*, const double*, const double*, vtkSubdivisionAlgorithm*, void*, const void* );
00097 
00098     enum {MaxFieldSize = 18};
00099 
00101 
00102     virtual void SetTetrahedronCallback( TetrahedronProcessorFunction );
00103     virtual TetrahedronProcessorFunction GetTetrahedronCallback() const;
00105 
00107 
00108     virtual void SetTriangleCallback( TriangleProcessorFunction );
00109     virtual TriangleProcessorFunction GetTriangleCallback() const;
00111 
00113 
00114     virtual void SetEdgeCallback( EdgeProcessorFunction );
00115     virtual EdgeProcessorFunction GetEdgeCallback() const;
00116     //ETX
00118 
00120 
00122     virtual void SetPrivateData( void* Private );
00123     virtual void* GetPrivateData() const;
00125 
00126     // can't wrap const private data because python wrapper will try to cast it to void*, not const void*
00127     //BTX
00129 
00131     virtual void SetConstPrivateData( const void* ConstPrivate );
00132     virtual const void* GetConstPrivateData() const;
00133     //ETX
00135 
00137 
00142     virtual void SetSubdivisionAlgorithm( vtkSubdivisionAlgorithm* );
00143     virtual vtkSubdivisionAlgorithm* GetSubdivisionAlgorithm() ;
00144     virtual const vtkSubdivisionAlgorithm* GetSubdivisionAlgorithm() const;
00146 
00148 
00158     virtual void SetEmbeddingDimension( int k, int d );
00159     int GetEmbeddingDimension( int k ) const;
00161 
00163 
00188     virtual void SetFieldSize( int k, int s );
00189     int GetFieldSize( int k ) const;
00191 
00193 
00194     virtual void SetMaximumNumberOfSubdivisions( int num_subdiv_in );
00195     int GetMaximumNumberOfSubdivisions();
00197 
00199 
00207     void AdaptivelySample3Facet( double* v1, double* v2, double* v3, double* v4 ) const ;
00208     void AdaptivelySample2Facet( double* v1, double* v2, double* v3 ) const ;
00209     void AdaptivelySample1Facet( double* v1, double* v2 ) const ;
00211 
00213 
00222     void ResetCounts()
00223     {
00224 #ifdef PARAVIEW_DEBUG_TESSELLATOR
00225       for ( int i=0; i<11; ++i )
00226         {
00227         this->CaseCounts[i] = 0;
00228         for ( int j=0; j<51; ++j )
00229           {
00230           this->SubcaseCounts[i][j] = 0;
00231           }
00232         }
00233 #endif // PARAVIEW_DEBUG_TESSELLATOR
00234     }
00235     vtkIdType GetCaseCount( int c )
00236       {
00237 #ifdef PARAVIEW_DEBUG_TESSELLATOR
00238       return this->CaseCounts[c];
00240 #else
00241       (void)c;
00242       return 0;
00243 #endif // PARAVIEW_DEBUG_TESSELLATOR
00244       }
00245     vtkIdType GetSubcaseCount( int casenum, int sub )
00246       {
00247 #ifdef PARAVIEW_DEBUG_TESSELLATOR
00248       return this->SubcaseCounts[casenum][sub];
00249 #else
00250       (void)casenum;
00251       (void)sub;
00252       return 0;
00253 #endif // PARAVIEW_DEBUG_TESSELLATOR
00254       }
00255 
00256   protected:
00257     //BTX
00258     static int EdgeCodesToCaseCodesPlusPermutation[64][2];
00259     static vtkIdType PermutationsFromIndex[24][14];
00260     static vtkIdType TetrahedralDecompositions[];
00261     //ETX
00262 
00263     void* PrivateData;
00264     const void* ConstPrivateData;
00265     vtkSubdivisionAlgorithm* Algorithm;
00266     //BTX
00267     EdgeProcessorFunction Callback1;
00268     TriangleProcessorFunction Callback2;
00269     TetrahedronProcessorFunction Callback3;
00270 #ifdef PARAVIEW_DEBUG_TESSELLATOR
00271     mutable vtkIdType CaseCounts[11];
00272     mutable vtkIdType SubcaseCounts[11][51];
00273 #endif // PARAVIEW_DEBUG_TESSELLATOR
00274     //ETX
00275 
00282     int PointDimension[4];
00283 
00287     int EmbeddingDimension[4];
00288 
00290     int MaximumNumberOfSubdivisions;
00291 
00292     vtkStreamingTessellator();
00293     ~vtkStreamingTessellator();
00294 
00295     void AdaptivelySample3Facet( double* v1, double* v2, double* v3, double* v4, int maxDepth ) const ;
00296     void AdaptivelySample2Facet( double* v1, double* v2, double* v3, int maxDepth, int move=7 ) const ;
00297     void AdaptivelySample1Facet( double* v1, double* v2, int maxDepth ) const ;
00298 
00299     int BestTets( int*, double**, int, int ) const;
00300 
00301   private:
00302     vtkStreamingTessellator( const vtkStreamingTessellator& ); // Not implemented.
00303     void operator = ( const vtkStreamingTessellator& ); // Not implemented.
00304 };
00305 
00306 //BTX
00307 
00308 inline void vtkStreamingTessellator::AdaptivelySample3Facet( double* v1, double* v2, double* v3, double* v4 ) const
00309 { this->AdaptivelySample3Facet( v1, v2, v3, v4, this->MaximumNumberOfSubdivisions ); }
00310 inline void vtkStreamingTessellator::AdaptivelySample2Facet( double* v1, double* v2, double* v3 ) const
00311 { this->AdaptivelySample2Facet( v1, v2, v3, this->MaximumNumberOfSubdivisions ); }
00312 inline void vtkStreamingTessellator::AdaptivelySample1Facet( double* v1, double* v2 ) const
00313 { this->AdaptivelySample1Facet( v1, v2, this->MaximumNumberOfSubdivisions ); }
00314 
00315 inline int vtkStreamingTessellator::GetEmbeddingDimension( int k ) const
00316 { if ( k <= 0 || k >= 4 ) return -1; return this->EmbeddingDimension[k]; }
00317 
00318 inline int vtkStreamingTessellator::GetFieldSize( int k ) const
00319 { if ( k <= 0 || k >= 4 ) return -1; return this->PointDimension[k] - this->EmbeddingDimension[k] - 3; }
00320 
00321 inline int vtkStreamingTessellator::GetMaximumNumberOfSubdivisions() {return this->MaximumNumberOfSubdivisions;}
00322 
00323 //ETX
00324 
00325 #endif // vtkStreamingTessellator_h

Generated on Tue May 30 12:31:47 2006 for ParaView by doxygen 1.3.5