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 =========================================================================*/
78 #ifndef vtkStreamingTessellator_h
79 #define vtkStreamingTessellator_h
80 
81 #include "vtkFiltersCoreModule.h" // For export macro
82 #include "vtkObject.h"
83 
84 #undef PARAVIEW_DEBUG_TESSELLATOR
85 
87 
88 class VTKFILTERSCORE_EXPORT vtkStreamingTessellator : public vtkObject
89 {
90  public:
92  static vtkStreamingTessellator* New();
93  void PrintSelf( ostream& os, vtkIndent indent ) override;
94 
95  typedef void (*VertexProcessorFunction)( const double*, vtkEdgeSubdivisionCriterion*, void*, const void* );
96  typedef void (*EdgeProcessorFunction)( const double*, const double*, vtkEdgeSubdivisionCriterion*, void*, const void* );
97  typedef void (*TriangleProcessorFunction)( const double*, const double*, const double*, vtkEdgeSubdivisionCriterion*, void*, const void* );
98  typedef void (*TetrahedronProcessorFunction)( const double*, const double*, const double*, const double*, vtkEdgeSubdivisionCriterion*, void*, const void* );
99 
100  enum {MaxFieldSize = 18};
101 
103 
106  virtual void SetTetrahedronCallback( TetrahedronProcessorFunction );
107  virtual TetrahedronProcessorFunction GetTetrahedronCallback() const;
109 
111 
114  virtual void SetTriangleCallback( TriangleProcessorFunction );
115  virtual TriangleProcessorFunction GetTriangleCallback() const;
117 
119 
122  virtual void SetEdgeCallback( EdgeProcessorFunction );
123  virtual EdgeProcessorFunction GetEdgeCallback() const;
125 
127 
130  virtual void SetVertexCallback( VertexProcessorFunction );
131  virtual VertexProcessorFunction GetVertexCallback() const;
133 
135 
138  virtual void SetPrivateData( void* Private );
139  virtual void* GetPrivateData() const;
141 
142  // can't wrap const private data because python wrapper will try to cast it to void*, not const void*
143 
145 
148  virtual void SetConstPrivateData( const void* ConstPrivate );
149  virtual const void* GetConstPrivateData() const;
151 
153 
160  virtual void SetSubdivisionAlgorithm( vtkEdgeSubdivisionCriterion* );
161  virtual vtkEdgeSubdivisionCriterion* GetSubdivisionAlgorithm() ;
163 
164  virtual const vtkEdgeSubdivisionCriterion* GetSubdivisionAlgorithm() const;
165 
167 
179  virtual void SetEmbeddingDimension( int k, int d );
180  int GetEmbeddingDimension( int k ) const;
182 
184 
213  virtual void SetFieldSize( int k, int s );
214  int GetFieldSize( int k ) const;
216 
218 
221  virtual void SetMaximumNumberOfSubdivisions( int num_subdiv_in );
222  int GetMaximumNumberOfSubdivisions();
224 
226 
245  void AdaptivelySample3Facet( double* v0, double* v1, double* v2, double* v3 ) const ;
246  void AdaptivelySample2Facet( double* v0, double* v1, double* v2 ) const ;
247  void AdaptivelySample1Facet( double* v0, double* v1 ) const ;
248  void AdaptivelySample0Facet( double* v0 ) const ;
250 
252 
262  void ResetCounts()
263  {
264 #ifdef PARAVIEW_DEBUG_TESSELLATOR
265  for ( int i=0; i<11; ++i )
266  {
267  this->CaseCounts[i] = 0;
268  for ( int j=0; j<51; ++j )
269  {
270  this->SubcaseCounts[i][j] = 0;
271  }
272  }
273 #endif // PARAVIEW_DEBUG_TESSELLATOR
274  }
276  {
277 #ifdef PARAVIEW_DEBUG_TESSELLATOR
278  return this->CaseCounts[c];
279 #else
280  (void)c;
281  return 0;
282 #endif // PARAVIEW_DEBUG_TESSELLATOR
283  }
284  vtkIdType GetSubcaseCount( int casenum, int sub )
285  {
286 #ifdef PARAVIEW_DEBUG_TESSELLATOR
287  return this->SubcaseCounts[casenum][sub];
288 #else
289  (void)casenum;
290  (void)sub;
291  return 0;
292 #endif // PARAVIEW_DEBUG_TESSELLATOR
293  }
295 
296  protected:
297 
298  static int EdgeCodesToCaseCodesPlusPermutation[64][2];
299  static vtkIdType PermutationsFromIndex[24][14];
300  static vtkIdType TetrahedralDecompositions[];
301 
302  void* PrivateData;
303  const void* ConstPrivateData;
304  vtkEdgeSubdivisionCriterion* Algorithm;
305 
306  VertexProcessorFunction Callback0;
307  EdgeProcessorFunction Callback1;
308  TriangleProcessorFunction Callback2;
309  TetrahedronProcessorFunction Callback3;
310 #ifdef PARAVIEW_DEBUG_TESSELLATOR
311  mutable vtkIdType CaseCounts[11];
312  mutable vtkIdType SubcaseCounts[11][51];
313 #endif // PARAVIEW_DEBUG_TESSELLATOR
314 
323  int PointDimension[4];
324 
330  int EmbeddingDimension[4];
331 
336 
338  ~vtkStreamingTessellator() override;
339 
340  void AdaptivelySample3Facet( double* v0, double* v1, double* v2, double* v3, int maxDepth ) const ;
341  void AdaptivelySample2Facet( double* v0, double* v1, double* v2, int maxDepth, int move=7 ) const ;
342  void AdaptivelySample1Facet( double* v0, double* v1, int maxDepth ) const ;
343 
344  int BestTets( int*, double**, int, int ) const;
345 
346  private:
348  void operator = ( const vtkStreamingTessellator& ) = delete;
349 };
350 
351 inline void vtkStreamingTessellator::AdaptivelySample3Facet( double* v0, double* v1, double* v2, double* v3 ) const
352 { this->AdaptivelySample3Facet( v0, v1, v2, v3, this->MaximumNumberOfSubdivisions ); }
353 inline void vtkStreamingTessellator::AdaptivelySample2Facet( double* v0, double* v1, double* v2 ) const
354 { this->AdaptivelySample2Facet( v0, v1, v2, this->MaximumNumberOfSubdivisions ); }
355 inline void vtkStreamingTessellator::AdaptivelySample1Facet( double* v0, double* v1 ) const
356 { this->AdaptivelySample1Facet( v0, v1, this->MaximumNumberOfSubdivisions ); }
357 
359 { if ( k <= 0 || k >= 4 ) return -1; return this->EmbeddingDimension[k]; }
360 
361 inline int vtkStreamingTessellator::GetFieldSize( int k ) const
362 { if ( k <= 0 || k >= 4 ) return -1; return this->PointDimension[k] - this->EmbeddingDimension[k] - 3; }
363 
364 inline int vtkStreamingTessellator::GetMaximumNumberOfSubdivisions() {return this->MaximumNumberOfSubdivisions;}
365 
366 #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:59
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 GetFieldSize(int k) const
Get/Set the number of field value coordinates associated with each input and output point...
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...
vtkIdType GetSubcaseCount(int casenum, int sub)
Reset/access the histogram of subdivision cases encountered.
int vtkIdType
Definition: vtkType.h:347
EdgeProcessorFunction Callback1
a simple class to control print indentation
Definition: vtkIndent.h:39
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...
TetrahedronProcessorFunction Callback3
how to decide whether a linear approximation to nonlinear geometry or field should be subdivided ...
vtkEdgeSubdivisionCriterion * Algorithm
TriangleProcessorFunction Callback2
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...
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