VTK  9.4.20241217
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
73#undef PARAVIEW_DEBUG_TESSELLATOR
74
75VTK_ABI_NAMESPACE_BEGIN
77
78class VTKFILTERSCORE_EXPORT vtkStreamingTessellator : public vtkObject
79{
80public:
83 void PrintSelf(ostream& os, vtkIndent indent) override;
84
85 typedef void (*VertexProcessorFunction)(
86 const double*, vtkEdgeSubdivisionCriterion*, void*, const void*);
87 typedef void (*EdgeProcessorFunction)(
88 const double*, const double*, vtkEdgeSubdivisionCriterion*, void*, const void*);
89 typedef void (*TriangleProcessorFunction)(
90 const double*, const double*, const double*, vtkEdgeSubdivisionCriterion*, void*, const void*);
91 typedef void (*TetrahedronProcessorFunction)(const double*, const double*, const double*,
92 const double*, vtkEdgeSubdivisionCriterion*, void*, const void*);
93
94 enum
95 {
96 MaxFieldSize = 18
97 };
98
100
103 virtual void SetTetrahedronCallback(TetrahedronProcessorFunction);
104 virtual TetrahedronProcessorFunction GetTetrahedronCallback() const;
106
108
111 virtual void SetTriangleCallback(TriangleProcessorFunction);
112 virtual TriangleProcessorFunction GetTriangleCallback() const;
114
116
119 virtual void SetEdgeCallback(EdgeProcessorFunction);
120 virtual EdgeProcessorFunction GetEdgeCallback() const;
122
124
127 virtual void SetVertexCallback(VertexProcessorFunction);
128 virtual VertexProcessorFunction GetVertexCallback() const;
130
132
135 virtual void SetPrivateData(void* Private);
136 virtual void* GetPrivateData() const;
138
139 // can't wrap const private data because python wrapper will try to cast it to void*, not const
140 // void*
141
143
146 virtual void SetConstPrivateData(const void* ConstPrivate);
147 virtual const void* GetConstPrivateData() const;
149
151
161
163
165
177 virtual void SetEmbeddingDimension(int k, int d);
178 int GetEmbeddingDimension(int k) const;
180
182
211 virtual void SetFieldSize(int k, int s);
212 int GetFieldSize(int k) const;
214
216
219 virtual void SetMaximumNumberOfSubdivisions(int num_subdiv_in);
220 int GetMaximumNumberOfSubdivisions();
222
224
243 void AdaptivelySample3FacetLinear(double* v0, double* v1, double* v2, double* v3) const;
244 void AdaptivelySample2FacetLinear(double* v0, double* v1, double* v2) const;
245 void AdaptivelySample1FacetLinear(double* v0, double* v1) const;
246
247 void AdaptivelySample3Facet(double* v0, double* v1, double* v2, double* v3) const;
248 void AdaptivelySample2Facet(double* v0, double* v1, double* v2) const;
249 void AdaptivelySample1Facet(double* v0, double* v1) const;
250 void AdaptivelySample0Facet(double* v0) const;
252
254
267 {
268#ifdef PARAVIEW_DEBUG_TESSELLATOR
269 for (int i = 0; i < 11; ++i)
270 {
271 this->CaseCounts[i] = 0;
272 for (int j = 0; j < 51; ++j)
273 {
274 this->SubcaseCounts[i][j] = 0;
275 }
276 }
277#endif // PARAVIEW_DEBUG_TESSELLATOR
278 }
280 {
281#ifdef PARAVIEW_DEBUG_TESSELLATOR
282 return this->CaseCounts[c];
283#else
284 (void)c;
285 return 0;
286#endif // PARAVIEW_DEBUG_TESSELLATOR
287 }
288 vtkIdType GetSubcaseCount(int casenum, int sub)
289 {
290#ifdef PARAVIEW_DEBUG_TESSELLATOR
291 return this->SubcaseCounts[casenum][sub];
292#else
293 (void)casenum;
294 (void)sub;
295 return 0;
296#endif // PARAVIEW_DEBUG_TESSELLATOR
297 }
299
300protected:
301 static int EdgeCodesToCaseCodesPlusPermutation[64][2];
302 static vtkIdType PermutationsFromIndex[24][14];
303 static vtkIdType TetrahedralDecompositions[];
304
306 const void* ConstPrivateData;
308
309 VertexProcessorFunction Callback0;
310 EdgeProcessorFunction Callback1;
311 TriangleProcessorFunction Callback2;
312 TetrahedronProcessorFunction Callback3;
313#ifdef PARAVIEW_DEBUG_TESSELLATOR
314 mutable vtkIdType CaseCounts[11];
315 mutable vtkIdType SubcaseCounts[11][51];
316#endif // PARAVIEW_DEBUG_TESSELLATOR
317
326 int PointDimension[4];
327
333 int EmbeddingDimension[4];
334
339
342
343 void AdaptivelySample3Facet(double* v0, double* v1, double* v2, double* v3, int maxDepth) const;
344 void AdaptivelySample2Facet(double* v0, double* v1, double* v2, int maxDepth, int move = 7) const;
345 void AdaptivelySample1Facet(double* v0, double* v1, int maxDepth) const;
346
347 int BestTets(int*, double**, int, int) const;
348
349private:
351 void operator=(const vtkStreamingTessellator&) = delete;
352};
353
355 double* v0, double* v1, double* v2, double* v3) const
356{
357 this->AdaptivelySample3Facet(v0, v1, v2, v3, this->MaximumNumberOfSubdivisions);
358}
360 double* v0, double* v1, double* v2) const
361{
363}
364inline void vtkStreamingTessellator::AdaptivelySample1Facet(double* v0, double* v1) const
365{
367}
368
370{
371 if (k <= 0 || k >= 4)
372 return -1;
373 return this->EmbeddingDimension[k];
374}
375
377{
378 if (k <= 0 || k >= 4)
379 return -1;
380 return this->PointDimension[k] - this->EmbeddingDimension[k] - 3;
381}
382
384{
385 return this->MaximumNumberOfSubdivisions;
386}
387
388VTK_ABI_NAMESPACE_END
389#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:108
abstract base class for most VTK objects
Definition vtkObject.h:162
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).
virtual const void * GetConstPrivateData() const
Get/Set a constant void pointer passed to the simplex output functions.
~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 const vtkEdgeSubdivisionCriterion * GetSubdivisionAlgorithm() const
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).
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkEdgeSubdivisionCriterion * Algorithm
virtual vtkEdgeSubdivisionCriterion * GetSubdivisionAlgorithm()
Get/Set the algorithm used to determine whether an edge should be subdivided or left as-is.
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.
virtual void * GetPrivateData() const
Get/Set a void pointer passed to the triangle and edge output functions.
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...
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
static vtkStreamingTessellator * New()
virtual void SetPrivateData(void *Private)
Get/Set a void pointer passed to the triangle and edge output functions.
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:315