VTK  9.3.0
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 
42 VTK_ABI_NAMESPACE_BEGIN
43 class vtkIdTypeArray;
44 
45 class VTKCOMMONDATAMODEL_EXPORT vtkTree : public vtkDirectedAcyclicGraph
46 {
47 public:
48  static vtkTree* New();
50  void PrintSelf(ostream& os, vtkIndent indent) override;
51 
55  int GetDataObjectType() override { return VTK_TREE; }
56 
58 
61  vtkGetMacro(Root, vtkIdType);
63 
68 
73 
80 
85 
90 
97 
101  bool IsLeaf(vtkIdType vertex);
102 
104 
108  static vtkTree* GetData(vtkInformationVector* v, int i = 0);
110 
117  virtual void ReorderChildren(vtkIdType parent, vtkIdTypeArray* children);
118 
119 protected:
121  ~vtkTree() override;
122 
127  bool IsStructureValid(vtkGraph* g) override;
128 
133 
134 private:
135  vtkTree(const vtkTree&) = delete;
136  void operator=(const vtkTree&) = delete;
137 };
138 
139 VTK_ABI_NAMESPACE_END
140 #endif
Iterates through adjacent vertices in a graph.
A rooted tree data structure.
Base class for graph data types.
Definition: vtkGraph.h:281
virtual vtkIdType GetOutDegree(vtkIdType v)
The number of outgoing edges from vertex v.
virtual void GetAdjacentVertices(vtkIdType v, vtkAdjacentVertexIterator *it)
Initializes the adjacent vertex iterator to iterate over all outgoing vertices from vertex v.
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:29
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
A rooted tree data structure.
Definition: vtkTree.h:46
vtkIdType GetChild(vtkIdType v, vtkIdType i)
Get the i-th child of a parent vertex.
bool IsStructureValid(vtkGraph *g) override
Check the storage, and accept it if it is a valid tree.
static vtkTree * GetData(vtkInformation *info)
Retrieve a graph from an information vector.
vtkIdType GetNumberOfChildren(vtkIdType v)
Get the number of children of a vertex.
Definition: vtkTree.h:67
virtual void ReorderChildren(vtkIdType parent, vtkIdTypeArray *children)
Reorder the children of a parent vertex.
vtkEdgeType GetParentEdge(vtkIdType v)
Get the edge connecting the vertex to its parent.
static vtkTree * New()
void GetChildren(vtkIdType v, vtkAdjacentVertexIterator *it)
Get the child vertices of a vertex.
Definition: vtkTree.h:79
static vtkTree * GetData(vtkInformationVector *v, int i=0)
Retrieve a graph from an information vector.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkIdType Root
The root of the tree.
Definition: vtkTree.h:132
vtkIdType GetParent(vtkIdType v)
Get the parent of a vertex.
int GetDataObjectType() override
Return what type of dataset this is.
Definition: vtkTree.h:55
vtkIdType GetLevel(vtkIdType v)
Get the level of the vertex in the tree.
bool IsLeaf(vtkIdType vertex)
Return whether the vertex is a leaf (i.e.
~vtkTree() override
@ info
Definition: vtkX3D.h:376
int vtkIdType
Definition: vtkType.h:315
#define VTK_TREE
Definition: vtkType.h:86