VTK  9.7.1
vtkSelector.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
11 #ifndef vtkSelector_h
12 #define vtkSelector_h
13 
14 #include "vtkDeprecation.h" // for VTK_DEPRECATED_IN_9_6_0
15 #include "vtkFiltersExtractionModule.h" // For export macro
16 #include "vtkObject.h"
17 #include "vtkSmartPointer.h" // For vtkSmartPointer
18 
19 #include <set> // for std::set
20 
21 VTK_ABI_NAMESPACE_BEGIN
23 class vtkDataObject;
24 class vtkSelectionNode;
25 class vtkSignedCharArray;
26 class vtkTable;
27 class vtkDataObjectTree;
28 class vtkUniformGridAMR;
29 
30 class VTKFILTERSEXTRACTION_EXPORT vtkSelector : public vtkObject
31 {
32 public:
33  vtkTypeMacro(vtkSelector, vtkObject);
34  void PrintSelf(ostream& os, vtkIndent indent) override;
35 
45  virtual void Initialize(vtkSelectionNode* node);
46 
50  virtual void Finalize() {}
51 
61  virtual void Execute(vtkDataObject* input, vtkDataObject* output);
62 
64 
68  vtkSetMacro(InsidednessArrayName, std::string);
69  vtkGetMacro(InsidednessArrayName, std::string);
71 protected:
72  vtkSelector();
73  ~vtkSelector() override;
74 
75  // Contains the selection criteria.
76  vtkSelectionNode* Node = nullptr;
77 
78  // Name of the insidedness array added to the output when the selection criteria is
79  // evaluated by this operator.
81 
97  virtual bool ComputeSelectedElements(
98  vtkDataObject* input, vtkSignedCharArray* insidednessArray) = 0;
99 
101  {
104  INHERIT
105  };
106 
112  "Deprecated method without effect, use GetBlockSelection(idx, false) instead.")
113  virtual SelectionMode GetAMRBlockSelection(
114  unsigned int vtkNotUsed(level), unsigned int vtkNotUsed(index))
115  {
116  return EXCLUDE;
117  };
118 
129  virtual SelectionMode GetBlockSelection(
130  unsigned int compositeIndex, bool isDataObjectTree = true);
131 
136  vtkSmartPointer<vtkSignedCharArray> CreateInsidednessArray(vtkIdType numElems);
137 
142  vtkSmartPointer<vtkSignedCharArray> ComputeCellsContainingSelectedPoints(
143  vtkDataObject* data, vtkSignedCharArray* selectedPoints);
144 
152  void ExpandToConnectedElements(vtkDataObject* output);
153 
154 private:
155  vtkSelector(const vtkSelector&) = delete;
156  void operator=(const vtkSelector&) = delete;
157 
158  void ProcessBlock(vtkDataObject* inputBlock, vtkDataObject* outputBlock, bool forceFalse);
159  void ProcessAMR(vtkUniformGridAMR* input, vtkDataObjectTree* output);
160  void ProcessDataObjectTree(vtkDataObjectTree* input, vtkDataObjectTree* output,
161  SelectionMode inheritedSelectionMode, unsigned int compositeIndex = 0);
162  void ProcessSelectors(vtkCompositeDataSet* input);
163 
164  std::set<unsigned int> SubsetCompositeIds;
165 };
166 
167 VTK_ABI_NAMESPACE_END
168 #endif
a node in a vtkSelection the defines the selection criteria.
abstract base class for most VTK objects
Definition: vtkObject.h:52
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
provides implementation for most abstract methods in the superclass vtkCompositeDataSet ...
std::string InsidednessArrayName
Definition: vtkSelector.h:80
Hold a reference to a vtkObjectBase instance.
Definition: vtkMeta.h:23
int vtkIdType
Definition: vtkType.h:363
#define VTK_DEPRECATED_IN_9_6_0(reason)
abstract superclass for composite (multi-block or AMR) datasets
a simple class to control print indentation
Definition: vtkIndent.h:28
dynamic, self-adjusting array of signed char
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:59
virtual void Finalize()
Does any cleanup of objects created in Initialize.
Definition: vtkSelector.h:50
general representation of visualization data
Definition: vtkDataObject.h:55
Legacy, empty shell inheriting vtkAMRDataObject.