VTK
vtkGraph.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkGraph.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 -------------------------------------------------------------------------*/
215 #ifndef vtkGraph_h
216 #define vtkGraph_h
217 
218 #include "vtkCommonDataModelModule.h" // For export macro
219 #include "vtkDataObject.h"
220 
222 class vtkCellArray;
223 class vtkEdgeListIterator;
225 class vtkDirectedGraph;
226 class vtkGraphEdge;
227 class vtkGraphEdgePoints;
229 class vtkGraphInternals;
230 class vtkIdTypeArray;
231 class vtkInEdgeIterator;
232 class vtkOutEdgeIterator;
233 class vtkPoints;
234 class vtkUndirectedGraph;
236 class vtkVariant;
237 class vtkVariantArray;
238 
239 //BTX
240 // Forward declare some boost stuff even if boost wrappers
241 // are turned off.
242 namespace boost
243 {
244  class vtk_edge_iterator;
245  class vtk_out_edge_pointer_iterator;
246  class vtk_in_edge_pointer_iterator;
247 }
248 
249 // Edge structures.
251 {
254  Id(id) { }
256 };
257 
259 {
262  vtkEdgeBase(id),
263  Target(t) { }
265 };
266 
268 {
271  vtkEdgeBase(id),
272  Source(s) { }
274 };
275 
277 {
280  vtkEdgeBase(id),
281  Source(s),
282  Target(t) { }
285 };
286 //ETX
287 
289 {
290 public:
292  void PrintSelf(ostream& os, vtkIndent indent);
293 
295 
299 
301  virtual int GetDataObjectType() {return VTK_GRAPH;}
302 
304  virtual void Initialize();
305 
307 
310  double *GetPoint(vtkIdType ptId);
311  void GetPoint(vtkIdType ptId, double x[3]);
313 
315 
320  virtual void SetPoints(vtkPoints *points);
322 
326 
328 
331  double *GetBounds();
332  void GetBounds(double bounds[6]);
334 
336  unsigned long int GetMTime();
337 
342 
347 
352 
353  //BTX
355 
357  //ETX
359 
365 
370 
375 
376  //BTX
378 
380  //ETX
382 
388 
394 
398  virtual void GetEdges(vtkEdgeListIterator *it);
399 
403 
408 
412 
413  // BTX
418 
420 
422  //ETX
424 
431  vtkIdType FindVertex(const vtkVariant& pedigreeID);
432 
435  virtual void ShallowCopy(vtkDataObject *obj);
436 
439  virtual void DeepCopy(vtkDataObject *obj);
440 
443  virtual void CopyStructure(vtkGraph *g);
444 
447  virtual bool CheckedShallowCopy(vtkGraph *g);
448 
451  virtual bool CheckedDeepCopy(vtkGraph *g);
452 
454  virtual void Squeeze();
455 
456  //BTX
458 
461  //ETX
463 
469 
472  bool IsSameStructure(vtkGraph *other);
473 
475 
484 
485  //BTX
487 
490  void SetEdgePoints(vtkIdType e, vtkIdType npts, double* pts);
491  void GetEdgePoints(vtkIdType e, vtkIdType& npts, double*& pts);
492  //ETX
494 
497 
500 
503 
505 
507  void SetEdgePoint(vtkIdType e, vtkIdType i, double x[3]);
508  void SetEdgePoint(vtkIdType e, vtkIdType i, double x, double y, double z)
509  { double p[3] = {x, y, z}; this->SetEdgePoint(e, i, p); }
511 
513 
515  void AddEdgePoint(vtkIdType e, double x[3]);
516  void AddEdgePoint(vtkIdType e, double x, double y, double z)
517  { double p[3] = {x, y, z}; this->AddEdgePoint(e, p); }
519 
521 
526 
531 
535 
541 
545 
547  void Dump();
548 
556 
559 
562 
563 protected:
564  //BTX
567 
569 
574  void AddVertexInternal(vtkVariantArray *propertyArr = 0,
575  vtkIdType *vertex = 0);
577 
582  void AddVertexInternal(const vtkVariant& pedigree, vtkIdType *vertex);
583 
585 
589  void AddEdgeInternal(vtkIdType u, vtkIdType v, bool directed,
590  vtkVariantArray *propertyArr, vtkEdgeType *edge);
591  void AddEdgeInternal(const vtkVariant& uPedigree, vtkIdType v, bool directed,
592  vtkVariantArray *propertyArr, vtkEdgeType *edge);
593  void AddEdgeInternal(vtkIdType u, const vtkVariant& vPedigree, bool directed,
594  vtkVariantArray *propertyArr, vtkEdgeType *edge);
595  void AddEdgeInternal(const vtkVariant& uPedigree, const vtkVariant& vPedigree,
596  bool directed, vtkVariantArray *propertyArr,
597  vtkEdgeType *edge);
599 
602  void RemoveVertexInternal(vtkIdType v, bool directed);
603 
606  void RemoveEdgeInternal(vtkIdType e, bool directed);
607 
610  void RemoveVerticesInternal(vtkIdTypeArray* arr, bool directed);
611 
613 
614  void RemoveEdgesInternal(vtkIdTypeArray* arr, bool directed);
615  //ETX
617 
620  virtual bool IsStructureValid(vtkGraph *g) = 0;
621 
623  virtual void CopyInternal(vtkGraph *g, bool deep);
624 
627 
630 
632  void SetInternals(vtkGraphInternals* internals);
633 
635  vtkGraphEdgePoints *EdgePoints;
636 
638  void SetEdgePoints(vtkGraphEdgePoints* edgePoints);
639 
643 
645 
646  virtual void GetOutEdges(vtkIdType v, const vtkOutEdgeType *& edges, vtkIdType & nedges);
647  virtual void GetInEdges(vtkIdType v, const vtkInEdgeType *& edges, vtkIdType & nedges);
649 
652 
653  //BTX
655 
657  friend class vtkEdgeListIterator;
658  friend class vtkInEdgeIterator;
659  friend class vtkOutEdgeIterator;
663  //ETX
665 
667 
671 
673  double Bounds[6];
674 
677 
679 
681  static double DefaultPoint[3];
683 
685 
687  virtual void SetEdgeList(vtkIdTypeArray* list);
689  //ETX
690 private:
691  vtkGraph(const vtkGraph&); // Not implemented.
692  void operator=(const vtkGraph&); // Not implemented.
693 };
695 
696 //BTX
700 //ETX
701 
702 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:39
vtkInEdgeType::vtkInEdgeType
vtkInEdgeType(vtkIdType s, vtkIdType id)
Definition: vtkGraph.h:270
vtkgl::z
GLdouble GLdouble z
Definition: vtkgl.h:11754
vtkGraph::AddEdgePoint
void AddEdgePoint(vtkIdType e, double x, double y, double z)
Definition: vtkGraph.h:516
vtkGraph::GetOutEdge
virtual void GetOutEdge(vtkIdType v, vtkIdType index, vtkGraphEdge *e)
vtkEdgeBase::Id
vtkIdType Id
Definition: vtkGraph.h:255
operator<<
VTKCOMMONDATAMODEL_EXPORT ostream & operator<<(ostream &out, vtkEdgeBase e)
vtkGraph::GetInEdges
virtual void GetInEdges(vtkIdType v, const vtkInEdgeType *&edges, vtkIdType &nedges)
vtkGetObjectMacro
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:232
vtkgl::id
GLuint id
Definition: vtkgl.h:11834
vtkGraph::DeepCopy
virtual void DeepCopy(vtkDataObject *obj)
vtkgl::b
GLboolean GLboolean GLboolean b
Definition: vtkgl.h:12312
vtkDistributedGraphHelper
helper for the vtkGraph class that allows the graph to be distributed across multiple memory spaces.
Definition: vtkDistributedGraphHelper.h:80
vtkGraph::GetDistributedGraphHelper
vtkDistributedGraphHelper * GetDistributedGraphHelper()
vtkGraph::Points
vtkPoints * Points
Definition: vtkGraph.h:680
vtkUndirectedGraph
An undirected graph.
Definition: vtkUndirectedGraph.h:54
vtkGraphInternals
Internal representation of vtkGraph.
Definition: vtkGraphInternals.h:52
vtkGraph::GetEdgePoints
void GetEdgePoints(vtkIdType e, vtkIdType &npts, double *&pts)
vtkGraph::GetEdgePoint
double * GetEdgePoint(vtkIdType e, vtkIdType i)
vtkgl::obj
GLsizei GLsizei GLuint * obj
Definition: vtkgl.h:11994
vtkIdType
int vtkIdType
Definition: vtkType.h:275
vtkCommonDataModelModule.h
vtkGraph::GetNumberOfEdgePoints
vtkIdType GetNumberOfEdgePoints(vtkIdType e)
VTK_GRAPH
#define VTK_GRAPH
Definition: vtkType.h:86
vtkGraph::Internals
vtkGraphInternals * Internals
Definition: vtkGraph.h:626
vtkGraph::ComputeTime
vtkTimeStamp ComputeTime
Definition: vtkGraph.h:676
vtkDataSetAttributes
represent and manipulate attribute data in a dataset
Definition: vtkDataSetAttributes.h:58
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:41
vtkGraph::GetNumberOfVertices
virtual vtkIdType GetNumberOfVertices()
vtkGraph::SetDistributedGraphHelper
void SetDistributedGraphHelper(vtkDistributedGraphHelper *helper)
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:35
vtkGraph::RemoveVertexInternal
void RemoveVertexInternal(vtkIdType v, bool directed)
vtkGraph::~vtkGraph
~vtkGraph()
vtkGraph::GetData
static vtkGraph * GetData(vtkInformation *info)
vtkgl::s
GLdouble s
Definition: vtkgl.h:11594
vtkGraph::SetPoints
virtual void SetPoints(vtkPoints *points)
vtkGraph::ComputeBounds
void ComputeBounds()
vtkGraph::AddEdgeInternal
void AddEdgeInternal(vtkIdType u, const vtkVariant &vPedigree, bool directed, vtkVariantArray *propertyArr, vtkEdgeType *edge)
vtkGraph::AddEdgeInternal
void AddEdgeInternal(const vtkVariant &uPedigree, const vtkVariant &vPedigree, bool directed, vtkVariantArray *propertyArr, vtkEdgeType *edge)
vtkGraph::AddVertexInternal
void AddVertexInternal(const vtkVariant &pedigree, vtkIdType *vertex)
vtkEdgeBase::vtkEdgeBase
vtkEdgeBase(vtkIdType id)
Definition: vtkGraph.h:253
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkGraph::GetGraphInternals
vtkGraphInternals * GetGraphInternals(bool modifying)
vtkDirectedGraph
A directed graph.
Definition: vtkDirectedGraph.h:47
vtkgl::v
const GLdouble * v
Definition: vtkgl.h:11595
vtkgl::x
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
boost
Forward declaration required for Boost serialization.
Definition: vtkVariantArray.h:44
vtkGraph::GetNumberOfEdges
virtual vtkIdType GetNumberOfEdges()
vtkGraph::GetBounds
void GetBounds(double bounds[6])
vtkInEdgeIterator
Iterates through all incoming edges to a vertex.
Definition: vtkInEdgeIterator.h:48
vtkGraph::GetNumberOfElements
virtual vtkIdType GetNumberOfElements(int type)
vtkGraph::GetOutEdge
virtual vtkOutEdgeType GetOutEdge(vtkIdType v, vtkIdType index)
vtkVariantArray
An array holding vtkVariants.
Definition: vtkVariantArray.h:48
vtkInEdgeType
Definition: vtkGraph.h:268
vtkGraph::BuildEdgeList
void BuildEdgeList()
vtkGraph::GetPoint
double * GetPoint(vtkIdType ptId)
vtkGraph::Dump
void Dump()
boost::vtk_out_edge_pointer_iterator
Definition: vtkBoostGraphAdapter.h:320
vtkgl::points
GLsizei const GLfloat * points
Definition: vtkgl.h:14786
vtkGraph::CopyInternal
virtual void CopyInternal(vtkGraph *g, bool deep)
vtkGraph::ForceOwnership
void ForceOwnership()
vtkOutEdgeType::Target
vtkIdType Target
Definition: vtkGraph.h:264
vtkEdgeType::Source
vtkIdType Source
Definition: vtkGraph.h:283
vtkFieldData
represent and manipulate fields of data
Definition: vtkFieldData.h:56
vtkGraph::GetInducedEdges
void GetInducedEdges(vtkIdTypeArray *verts, vtkIdTypeArray *edges)
vtkGraph::SetEdgePoints
void SetEdgePoints(vtkGraphEdgePoints *edgePoints)
vtkGraph::VertexData
vtkDataSetAttributes * VertexData
Definition: vtkGraph.h:668
vtkGraph::AddEdgeInternal
void AddEdgeInternal(vtkIdType u, vtkIdType v, bool directed, vtkVariantArray *propertyArr, vtkEdgeType *edge)
vtkEdgeType
Definition: vtkGraph.h:277
edges
vtksys_stl::pair< boost::graph_traits< vtkGraph * >::edge_iterator, boost::graph_traits< vtkGraph * >::edge_iterator > edges(vtkGraph *g)
Definition: vtkBoostGraphAdapter.h:855
vtkGraph::IsStructureValid
virtual bool IsStructureValid(vtkGraph *g)=0
operator!=
bool VTKCOMMONDATAMODEL_EXPORT operator!=(vtkEdgeBase e1, vtkEdgeBase e2)
operator==
bool VTKCOMMONDATAMODEL_EXPORT operator==(vtkEdgeBase e1, vtkEdgeBase e2)
vtkGraph::EdgeList
vtkIdTypeArray * EdgeList
Definition: vtkGraph.h:688
vtkOutEdgeType::vtkOutEdgeType
vtkOutEdgeType()
Definition: vtkGraph.h:260
vtkGraph::CheckedDeepCopy
virtual bool CheckedDeepCopy(vtkGraph *g)
vtkGraph::GetInEdge
virtual void GetInEdge(vtkIdType v, vtkIdType index, vtkGraphEdge *e)
vtkGraph::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkGraph::RemoveVerticesInternal
void RemoveVerticesInternal(vtkIdTypeArray *arr, bool directed)
vtkGraph::DeepCopyEdgePoints
void DeepCopyEdgePoints(vtkGraph *g)
vtkGraph::GetOutDegree
virtual vtkIdType GetOutDegree(vtkIdType v)
vtkGraph::ClearEdgePoints
void ClearEdgePoints(vtkIdType e)
vtkGraph::CheckedShallowCopy
virtual bool CheckedShallowCopy(vtkGraph *g)
vtkGraph::RemoveEdgeInternal
void RemoveEdgeInternal(vtkIdType e, bool directed)
vtkGraph::GetInDegree
virtual vtkIdType GetInDegree(vtkIdType v)
vtkGraph::GetDataObjectType
virtual int GetDataObjectType()
Definition: vtkGraph.h:301
vtkOutEdgeType::vtkOutEdgeType
vtkOutEdgeType(vtkIdType t, vtkIdType id)
Definition: vtkGraph.h:261
vtkGraphEdge
Representation of a single graph edge.
Definition: vtkGraphEdge.h:39
vtkEdgeType::Target
vtkIdType Target
Definition: vtkGraph.h:284
vtkGraph::GetDegree
virtual vtkIdType GetDegree(vtkIdType v)
vtkGraph::ToUndirectedGraph
bool ToUndirectedGraph(vtkUndirectedGraph *g)
vtkGraph::GetEdgeId
vtkIdType GetEdgeId(vtkIdType a, vtkIdType b)
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:50
vtkGraph::SetEdgeList
virtual void SetEdgeList(vtkIdTypeArray *list)
vtkVariant
A atomic type representing the union of many types.
Definition: vtkVariant.h:79
vtkEdgeListIterator
Iterates through all edges in a graph.
Definition: vtkEdgeListIterator.h:56
vtkGraph::AddVertexInternal
void AddVertexInternal(vtkVariantArray *propertyArr=0, vtkIdType *vertex=0)
vtkOutEdgeIterator
Iterates through all outgoing edges from a vertex.
Definition: vtkOutEdgeIterator.h:51
boost::vtk_in_edge_pointer_iterator
Definition: vtkBoostGraphAdapter.h:357
vtkGraph::GetTargetVertex
vtkIdType GetTargetVertex(vtkIdType e)
vtkInEdgeType::Source
vtkIdType Source
Definition: vtkGraph.h:273
vtkgl::a
GLboolean GLboolean GLboolean GLboolean a
Definition: vtkgl.h:12312
vtkGraph::GetPoint
void GetPoint(vtkIdType ptId, double x[3])
vtkGraph::GetAdjacentVertices
virtual void GetAdjacentVertices(vtkIdType v, vtkAdjacentVertexIterator *it)
vtkGraph::SetEdgePoints
void SetEdgePoints(vtkIdType e, vtkIdType npts, double *pts)
vtkGraph::EdgePoints
vtkGraphEdgePoints * EdgePoints
Definition: vtkGraph.h:635
vtkAdjacentVertexIterator
Iterates through adjacent vertices in a graph.
Definition: vtkAdjacentVertexIterator.h:47
vtkEdgeType::vtkEdgeType
vtkEdgeType(vtkIdType s, vtkIdType t, vtkIdType id)
Definition: vtkGraph.h:279
vtkGraph::GetVertices
virtual void GetVertices(vtkVertexListIterator *it)
vtkGraph::GetMTime
unsigned long int GetMTime()
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
vtkGraph::EdgeData
vtkDataSetAttributes * EdgeData
Definition: vtkGraph.h:669
vtkGraph::GetOutEdges
virtual void GetOutEdges(vtkIdType v, vtkOutEdgeIterator *it)
vtkGraph::ToDirectedGraph
bool ToDirectedGraph(vtkDirectedGraph *g)
vtkEdgeBase
Definition: vtkGraph.h:251
vtkX3D::info
@ info
Definition: vtkX3D.h:376
vertices
vtksys_stl::pair< boost::graph_traits< vtkGraph * >::vertex_iterator, boost::graph_traits< vtkGraph * >::vertex_iterator > vertices(vtkGraph *g)
Definition: vtkBoostGraphAdapter.h:837
vtkGraph::vtkGraph
vtkGraph()
vtkgl::index
GLuint index
Definition: vtkgl.h:11983
vtkGraph::GetEdges
virtual void GetEdges(vtkEdgeListIterator *it)
vtkgl::t
GLdouble GLdouble t
Definition: vtkgl.h:11602
vtkIdTypeArray
dynamic, self-adjusting array of vtkIdType
Definition: vtkIdTypeArray.h:49
vtkgl::y
GLint GLint GLint GLint GLint GLint y
Definition: vtkgl.h:11318
vtkgl::g
GLboolean GLboolean g
Definition: vtkgl.h:12312
vtkOutEdgeType
Definition: vtkGraph.h:259
vtkGraph::GetInEdges
virtual void GetInEdges(vtkIdType v, vtkInEdgeIterator *it)
vtkEdgeBase::vtkEdgeBase
vtkEdgeBase()
Definition: vtkGraph.h:252
vtkDataObject.h
vtkEdgeType::vtkEdgeType
vtkEdgeType()
Definition: vtkGraph.h:278
vtkGraph::ShallowCopyEdgePoints
void ShallowCopyEdgePoints(vtkGraph *g)
vtkGraph::ShallowCopy
virtual void ShallowCopy(vtkDataObject *obj)
vtkGraph::IsSameStructure
bool IsSameStructure(vtkGraph *other)
vtkGraph::Initialize
virtual void Initialize()
vtkGraph::ReorderOutVertices
void ReorderOutVertices(vtkIdType v, vtkIdTypeArray *vertices)
vtkGraph::SetEdgePoint
void SetEdgePoint(vtkIdType e, vtkIdType i, double x, double y, double z)
Definition: vtkGraph.h:508
vtkInEdgeType::vtkInEdgeType
vtkInEdgeType()
Definition: vtkGraph.h:269
vtkGraph::AddEdgePoint
void AddEdgePoint(vtkIdType e, double x[3])
vtkGraph::SetInternals
void SetInternals(vtkGraphInternals *internals)
vtkgl::p
GLfloat GLfloat p
Definition: vtkgl.h:15717
vtkGraph::DistributedHelper
vtkDistributedGraphHelper * DistributedHelper
Definition: vtkGraph.h:629
vtkGraph::GetBounds
double * GetBounds()
vtkGraph::FindVertex
vtkIdType FindVertex(const vtkVariant &pedigreeID)
vtkVertexListIterator
Iterates all vertices in a graph.
Definition: vtkVertexListIterator.h:47
VTKCOMMONDATAMODEL_EXPORT
#define VTKCOMMONDATAMODEL_EXPORT
Definition: vtkCommonDataModelModule.h:15
boost::vtk_edge_iterator
Definition: vtkBoostGraphAdapter.h:187
vtkGraph
Base class for graph data types.
Definition: vtkGraph.h:289
vtkGraph::GetAttributesAsFieldData
virtual vtkFieldData * GetAttributesAsFieldData(int type)
vtkGraph::GetOutEdges
virtual void GetOutEdges(vtkIdType v, const vtkOutEdgeType *&edges, vtkIdType &nedges)
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:65
vtkGraph::CopyStructure
virtual void CopyStructure(vtkGraph *g)
vtkGraph::GetInEdge
virtual vtkInEdgeType GetInEdge(vtkIdType v, vtkIdType index)
vtkgl::type
GLuint GLuint GLsizei GLenum type
Definition: vtkgl.h:11315
vtkGraph::RemoveEdgesInternal
void RemoveEdgesInternal(vtkIdTypeArray *arr, bool directed)
vtkGraph::GetSourceVertex
vtkIdType GetSourceVertex(vtkIdType e)
vtkGraph::GetPoints
vtkPoints * GetPoints()
vtkGraph::AddEdgeInternal
void AddEdgeInternal(const vtkVariant &uPedigree, vtkIdType v, bool directed, vtkVariantArray *propertyArr, vtkEdgeType *edge)
vtkGraph::Squeeze
virtual void Squeeze()
vtkGraph::SetEdgePoint
void SetEdgePoint(vtkIdType e, vtkIdType i, double x[3])
vtkGraph::GetData
static vtkGraph * GetData(vtkInformationVector *v, int i=0)