VTK
vtkStreamingTessellator.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkStreamingTessellator.h
5  Language: C++
6 
7  Copyright 2003 Sandia Corporation.
8  Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
9  license for use of this work by or on behalf of the
10  U.S. Government. Redistribution and use in source and binary forms, with
11  or without modification, are permitted provided that this Notice and any
12  statement of authorship are reproduced on all copies.
13 
14 =========================================================================*/
80 #ifndef vtkStreamingTessellator_h
81 #define vtkStreamingTessellator_h
82 
83 #include "vtkObject.h"
84 
85 #undef PARAVIEW_DEBUG_TESSELLATOR
86 
88 
90 {
91  public:
93  static vtkStreamingTessellator* New();
94  virtual void PrintSelf( ostream& os, vtkIndent indent );
95 
96  //BTX
97  typedef void (*VertexProcessorFunction)( const double*, vtkEdgeSubdivisionCriterion*, void*, const void* );
98  typedef void (*EdgeProcessorFunction)( const double*, const double*, vtkEdgeSubdivisionCriterion*, void*, const void* );
99  typedef void (*TriangleProcessorFunction)( const double*, const double*, const double*, vtkEdgeSubdivisionCriterion*, void*, const void* );
100  typedef void (*TetrahedronProcessorFunction)( const double*, const double*, const double*, const double*, vtkEdgeSubdivisionCriterion*, void*, const void* );
101 
102  enum {MaxFieldSize = 18};
103 
105 
106  virtual void SetTetrahedronCallback( TetrahedronProcessorFunction );
107  virtual TetrahedronProcessorFunction GetTetrahedronCallback() const;
109 
111 
112  virtual void SetTriangleCallback( TriangleProcessorFunction );
113  virtual TriangleProcessorFunction GetTriangleCallback() const;
115 
117 
118  virtual void SetEdgeCallback( EdgeProcessorFunction );
119  virtual EdgeProcessorFunction GetEdgeCallback() const;
121 
123 
124  virtual void SetVertexCallback( VertexProcessorFunction );
125  virtual VertexProcessorFunction GetVertexCallback() const;
126  //ETX
128 
130 
132  virtual void SetPrivateData( void* Private );
133  virtual void* GetPrivateData() const;
135 
136  // can't wrap const private data because python wrapper will try to cast it to void*, not const void*
137  //BTX
139 
141  virtual void SetConstPrivateData( const void* ConstPrivate );
142  virtual const void* GetConstPrivateData() const;
143  //ETX
145 
147 
152  virtual void SetSubdivisionAlgorithm( vtkEdgeSubdivisionCriterion* );
153  virtual vtkEdgeSubdivisionCriterion* GetSubdivisionAlgorithm() ;
154  //BTX
155  virtual const vtkEdgeSubdivisionCriterion* GetSubdivisionAlgorithm() const;
156  //ETX
158 
160 
170  virtual void SetEmbeddingDimension( int k, int d );
171  int GetEmbeddingDimension( int k ) const;
173 
175 
201  virtual void SetFieldSize( int k, int s );
202  int GetFieldSize( int k ) const;
204 
206 
207  virtual void SetMaximumNumberOfSubdivisions( int num_subdiv_in );
208  int GetMaximumNumberOfSubdivisions();
210 
212 
224  void AdaptivelySample3Facet( double* v1, double* v2, double* v3, double* v4 ) const ;
225  void AdaptivelySample2Facet( double* v1, double* v2, double* v3 ) const ;
226  void AdaptivelySample1Facet( double* v1, double* v2 ) const ;
227  void AdaptivelySample0Facet( double* v1 ) const ;
229 
231 
240  void ResetCounts()
241  {
242 #ifdef PARAVIEW_DEBUG_TESSELLATOR
243  for ( int i=0; i<11; ++i )
244  {
245  this->CaseCounts[i] = 0;
246  for ( int j=0; j<51; ++j )
247  {
248  this->SubcaseCounts[i][j] = 0;
249  }
250  }
251 #endif // PARAVIEW_DEBUG_TESSELLATOR
252  }
253  vtkIdType GetCaseCount( int c )
254  {
255 #ifdef PARAVIEW_DEBUG_TESSELLATOR
256  return this->CaseCounts[c];
257 #else
258  (void)c;
259  return 0;
260 #endif // PARAVIEW_DEBUG_TESSELLATOR
261  }
262  vtkIdType GetSubcaseCount( int casenum, int sub )
263  {
264 #ifdef PARAVIEW_DEBUG_TESSELLATOR
265  return this->SubcaseCounts[casenum][sub];
266 #else
267  (void)casenum;
268  (void)sub;
269  return 0;
270 #endif // PARAVIEW_DEBUG_TESSELLATOR
271  }
273 
274  protected:
275  //BTX
276  static int EdgeCodesToCaseCodesPlusPermutation[64][2];
277  static vtkIdType PermutationsFromIndex[24][14];
278  static vtkIdType TetrahedralDecompositions[];
279  //ETX
280 
281  void* PrivateData;
282  const void* ConstPrivateData;
284  //BTX
285  VertexProcessorFunction Callback0;
286  EdgeProcessorFunction Callback1;
287  TriangleProcessorFunction Callback2;
288  TetrahedronProcessorFunction Callback3;
289 #ifdef PARAVIEW_DEBUG_TESSELLATOR
290  mutable vtkIdType CaseCounts[11];
291  mutable vtkIdType SubcaseCounts[11][51];
292 #endif // PARAVIEW_DEBUG_TESSELLATOR
293  //ETX
294 
301  int PointDimension[4];
302 
306  int EmbeddingDimension[4];
307 
310 
313 
314  void AdaptivelySample3Facet( double* v1, double* v2, double* v3, double* v4, int maxDepth ) const ;
315  void AdaptivelySample2Facet( double* v1, double* v2, double* v3, int maxDepth, int move=7 ) const ;
316  void AdaptivelySample1Facet( double* v1, double* v2, int maxDepth ) const ;
317 
318  int BestTets( int*, double**, int, int ) const;
319 
320  private:
321  vtkStreamingTessellator( const vtkStreamingTessellator& ); // Not implemented.
322  void operator = ( const vtkStreamingTessellator& ); // Not implemented.
323 };
324 
325 //BTX
326 
327 inline void vtkStreamingTessellator::AdaptivelySample3Facet( double* v1, double* v2, double* v3, double* v4 ) const
328 { this->AdaptivelySample3Facet( v1, v2, v3, v4, this->MaximumNumberOfSubdivisions ); }
329 inline void vtkStreamingTessellator::AdaptivelySample2Facet( double* v1, double* v2, double* v3 ) const
330 { this->AdaptivelySample2Facet( v1, v2, v3, this->MaximumNumberOfSubdivisions ); }
331 inline void vtkStreamingTessellator::AdaptivelySample1Facet( double* v1, double* v2 ) const
332 { this->AdaptivelySample1Facet( v1, v2, this->MaximumNumberOfSubdivisions ); }
333 
335 { if ( k <= 0 || k >= 4 ) return -1; return this->EmbeddingDimension[k]; }
336 
337 inline int vtkStreamingTessellator::GetFieldSize( int k ) const
338 { if ( k <= 0 || k >= 4 ) return -1; return this->PointDimension[k] - this->EmbeddingDimension[k] - 3; }
339 
341 
342 //ETX
343 
344 #endif // vtkStreamingTessellator_h