VTK  9.5.2
vtkSelectionSource.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
32
33#ifndef vtkSelectionSource_h
34#define vtkSelectionSource_h
35
36#include "vtkFiltersSourcesModule.h" // For export macro
38#include "vtkSelectionNode.h" // For FieldType
39
40#include <memory> // for std::shared_ptr
41#include <vector> // for std::vector
42
43VTK_ABI_NAMESPACE_BEGIN
44class VTKFILTERSSOURCES_EXPORT vtkSelectionSource : public vtkSelectionAlgorithm
45{
46public:
49 void PrintSelf(ostream& os, vtkIndent indent) override;
50
52
57 void SetNumberOfNodes(unsigned int numberOfNodes);
58 unsigned int GetNumberOfNodes() { return static_cast<unsigned int>(this->NodesInfo.size()); }
60
62
65 void RemoveNode(unsigned int idx);
66 void RemoveNode(const char* name);
68
72 virtual void RemoveAllNodes();
73
75
87 vtkSetStdStringFromCharMacro(Expression);
88 vtkGetCharFromStdStringMacro(Expression);
90
92
105 enum FieldTypeOptions
106 {
109 };
110 vtkSetClampMacro(FieldTypeOption, int, FIELD_TYPE, ELEMENT_TYPE);
113 vtkGetMacro(FieldTypeOption, int);
115
117
124 vtkSetClampMacro(FieldType, int, vtkSelectionNode::CELL, vtkSelectionNode::ROW);
125 vtkGetMacro(FieldType, int);
127
129
137 vtkSetClampMacro(ElementType, int, vtkDataObject::POINT, vtkDataObject::ROW);
138 vtkGetMacro(ElementType, int);
140
142
148 vtkSetClampMacro(ProcessID, int, -1, VTK_INT_MAX);
149 vtkGetMacro(ProcessID, int);
151
152 //------------------------------------------------------------------------------
153 // Functions to manipulate the information of each selection node.
154 //------------------------------------------------------------------------------
155
157
166 void SetNodeName(unsigned int nodeId, const char* name);
167 void SetNodeName(const char* name) { this->SetNodeName(0, name); }
168 const char* GetNodeName(unsigned int nodeId);
169 const char* GetNodeName() { return this->GetNodeName(0); }
171
173
178 void AddID(unsigned int nodeId, vtkIdType piece, vtkIdType id);
179 void AddID(vtkIdType piece, vtkIdType id) { this->AddID(0, piece, id); }
180 void AddStringID(unsigned int nodeId, vtkIdType piece, const char* id);
181 void AddStringID(vtkIdType piece, const char* id) { this->AddStringID(0, piece, id); }
183
185
188 void AddLocation(unsigned int nodeId, double x, double y, double z);
189 void AddLocation(double x, double y, double z) { this->AddLocation(0, x, y, z); }
191
193
196 void AddThreshold(unsigned int nodeId, double min, double max);
197 void AddThreshold(double min, double max) { this->AddThreshold(0, min, max); }
199
201
204 void SetFrustum(unsigned int nodeId, double* vertices);
205 void SetFrustum(double* vertices) { this->SetFrustum(0, vertices); }
207
209
212 void AddBlock(unsigned int nodeId, vtkIdType block);
213 void AddBlock(vtkIdType blockno) { this->AddBlock(0, blockno); }
215
217
221 void AddBlockSelector(unsigned int nodeId, const char* block);
222 void AddBlockSelector(const char* selector) { this->AddBlockSelector(0, selector); }
223 void RemoveAllBlockSelectors(unsigned int nodeId);
226
228
231 void RemoveAllIDs(unsigned int nodeId);
232 void RemoveAllIDs() { this->RemoveAllIDs(0); }
233 void RemoveAllStringIDs(unsigned int nodeId);
236
238
241 void RemoveAllThresholds(unsigned int nodeId);
244
246
249 void RemoveAllLocations(unsigned int nodeId);
252
254
257 void RemoveAllBlocks(unsigned int nodeId);
258 void RemoveAllBlocks() { this->RemoveAllBlocks(0); }
260
262
269 void SetContentType(unsigned int nodeId, int type);
270 void SetContentType(int contentType) { this->SetContentType(0, contentType); }
271 int GetContentTypeMinValue() { return vtkSelectionNode::SelectionContent::GLOBALIDS; }
272 int GetContentTypeMaxValue() { return vtkSelectionNode::SelectionContent::USER; }
273 int GetContentType(unsigned int nodeId);
274 int GetContentType() { return this->GetContentType(0); }
276
278
284 void SetContainingCells(unsigned int nodeId, vtkTypeBool containingCells);
285 void SetContainingCells(vtkTypeBool containingCells)
286 {
287 this->SetContainingCells(0, containingCells);
288 }
289 vtkTypeBool GetContainingCells(unsigned int nodeId);
292
294
299 void SetNumberOfLayers(unsigned int nodeId, int numberOfLayers);
300 void SetNumberOfLayers(int numberOfLayers) { this->SetNumberOfLayers(0, numberOfLayers); }
301 int GetNumberOfLayersMinValue() { return 0; }
303 int GetNumberOfLayers(unsigned int nodeId);
304 int GetNumberOfLayers() { return this->GetNumberOfLayers(0); }
306
308
313 void SetRemoveSeed(unsigned int nodeId, bool RemoveSeed);
314 void SetRemoveSeed(bool RemoveSeed) { this->SetRemoveSeed(0, RemoveSeed); }
315 bool GetRemoveSeed(unsigned int nodeId);
316 bool GetRemoveSeed() { return this->GetRemoveSeed(0); }
318
320
325 void SetRemoveIntermediateLayers(unsigned int nodeId, bool RemoveIntermediateLayers);
326 void SetRemoveIntermediateLayers(bool RemoveIntermediateLayers)
327 {
328 this->SetRemoveIntermediateLayers(0, RemoveIntermediateLayers);
329 }
330 bool GetRemoveIntermediateLayers(unsigned int nodeId);
333
335
340 void SetInverse(unsigned int nodeId, vtkTypeBool inverse);
341 void SetInverse(vtkTypeBool inverse) { this->SetInverse(0, inverse); }
342 vtkTypeBool GetInverse(unsigned int nodeId);
343 vtkTypeBool GetInverse() { return this->GetInverse(0); }
345
347
351 void SetArrayName(unsigned int nodeId, const char* name);
352 void SetArrayName(const char* name) { this->SetArrayName(0, name); }
353 const char* GetArrayName(unsigned int nodeId);
354 const char* GetArrayName() { return this->GetArrayName(0); }
356
358
363 void SetArrayComponent(unsigned int nodeId, int component);
364 void SetArrayComponent(int component) { this->SetArrayComponent(0, component); }
365 int GetArrayComponent(unsigned int nodeId);
366 int GetArrayComponent() { return this->GetArrayComponent(0); }
368
370
376 void SetCompositeIndex(unsigned int nodeId, int index);
377 void SetCompositeIndex(int compositeIndex) { this->SetCompositeIndex(0, compositeIndex); }
378 int GetCompositeIndex(unsigned int nodeId);
379 int GetCompositeIndex() { return this->GetCompositeIndex(0); }
381
383
390 void SetHierarchicalLevel(unsigned int nodeId, int level);
391 void SetHierarchicalLevel(int level) { this->SetHierarchicalLevel(0, level); }
392 int GetHierarchicalLevel(unsigned int nodeId);
394 void SetHierarchicalIndex(unsigned int nodeId, int index);
395 void SetHierarchicalIndex(int index) { this->SetHierarchicalIndex(0, index); }
396 int GetHierarchicalIndex(unsigned int nodeId);
399
401
406 void SetAssemblyName(unsigned int nodeId, const char* name);
407 void SetAssemblyName(const char* name) { this->SetAssemblyName(0, name); }
408 const char* GetAssemblyName(unsigned int nodeId);
409 const char* GetAssemblyName() { return this->GetAssemblyName(0); }
410 void AddSelector(unsigned int nodeId, const char* selector);
411 void AddSelector(const char* selector) { this->AddSelector(0, selector); }
412 void RemoveAllSelectors(unsigned int nodeId);
415
417
420 void SetQueryString(unsigned int nodeId, const char* queryString);
421 void SetQueryString(const char* query) { this->SetQueryString(0, query); }
422 const char* GetQueryString(unsigned int nodeId);
423 const char* GetQueryString() { return this->GetQueryString(0); }
425
426protected:
429
431 vtkInformationVector* outputVector) override;
433 vtkInformationVector* outputVector) override;
434
435 std::string Expression;
440 struct NodeInformation;
441 std::vector<std::shared_ptr<NodeInformation>> NodesInfo;
442
443private:
444 vtkSelectionSource(const vtkSelectionSource&) = delete;
445 void operator=(const vtkSelectionSource&) = delete;
446};
447
448VTK_ABI_NAMESPACE_END
449#endif
a simple class to control print indentation
Definition vtkIndent.h:29
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Generate selection from given set of ids.
void SetNumberOfNodes(unsigned int numberOfNodes)
Set/Get the number of nodes that will be created for the generated selection.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void RemoveNode(const char *name)
Remove a selection node.
static vtkSelectionSource * New()
unsigned int GetNumberOfNodes()
Set/Get the number of nodes that will be created for the generated selection.
virtual void RemoveAllNodes()
Remove all selection nodes.
void RemoveNode(unsigned int idx)
Remove a selection node.
vtkSelectionSource FIELD_TYPE
Set/Get FieldTypeOption which is used to specify the selection field type for the selection.
int vtkTypeBool
Definition vtkABI.h:64
virtual bool GetInverse()
vtkAppendSelection vtkSelectionAlgorithm SetInverse(bool)
Determines whether the selection describes what to include or exclude.
std::pair< boost::graph_traits< vtkGraph * >::vertex_iterator, boost::graph_traits< vtkGraph * >::vertex_iterator > vertices(vtkGraph *g)
virtual int GetContentType()
Get or set the content type of the selection.
virtual char * GetQueryString()
Set/Get the query expression string.
virtual void SetContentType(int type)
Get or set the content type of the selection.
virtual void SetQueryString(const char *)
Set/Get the query expression string.
vtkTypeBool GetContainingCells()
int GetCompositeIndex()
int FieldTypeOption
bool GetRemoveIntermediateLayers()
**void AddID(vtkIdType piece, vtkIdType id)
**void SetAssemblyName(const char *name)
vtkSelectionSource()
int FieldType
**void SetRemoveIntermediateLayers(bool RemoveIntermediateLayers)
**void SetArrayName(const char *name)
void AddStringID(unsigned int nodeId, vtkIdType piece, const char *id)
**void AddBlockSelector(const char *selector)
**void RemoveAllBlocks()
**void SetArrayComponent(int component)
bool GetRemoveSeed()
std::string Expression
void RemoveAllBlockSelectors()
**void SetNumberOfLayers(int numberOfLayers)
int ProcessID
int GetHierarchicalIndex()
std::vector< std::shared_ptr< NodeInformation > > NodesInfo
void AddSelector(unsigned int nodeId, const char *selector)
const char * GetAssemblyName()
int GetContentTypeMaxValue()
virtual void SetFieldTypeOption(int)
int GetContentTypeMinValue()
void RemoveAllStringIDs()
virtual void SetFieldTypeOptionToElementType()
int GetArrayComponent()
**void SetFrustum(double *vertices)
int GetNumberOfLayersMinValue()
const char * GetArrayName()
**void RemoveAllThresholds()
int GetNumberOfLayersMaxValue()
**void SetContainingCells(vtkTypeBool containingCells)
**void SetNodeName(const char *name)
**void AddLocation(double x, double y, double z)
int GetHierarchicalLevel()
**void RemoveAllIDs()
void RemoveAllSelectors()
int GetNumberOfLayers()
virtual void SetFieldTypeOptionToFieldType()
**void SetHierarchicalLevel(int level)
**void AddThreshold(double min, double max)
**void AddBlock(vtkIdType blockno)
**void SetCompositeIndex(int compositeIndex)
~vtkSelectionSource() override
**void SetRemoveSeed(bool RemoveSeed)
const char * GetNodeName()
void SetHierarchicalIndex(unsigned int nodeId, int index)
int ElementType
**void RemoveAllLocations()
vtkSelectionSource ELEMENT_TYPE
int vtkIdType
Definition vtkType.h:332
#define VTK_INT_MAX
Definition vtkType.h:161
#define max(a, b)