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
vtkStreamingTessellator
An algorithm that refines an initial simplicial tessellation using edge subdivision.
Definition: vtkStreamingTessellator.h:86
vtkStreamingTessellator::GetCaseCount
vtkIdType GetCaseCount(int c)
Reset/access the histogram of subdivision cases encountered.
Definition: vtkStreamingTessellator.h:286
vtkStreamingTessellator::AdaptivelySample2FacetLinear
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...
vtkStreamingTessellator::BestTets
int BestTets(int *, double **, int, int) const
vtkStreamingTessellator::GetEmbeddingDimension
int GetEmbeddingDimension(int k) const
Get/Set the number of parameter-space coordinates associated with each input and output point.
Definition: vtkStreamingTessellator.h:376
vtkStreamingTessellator::AdaptivelySample1FacetLinear
void AdaptivelySample1FacetLinear(double *v0, double *v1) const
This will adaptively subdivide the tetrahedron (3-facet), triangle (2-facet), or edge (1-facet) until...
vtkIdType
int vtkIdType
Definition: vtkType.h:332
vtkStreamingTessellator::vtkStreamingTessellator
vtkStreamingTessellator()
vtkStreamingTessellator::GetTriangleCallback
virtual TriangleProcessorFunction GetTriangleCallback() const
Get/Set the function called for each output triangle (2-facet).
vtkStreamingTessellator::SetTriangleCallback
virtual void SetTriangleCallback(TriangleProcessorFunction)
Get/Set the function called for each output triangle (2-facet).
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:82
vtkStreamingTessellator::Callback1
EdgeProcessorFunction Callback1
Definition: vtkStreamingTessellator.h:317
vtkStreamingTessellator::GetSubcaseCount
vtkIdType GetSubcaseCount(int casenum, int sub)
Reset/access the histogram of subdivision cases encountered.
Definition: vtkStreamingTessellator.h:295
vtkStreamingTessellator::PointDimension
int PointDimension[4]
PointDimension is the length of each double* array associated with each point passed to a subdivision...
Definition: vtkStreamingTessellator.h:333
vtkStreamingTessellator::AdaptivelySample2Facet
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...
Definition: vtkStreamingTessellator.h:366
vtkStreamingTessellator::AdaptivelySample1Facet
void AdaptivelySample1Facet(double *v0, double *v1) const
This will adaptively subdivide the tetrahedron (3-facet), triangle (2-facet), or edge (1-facet) until...
Definition: vtkStreamingTessellator.h:371
vtkStreamingTessellator::AdaptivelySample3Facet
void AdaptivelySample3Facet(double *v0, double *v1, double *v2, double *v3, int maxDepth) const
vtkStreamingTessellator::GetFieldSize
int GetFieldSize(int k) const
Get/Set the number of field value coordinates associated with each input and output point.
Definition: vtkStreamingTessellator.h:383
vtkStreamingTessellator::SetSubdivisionAlgorithm
virtual void SetSubdivisionAlgorithm(vtkEdgeSubdivisionCriterion *)
Get/Set the algorithm used to determine whether an edge should be subdivided or left as-is.
vtkStreamingTessellator::SetEmbeddingDimension
virtual void SetEmbeddingDimension(int k, int d)
Get/Set the number of parameter-space coordinates associated with each input and output point.
vtkStreamingTessellator::GetSubdivisionAlgorithm
virtual vtkEdgeSubdivisionCriterion * GetSubdivisionAlgorithm()
Get/Set the algorithm used to determine whether an edge should be subdivided or left as-is.
vtkStreamingTessellator::SetConstPrivateData
virtual void SetConstPrivateData(const void *ConstPrivate)
Get/Set a constant void pointer passed to the simplex output functions.
vtkStreamingTessellator::GetVertexCallback
virtual VertexProcessorFunction GetVertexCallback() const
Get/Set the function called for each output line segment (1-facet).
vtkStreamingTessellator::SetMaximumNumberOfSubdivisions
virtual void SetMaximumNumberOfSubdivisions(int num_subdiv_in)
Get/Set the maximum number of subdivisions that may occur.
vtkStreamingTessellator::EmbeddingDimension
int EmbeddingDimension[4]
The parametric dimension of each point passed to the subdivision algorithm.
Definition: vtkStreamingTessellator.h:340
vtkStreamingTessellator::~vtkStreamingTessellator
~vtkStreamingTessellator() override
vtkEdgeSubdivisionCriterion
how to decide whether a linear approximation to nonlinear geometry or field should be subdivided
Definition: vtkEdgeSubdivisionCriterion.h:44
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkStreamingTessellator::PrivateData
void * PrivateData
Definition: vtkStreamingTessellator.h:312
vtkStreamingTessellator::AdaptivelySample3FacetLinear
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...
vtkStreamingTessellator::AdaptivelySample3Facet
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...
Definition: vtkStreamingTessellator.h:361
vtkStreamingTessellator::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkStreamingTessellator::SetEdgeCallback
virtual void SetEdgeCallback(EdgeProcessorFunction)
Get/Set the function called for each output line segment (1-facet).
vtkStreamingTessellator::Callback3
TetrahedronProcessorFunction Callback3
Definition: vtkStreamingTessellator.h:319
vtkStreamingTessellator::SetFieldSize
virtual void SetFieldSize(int k, int s)
Get/Set the number of field value coordinates associated with each input and output point.
vtkStreamingTessellator::GetPrivateData
virtual void * GetPrivateData() const
Get/Set a void pointer passed to the triangle and edge output functions.
vtkStreamingTessellator::New
static vtkStreamingTessellator * New()
vtkStreamingTessellator::Algorithm
vtkEdgeSubdivisionCriterion * Algorithm
Definition: vtkStreamingTessellator.h:314
vtkStreamingTessellator::ConstPrivateData
const void * ConstPrivateData
Definition: vtkStreamingTessellator.h:313
vtkObject.h
vtkStreamingTessellator::Callback2
TriangleProcessorFunction Callback2
Definition: vtkStreamingTessellator.h:318
vtkStreamingTessellator::AdaptivelySample2Facet
void AdaptivelySample2Facet(double *v0, double *v1, double *v2, int maxDepth, int move=7) const
vtkStreamingTessellator::SetPrivateData
virtual void SetPrivateData(void *Private)
Get/Set a void pointer passed to the triangle and edge output functions.
vtkStreamingTessellator::Callback0
VertexProcessorFunction Callback0
Definition: vtkStreamingTessellator.h:316
vtkStreamingTessellator::SetTetrahedronCallback
virtual void SetTetrahedronCallback(TetrahedronProcessorFunction)
Get/Set the function called for each output tetrahedron (3-facet).
vtkStreamingTessellator::ResetCounts
void ResetCounts()
Reset/access the histogram of subdivision cases encountered.
Definition: vtkStreamingTessellator.h:273
vtkStreamingTessellator::GetEdgeCallback
virtual EdgeProcessorFunction GetEdgeCallback() const
Get/Set the function called for each output line segment (1-facet).
vtkStreamingTessellator::GetMaximumNumberOfSubdivisions
int GetMaximumNumberOfSubdivisions()
Get/Set the maximum number of subdivisions that may occur.
Definition: vtkStreamingTessellator.h:390
vtkStreamingTessellator::SetVertexCallback
virtual void SetVertexCallback(VertexProcessorFunction)
Get/Set the function called for each output line segment (1-facet).
vtkStreamingTessellator::AdaptivelySample0Facet
void AdaptivelySample0Facet(double *v0) const
This will adaptively subdivide the tetrahedron (3-facet), triangle (2-facet), or edge (1-facet) until...
vtkStreamingTessellator::GetConstPrivateData
virtual const void * GetConstPrivateData() const
Get/Set a constant void pointer passed to the simplex output functions.
vtkStreamingTessellator::GetSubdivisionAlgorithm
virtual const vtkEdgeSubdivisionCriterion * GetSubdivisionAlgorithm() const
vtkStreamingTessellator::GetTetrahedronCallback
virtual TetrahedronProcessorFunction GetTetrahedronCallback() const
Get/Set the function called for each output tetrahedron (3-facet).
vtkStreamingTessellator::MaximumNumberOfSubdivisions
int MaximumNumberOfSubdivisions
The number of subdivisions allowed.
Definition: vtkStreamingTessellator.h:345
vtkStreamingTessellator::AdaptivelySample1Facet
void AdaptivelySample1Facet(double *v0, double *v1, int maxDepth) const