VTK
vtkTree.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkTree.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 /*-------------------------------------------------------------------------
16  Copyright 2008 Sandia Corporation.
17  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
18  the U.S. Government retains certain rights in this software.
19 -------------------------------------------------------------------------*/
46 #ifndef vtkTree_h
47 #define vtkTree_h
48 
49 #include "vtkCommonDataModelModule.h" // For export macro
51 
52 class vtkIdTypeArray;
53 
54 class VTKCOMMONDATAMODEL_EXPORT vtkTree : public vtkDirectedAcyclicGraph
55 {
56 public:
57  static vtkTree *New();
59  void PrintSelf(ostream& os, vtkIndent indent) override;
60 
64  int GetDataObjectType() override {return VTK_TREE;}
65 
67 
70  vtkGetMacro(Root, vtkIdType);
72 
77  { return this->GetOutDegree(v); }
78 
82  vtkIdType GetChild(vtkIdType v, vtkIdType i);
83 
90  { this->GetAdjacentVertices(v, it); }
91 
95  vtkIdType GetParent(vtkIdType v);
96 
100  vtkEdgeType GetParentEdge(vtkIdType v);
101 
107  vtkIdType GetLevel(vtkIdType v);
108 
112  bool IsLeaf(vtkIdType vertex);
113 
115 
119  static vtkTree *GetData(vtkInformationVector *v, int i=0);
121 
128  virtual void ReorderChildren(vtkIdType parent, vtkIdTypeArray *children);
129 
130 protected:
131  vtkTree();
132  ~vtkTree() override;
133 
138  bool IsStructureValid(vtkGraph *g) override;
139 
144 
145 private:
146  vtkTree(const vtkTree&) = delete;
147  void operator=(const vtkTree&) = delete;
148 };
149 
150 #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:76
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:347
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:281
a simple class to control print indentation
Definition: vtkIndent.h:33
int GetDataObjectType() override
Return what type of dataset this is.
Definition: vtkTree.h:64
vtkIdType Root
The root of the tree.
Definition: vtkTree.h:143
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:89
A rooted tree data structure.
Definition: vtkTree.h:54
A rooted tree data structure.
#define VTK_TREE
Definition: vtkType.h:112
virtual vtkIdType GetOutDegree(vtkIdType v)
The number of outgoing edges from vertex v.