VTK  9.7.1
vtkTree.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright 2008 Sandia Corporation
3 // SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-USGov
36 #ifndef vtkTree_h
37 #define vtkTree_h
38 
39 #include "vtkCommonDataModelModule.h" // For export macro
41 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
42 
43 VTK_ABI_NAMESPACE_BEGIN
44 class vtkIdTypeArray;
45 
46 class VTKCOMMONDATAMODEL_EXPORT VTK_MARSHALAUTO vtkTree : public vtkDirectedAcyclicGraph
47 {
48 public:
49  static vtkTree* New();
51  void PrintSelf(ostream& os, vtkIndent indent) override;
52 
56  int GetDataObjectType() VTK_FUTURE_CONST override { return VTK_TREE; }
57 
59 
62  vtkGetMacro(Root, vtkIdType);
63  vtkSetMacro(Root, vtkIdType);
65 
70 
74  vtkIdType GetChild(vtkIdType v, vtkIdType i);
75 
82 
86  vtkIdType GetParent(vtkIdType v);
87 
91  vtkEdgeType GetParentEdge(vtkIdType v);
92 
98  vtkIdType GetLevel(vtkIdType v);
99 
103  bool IsLeaf(vtkIdType vertex);
104 
106 
110  static vtkTree* GetData(vtkInformationVector* v, int i = 0);
112 
119  virtual void ReorderChildren(vtkIdType parent, vtkIdTypeArray* children);
120 
121 protected:
122  vtkTree();
123  ~vtkTree() override;
124 
129  bool IsStructureValid(vtkGraph* g) override;
130 
135 
136 private:
137  vtkTree(const vtkTree&) = delete;
138  void operator=(const vtkTree&) = delete;
139 };
140 
141 VTK_ABI_NAMESPACE_END
142 #endif
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkIdType GetNumberOfChildren(vtkIdType v)
Get the number of children of a vertex.
Definition: vtkTree.h:69
Store vtkAlgorithm input/output information.
Iterates through adjacent vertices in a graph.
static vtkDirectedAcyclicGraph * New()
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:363
virtual void GetAdjacentVertices(vtkIdType v, vtkAdjacentVertexIterator *it)
Initializes the adjacent vertex iterator to iterate over all outgoing vertices from vertex v...
Base class for graph data types.
Definition: vtkGraph.h:282
a simple class to control print indentation
Definition: vtkIndent.h:28
int GetDataObjectType() VTK_FUTURE_CONST override
Return what type of dataset this is.
Definition: vtkTree.h:56
vtkIdType Root
The root of the tree.
Definition: vtkTree.h:134
static vtkDirectedAcyclicGraph * GetData(vtkInformation *info)
Retrieve a graph from an information vector.
Store zero or more vtkInformation instances.
bool IsStructureValid(vtkGraph *g) override
Check the storage, and accept it if it is a valid tree.
#define VTK_MARSHALAUTO
void GetChildren(vtkIdType v, vtkAdjacentVertexIterator *it)
Get the child vertices of a vertex.
Definition: vtkTree.h:81
A rooted tree data structure.
Definition: vtkTree.h:46
A rooted tree data structure.
virtual vtkIdType GetOutDegree(vtkIdType v)
The number of outgoing edges from vertex v.