VTK  9.3.20240420
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 "vtkFiltersExtractionModule.h" // For export macro
15#include "vtkObject.h"
16#include "vtkSmartPointer.h" // For vtkSmartPointer
17
18#include <set> // for std::set
19
20VTK_ABI_NAMESPACE_BEGIN
22class vtkDataObject;
25class vtkTable;
28
29class VTKFILTERSEXTRACTION_EXPORT vtkSelector : public vtkObject
30{
31public:
32 vtkTypeMacro(vtkSelector, vtkObject);
33 void PrintSelf(ostream& os, vtkIndent indent) override;
34
44 virtual void Initialize(vtkSelectionNode* node);
45
49 virtual void Finalize() {}
50
60 virtual void Execute(vtkDataObject* input, vtkDataObject* output);
61
63
67 vtkSetMacro(InsidednessArrayName, std::string);
68 vtkGetMacro(InsidednessArrayName, std::string);
70protected:
72 ~vtkSelector() override;
73
74 // Contains the selection criteria.
75 vtkSelectionNode* Node = nullptr;
76
77 // Name of the insidedness array added to the output when the selection criteria is
78 // evaluated by this operator.
80
97 vtkDataObject* input, vtkSignedCharArray* insidednessArray) = 0;
98
100 {
103 INHERIT
104 };
105
113 virtual SelectionMode GetAMRBlockSelection(unsigned int level, unsigned int index);
114
126 unsigned int compositeIndex, bool isDataObjectTree = true);
127
133
139 vtkDataObject* data, vtkSignedCharArray* selectedPoints);
140
149
150private:
151 vtkSelector(const vtkSelector&) = delete;
152 void operator=(const vtkSelector&) = delete;
153
154 void ProcessBlock(vtkDataObject* inputBlock, vtkDataObject* outputBlock, bool forceFalse);
155 void ProcessAMR(vtkUniformGridAMR* input, vtkCompositeDataSet* output);
156 void ProcessDataObjectTree(vtkDataObjectTree* input, vtkDataObjectTree* output,
157 SelectionMode inheritedSelectionMode, unsigned int compositeIndex = 0);
158 void ProcessSelectors(vtkCompositeDataSet* input);
159
160 std::set<unsigned int> SubsetCompositeIds;
161};
162
163VTK_ABI_NAMESPACE_END
164#endif
abstract superclass for composite (multi-block or AMR) datasets
provides implementation for most abstract methods in the superclass vtkCompositeDataSet
general representation of visualization data
a simple class to control print indentation
Definition vtkIndent.h:108
abstract base class for most VTK objects
Definition vtkObject.h:162
a node in a vtkSelection the defines the selection criteria.
virtual SelectionMode GetAMRBlockSelection(unsigned int level, unsigned int index)
Returns whether the AMR block is to be processed.
virtual bool ComputeSelectedElements(vtkDataObject *input, vtkSignedCharArray *insidednessArray)=0
This method computes whether or not each element in the dataset is inside the selection and populates...
vtkSmartPointer< vtkSignedCharArray > CreateInsidednessArray(vtkIdType numElems)
Creates an array suitable for storing insideness.
virtual SelectionMode GetBlockSelection(unsigned int compositeIndex, bool isDataObjectTree=true)
Returns whether the block is to be processed.
vtkSmartPointer< vtkSignedCharArray > ComputeCellsContainingSelectedPoints(vtkDataObject *data, vtkSignedCharArray *selectedPoints)
Given a data object and selected points, return an array indicating the insidedness of cells that con...
virtual void Finalize()
Does any cleanup of objects created in Initialize.
Definition vtkSelector.h:49
virtual void Execute(vtkDataObject *input, vtkDataObject *output)
Given an input and the vtkSelectionNode passed into the Initialize() method, add to the output a vtkS...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
std::string InsidednessArrayName
Definition vtkSelector.h:79
~vtkSelector() override
virtual void Initialize(vtkSelectionNode *node)
Sets the vtkSelectionNode used by this selection operator and initializes the data structures in the ...
void ExpandToConnectedElements(vtkDataObject *output)
Handle expanding to connected cells or point, if requested.
dynamic, self-adjusting array of signed char
Hold a reference to a vtkObjectBase instance.
A table, which contains similar-typed columns of data.
Definition vtkTable.h:168
a concrete implementation of vtkCompositeDataSet
int vtkIdType
Definition vtkType.h:315