VTK  9.7.1
vtkCutter.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
40 #ifndef vtkCutter_h
41 #define vtkCutter_h
42 
43 #include "vtkFiltersCoreModule.h" // For export macro
44 #include "vtkPolyDataAlgorithm.h"
45 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
46 
47 #include "vtkContourValues.h" // Needed for inline methods
48 
49 #define VTK_SORT_BY_VALUE 0
50 #define VTK_SORT_BY_CELL 1
51 
52 VTK_ABI_NAMESPACE_BEGIN
56 class vtkPlaneCutter;
60 
61 class VTKFILTERSCORE_EXPORT VTK_MARSHALAUTO vtkCutter : public vtkPolyDataAlgorithm
62 {
63 public:
65  void PrintSelf(ostream& os, vtkIndent indent) override;
66 
71  static vtkCutter* New();
72 
77  void SetValue(int i, double value) { this->ContourValues->SetValue(i, value); }
78 
82  double GetValue(int i) { return this->ContourValues->GetValue(i); }
83 
88  double* GetValues() { return this->ContourValues->GetValues(); }
89 
95  void GetValues(double* contourValues) { this->ContourValues->GetValues(contourValues); }
96 
102  void SetNumberOfContours(int number) { this->ContourValues->SetNumberOfContours(number); }
103 
107  vtkIdType GetNumberOfContours() { return this->ContourValues->GetNumberOfContours(); }
108 
113  void GenerateValues(int numContours, double range[2])
114  {
115  this->ContourValues->GenerateValues(numContours, range);
116  }
117 
122  void GenerateValues(int numContours, double rangeStart, double rangeEnd)
123  {
124  this->ContourValues->GenerateValues(numContours, rangeStart, rangeEnd);
125  }
126 
131  vtkMTimeType GetMTime() override;
132 
134 
137  virtual void SetCutFunction(vtkImplicitFunction*);
138  vtkGetObjectMacro(CutFunction, vtkImplicitFunction);
140 
142 
147  vtkSetMacro(GenerateCutScalars, vtkTypeBool);
148  vtkGetMacro(GenerateCutScalars, vtkTypeBool);
149  vtkBooleanMacro(GenerateCutScalars, vtkTypeBool);
151 
153 
160  vtkSetMacro(GenerateTriangles, vtkTypeBool);
161  vtkGetMacro(GenerateTriangles, vtkTypeBool);
162  vtkBooleanMacro(GenerateTriangles, vtkTypeBool);
164 
166 
170  void SetLocator(vtkIncrementalPointLocator* locator);
171  vtkGetObjectMacro(Locator, vtkIncrementalPointLocator);
173 
175 
190  vtkSetClampMacro(SortBy, int, VTK_SORT_BY_VALUE, VTK_SORT_BY_CELL);
191  vtkGetMacro(SortBy, int);
192  void SetSortByToSortByValue() { this->SetSortBy(VTK_SORT_BY_VALUE); }
193  void SetSortByToSortByCell() { this->SetSortBy(VTK_SORT_BY_CELL); }
194  const char* GetSortByAsString();
196 
201  void CreateDefaultLocator();
202 
204 
209  vtkSetClampMacro(OutputPointsPrecision, int, SINGLE_PRECISION, DEFAULT_PRECISION);
210  vtkGetMacro(OutputPointsPrecision, int);
212 
213 protected:
214  vtkCutter(vtkImplicitFunction* cf = nullptr);
215  ~vtkCutter() override;
216 
219  int FillInputPortInformation(int port, vtkInformation* info) override;
220  void UnstructuredGridCutter(vtkDataSet* input, vtkPolyData* output);
221  void DataSetCutter(vtkDataSet* input, vtkPolyData* output);
222  void StructuredPointsCutter(
224  void StructuredGridCutter(vtkDataSet*, vtkPolyData*);
225  void RectilinearGridCutter(vtkDataSet*, vtkPolyData*);
228 
234 
236  int SortBy;
240 
241  // Garbage collection method
242  void ReportReferences(vtkGarbageCollector*) override;
243 
244 private:
245  vtkCutter(const vtkCutter&) = delete;
246  void operator=(const vtkCutter&) = delete;
247 };
248 
252 inline const char* vtkCutter::GetSortByAsString()
253 {
254  if (this->SortBy == VTK_SORT_BY_VALUE)
255  {
256  return "SortByValue";
257  }
258  else
259  {
260  return "SortByCell";
261  }
262 }
263 
264 VTK_ABI_NAMESPACE_END
265 #endif
abstract interface for implicit functions
Cut vtkDataSet with user-specified implicit function.
Definition: vtkCutter.h:61
vtkNew< vtkRectilinearSynchronizedTemplates > RectilinearSynchronizedTemplates
Definition: vtkCutter.h:232
double GetValue(int i)
Get the ith contour value.
Definition: vtkCutter.h:82
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:318
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
generate isosurface from structured grids
void ReportReferences(vtkGarbageCollector *) override
Abstract class in support of both point location and point insertion.
vtkNew< vtkGridSynchronizedTemplates3D > GridSynchronizedTemplates
Definition: vtkCutter.h:231
vtkIncrementalPointLocator * Locator
Definition: vtkCutter.h:235
int SortBy
Definition: vtkCutter.h:236
void GenerateValues(int numContours, double range[2])
Generate numContours equally spaced contour values between specified range.
Definition: vtkCutter.h:113
int vtkIdType
Definition: vtkType.h:363
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:71
vtkImplicitFunction * CutFunction
Definition: vtkCutter.h:226
#define vtkCutter
Definition: vtkmSlice.h:23
Detect and break reference loops.
vtkTypeBool GenerateTriangles
Definition: vtkCutter.h:227
generate cut surface from structured points
generate isosurface from structured points
static vtkPolyDataAlgorithm * New()
int vtkTypeBool
Definition: vtkABI.h:64
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
vtkNew< vtkPlaneCutter > PlaneCutter
Definition: vtkCutter.h:233
Superclass for algorithms that produce only polydata as output.
a simple class to control print indentation
Definition: vtkIndent.h:28
cut any dataset with a plane and generate a polygonal cut surface
vtkIdType GetNumberOfContours()
Get the number of contours in the list of contour values.
Definition: vtkCutter.h:107
virtual vtkMTimeType GetMTime()
Return this object's modified time.
void SetSortByToSortByCell()
Set the sorting order for the generated polydata.
Definition: vtkCutter.h:193
vtkTypeBool GenerateCutScalars
Definition: vtkCutter.h:238
vtkNew< vtkSynchronizedTemplates3D > SynchronizedTemplates3D
Definition: vtkCutter.h:229
#define VTK_SORT_BY_VALUE
Definition: vtkCutter.h:49
void SetNumberOfContours(int number)
Set the number of contours to place into the list.
Definition: vtkCutter.h:102
generate isosurface from rectilinear grid
void SetSortByToSortByValue()
Set the sorting order for the generated polydata.
Definition: vtkCutter.h:192
void SetValue(int i, double value)
Set a particular contour value at contour number i.
Definition: vtkCutter.h:77
#define VTK_SORT_BY_CELL
Definition: vtkCutter.h:50
const char * GetSortByAsString()
Return the sorting procedure as a descriptive character string.
Definition: vtkCutter.h:252
void GenerateValues(int numContours, double rangeStart, double rangeEnd)
Generate numContours equally spaced contour values between specified range.
Definition: vtkCutter.h:122
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
Store zero or more vtkInformation instances.
void GetValues(double *contourValues)
Fill a supplied list with contour values.
Definition: vtkCutter.h:95
#define VTK_MARSHALAUTO
int OutputPointsPrecision
Definition: vtkCutter.h:239
vtkNew< vtkContourValues > ContourValues
Definition: vtkCutter.h:237
vtkNew< vtkSynchronizedTemplatesCutter3D > SynchronizedTemplatesCutter3D
Definition: vtkCutter.h:230
double * GetValues()
Get a pointer to an array of contour values.
Definition: vtkCutter.h:88
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.