VTK  9.1.0
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:
90  void PrintSelf(ostream& os, vtkIndent indent) override;
91 
92  typedef void (*VertexProcessorFunction)(
93  const double*, vtkEdgeSubdivisionCriterion*, void*, const void*);
94  typedef void (*EdgeProcessorFunction)(
95  const double*, const double*, vtkEdgeSubdivisionCriterion*, void*, const void*);
96  typedef void (*TriangleProcessorFunction)(
97  const double*, const double*, const double*, vtkEdgeSubdivisionCriterion*, void*, const void*);
98  typedef void (*TetrahedronProcessorFunction)(const double*, const double*, const double*,
99  const double*, vtkEdgeSubdivisionCriterion*, void*, const void*);
100 
101  enum
102  {
103  MaxFieldSize = 18
104  };
105 
107 
110  virtual void SetTetrahedronCallback(TetrahedronProcessorFunction);
111  virtual TetrahedronProcessorFunction GetTetrahedronCallback() const;
113 
115 
118  virtual void SetTriangleCallback(TriangleProcessorFunction);
119  virtual TriangleProcessorFunction GetTriangleCallback() const;
121 
123 
126  virtual void SetEdgeCallback(EdgeProcessorFunction);
127  virtual EdgeProcessorFunction GetEdgeCallback() const;
129 
131 
134  virtual void SetVertexCallback(VertexProcessorFunction);
135  virtual VertexProcessorFunction GetVertexCallback() const;
137 
139 
142  virtual void SetPrivateData(void* Private);
143  virtual void* GetPrivateData() const;
145 
146  // can't wrap const private data because python wrapper will try to cast it to void*, not const
147  // void*
148 
150 
153  virtual void SetConstPrivateData(const void* ConstPrivate);
154  virtual const void* GetConstPrivateData() const;
156 
158 
168 
170 
172 
184  virtual void SetEmbeddingDimension(int k, int d);
185  int GetEmbeddingDimension(int k) const;
187 
189 
218  virtual void SetFieldSize(int k, int s);
219  int GetFieldSize(int k) const;
221 
223 
226  virtual void SetMaximumNumberOfSubdivisions(int num_subdiv_in);
227  int GetMaximumNumberOfSubdivisions();
229 
231 
250  void AdaptivelySample3FacetLinear(double* v0, double* v1, double* v2, double* v3) const;
251  void AdaptivelySample2FacetLinear(double* v0, double* v1, double* v2) const;
252  void AdaptivelySample1FacetLinear(double* v0, double* v1) const;
253 
254  void AdaptivelySample3Facet(double* v0, double* v1, double* v2, double* v3) const;
255  void AdaptivelySample2Facet(double* v0, double* v1, double* v2) const;
256  void AdaptivelySample1Facet(double* v0, double* v1) const;
257  void AdaptivelySample0Facet(double* v0) const;
259 
261 
273  void ResetCounts()
274  {
275 #ifdef PARAVIEW_DEBUG_TESSELLATOR
276  for (int i = 0; i < 11; ++i)
277  {
278  this->CaseCounts[i] = 0;
279  for (int j = 0; j < 51; ++j)
280  {
281  this->SubcaseCounts[i][j] = 0;
282  }
283  }
284 #endif // PARAVIEW_DEBUG_TESSELLATOR
285  }
287  {
288 #ifdef PARAVIEW_DEBUG_TESSELLATOR
289  return this->CaseCounts[c];
290 #else
291  (void)c;
292  return 0;
293 #endif // PARAVIEW_DEBUG_TESSELLATOR
294  }
295  vtkIdType GetSubcaseCount(int casenum, int sub)
296  {
297 #ifdef PARAVIEW_DEBUG_TESSELLATOR
298  return this->SubcaseCounts[casenum][sub];
299 #else
300  (void)casenum;
301  (void)sub;
302  return 0;
303 #endif // PARAVIEW_DEBUG_TESSELLATOR
304  }
306 
307 protected:
308  static int EdgeCodesToCaseCodesPlusPermutation[64][2];
309  static vtkIdType PermutationsFromIndex[24][14];
310  static vtkIdType TetrahedralDecompositions[];
311 
312  void* PrivateData;
313  const void* ConstPrivateData;
315 
316  VertexProcessorFunction Callback0;
317  EdgeProcessorFunction Callback1;
318  TriangleProcessorFunction Callback2;
319  TetrahedronProcessorFunction Callback3;
320 #ifdef PARAVIEW_DEBUG_TESSELLATOR
321  mutable vtkIdType CaseCounts[11];
322  mutable vtkIdType SubcaseCounts[11][51];
323 #endif // PARAVIEW_DEBUG_TESSELLATOR
324 
333  int PointDimension[4];
334 
340  int EmbeddingDimension[4];
341 
346 
349 
350  void AdaptivelySample3Facet(double* v0, double* v1, double* v2, double* v3, int maxDepth) const;
351  void AdaptivelySample2Facet(double* v0, double* v1, double* v2, int maxDepth, int move = 7) const;
352  void AdaptivelySample1Facet(double* v0, double* v1, int maxDepth) const;
353 
354  int BestTets(int*, double**, int, int) const;
355 
356 private:
358  void operator=(const vtkStreamingTessellator&) = delete;
359 };
360 
362  double* v0, double* v1, double* v2, double* v3) const
363 {
364  this->AdaptivelySample3Facet(v0, v1, v2, v3, this->MaximumNumberOfSubdivisions);
365 }
367  double* v0, double* v1, double* v2) const
368 {
369  this->AdaptivelySample2Facet(v0, v1, v2, this->MaximumNumberOfSubdivisions);
370 }
371 inline void vtkStreamingTessellator::AdaptivelySample1Facet(double* v0, double* v1) const
372 {
374 }
375 
377 {
378  if (k <= 0 || k >= 4)
379  return -1;
380  return this->EmbeddingDimension[k];
381 }
382 
384 {
385  if (k <= 0 || k >= 4)
386  return -1;
387  return this->PointDimension[k] - this->EmbeddingDimension[k] - 3;
388 }
389 
391 {
392  return this->MaximumNumberOfSubdivisions;
393 }
394 
395 #endif // vtkStreamingTessellator_h
how to decide whether a linear approximation to nonlinear geometry or field should be subdivided
a simple class to control print indentation
Definition: vtkIndent.h:34
abstract base class for most VTK objects
Definition: vtkObject.h:63
An algorithm that refines an initial simplicial tessellation using edge subdivision.
virtual TetrahedronProcessorFunction GetTetrahedronCallback() const
Get/Set the function called for each output tetrahedron (3-facet).
~vtkStreamingTessellator() override
void AdaptivelySample3FacetLinear(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...
void AdaptivelySample1Facet(double *v0, double *v1, int maxDepth) const
vtkIdType GetCaseCount(int c)
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...
virtual void SetSubdivisionAlgorithm(vtkEdgeSubdivisionCriterion *)
Get/Set the algorithm used to determine whether an edge should be subdivided or left as-is.
virtual void SetMaximumNumberOfSubdivisions(int num_subdiv_in)
Get/Set the maximum number of subdivisions that may occur.
TriangleProcessorFunction Callback2
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...
virtual void SetFieldSize(int k, int s)
Get/Set the number of field value coordinates associated with each input and output point.
virtual VertexProcessorFunction GetVertexCallback() const
Get/Set the function called for each output line segment (1-facet).
int BestTets(int *, double **, int, int) const
VertexProcessorFunction Callback0
EdgeProcessorFunction Callback1
virtual void * GetPrivateData() const
Get/Set a void pointer passed to the triangle and edge output functions.
void AdaptivelySample0Facet(double *v0) const
This will adaptively subdivide the tetrahedron (3-facet), triangle (2-facet), or edge (1-facet) until...
int PointDimension[4]
PointDimension is the length of each double* array associated with each point passed to a subdivision...
virtual void SetVertexCallback(VertexProcessorFunction)
Get/Set the function called for each output line segment (1-facet).
static vtkStreamingTessellator * New()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkEdgeSubdivisionCriterion * Algorithm
int GetMaximumNumberOfSubdivisions()
Get/Set the maximum number of subdivisions that may occur.
virtual void SetEdgeCallback(EdgeProcessorFunction)
Get/Set the function called for each output line segment (1-facet).
int GetFieldSize(int k) const
Get/Set the number of field value coordinates associated with each input and output point.
void ResetCounts()
Reset/access the histogram of subdivision cases encountered.
void AdaptivelySample1Facet(double *v0, double *v1) const
This will adaptively subdivide the tetrahedron (3-facet), triangle (2-facet), or edge (1-facet) until...
virtual vtkEdgeSubdivisionCriterion * GetSubdivisionAlgorithm()
Get/Set the algorithm used to determine whether an edge should be subdivided or left as-is.
TetrahedronProcessorFunction Callback3
virtual void SetTetrahedronCallback(TetrahedronProcessorFunction)
Get/Set the function called for each output tetrahedron (3-facet).
void AdaptivelySample1FacetLinear(double *v0, double *v1) const
This will adaptively subdivide the tetrahedron (3-facet), triangle (2-facet), or edge (1-facet) until...
void AdaptivelySample2FacetLinear(double *v0, double *v1, double *v2) const
This will adaptively subdivide the tetrahedron (3-facet), triangle (2-facet), or edge (1-facet) until...
void AdaptivelySample3Facet(double *v0, double *v1, double *v2, double *v3, int maxDepth) const
virtual const void * GetConstPrivateData() const
Get/Set a constant void pointer passed to the simplex output functions.
virtual void SetPrivateData(void *Private)
Get/Set a void pointer passed to the triangle and edge output functions.
virtual const vtkEdgeSubdivisionCriterion * GetSubdivisionAlgorithm() const
virtual TriangleProcessorFunction GetTriangleCallback() const
Get/Set the function called for each output triangle (2-facet).
virtual void SetEmbeddingDimension(int k, int d)
Get/Set the number of parameter-space coordinates associated with each input and output point.
virtual void SetConstPrivateData(const void *ConstPrivate)
Get/Set a constant void pointer passed to the simplex output functions.
vtkIdType GetSubcaseCount(int casenum, int sub)
Reset/access the histogram of subdivision cases encountered.
int EmbeddingDimension[4]
The parametric dimension of each point passed to the subdivision algorithm.
virtual void SetTriangleCallback(TriangleProcessorFunction)
Get/Set the function called for each output triangle (2-facet).
int MaximumNumberOfSubdivisions
The number of subdivisions allowed.
virtual EdgeProcessorFunction GetEdgeCallback() const
Get/Set the function called for each output line segment (1-facet).
int GetEmbeddingDimension(int k) const
Get/Set the number of parameter-space coordinates associated with each input and output point.
void AdaptivelySample2Facet(double *v0, double *v1, double *v2, int maxDepth, int move=7) const
int vtkIdType
Definition: vtkType.h:332