VTK  9.7.1
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
33 #ifndef vtkSelectionSource_h
34 #define vtkSelectionSource_h
35 
36 #include "vtkFiltersSourcesModule.h" // For export macro
37 #include "vtkSelectionAlgorithm.h"
38 #include "vtkSelectionNode.h" // For FieldType
39 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
40 
41 #include <memory> // for std::shared_ptr
42 #include <vector> // for std::vector
43 
44 VTK_ABI_NAMESPACE_BEGIN
45 class VTKFILTERSSOURCES_EXPORT VTK_MARSHALAUTO vtkSelectionSource : public vtkSelectionAlgorithm
46 {
47 public:
48  static vtkSelectionSource* New();
50  void PrintSelf(ostream& os, vtkIndent indent) override;
51 
53 
58  void SetNumberOfNodes(unsigned int numberOfNodes);
59  unsigned int GetNumberOfNodes() { return static_cast<unsigned int>(this->NodesInfo.size()); }
61 
63 
66  void RemoveNode(unsigned int idx);
67  void RemoveNode(const char* name);
69 
73  virtual void RemoveAllNodes();
74 
76 
88  vtkSetStdStringFromCharMacro(Expression);
89  vtkGetCharFromStdStringMacro(Expression);
91 
93 
107  {
109  ELEMENT_TYPE
110  };
111  vtkSetClampMacro(FieldTypeOption, int, FIELD_TYPE, ELEMENT_TYPE);
112  virtual void SetFieldTypeOptionToFieldType() { this->SetFieldTypeOption(FIELD_TYPE); }
113  virtual void SetFieldTypeOptionToElementType() { this->SetFieldTypeOption(ELEMENT_TYPE); }
114  vtkGetMacro(FieldTypeOption, int);
116 
118 
125  vtkSetClampMacro(FieldType, int, vtkSelectionNode::CELL, vtkSelectionNode::ROW);
126  vtkGetMacro(FieldType, int);
128 
130 
138  vtkSetClampMacro(ElementType, int, vtkDataObject::POINT, vtkDataObject::ROW);
139  vtkGetMacro(ElementType, int);
141 
143 
149  vtkSetClampMacro(ProcessID, int, -1, VTK_INT_MAX);
150  vtkGetMacro(ProcessID, int);
152 
153  //------------------------------------------------------------------------------
154  // Functions to manipulate the information of each selection node.
155  //------------------------------------------------------------------------------
156 
158 
167  void SetNodeName(unsigned int nodeId, const char* name);
168  void SetNodeName(const char* name) { this->SetNodeName(0, name); }
169  const char* GetNodeName(unsigned int nodeId);
170  const char* GetNodeName() { return this->GetNodeName(0); }
172 
174 
179  void AddID(unsigned int nodeId, vtkIdType piece, vtkIdType id);
180  void AddID(vtkIdType piece, vtkIdType id) { this->AddID(0, piece, id); }
181  void AddStringID(unsigned int nodeId, vtkIdType piece, const char* id);
182  void AddStringID(vtkIdType piece, const char* id) { this->AddStringID(0, piece, id); }
184 
186 
189  void AddLocation(unsigned int nodeId, double x, double y, double z);
190  void AddLocation(double x, double y, double z) { this->AddLocation(0, x, y, z); }
192 
194 
197  void AddThreshold(unsigned int nodeId, double min, double max);
198  void AddThreshold(double min, double max) { this->AddThreshold(0, min, max); }
200 
202 
205  void SetFrustum(unsigned int nodeId, double* vertices);
206  void SetFrustum(double* vertices) { this->SetFrustum(0, vertices); }
208 
210 
213  void AddBlock(unsigned int nodeId, vtkIdType block);
214  void AddBlock(vtkIdType blockno) { this->AddBlock(0, blockno); }
216 
218 
222  void AddBlockSelector(unsigned int nodeId, const char* block);
223  void AddBlockSelector(const char* selector) { this->AddBlockSelector(0, selector); }
224  void RemoveAllBlockSelectors(unsigned int nodeId);
227 
229 
232  void RemoveAllIDs(unsigned int nodeId);
233  void RemoveAllIDs() { this->RemoveAllIDs(0); }
234  void RemoveAllStringIDs(unsigned int nodeId);
237 
239 
242  void RemoveAllThresholds(unsigned int nodeId);
245 
247 
250  void RemoveAllLocations(unsigned int nodeId);
253 
255 
258  void RemoveAllBlocks(unsigned int nodeId);
259  void RemoveAllBlocks() { this->RemoveAllBlocks(0); }
261 
263 
270  void SetContentType(unsigned int nodeId, int type);
271  void SetContentType(int contentType) { this->SetContentType(0, contentType); }
272  int GetContentTypeMinValue() { return vtkSelectionNode::SelectionContent::GLOBALIDS; }
273  int GetContentTypeMaxValue() { return vtkSelectionNode::SelectionContent::USER; }
274  int GetContentType(unsigned int nodeId);
275  int GetContentType() { return this->GetContentType(0); }
277 
279 
285  void SetContainingCells(unsigned int nodeId, vtkTypeBool containingCells);
286  void SetContainingCells(vtkTypeBool containingCells)
287  {
288  this->SetContainingCells(0, containingCells);
289  }
290  vtkTypeBool GetContainingCells(unsigned int nodeId);
293 
295 
300  void SetNumberOfLayers(unsigned int nodeId, int numberOfLayers);
301  void SetNumberOfLayers(int numberOfLayers) { this->SetNumberOfLayers(0, numberOfLayers); }
302  int GetNumberOfLayersMinValue() { return 0; }
304  int GetNumberOfLayers(unsigned int nodeId);
305  int GetNumberOfLayers() { return this->GetNumberOfLayers(0); }
307 
309 
314  void SetRemoveSeed(unsigned int nodeId, bool RemoveSeed);
315  void SetRemoveSeed(bool RemoveSeed) { this->SetRemoveSeed(0, RemoveSeed); }
316  bool GetRemoveSeed(unsigned int nodeId);
317  bool GetRemoveSeed() { return this->GetRemoveSeed(0); }
319 
321 
326  void SetRemoveIntermediateLayers(unsigned int nodeId, bool RemoveIntermediateLayers);
327  void SetRemoveIntermediateLayers(bool RemoveIntermediateLayers)
328  {
329  this->SetRemoveIntermediateLayers(0, RemoveIntermediateLayers);
330  }
331  bool GetRemoveIntermediateLayers(unsigned int nodeId);
334 
336 
341  void SetInverse(unsigned int nodeId, vtkTypeBool inverse);
342  void SetInverse(vtkTypeBool inverse) { this->SetInverse(0, inverse); }
343  vtkTypeBool GetInverse(unsigned int nodeId);
344  vtkTypeBool GetInverse() { return this->GetInverse(0); }
346 
348 
352  void SetArrayName(unsigned int nodeId, const char* name);
353  void SetArrayName(const char* name) { this->SetArrayName(0, name); }
354  const char* GetArrayName(unsigned int nodeId);
355  const char* GetArrayName() { return this->GetArrayName(0); }
357 
359 
364  void SetArrayComponent(unsigned int nodeId, int component);
365  void SetArrayComponent(int component) { this->SetArrayComponent(0, component); }
366  int GetArrayComponent(unsigned int nodeId);
367  int GetArrayComponent() { return this->GetArrayComponent(0); }
369 
371 
377  void SetCompositeIndex(unsigned int nodeId, int index);
378  void SetCompositeIndex(int compositeIndex) { this->SetCompositeIndex(0, compositeIndex); }
379  int GetCompositeIndex(unsigned int nodeId);
380  int GetCompositeIndex() { return this->GetCompositeIndex(0); }
382 
384 
391  void SetHierarchicalLevel(unsigned int nodeId, int level);
392  void SetHierarchicalLevel(int level) { this->SetHierarchicalLevel(0, level); }
393  int GetHierarchicalLevel(unsigned int nodeId);
394  int GetHierarchicalLevel() { return this->GetHierarchicalLevel(0); }
395  void SetHierarchicalIndex(unsigned int nodeId, int index);
396  void SetHierarchicalIndex(int index) { this->SetHierarchicalIndex(0, index); }
397  int GetHierarchicalIndex(unsigned int nodeId);
398  int GetHierarchicalIndex() { return this->GetHierarchicalIndex(0); }
400 
402 
407  void SetAssemblyName(unsigned int nodeId, const char* name);
408  void SetAssemblyName(const char* name) { this->SetAssemblyName(0, name); }
409  const char* GetAssemblyName(unsigned int nodeId);
410  const char* GetAssemblyName() { return this->GetAssemblyName(0); }
411  void AddSelector(unsigned int nodeId, const char* selector);
412  void AddSelector(const char* selector) { this->AddSelector(0, selector); }
413  void RemoveAllSelectors(unsigned int nodeId);
416 
418 
421  void SetQueryString(unsigned int nodeId, const char* queryString);
422  void SetQueryString(const char* query) { this->SetQueryString(0, query); }
423  const char* GetQueryString(unsigned int nodeId);
424  const char* GetQueryString() { return this->GetQueryString(0); }
426 
427 protected:
429  ~vtkSelectionSource() override;
430 
431  int RequestInformation(vtkInformation* request, vtkInformationVector** inputVector,
432  vtkInformationVector* outputVector) override;
433  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
434  vtkInformationVector* outputVector) override;
435 
441  struct NodeInformation;
442  std::vector<std::shared_ptr<NodeInformation>> NodesInfo;
443 
444 private:
445  vtkSelectionSource(const vtkSelectionSource&) = delete;
446  void operator=(const vtkSelectionSource&) = delete;
447 };
448 
449 VTK_ABI_NAMESPACE_END
450 #endif
void SetRemoveSeed(bool RemoveSeed)
Set/Get the number of layers related flag to remove seed selection.
void AddStringID(vtkIdType piece, const char *id)
Add a (piece, id) to the selection set.
void SetArrayComponent(int component)
Set/Get the component number for the array specified by ArrayName.
unsigned int GetNumberOfNodes()
Set/Get the number of nodes that will be created for the generated selection.
void RemoveAllStringIDs()
Removes all IDs.
void SetNumberOfLayers(int numberOfLayers)
Set/Get the number of layers to extract connected to the selected elements.
void SetRemoveIntermediateLayers(bool RemoveIntermediateLayers)
Set/Get the number of layers related flag to remove intermediate layers.
void AddLocation(double x, double y, double z)
Add a point in world space to probe at.
const char * GetArrayName()
Get/Set the name used for the SelectionList in the generated vtkSelectionNode.
The selection data provided is cell-data.
int GetNumberOfLayersMaxValue()
Set/Get the number of layers to extract connected to the selected elements.
int GetHierarchicalLevel()
Set/Get the Hierarchical/HierarchicalIndex.
Store vtkAlgorithm input/output information.
const char * GetAssemblyName()
For selector-based selection qualification.
void SetQueryString(const char *query)
Set/Get the query expression string.
std::vector< std::shared_ptr< NodeInformation > > NodesInfo
int GetCompositeIndex()
Set/Get the CompositeIndex.
#define VTK_INT_MAX
Definition: vtkType.h:192
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetInverse(vtkTypeBool inverse)
Determines whether the selection describes what to include or exclude.
bool GetRemoveIntermediateLayers()
Set/Get the number of layers related flag to remove intermediate layers.
void AddSelector(const char *selector)
For selector-based selection qualification.
void RemoveAllIDs()
Removes all IDs.
const char * GetQueryString()
Set/Get the query expression string.
int vtkIdType
Definition: vtkType.h:363
std::pair< boost::graph_traits< vtkGraph * >::vertex_iterator, boost::graph_traits< vtkGraph * >::vertex_iterator > vertices(vtkGraph *g)
void RemoveAllSelectors()
For selector-based selection qualification.
void SetContainingCells(vtkTypeBool containingCells)
When extracting by points, extract the cells that contain the passing points.
int GetNumberOfLayers()
Set/Get the number of layers to extract connected to the selected elements.
void SetArrayName(const char *name)
Get/Set the name used for the SelectionList in the generated vtkSelectionNode.
void RemoveAllBlocks()
Remove all blocks added with AddBlock.
int vtkTypeBool
Definition: vtkABI.h:64
FieldTypeOptions
Set/Get FieldTypeOption which is used to specify the selection field type for the selection...
void RemoveAllThresholds()
Remove all thresholds added with AddThreshold.
void SetCompositeIndex(int compositeIndex)
Set/Get the CompositeIndex.
virtual void SetFieldTypeOptionToFieldType()
Set/Get FieldTypeOption which is used to specify the selection field type for the selection...
static vtkSelectionAlgorithm * New()
bool GetRemoveSeed()
Set/Get the number of layers related flag to remove seed selection.
a simple class to control print indentation
Definition: vtkIndent.h:28
int GetHierarchicalIndex()
Set/Get the Hierarchical/HierarchicalIndex.
void SetHierarchicalIndex(int index)
Set/Get the Hierarchical/HierarchicalIndex.
virtual void SetFieldTypeOptionToElementType()
Set/Get FieldTypeOption which is used to specify the selection field type for the selection...
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
void SetHierarchicalLevel(int level)
Set/Get the Hierarchical/HierarchicalIndex.
Generate selection from given set of ids.
int GetArrayComponent()
Set/Get the component number for the array specified by ArrayName.
Superclass for algorithms that produce only Selection as output.
vtkTypeBool GetContainingCells()
When extracting by points, extract the cells that contain the passing points.
void SetFrustum(double *vertices)
Set a frustum to choose within.
int GetNumberOfLayersMinValue()
Set/Get the number of layers to extract connected to the selected elements.
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
void RemoveAllLocations()
Remove all locations added with AddLocation.
void AddID(vtkIdType piece, vtkIdType id)
Add a (piece, id) to the selection set.
void SetNodeName(const char *name)
Set/Get the node name.
The selection data provided is table row-data.
void AddBlock(vtkIdType blockno)
Add the flat-index/composite index for a block.
Store zero or more vtkInformation instances.
const char * GetNodeName()
Set/Get the node name.
void SetAssemblyName(const char *name)
For selector-based selection qualification.
#define VTK_MARSHALAUTO
int GetContentType()
Set/Get the content type.
int GetContentTypeMinValue()
Set/Get the content type.
vtkTypeBool GetInverse()
Determines whether the selection describes what to include or exclude.
void AddBlockSelector(const char *selector)
Add/Remove block-selectors to make selections with vtkSelectionNode::BLOCK_SELECTORS as the content-t...
int GetContentTypeMaxValue()
Set/Get the content type.
void SetContentType(int contentType)
Set/Get the content type.
void AddThreshold(double min, double max)
Add a value range to threshold within.
#define max(a, b)
void RemoveAllBlockSelectors()
Add/Remove block-selectors to make selections with vtkSelectionNode::BLOCK_SELECTORS as the content-t...