VTK: Filters/Geometry/vtkDataSetSurfaceFilter.h Source File

| VTK 9.3.1

vtkDataSetSurfaceFilter.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
88 #ifndef vtkDataSetSurfaceFilter_h
89 #define vtkDataSetSurfaceFilter_h
90
91 #include "vtkFiltersGeometryModule.h" // For export macro
92 #include "vtkGeometryFilter.h" // To facilitate delegation
93 #include "vtkPolyDataAlgorithm.h"
94
95 VTK_ABI_NAMESPACE_BEGIN
96 template <typename ArrayType>
97 class vtkSmartPointer;
98
99 class vtkPointData;
100 class vtkPoints;
101 class vtkIdTypeArray;
102 class vtkImageData;
103 class vtkRectilinearGrid;
104 class vtkStructuredGrid;
105 class vtkUnstructuredGridBase;
106
107 // Helper structure for hashing faces.
108 struct vtkFastGeomQuadStruct
109 {
110 struct vtkFastGeomQuadStruct* Next;
111 vtkIdType SourceId;
112 int numPts;
113 vtkIdType* ptArray;
114 };
115 typedef struct vtkFastGeomQuadStruct vtkFastGeomQuad;
116
117 class VTKFILTERSGEOMETRY_EXPORT vtkDataSetSurfaceFilter : public vtkPolyDataAlgorithm
118 {
119 public:
121
124 static vtkDataSetSurfaceFilter* New();
125 vtkTypeMacro(vtkDataSetSurfaceFilter, vtkPolyDataAlgorithm);
126 void PrintSelf(ostream& os, vtkIndent indent) override;
127
129
134 vtkSetMacro(PieceInvariant, int);
135 vtkGetMacro(PieceInvariant, int);
137
139
145 vtkSetMacro(PassThroughCellIds, vtkTypeBool);
146 vtkGetMacro(PassThroughCellIds, vtkTypeBool);
147 vtkBooleanMacro(PassThroughCellIds, vtkTypeBool);
148 vtkSetMacro(PassThroughPointIds, vtkTypeBool);
149 vtkGetMacro(PassThroughPointIds, vtkTypeBool);
150 vtkBooleanMacro(PassThroughPointIds, vtkTypeBool);
152
154
160 vtkSetMacro(FastMode, bool);
161 vtkGetMacro(FastMode, bool);
162 vtkBooleanMacro(FastMode, bool);
164
166
172 vtkSetStringMacro(OriginalCellIdsName);
173 virtual const char* GetOriginalCellIdsName()
174 {
175 return (this->OriginalCellIdsName ? this->OriginalCellIdsName : "vtkOriginalCellIds");
176 }
177 vtkSetStringMacro(OriginalPointIdsName);
178 virtual const char* GetOriginalPointIdsName()
179 {
180 return (this->OriginalPointIdsName ? this->OriginalPointIdsName : "vtkOriginalPointIds");
181 }
183
185
196 vtkSetMacro(NonlinearSubdivisionLevel, int);
197 vtkGetMacro(NonlinearSubdivisionLevel, int);
199
201
206 vtkSetMacro(Delegation, vtkTypeBool);
207 vtkGetMacro(Delegation, vtkTypeBool);
208 vtkBooleanMacro(Delegation, vtkTypeBool);
210
212
216 virtual int StructuredExecute(
217 vtkDataSet* input, vtkPolyData* output, vtkIdType* ext, vtkIdType* wholeExt);
218 #ifdef VTK_USE_64BIT_IDS
219 virtual int StructuredExecute(
220 vtkDataSet* input, vtkPolyData* output, const int* ext32, const int* wholeExt32)
221 {
222 vtkIdType ext[6];
223 vtkIdType wholeExt[6];
224 for (int cc = 0; cc < 6; cc++)
225 {
226 ext[cc] = ext32[cc];
227 wholeExt[cc] = wholeExt32[cc];
228 }
229 return this->StructuredExecute(input, output, ext, wholeExt);
230 }
231 #endif
232
241 virtual int UnstructuredGridExecute(vtkDataSet* input, vtkPolyData* output);
243
247 virtual int DataSetExecute(vtkDataSet* input, vtkPolyData* output);
248 virtual int UniformGridExecute(vtkDataSet* input, vtkPolyData* output, vtkIdType* ext,
249 vtkIdType* wholeExt, bool extractface[6]);
251
256 int UnstructuredGridExecute(
257 vtkDataSet* input, vtkPolyData* output, vtkGeometryFilterHelper* info);
258 #ifdef VTK_USE_64BIT_IDS
259 virtual int UniformGridExecute(vtkDataSet* input, vtkPolyData* output, const int* ext32,
260 const int* wholeExt32, bool extractface[6])
261 {
262 vtkIdType ext[6];
263 vtkIdType wholeExt[6];
264 for (int cc = 0; cc < 6; cc++)
265 {
266 ext[cc] = ext32[cc];
267 wholeExt[cc] = wholeExt32[cc];
268 }
269 return this->UniformGridExecute(input, output, ext, wholeExt, extractface);
270 }
271 #endif
273
274 protected:
275 vtkDataSetSurfaceFilter();
276 ~vtkDataSetSurfaceFilter() override;
277
278 int RequestUpdateExtent(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
279
280 int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
281 int FillInputPortInformation(int port, vtkInformation* info) override;
282
283 // Helper methods.
284
292 void EstimateStructuredDataArraySizes(
293 vtkIdType* ext, vtkIdType* wholeExt, vtkIdType& numPoints, vtkIdType& numCells);
294
295 void ExecuteFaceQuads(vtkDataSet* input, vtkPolyData* output, int maxFlag, vtkIdType* ext,
296 int aAxis, int bAxis, int cAxis, vtkIdType* wholeExt, bool checkVisibility);
297
298 void ExecuteFaceQuads(vtkDataSet* input, vtkPolyData* output, int maxFlag, vtkIdType* ext,
299 int aAxis, int bAxis, int cAxis, vtkIdType* wholeExt);
300
301 void InitializeQuadHash(vtkIdType numPoints);
302 void DeleteQuadHash();
303 virtual void InsertQuadInHash(
304 vtkIdType a, vtkIdType b, vtkIdType c, vtkIdType d, vtkIdType sourceId);
305 virtual void InsertTriInHash(
306 vtkIdType a, vtkIdType b, vtkIdType c, vtkIdType sourceId, vtkIdType faceId = -1);
307 virtual void InsertPolygonInHash(const vtkIdType* ids, int numpts, vtkIdType sourceId);
308 void InitQuadHashTraversal();
309 vtkFastGeomQuad* GetNextVisibleQuadFromHash();
310
311 vtkFastGeomQuad** QuadHash;
312 vtkIdType QuadHashLength;
313 vtkFastGeomQuad* QuadHashTraversal;
314 vtkIdType QuadHashTraversalIndex;
315
316 vtkIdType* PointMap;
317 vtkIdType GetOutputPointId(
318 vtkIdType inPtId, vtkDataSet* input, vtkPoints* outPts, vtkPointData* outPD);
319 vtkIdType GetOutputPointIdAndInterpolate(vtkIdType inPtId, vtkDataSet* input, vtkCell* cell,
320 double* weights, vtkPoints* outPts, vtkPointData* outPD);
321
322 class vtkEdgeInterpolationMap;
323
324 vtkEdgeInterpolationMap* EdgeMap;
325 vtkIdType GetInterpolatedPointId(vtkIdType edgePtA, vtkIdType edgePtB, vtkDataSet* input,
326 vtkCell* cell, double pcoords[3], double* weights, vtkPoints* outPts, vtkPointData* outPD);
327 vtkIdType GetInterpolatedPointId(vtkDataSet* input, vtkCell* cell, double pcoords[3],
328 double* weights, vtkPoints* outPts, vtkPointData* outPD);
329 vtkIdType NumberOfNewCells;
330
331 // Better memory allocation for faces (hash)
332 void InitFastGeomQuadAllocation(vtkIdType numberOfCells);
333 vtkFastGeomQuad* NewFastGeomQuad(int numPts);
334 void DeleteAllFastGeomQuads();
335 // -----
336 vtkIdType FastGeomQuadArrayLength;
337 vtkIdType NumberOfFastGeomQuadArrays;
338 unsigned char** FastGeomQuadArrays; // store this data as an array of bytes
339 // These indexes allow us to find the next available face.
340 vtkIdType NextArrayIndex;
341 vtkIdType NextQuadIndex;
342
343 int PieceInvariant;
344
345 vtkTypeBool PassThroughCellIds;
346 void RecordOrigCellId(vtkIdType newIndex, vtkIdType origId);
347 virtual void RecordOrigCellId(vtkIdType newIndex, vtkFastGeomQuad* quad);
348 vtkIdTypeArray* OriginalCellIds;
349 char* OriginalCellIdsName;
350
351 vtkTypeBool PassThroughPointIds;
352 void RecordOrigPointId(vtkIdType newIndex, vtkIdType origId);
353 vtkIdTypeArray* OriginalPointIds;
354 char* OriginalPointIdsName;
355
356 int NonlinearSubdivisionLevel;
357 vtkTypeBool Delegation;
358 bool FastMode;
359
360 private:
361 int UnstructuredGridBaseExecute(vtkDataSet* input, vtkPolyData* output);
362 int UnstructuredGridExecuteInternal(
363 vtkUnstructuredGridBase* input, vtkPolyData* output, bool handleSubdivision);
364
365 int StructuredExecuteNoBlanking(
366 vtkDataSet* input, vtkPolyData* output, vtkIdType* ext, vtkIdType* wholeExt);
367
368 vtkDataSetSurfaceFilter(const vtkDataSetSurfaceFilter&) = delete;
369 void operator=(const vtkDataSetSurfaceFilter&) = delete;
370 };
371
372 VTK_ABI_NAMESPACE_END
373 #endif
vtkCell
abstract class to specify cell behavior
Definition: vtkCell.h:59
vtkDataSetSurfaceFilter
Extracts outer surface (as vtkPolyData) of any dataset.
Definition: vtkDataSetSurfaceFilter.h:118
vtkDataSetSurfaceFilter::Delegation
vtkTypeBool Delegation
Definition: vtkDataSetSurfaceFilter.h:357
vtkDataSetSurfaceFilter::NextArrayIndex
vtkIdType NextArrayIndex
Definition: vtkDataSetSurfaceFilter.h:340
vtkDataSetSurfaceFilter::OriginalPointIdsName
char * OriginalPointIdsName
Definition: vtkDataSetSurfaceFilter.h:354
vtkDataSetSurfaceFilter::FastGeomQuadArrays
unsigned char ** FastGeomQuadArrays
Definition: vtkDataSetSurfaceFilter.h:338
vtkDataSetSurfaceFilter::QuadHashTraversal
vtkFastGeomQuad * QuadHashTraversal
Definition: vtkDataSetSurfaceFilter.h:313
vtkDataSetSurfaceFilter::PassThroughCellIds
vtkTypeBool PassThroughCellIds
Definition: vtkDataSetSurfaceFilter.h:345
vtkDataSetSurfaceFilter::GetOutputPointId
vtkIdType GetOutputPointId(vtkIdType inPtId, vtkDataSet *input, vtkPoints *outPts, vtkPointData *outPD)
vtkDataSetSurfaceFilter::QuadHash
vtkFastGeomQuad ** QuadHash
Definition: vtkDataSetSurfaceFilter.h:311
vtkDataSetSurfaceFilter::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Statndard methods for object instantiation, type information, and printing.
vtkDataSetSurfaceFilter::ExecuteFaceQuads
void ExecuteFaceQuads(vtkDataSet *input, vtkPolyData *output, int maxFlag, vtkIdType *ext, int aAxis, int bAxis, int cAxis, vtkIdType *wholeExt)
vtkDataSetSurfaceFilter::New
static vtkDataSetSurfaceFilter * New()
Statndard methods for object instantiation, type information, and printing.
vtkDataSetSurfaceFilter::UnstructuredGridExecute
int UnstructuredGridExecute(vtkDataSet *input, vtkPolyData *output, vtkGeometryFilterHelper *info)
Optimized UnstructuredGridExecute function for vtkUnstructuredGrid and subclass instances only.
vtkDataSetSurfaceFilter::DataSetExecute
virtual int DataSetExecute(vtkDataSet *input, vtkPolyData *output)
Execute the filter on input and store the result in output.
vtkDataSetSurfaceFilter::GetInterpolatedPointId
vtkIdType GetInterpolatedPointId(vtkDataSet *input, vtkCell *cell, double pcoords[3], double *weights, vtkPoints *outPts, vtkPointData *outPD)
vtkDataSetSurfaceFilter::InsertPolygonInHash
virtual void InsertPolygonInHash(const vtkIdType *ids, int numpts, vtkIdType sourceId)
vtkDataSetSurfaceFilter::GetOriginalCellIdsName
virtual const char * GetOriginalCellIdsName()
If PassThroughCellIds or PassThroughPointIds is on, then these ivars control the name given to the fi...
Definition: vtkDataSetSurfaceFilter.h:173
vtkDataSetSurfaceFilter::NewFastGeomQuad
vtkFastGeomQuad * NewFastGeomQuad(int numPts)
vtkDataSetSurfaceFilter::NumberOfFastGeomQuadArrays
vtkIdType NumberOfFastGeomQuadArrays
Definition: vtkDataSetSurfaceFilter.h:337
vtkDataSetSurfaceFilter::DeleteAllFastGeomQuads
void DeleteAllFastGeomQuads()
vtkDataSetSurfaceFilter::NextQuadIndex
vtkIdType NextQuadIndex
Definition: vtkDataSetSurfaceFilter.h:341
vtkDataSetSurfaceFilter::ExecuteFaceQuads
void ExecuteFaceQuads(vtkDataSet *input, vtkPolyData *output, int maxFlag, vtkIdType *ext, int aAxis, int bAxis, int cAxis, vtkIdType *wholeExt, bool checkVisibility)
vtkDataSetSurfaceFilter::UniformGridExecute
virtual int UniformGridExecute(vtkDataSet *input, vtkPolyData *output, vtkIdType *ext, vtkIdType *wholeExt, bool extractface[6])
Direct access methods so that this class can be used as an algorithm without using it as a filter (i....
vtkDataSetSurfaceFilter::QuadHashTraversalIndex
vtkIdType QuadHashTraversalIndex
Definition: vtkDataSetSurfaceFilter.h:314
vtkDataSetSurfaceFilter::~vtkDataSetSurfaceFilter
~vtkDataSetSurfaceFilter() override
vtkDataSetSurfaceFilter::PointMap
vtkIdType * PointMap
Definition: vtkDataSetSurfaceFilter.h:316
vtkDataSetSurfaceFilter::RequestUpdateExtent
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
vtkDataSetSurfaceFilter::OriginalCellIdsName
char * OriginalCellIdsName
Definition: vtkDataSetSurfaceFilter.h:349
vtkDataSetSurfaceFilter::vtkDataSetSurfaceFilter
vtkDataSetSurfaceFilter()
vtkDataSetSurfaceFilter::EstimateStructuredDataArraySizes
void EstimateStructuredDataArraySizes(vtkIdType *ext, vtkIdType *wholeExt, vtkIdType &numPoints, vtkIdType &numCells)
Estimates the total number of points & cells on the surface to render ext – the extent of the structu...
vtkDataSetSurfaceFilter::StructuredExecute
virtual int StructuredExecute(vtkDataSet *input, vtkPolyData *output, vtkIdType *ext, vtkIdType *wholeExt)
Direct access methods so that this class can be used as an algorithm without using it as a filter (i....
vtkDataSetSurfaceFilter::QuadHashLength
vtkIdType QuadHashLength
Definition: vtkDataSetSurfaceFilter.h:312
vtkDataSetSurfaceFilter::OriginalCellIds
vtkIdTypeArray * OriginalCellIds
Definition: vtkDataSetSurfaceFilter.h:348
vtkDataSetSurfaceFilter::UnstructuredGridExecute
virtual int UnstructuredGridExecute(vtkDataSet *input, vtkPolyData *output)
Execute the filter on input and store the result in output.
vtkDataSetSurfaceFilter::GetOutputPointIdAndInterpolate
vtkIdType GetOutputPointIdAndInterpolate(vtkIdType inPtId, vtkDataSet *input, vtkCell *cell, double *weights, vtkPoints *outPts, vtkPointData *outPD)
vtkDataSetSurfaceFilter::GetNextVisibleQuadFromHash
vtkFastGeomQuad * GetNextVisibleQuadFromHash()
vtkDataSetSurfaceFilter::EdgeMap
vtkEdgeInterpolationMap * EdgeMap
Definition: vtkDataSetSurfaceFilter.h:322
vtkDataSetSurfaceFilter::RecordOrigCellId
virtual void RecordOrigCellId(vtkIdType newIndex, vtkFastGeomQuad *quad)
vtkDataSetSurfaceFilter::GetInterpolatedPointId
vtkIdType GetInterpolatedPointId(vtkIdType edgePtA, vtkIdType edgePtB, vtkDataSet *input, vtkCell *cell, double pcoords[3], double *weights, vtkPoints *outPts, vtkPointData *outPD)
vtkDataSetSurfaceFilter::PieceInvariant
int PieceInvariant
Definition: vtkDataSetSurfaceFilter.h:343
vtkDataSetSurfaceFilter::InitQuadHashTraversal
void InitQuadHashTraversal()
vtkDataSetSurfaceFilter::InitFastGeomQuadAllocation
void InitFastGeomQuadAllocation(vtkIdType numberOfCells)
vtkDataSetSurfaceFilter::DeleteQuadHash
void DeleteQuadHash()
vtkDataSetSurfaceFilter::NonlinearSubdivisionLevel
int NonlinearSubdivisionLevel
Definition: vtkDataSetSurfaceFilter.h:356
vtkDataSetSurfaceFilter::RecordOrigPointId
void RecordOrigPointId(vtkIdType newIndex, vtkIdType origId)
vtkDataSetSurfaceFilter::RecordOrigCellId
void RecordOrigCellId(vtkIdType newIndex, vtkIdType origId)
vtkDataSetSurfaceFilter::NumberOfNewCells
vtkIdType NumberOfNewCells
Definition: vtkDataSetSurfaceFilter.h:329
vtkDataSetSurfaceFilter::FillInputPortInformation
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkDataSetSurfaceFilter::GetOriginalPointIdsName
virtual const char * GetOriginalPointIdsName()
If PassThroughCellIds or PassThroughPointIds is on, then these ivars control the name given to the fi...
Definition: vtkDataSetSurfaceFilter.h:178
vtkDataSetSurfaceFilter::InsertQuadInHash
virtual void InsertQuadInHash(vtkIdType a, vtkIdType b, vtkIdType c, vtkIdType d, vtkIdType sourceId)
vtkDataSetSurfaceFilter::RequestData
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
vtkDataSetSurfaceFilter::InsertTriInHash
virtual void InsertTriInHash(vtkIdType a, vtkIdType b, vtkIdType c, vtkIdType sourceId, vtkIdType faceId=-1)
vtkDataSetSurfaceFilter::OriginalPointIds
vtkIdTypeArray * OriginalPointIds
Definition: vtkDataSetSurfaceFilter.h:353
vtkDataSetSurfaceFilter::FastMode
bool FastMode
Definition: vtkDataSetSurfaceFilter.h:358
vtkDataSetSurfaceFilter::FastGeomQuadArrayLength
vtkIdType FastGeomQuadArrayLength
Definition: vtkDataSetSurfaceFilter.h:336
vtkDataSetSurfaceFilter::PassThroughPointIds
vtkTypeBool PassThroughPointIds
Definition: vtkDataSetSurfaceFilter.h:351
vtkDataSetSurfaceFilter::InitializeQuadHash
void InitializeQuadHash(vtkIdType numPoints)
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
vtkIdTypeArray
dynamic, self-adjusting array of vtkIdType
Definition: vtkIdTypeArray.h:37
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:52
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:40
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:72
vtkPointData
represent and manipulate point attribute data
Definition: vtkPointData.h:39
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:38
vtkPolyDataAlgorithm
Superclass for algorithms that produce only polydata as output.
Definition: vtkPolyDataAlgorithm.h:43
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:89
vtkRectilinearGrid
a dataset that is topologically regular with variable spacing in the three coordinate directions
Definition: vtkRectilinearGrid.h:56
vtkSmartPointer
Hold a reference to a vtkObjectBase instance.
Definition: vtkSmartPointer.h:41
vtkStructuredGrid
topologically regular array of data
Definition: vtkStructuredGrid.h:63
vtkUnstructuredGridBase
dataset represents arbitrary combinations of all possible cell types.
Definition: vtkUnstructuredGridBase.h:27
vtkX3D::info
@ info
Definition: vtkX3D.h:376
vtkX3D::port
@ port
Definition: vtkX3D.h:447
vtkFastGeomQuadStruct
Definition: vtkDataSetSurfaceFilter.h:109
vtkFastGeomQuadStruct::ptArray
vtkIdType * ptArray
Definition: vtkDataSetSurfaceFilter.h:113
vtkFastGeomQuadStruct::SourceId
vtkIdType SourceId
Definition: vtkDataSetSurfaceFilter.h:111
vtkFastGeomQuadStruct::Next
struct vtkFastGeomQuadStruct * Next
Definition: vtkDataSetSurfaceFilter.h:110
vtkFastGeomQuadStruct::numPts
int numPts
Definition: vtkDataSetSurfaceFilter.h:112
vtkGeometryFilterHelper
Definition: vtkGeometryFilter.h:108
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:64
vtkGeometryFilter.h
vtkPolyDataAlgorithm.h
vtkIdType
int vtkIdType
Definition: vtkType.h:315