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
51
52#ifndef vtkSelectionSource_h
53#define vtkSelectionSource_h
54
55#include "vtkFiltersSourcesModule.h" // For export macro
57#include "vtkSelectionNode.h" // For FieldType
58
59#include <memory> // for std::shared_ptr
60#include <vector> // for std::vector
61
62VTK_ABI_NAMESPACE_BEGIN
63class VTKFILTERSSOURCES_EXPORT vtkSelectionSource : public vtkSelectionAlgorithm
64{
65public:
68 void PrintSelf(ostream& os, vtkIndent indent) override;
69
71
76 void SetNumberOfNodes(unsigned int numberOfNodes);
77 unsigned int GetNumberOfNodes() { return static_cast<unsigned int>(this->NodesInfo.size()); }
79
81
84 void RemoveNode(unsigned int idx);
85 void RemoveNode(const char* name);
87
91 virtual void RemoveAllNodes();
92
94
106 vtkSetStdStringFromCharMacro(Expression);
107 vtkGetCharFromStdStringMacro(Expression);
109
111
124 enum FieldTypeOptions
125 {
128 };
129 vtkSetClampMacro(FieldTypeOption, int, FIELD_TYPE, ELEMENT_TYPE);
132 vtkGetMacro(FieldTypeOption, int);
134
136
143 vtkSetClampMacro(FieldType, int, vtkSelectionNode::CELL, vtkSelectionNode::ROW);
144 vtkGetMacro(FieldType, int);
146
148
156 vtkSetClampMacro(ElementType, int, vtkDataObject::POINT, vtkDataObject::ROW);
157 vtkGetMacro(ElementType, int);
159
161
167 vtkSetClampMacro(ProcessID, int, -1, VTK_INT_MAX);
168 vtkGetMacro(ProcessID, int);
170
171 //------------------------------------------------------------------------------
172 // Functions to manipulate the information of each selection node.
173 //------------------------------------------------------------------------------
174
176
185 void SetNodeName(unsigned int nodeId, const char* name);
186 void SetNodeName(const char* name) { this->SetNodeName(0, name); }
187 const char* GetNodeName(unsigned int nodeId);
188 const char* GetNodeName() { return this->GetNodeName(0); }
190
192
197 void AddID(unsigned int nodeId, vtkIdType piece, vtkIdType id);
198 void AddID(vtkIdType piece, vtkIdType id) { this->AddID(0, piece, id); }
199 void AddStringID(unsigned int nodeId, vtkIdType piece, const char* id);
200 void AddStringID(vtkIdType piece, const char* id) { this->AddStringID(0, piece, id); }
202
204
207 void AddLocation(unsigned int nodeId, double x, double y, double z);
208 void AddLocation(double x, double y, double z) { this->AddLocation(0, x, y, z); }
210
212
215 void AddThreshold(unsigned int nodeId, double min, double max);
216 void AddThreshold(double min, double max) { this->AddThreshold(0, min, max); }
218
220
223 void SetFrustum(unsigned int nodeId, double* vertices);
224 void SetFrustum(double* vertices) { this->SetFrustum(0, vertices); }
226
228
231 void AddBlock(unsigned int nodeId, vtkIdType block);
232 void AddBlock(vtkIdType blockno) { this->AddBlock(0, blockno); }
234
236
240 void AddBlockSelector(unsigned int nodeId, const char* block);
241 void AddBlockSelector(const char* selector) { this->AddBlockSelector(0, selector); }
242 void RemoveAllBlockSelectors(unsigned int nodeId);
245
247
250 void RemoveAllIDs(unsigned int nodeId);
251 void RemoveAllIDs() { this->RemoveAllIDs(0); }
252 void RemoveAllStringIDs(unsigned int nodeId);
255
257
260 void RemoveAllThresholds(unsigned int nodeId);
263
265
268 void RemoveAllLocations(unsigned int nodeId);
271
273
276 void RemoveAllBlocks(unsigned int nodeId);
277 void RemoveAllBlocks() { this->RemoveAllBlocks(0); }
279
281
288 void SetContentType(unsigned int nodeId, int type);
289 void SetContentType(int contentType) { this->SetContentType(0, contentType); }
290 int GetContentTypeMinValue() { return vtkSelectionNode::SelectionContent::GLOBALIDS; }
291 int GetContentTypeMaxValue() { return vtkSelectionNode::SelectionContent::USER; }
292 int GetContentType(unsigned int nodeId);
293 int GetContentType() { return this->GetContentType(0); }
295
297
303 void SetContainingCells(unsigned int nodeId, vtkTypeBool containingCells);
304 void SetContainingCells(vtkTypeBool containingCells)
305 {
306 this->SetContainingCells(0, containingCells);
307 }
308 vtkTypeBool GetContainingCells(unsigned int nodeId);
311
313
318 void SetNumberOfLayers(unsigned int nodeId, int numberOfLayers);
319 void SetNumberOfLayers(int numberOfLayers) { this->SetNumberOfLayers(0, numberOfLayers); }
320 int GetNumberOfLayersMinValue() { return 0; }
322 int GetNumberOfLayers(unsigned int nodeId);
323 int GetNumberOfLayers() { return this->GetNumberOfLayers(0); }
325
327
332 void SetRemoveSeed(unsigned int nodeId, bool RemoveSeed);
333 void SetRemoveSeed(bool RemoveSeed) { this->SetRemoveSeed(0, RemoveSeed); }
334 bool GetRemoveSeed(unsigned int nodeId);
335 bool GetRemoveSeed() { return this->GetRemoveSeed(0); }
337
339
344 void SetRemoveIntermediateLayers(unsigned int nodeId, bool RemoveIntermediateLayers);
345 void SetRemoveIntermediateLayers(bool RemoveIntermediateLayers)
346 {
347 this->SetRemoveIntermediateLayers(0, RemoveIntermediateLayers);
348 }
349 bool GetRemoveIntermediateLayers(unsigned int nodeId);
352
354
359 void SetInverse(unsigned int nodeId, vtkTypeBool inverse);
360 void SetInverse(vtkTypeBool inverse) { this->SetInverse(0, inverse); }
361 vtkTypeBool GetInverse(unsigned int nodeId);
362 vtkTypeBool GetInverse() { return this->GetInverse(0); }
364
366
370 void SetArrayName(unsigned int nodeId, const char* name);
371 void SetArrayName(const char* name) { this->SetArrayName(0, name); }
372 const char* GetArrayName(unsigned int nodeId);
373 const char* GetArrayName() { return this->GetArrayName(0); }
375
377
382 void SetArrayComponent(unsigned int nodeId, int component);
383 void SetArrayComponent(int component) { this->SetArrayComponent(0, component); }
384 int GetArrayComponent(unsigned int nodeId);
385 int GetArrayComponent() { return this->GetArrayComponent(0); }
387
389
395 void SetCompositeIndex(unsigned int nodeId, int index);
396 void SetCompositeIndex(int compositeIndex) { this->SetCompositeIndex(0, compositeIndex); }
397 int GetCompositeIndex(unsigned int nodeId);
398 int GetCompositeIndex() { return this->GetCompositeIndex(0); }
400
402
409 void SetHierarchicalLevel(unsigned int nodeId, int level);
410 void SetHierarchicalLevel(int level) { this->SetHierarchicalLevel(0, level); }
411 int GetHierarchicalLevel(unsigned int nodeId);
413 void SetHierarchicalIndex(unsigned int nodeId, int index);
414 void SetHierarchicalIndex(int index) { this->SetHierarchicalIndex(0, index); }
415 int GetHierarchicalIndex(unsigned int nodeId);
418
420
425 void SetAssemblyName(unsigned int nodeId, const char* name);
426 void SetAssemblyName(const char* name) { this->SetAssemblyName(0, name); }
427 const char* GetAssemblyName(unsigned int nodeId);
428 const char* GetAssemblyName() { return this->GetAssemblyName(0); }
429 void AddSelector(unsigned int nodeId, const char* selector);
430 void AddSelector(const char* selector) { this->AddSelector(0, selector); }
431 void RemoveAllSelectors(unsigned int nodeId);
434
436
439 void SetQueryString(unsigned int nodeId, const char* queryString);
440 void SetQueryString(const char* query) { this->SetQueryString(0, query); }
441 const char* GetQueryString(unsigned int nodeId);
442 const char* GetQueryString() { return this->GetQueryString(0); }
444
445protected:
448
450 vtkInformationVector* outputVector) override;
452 vtkInformationVector* outputVector) override;
453
454 std::string Expression;
459 struct NodeInformation;
460 std::vector<std::shared_ptr<NodeInformation>> NodesInfo;
461
462private:
463 vtkSelectionSource(const vtkSelectionSource&) = delete;
464 void operator=(const vtkSelectionSource&) = delete;
465};
466
467VTK_ABI_NAMESPACE_END
468#endif
a simple class to control print indentation
Definition vtkIndent.h:108
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)