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 =========================================================================*/
75 #ifndef vtkStreamingTessellator_h
76 #define vtkStreamingTessellator_h
77 
78 #include "vtkFiltersCoreModule.h" // For export macro
79 #include "vtkObject.h"
80 
81 #undef PARAVIEW_DEBUG_TESSELLATOR
82 
84 
85 class VTKFILTERSCORE_EXPORT vtkStreamingTessellator : public vtkObject
86 {
87  public:
89  static vtkStreamingTessellator* New();
90  void PrintSelf( ostream& os, vtkIndent indent ) override;
91 
92  typedef void (*VertexProcessorFunction)( const double*, vtkEdgeSubdivisionCriterion*, void*, const void* );
93  typedef void (*EdgeProcessorFunction)( const double*, const double*, vtkEdgeSubdivisionCriterion*, void*, const void* );
94  typedef void (*TriangleProcessorFunction)( const double*, const double*, const double*, vtkEdgeSubdivisionCriterion*, void*, const void* );
95  typedef void (*TetrahedronProcessorFunction)( const double*, const double*, const double*, const double*, vtkEdgeSubdivisionCriterion*, void*, const void* );
96 
97  enum {MaxFieldSize = 18};
98 
100 
103  virtual void SetTetrahedronCallback( TetrahedronProcessorFunction );
104  virtual TetrahedronProcessorFunction GetTetrahedronCallback() const;
106 
108 
111  virtual void SetTriangleCallback( TriangleProcessorFunction );
112  virtual TriangleProcessorFunction GetTriangleCallback() const;
114 
116 
119  virtual void SetEdgeCallback( EdgeProcessorFunction );
120  virtual EdgeProcessorFunction GetEdgeCallback() const;
122 
124 
127  virtual void SetVertexCallback( VertexProcessorFunction );
128  virtual VertexProcessorFunction GetVertexCallback() const;
130 
132 
135  virtual void SetPrivateData( void* Private );
136  virtual void* GetPrivateData() const;
138 
139  // can't wrap const private data because python wrapper will try to cast it to void*, not const void*
140 
142 
145  virtual void SetConstPrivateData( const void* ConstPrivate );
146  virtual const void* GetConstPrivateData() const;
148 
150 
157  virtual void SetSubdivisionAlgorithm( vtkEdgeSubdivisionCriterion* );
158  virtual vtkEdgeSubdivisionCriterion* GetSubdivisionAlgorithm() ;
160 
161  virtual const vtkEdgeSubdivisionCriterion* GetSubdivisionAlgorithm() const;
162 
164 
176  virtual void SetEmbeddingDimension( int k, int d );
177  int GetEmbeddingDimension( int k ) const;
179 
181 
210  virtual void SetFieldSize( int k, int s );
211  int GetFieldSize( int k ) const;
213 
215 
218  virtual void SetMaximumNumberOfSubdivisions( int num_subdiv_in );
219  int GetMaximumNumberOfSubdivisions();
221 
223 
242  void AdaptivelySample3Facet( double* v0, double* v1, double* v2, double* v3 ) const ;
243  void AdaptivelySample2Facet( double* v0, double* v1, double* v2 ) const ;
244  void AdaptivelySample1Facet( double* v0, double* v1 ) const ;
245  void AdaptivelySample0Facet( double* v0 ) const ;
247 
249 
259  void ResetCounts()
260  {
261 #ifdef PARAVIEW_DEBUG_TESSELLATOR
262  for ( int i=0; i<11; ++i )
263  {
264  this->CaseCounts[i] = 0;
265  for ( int j=0; j<51; ++j )
266  {
267  this->SubcaseCounts[i][j] = 0;
268  }
269  }
270 #endif // PARAVIEW_DEBUG_TESSELLATOR
271  }
273  {
274 #ifdef PARAVIEW_DEBUG_TESSELLATOR
275  return this->CaseCounts[c];
276 #else
277  (void)c;
278  return 0;
279 #endif // PARAVIEW_DEBUG_TESSELLATOR
280  }
281  vtkIdType GetSubcaseCount( int casenum, int sub )
282  {
283 #ifdef PARAVIEW_DEBUG_TESSELLATOR
284  return this->SubcaseCounts[casenum][sub];
285 #else
286  (void)casenum;
287  (void)sub;
288  return 0;
289 #endif // PARAVIEW_DEBUG_TESSELLATOR
290  }
292 
293  protected:
294 
295  static int EdgeCodesToCaseCodesPlusPermutation[64][2];
296  static vtkIdType PermutationsFromIndex[24][14];
297  static vtkIdType TetrahedralDecompositions[];
298 
299  void* PrivateData;
300  const void* ConstPrivateData;
302 
303  VertexProcessorFunction Callback0;
304  EdgeProcessorFunction Callback1;
305  TriangleProcessorFunction Callback2;
306  TetrahedronProcessorFunction Callback3;
307 #ifdef PARAVIEW_DEBUG_TESSELLATOR
308  mutable vtkIdType CaseCounts[11];
309  mutable vtkIdType SubcaseCounts[11][51];
310 #endif // PARAVIEW_DEBUG_TESSELLATOR
311 
320  int PointDimension[4];
321 
327  int EmbeddingDimension[4];
328 
333 
335  ~vtkStreamingTessellator() override;
336 
337  void AdaptivelySample3Facet( double* v0, double* v1, double* v2, double* v3, int maxDepth ) const ;
338  void AdaptivelySample2Facet( double* v0, double* v1, double* v2, int maxDepth, int move=7 ) const ;
339  void AdaptivelySample1Facet( double* v0, double* v1, int maxDepth ) const ;
340 
341  int BestTets( int*, double**, int, int ) const;
342 
343  private:
345  void operator = ( const vtkStreamingTessellator& ) = delete;
346 };
347 
348 inline void vtkStreamingTessellator::AdaptivelySample3Facet( double* v0, double* v1, double* v2, double* v3 ) const
349 { this->AdaptivelySample3Facet( v0, v1, v2, v3, this->MaximumNumberOfSubdivisions ); }
350 inline void vtkStreamingTessellator::AdaptivelySample2Facet( double* v0, double* v1, double* v2 ) const
351 { this->AdaptivelySample2Facet( v0, v1, v2, this->MaximumNumberOfSubdivisions ); }
352 inline void vtkStreamingTessellator::AdaptivelySample1Facet( double* v0, double* v1 ) const
353 { this->AdaptivelySample1Facet( v0, v1, this->MaximumNumberOfSubdivisions ); }
354 
356 { if ( k <= 0 || k >= 4 ) return -1; return this->EmbeddingDimension[k]; }
357 
358 inline int vtkStreamingTessellator::GetFieldSize( int k ) const
359 { if ( k <= 0 || k >= 4 ) return -1; return this->PointDimension[k] - this->EmbeddingDimension[k] - 3; }
360 
362 
363 #endif // vtkStreamingTessellator_h
vtkIdType GetCaseCount(int c)
Reset/access the histogram of subdivision cases encountered.
abstract base class for most VTK objects
Definition: vtkObject.h:53
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
An algorithm that refines an initial simplicial tessellation using edge subdivision.
int PointDimension[4]
PointDimension is the length of each double* array associated with each point passed to a subdivision...
void AdaptivelySample1Facet(double *v0, double *v1) const
This will adaptively subdivide the tetrahedron (3-facet), triangle (2-facet), or edge (1-facet) until...
int GetEmbeddingDimension(int k) const
Get/Set the number of parameter-space coordinates associated with each input and output point...
vtkIdType GetSubcaseCount(int casenum, int sub)
Reset/access the histogram of subdivision cases encountered.
void AdaptivelySample2Facet(double *v0, double *v1, double *v2) const
This will adaptively subdivide the tetrahedron (3-facet), triangle (2-facet), or edge (1-facet) until...
int GetFieldSize(int k) const
Get/Set the number of field value coordinates associated with each input and output point...
int vtkIdType
Definition: vtkType.h:345
int EmbeddingDimension[4]
The parametric dimension of each point passed to the subdivision algorithm.
EdgeProcessorFunction Callback1
a simple class to control print indentation
Definition: vtkIndent.h:33
TetrahedronProcessorFunction Callback3
how to decide whether a linear approximation to nonlinear geometry or field should be subdivided ...
vtkEdgeSubdivisionCriterion * Algorithm
void AdaptivelySample3Facet(double *v0, double *v1, double *v2, double *v3) const
This will adaptively subdivide the tetrahedron (3-facet), triangle (2-facet), or edge (1-facet) until...
TriangleProcessorFunction Callback2
void ResetCounts()
Reset/access the histogram of subdivision cases encountered.
int GetMaximumNumberOfSubdivisions()
Get/Set the maximum number of subdivisions that may occur.
int MaximumNumberOfSubdivisions
The number of subdivisions allowed.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
VertexProcessorFunction Callback0