VTK  9.3.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 
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 
72  vtkIdType GetChild(vtkIdType v, vtkIdType i);
73 
80 
84  vtkIdType GetParent(vtkIdType v);
85 
89  vtkEdgeType GetParentEdge(vtkIdType v);
90 
96  vtkIdType GetLevel(vtkIdType v);
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:
120  vtkTree();
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
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:67
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:315
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:280
a simple class to control print indentation
Definition: vtkIndent.h:28
int GetDataObjectType() override
Return what type of dataset this is.
Definition: vtkTree.h:55
vtkIdType Root
The root of the tree.
Definition: vtkTree.h:132
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.
void GetChildren(vtkIdType v, vtkAdjacentVertexIterator *it)
Get the child vertices of a vertex.
Definition: vtkTree.h:79
A rooted tree data structure.
Definition: vtkTree.h:45
A rooted tree data structure.
#define VTK_TREE
Definition: vtkType.h:86
virtual vtkIdType GetOutDegree(vtkIdType v)
The number of outgoing edges from vertex v.