VTK  9.7.1
vtkStreamingTessellator.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright 2003 Sandia Corporation
3 // SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-USGov
67 #ifndef vtkStreamingTessellator_h
68 #define vtkStreamingTessellator_h
69 
70 #include "vtkFiltersCoreModule.h" // For export macro
71 #include "vtkObject.h"
72 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
73 
74 #undef PARAVIEW_DEBUG_TESSELLATOR
75 
76 VTK_ABI_NAMESPACE_BEGIN
78 
79 class VTKFILTERSCORE_EXPORT VTK_MARSHALAUTO vtkStreamingTessellator : public vtkObject
80 {
81 public:
83  static vtkStreamingTessellator* New();
84  void PrintSelf(ostream& os, vtkIndent indent) override;
85 
86  typedef void (*VertexProcessorFunction)(
87  const double*, vtkEdgeSubdivisionCriterion*, void*, const void*);
88  typedef void (*EdgeProcessorFunction)(
89  const double*, const double*, vtkEdgeSubdivisionCriterion*, void*, const void*);
90  typedef void (*TriangleProcessorFunction)(
91  const double*, const double*, const double*, vtkEdgeSubdivisionCriterion*, void*, const void*);
92  typedef void (*TetrahedronProcessorFunction)(const double*, const double*, const double*,
93  const double*, vtkEdgeSubdivisionCriterion*, void*, const void*);
94 
95  enum
96  {
97  MaxFieldSize = 18
98  };
99 
101 
105  virtual void SetTetrahedronCallback(TetrahedronProcessorFunction);
107  virtual TetrahedronProcessorFunction GetTetrahedronCallback() const;
109 
111 
115  virtual void SetTriangleCallback(TriangleProcessorFunction);
117  virtual TriangleProcessorFunction GetTriangleCallback() const;
119 
121 
125  virtual void SetEdgeCallback(EdgeProcessorFunction);
127  virtual EdgeProcessorFunction GetEdgeCallback() const;
129 
131 
135  virtual void SetVertexCallback(VertexProcessorFunction);
137  virtual VertexProcessorFunction GetVertexCallback() const;
139 
141 
145  virtual void SetPrivateData(void* Private);
147  virtual void* GetPrivateData() const;
149 
150  // can't wrap const private data because python wrapper will try to cast it to void*, not const
151  // void*
152 
154 
158  virtual void SetConstPrivateData(const void* ConstPrivate);
160  virtual const void* GetConstPrivateData() const;
162 
164 
171  virtual void SetSubdivisionAlgorithm(vtkEdgeSubdivisionCriterion*);
172  virtual vtkEdgeSubdivisionCriterion* GetSubdivisionAlgorithm();
174 
175  virtual const vtkEdgeSubdivisionCriterion* GetSubdivisionAlgorithm() const;
176 
178 
190  virtual void SetEmbeddingDimension(int k, int d);
191  int GetEmbeddingDimension(int k) const;
193 
195 
224  virtual void SetFieldSize(int k, int s);
225  int GetFieldSize(int k) const;
227 
229 
232  virtual void SetMaximumNumberOfSubdivisions(int num_subdiv_in);
233  int GetMaximumNumberOfSubdivisions();
235 
237 
256  void AdaptivelySample3FacetLinear(double* v0, double* v1, double* v2, double* v3) const;
257  void AdaptivelySample2FacetLinear(double* v0, double* v1, double* v2) const;
258  void AdaptivelySample1FacetLinear(double* v0, double* v1) const;
259 
260  void AdaptivelySample3Facet(double* v0, double* v1, double* v2, double* v3) const;
261  void AdaptivelySample2Facet(double* v0, double* v1, double* v2) const;
262  void AdaptivelySample1Facet(double* v0, double* v1) const;
263  void AdaptivelySample0Facet(double* v0) const;
265 
267 
279  void ResetCounts()
280  {
281 #ifdef PARAVIEW_DEBUG_TESSELLATOR
282  for (int i = 0; i < 11; ++i)
283  {
284  this->CaseCounts[i] = 0;
285  for (int j = 0; j < 51; ++j)
286  {
287  this->SubcaseCounts[i][j] = 0;
288  }
289  }
290 #endif // PARAVIEW_DEBUG_TESSELLATOR
291  }
293  {
294 #ifdef PARAVIEW_DEBUG_TESSELLATOR
295  return this->CaseCounts[c];
296 #else
297  (void)c;
298  return 0;
299 #endif // PARAVIEW_DEBUG_TESSELLATOR
300  }
301  vtkIdType GetSubcaseCount(int casenum, int sub)
302  {
303 #ifdef PARAVIEW_DEBUG_TESSELLATOR
304  return this->SubcaseCounts[casenum][sub];
305 #else
306  (void)casenum;
307  (void)sub;
308  return 0;
309 #endif // PARAVIEW_DEBUG_TESSELLATOR
310  }
312 
313 protected:
314  static int EdgeCodesToCaseCodesPlusPermutation[64][2];
315  static vtkIdType PermutationsFromIndex[24][14];
316  static vtkIdType TetrahedralDecompositions[];
317 
318  void* PrivateData;
319  const void* ConstPrivateData;
320  vtkEdgeSubdivisionCriterion* Algorithm;
321 
322  VertexProcessorFunction Callback0;
323  EdgeProcessorFunction Callback1;
324  TriangleProcessorFunction Callback2;
325  TetrahedronProcessorFunction Callback3;
326 #ifdef PARAVIEW_DEBUG_TESSELLATOR
327  mutable vtkIdType CaseCounts[11];
328  mutable vtkIdType SubcaseCounts[11][51];
329 #endif // PARAVIEW_DEBUG_TESSELLATOR
330 
339  int PointDimension[4];
340 
346  int EmbeddingDimension[4];
347 
352 
354  ~vtkStreamingTessellator() override;
355 
356  void AdaptivelySample3Facet(double* v0, double* v1, double* v2, double* v3, int maxDepth) const;
357  void AdaptivelySample2Facet(double* v0, double* v1, double* v2, int maxDepth, int move = 7) const;
358  void AdaptivelySample1Facet(double* v0, double* v1, int maxDepth) const;
359 
360  int BestTets(int*, double**, int, int) const;
361 
362 private:
364  void operator=(const vtkStreamingTessellator&) = delete;
365 };
366 
368  double* v0, double* v1, double* v2, double* v3) const
369 {
370  this->AdaptivelySample3Facet(v0, v1, v2, v3, this->MaximumNumberOfSubdivisions);
371 }
373  double* v0, double* v1, double* v2) const
374 {
375  this->AdaptivelySample2Facet(v0, v1, v2, this->MaximumNumberOfSubdivisions);
376 }
377 inline void vtkStreamingTessellator::AdaptivelySample1Facet(double* v0, double* v1) const
378 {
380 }
381 
383 {
384  if (k <= 0 || k >= 4)
385  return -1;
386  return this->EmbeddingDimension[k];
387 }
388 
390 {
391  if (k <= 0 || k >= 4)
392  return -1;
393  return this->PointDimension[k] - this->EmbeddingDimension[k] - 3;
394 }
395 
397 {
398  return this->MaximumNumberOfSubdivisions;
399 }
400 
401 VTK_ABI_NAMESPACE_END
402 #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:52
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:363
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:28
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
#define VTK_MARSHALEXCLUDE(reason)
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...
int GetMaximumNumberOfSubdivisions()
Get/Set the maximum number of subdivisions that may occur.
int MaximumNumberOfSubdivisions
The number of subdivisions allowed.
#define VTK_MARSHALAUTO
#define VTK_MARSHAL_EXCLUDE_REASON_NOT_SUPPORTED
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
VertexProcessorFunction Callback0