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
79 #ifndef vtkDataSetSurfaceFilter_h
80 #define vtkDataSetSurfaceFilter_h
81 
82 #include "vtkFiltersGeometryModule.h" // For export macro
83 #include "vtkGeometryFilter.h" // To facilitate delegation
84 #include "vtkPolyDataAlgorithm.h"
85 
86 VTK_ABI_NAMESPACE_BEGIN
87 template <typename ArrayType>
88 class vtkSmartPointer;
89 
90 class vtkPointData;
91 class vtkPoints;
92 class vtkIdTypeArray;
93 class vtkImageData;
94 class vtkRectilinearGrid;
95 class vtkStructuredGrid;
97 
98 // Helper structure for hashing faces.
100 {
103  int numPts;
105 };
107 
108 class VTKFILTERSGEOMETRY_EXPORT vtkDataSetSurfaceFilter : public vtkPolyDataAlgorithm
109 {
110 public:
112 
115  static vtkDataSetSurfaceFilter* New();
117  void PrintSelf(ostream& os, vtkIndent indent) override;
118 
120 
125  vtkSetMacro(PieceInvariant, int);
126  vtkGetMacro(PieceInvariant, int);
128 
130 
136  vtkSetMacro(PassThroughCellIds, vtkTypeBool);
137  vtkGetMacro(PassThroughCellIds, vtkTypeBool);
138  vtkBooleanMacro(PassThroughCellIds, vtkTypeBool);
139  vtkSetMacro(PassThroughPointIds, vtkTypeBool);
140  vtkGetMacro(PassThroughPointIds, vtkTypeBool);
141  vtkBooleanMacro(PassThroughPointIds, vtkTypeBool);
143 
145 
151  vtkSetMacro(FastMode, bool);
152  vtkGetMacro(FastMode, bool);
153  vtkBooleanMacro(FastMode, bool);
155 
157 
163  vtkSetStringMacro(OriginalCellIdsName);
164  virtual const char* GetOriginalCellIdsName()
165  {
166  return (this->OriginalCellIdsName ? this->OriginalCellIdsName : "vtkOriginalCellIds");
167  }
168  vtkSetStringMacro(OriginalPointIdsName);
169  virtual const char* GetOriginalPointIdsName()
170  {
171  return (this->OriginalPointIdsName ? this->OriginalPointIdsName : "vtkOriginalPointIds");
172  }
174 
176 
187  vtkSetMacro(NonlinearSubdivisionLevel, int);
188  vtkGetMacro(NonlinearSubdivisionLevel, int);
190 
192 
197  vtkSetMacro(Delegation, vtkTypeBool);
198  vtkGetMacro(Delegation, vtkTypeBool);
199  vtkBooleanMacro(Delegation, vtkTypeBool);
201 
203 
207  virtual int StructuredExecute(
208  vtkDataSet* input, vtkPolyData* output, vtkIdType* ext, vtkIdType* wholeExt);
209 #ifdef VTK_USE_64BIT_IDS
210  virtual int StructuredExecute(
211  vtkDataSet* input, vtkPolyData* output, const int* ext32, const int* wholeExt32)
212  {
213  vtkIdType ext[6];
214  vtkIdType wholeExt[6];
215  for (int cc = 0; cc < 6; cc++)
216  {
217  ext[cc] = ext32[cc];
218  wholeExt[cc] = wholeExt32[cc];
219  }
220  return this->StructuredExecute(input, output, ext, wholeExt);
221  }
222 #endif
223 
232  virtual int UnstructuredGridExecute(vtkDataSet* input, vtkPolyData* output);
234 
238  virtual int DataSetExecute(vtkDataSet* input, vtkPolyData* output);
239  virtual int UniformGridExecute(vtkDataSet* input, vtkPolyData* output, vtkIdType* ext,
240  vtkIdType* wholeExt, bool extractface[6]);
242 
247  int UnstructuredGridExecute(
249 #ifdef VTK_USE_64BIT_IDS
250  virtual int UniformGridExecute(vtkDataSet* input, vtkPolyData* output, const int* ext32,
251  const int* wholeExt32, bool extractface[6])
252  {
253  vtkIdType ext[6];
254  vtkIdType wholeExt[6];
255  for (int cc = 0; cc < 6; cc++)
256  {
257  ext[cc] = ext32[cc];
258  wholeExt[cc] = wholeExt32[cc];
259  }
260  return this->UniformGridExecute(input, output, ext, wholeExt, extractface);
261  }
262 #endif
263 
265 protected:
267  ~vtkDataSetSurfaceFilter() override;
268 
270 
272  int FillInputPortInformation(int port, vtkInformation* info) override;
273 
274  // Helper methods.
275 
283  void EstimateStructuredDataArraySizes(
284  vtkIdType* ext, vtkIdType* wholeExt, vtkIdType& numPoints, vtkIdType& numCells);
285 
286  void ExecuteFaceQuads(vtkDataSet* input, vtkPolyData* output, int maxFlag, vtkIdType* ext,
287  int aAxis, int bAxis, int cAxis, vtkIdType* wholeExt, bool checkVisibility);
288 
289  void ExecuteFaceQuads(vtkDataSet* input, vtkPolyData* output, int maxFlag, vtkIdType* ext,
290  int aAxis, int bAxis, int cAxis, vtkIdType* wholeExt);
291 
292  void InitializeQuadHash(vtkIdType numPoints);
293  void DeleteQuadHash();
294  virtual void InsertQuadInHash(
295  vtkIdType a, vtkIdType b, vtkIdType c, vtkIdType d, vtkIdType sourceId);
296  virtual void InsertTriInHash(
297  vtkIdType a, vtkIdType b, vtkIdType c, vtkIdType sourceId, vtkIdType faceId = -1);
298  virtual void InsertPolygonInHash(const vtkIdType* ids, int numpts, vtkIdType sourceId);
299  void InitQuadHashTraversal();
300  vtkFastGeomQuad* GetNextVisibleQuadFromHash();
301 
306 
308  vtkIdType GetOutputPointId(
309  vtkIdType inPtId, vtkDataSet* input, vtkPoints* outPts, vtkPointData* outPD);
310  vtkIdType GetOutputPointIdAndInterpolate(vtkIdType inPtId, vtkDataSet* input, vtkCell* cell,
311  double* weights, vtkPoints* outPts, vtkPointData* outPD);
312 
313  class vtkEdgeInterpolationMap;
314 
315  vtkEdgeInterpolationMap* EdgeMap;
316  vtkIdType GetInterpolatedPointId(vtkIdType edgePtA, vtkIdType edgePtB, vtkDataSet* input,
317  vtkCell* cell, double pcoords[3], double* weights, vtkPoints* outPts, vtkPointData* outPD);
318  vtkIdType GetInterpolatedPointId(vtkDataSet* input, vtkCell* cell, double pcoords[3],
319  double* weights, vtkPoints* outPts, vtkPointData* outPD);
321 
322  // Better memory allocation for faces (hash)
323  void InitFastGeomQuadAllocation(vtkIdType numberOfCells);
324  vtkFastGeomQuad* NewFastGeomQuad(int numPts);
325  void DeleteAllFastGeomQuads();
326  // -----
329  unsigned char** FastGeomQuadArrays; // store this data as an array of bytes
330  // These indexes allow us to find the next available face.
333 
335 
337  void RecordOrigCellId(vtkIdType newIndex, vtkIdType origId);
338  virtual void RecordOrigCellId(vtkIdType newIndex, vtkFastGeomQuad* quad);
341 
343  void RecordOrigPointId(vtkIdType newIndex, vtkIdType origId);
346 
349  bool FastMode;
350 
351 private:
352  int UnstructuredGridBaseExecute(vtkDataSet* input, vtkPolyData* output);
353  int UnstructuredGridExecuteInternal(
354  vtkUnstructuredGridBase* input, vtkPolyData* output, bool handleSubdivision);
355 
356  int StructuredExecuteNoBlanking(
357  vtkDataSet* input, vtkPolyData* output, vtkIdType* ext, vtkIdType* wholeExt);
358 
360  void operator=(const vtkDataSetSurfaceFilter&) = delete;
361 };
362 
363 VTK_ABI_NAMESPACE_END
364 #endif
a dataset that is topologically regular with variable spacing in the three coordinate directions ...
represent and manipulate point attribute data
Definition: vtkPointData.h:29
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:52
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
virtual const char * GetOriginalCellIdsName()
If PassThroughCellIds or PassThroughPointIds is on, then these ivars control the name given to the fi...
dynamic, self-adjusting array of vtkIdType
Hold a reference to a vtkObjectBase instance.
Definition: vtkMeta.h:23
int vtkIdType
Definition: vtkType.h:315
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
static vtkPolyDataAlgorithm * New()
int vtkTypeBool
Definition: vtkABI.h:64
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
abstract class to specify cell behavior
Definition: vtkCell.h:49
Superclass for algorithms that produce only polydata as output.
struct vtkFastGeomQuadStruct * Next
a simple class to control print indentation
Definition: vtkIndent.h:28
topologically and geometrically regular array of data
Definition: vtkImageData.h:42
topologically regular array of data
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
virtual const char * GetOriginalPointIdsName()
If PassThroughCellIds or PassThroughPointIds is on, then these ivars control the name given to the fi...
Store zero or more vtkInformation instances.
Extracts outer surface (as vtkPolyData) of any dataset.
dataset represents arbitrary combinations of all possible cell types.
represent and manipulate 3D points
Definition: vtkPoints.h:28
vtkEdgeInterpolationMap * EdgeMap
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.