VTK  9.7.1
vtkClipDataSet.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
51 #ifndef vtkClipDataSet_h
52 #define vtkClipDataSet_h
53 
54 #include "vtkFiltersGeneralModule.h" // For export macro
56 
57 VTK_ABI_NAMESPACE_BEGIN
58 class vtkCallbackCommand;
59 class vtkCellArray;
60 class vtkCellData;
64 
65 class VTKFILTERSGENERAL_EXPORT vtkClipDataSet : public vtkUnstructuredGridAlgorithm
66 {
67 public:
69  void PrintSelf(ostream& os, vtkIndent indent) override;
70 
75  static vtkClipDataSet* New();
76 
78 
84  vtkSetMacro(Value, double);
85  vtkGetMacro(Value, double);
87 
89 
94  vtkSetMacro(UseValueAsOffset, bool);
95  vtkGetMacro(UseValueAsOffset, bool);
96  vtkBooleanMacro(UseValueAsOffset, bool);
98 
100 
108  vtkSetMacro(InsideOut, vtkTypeBool);
109  vtkGetMacro(InsideOut, vtkTypeBool);
110  vtkBooleanMacro(InsideOut, vtkTypeBool);
112 
114 
119  virtual void SetClipFunction(vtkImplicitFunction*);
120  vtkGetObjectMacro(ClipFunction, vtkImplicitFunction);
122 
124 
130  vtkSetMacro(GenerateClipScalars, vtkTypeBool);
131  vtkGetMacro(GenerateClipScalars, vtkTypeBool);
132  vtkBooleanMacro(GenerateClipScalars, vtkTypeBool);
134 
136 
140  vtkSetMacro(GenerateClippedOutput, vtkTypeBool);
141  vtkGetMacro(GenerateClippedOutput, vtkTypeBool);
142  vtkBooleanMacro(GenerateClippedOutput, vtkTypeBool);
144 
146 
152  vtkSetClampMacro(MergeTolerance, double, 0.0001, 0.25);
153  vtkGetMacro(MergeTolerance, double);
155 
159  vtkUnstructuredGrid* GetClippedOutput();
160 
162 
166  void SetLocator(vtkIncrementalPointLocator* locator);
167  vtkGetObjectMacro(Locator, vtkIncrementalPointLocator);
169 
174  void CreateDefaultLocator();
175 
179  vtkMTimeType GetMTime() override;
180 
182 
187  vtkSetClampMacro(OutputPointsPrecision, int, SINGLE_PRECISION, DEFAULT_PRECISION);
188  vtkGetMacro(OutputPointsPrecision, int);
190 
192 
195  vtkGetMacro(StableClipNonLinear, bool);
196  vtkSetMacro(StableClipNonLinear, bool);
197  vtkBooleanMacro(StableClipNonLinear, bool);
199 
200 protected:
201  vtkClipDataSet(vtkImplicitFunction* cf = nullptr);
202  ~vtkClipDataSet() override;
203 
205  int FillInputPortInformation(int port, vtkInformation* info) override;
207 
210  double Value;
212 
215 
216  // Callback registered with the InternalProgressObserver.
217  static void InternalProgressCallbackFunction(vtkObject*, unsigned long, void* clientdata, void*);
218  void InternalProgressCallback(vtkAlgorithm* algorithm);
219  // The observer to report progress from the internal readers.
221 
222  // helper functions
223  void ClipVolume(vtkDataSet* input, vtkUnstructuredGrid* output);
224 
225  int ClipPoints(
226  vtkDataSet* input, vtkUnstructuredGrid* output, vtkInformationVector** inputVector);
227 
230 
231  bool StableClipNonLinear = true;
232 
233 private:
234  vtkClipDataSet(const vtkClipDataSet&) = delete;
235  void operator=(const vtkClipDataSet&) = delete;
236 
241  vtkIdType SeparateCellIds(vtkIdType numCells, vtkDataSet* input, std::vector<vtkIdType>& pointMap,
242  std::vector<vtkIdType>& clippingCellIds, double clipValue, vtkDataArray* clipScalars,
243  std::array<std::vector<vtkIdType>, 2>& intactCellIds);
244 
248  void FillIntactCells(vtkDataSet* input, int numOutputs,
249  std::array<std::vector<vtkIdType>, 2>& intactCellIds, std::vector<vtkIdType>& pointMap,
250  vtkSmartPointer<vtkCellArray> conn[2], vtkCellData* outCD[2], vtkCellData* inCD,
252 };
253 
254 VTK_ABI_NAMESPACE_END
255 #endif
abstract interface for implicit functions
vtkIncrementalPointLocator * Locator
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
abstract base class for most VTK objects
Definition: vtkObject.h:52
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:318
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
represent and manipulate cell attribute data
Definition: vtkCellData.h:31
static vtkUnstructuredGridAlgorithm * New()
Abstract class in support of both point location and point insertion.
int vtkIdType
Definition: vtkType.h:363
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkTypeBool GenerateClipScalars
int vtkTypeBool
Definition: vtkABI.h:64
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
supports function callbacks
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:53
a simple class to control print indentation
Definition: vtkIndent.h:28
dataset represents arbitrary combinations of all possible cell types
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
vtkImplicitFunction * ClipFunction
virtual vtkMTimeType GetMTime()
Return this object's modified time.
vtkTypeBool GenerateClippedOutput
Superclass for algorithms that produce only unstructured grid as output.
dynamic, self-adjusting array of unsigned char
object to represent cell connectivity
Definition: vtkCellArray.h:177
vtkCallbackCommand * InternalProgressObserver
clip any dataset with user-specified implicit function or input scalar data
Store zero or more vtkInformation instances.
vtkTypeBool InsideOut