VTK  9.2.6
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)(
96  const double*, vtkEdgeSubdivisionCriterion*, void*, const void*);
97  typedef void (*EdgeProcessorFunction)(
98  const double*, const double*, vtkEdgeSubdivisionCriterion*, void*, const void*);
99  typedef void (*TriangleProcessorFunction)(
100  const double*, const double*, const double*, vtkEdgeSubdivisionCriterion*, void*, const void*);
101  typedef void (*TetrahedronProcessorFunction)(const double*, const double*, const double*,
102  const double*, vtkEdgeSubdivisionCriterion*, void*, const void*);
103 
104  enum
105  {
106  MaxFieldSize = 18
107  };
108 
110 
113  virtual void SetTetrahedronCallback(TetrahedronProcessorFunction);
114  virtual TetrahedronProcessorFunction GetTetrahedronCallback() const;
116 
118 
121  virtual void SetTriangleCallback(TriangleProcessorFunction);
122  virtual TriangleProcessorFunction GetTriangleCallback() const;
124 
126 
129  virtual void SetEdgeCallback(EdgeProcessorFunction);
130  virtual EdgeProcessorFunction GetEdgeCallback() const;
132 
134 
137  virtual void SetVertexCallback(VertexProcessorFunction);
138  virtual VertexProcessorFunction GetVertexCallback() const;
140 
142 
145  virtual void SetPrivateData(void* Private);
146  virtual void* GetPrivateData() const;
148 
149  // can't wrap const private data because python wrapper will try to cast it to void*, not const
150  // void*
151 
153 
156  virtual void SetConstPrivateData(const void* ConstPrivate);
157  virtual const void* GetConstPrivateData() const;
159 
161 
168  virtual void SetSubdivisionAlgorithm(vtkEdgeSubdivisionCriterion*);
169  virtual vtkEdgeSubdivisionCriterion* GetSubdivisionAlgorithm();
171 
172  virtual const vtkEdgeSubdivisionCriterion* GetSubdivisionAlgorithm() const;
173 
175 
187  virtual void SetEmbeddingDimension(int k, int d);
188  int GetEmbeddingDimension(int k) const;
190 
192 
221  virtual void SetFieldSize(int k, int s);
222  int GetFieldSize(int k) const;
224 
226 
229  virtual void SetMaximumNumberOfSubdivisions(int num_subdiv_in);
230  int GetMaximumNumberOfSubdivisions();
232 
234 
253  void AdaptivelySample3FacetLinear(double* v0, double* v1, double* v2, double* v3) const;
254  void AdaptivelySample2FacetLinear(double* v0, double* v1, double* v2) const;
255  void AdaptivelySample1FacetLinear(double* v0, double* v1) const;
256 
257  void AdaptivelySample3Facet(double* v0, double* v1, double* v2, double* v3) const;
258  void AdaptivelySample2Facet(double* v0, double* v1, double* v2) const;
259  void AdaptivelySample1Facet(double* v0, double* v1) const;
260  void AdaptivelySample0Facet(double* v0) const;
262 
264 
276  void ResetCounts()
277  {
278 #ifdef PARAVIEW_DEBUG_TESSELLATOR
279  for (int i = 0; i < 11; ++i)
280  {
281  this->CaseCounts[i] = 0;
282  for (int j = 0; j < 51; ++j)
283  {
284  this->SubcaseCounts[i][j] = 0;
285  }
286  }
287 #endif // PARAVIEW_DEBUG_TESSELLATOR
288  }
290  {
291 #ifdef PARAVIEW_DEBUG_TESSELLATOR
292  return this->CaseCounts[c];
293 #else
294  (void)c;
295  return 0;
296 #endif // PARAVIEW_DEBUG_TESSELLATOR
297  }
298  vtkIdType GetSubcaseCount(int casenum, int sub)
299  {
300 #ifdef PARAVIEW_DEBUG_TESSELLATOR
301  return this->SubcaseCounts[casenum][sub];
302 #else
303  (void)casenum;
304  (void)sub;
305  return 0;
306 #endif // PARAVIEW_DEBUG_TESSELLATOR
307  }
309 
310 protected:
311  static int EdgeCodesToCaseCodesPlusPermutation[64][2];
312  static vtkIdType PermutationsFromIndex[24][14];
313  static vtkIdType TetrahedralDecompositions[];
314 
315  void* PrivateData;
316  const void* ConstPrivateData;
317  vtkEdgeSubdivisionCriterion* Algorithm;
318 
319  VertexProcessorFunction Callback0;
320  EdgeProcessorFunction Callback1;
321  TriangleProcessorFunction Callback2;
322  TetrahedronProcessorFunction Callback3;
323 #ifdef PARAVIEW_DEBUG_TESSELLATOR
324  mutable vtkIdType CaseCounts[11];
325  mutable vtkIdType SubcaseCounts[11][51];
326 #endif // PARAVIEW_DEBUG_TESSELLATOR
327 
336  int PointDimension[4];
337 
343  int EmbeddingDimension[4];
344 
349 
351  ~vtkStreamingTessellator() override;
352 
353  void AdaptivelySample3Facet(double* v0, double* v1, double* v2, double* v3, int maxDepth) const;
354  void AdaptivelySample2Facet(double* v0, double* v1, double* v2, int maxDepth, int move = 7) const;
355  void AdaptivelySample1Facet(double* v0, double* v1, int maxDepth) const;
356 
357  int BestTets(int*, double**, int, int) const;
358 
359 private:
361  void operator=(const vtkStreamingTessellator&) = delete;
362 };
363 
365  double* v0, double* v1, double* v2, double* v3) const
366 {
367  this->AdaptivelySample3Facet(v0, v1, v2, v3, this->MaximumNumberOfSubdivisions);
368 }
370  double* v0, double* v1, double* v2) const
371 {
372  this->AdaptivelySample2Facet(v0, v1, v2, this->MaximumNumberOfSubdivisions);
373 }
374 inline void vtkStreamingTessellator::AdaptivelySample1Facet(double* v0, double* v1) const
375 {
377 }
378 
380 {
381  if (k <= 0 || k >= 4)
382  return -1;
383  return this->EmbeddingDimension[k];
384 }
385 
387 {
388  if (k <= 0 || k >= 4)
389  return -1;
390  return this->PointDimension[k] - this->EmbeddingDimension[k] - 3;
391 }
392 
394 {
395  return this->MaximumNumberOfSubdivisions;
396 }
397 
398 #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:62
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...
int PointDimension[4]
PointDimension is the length of each double* array associated with each point passed to a subdivision...
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:332
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: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