29 #ifndef vtkBoostGraphAdapter_h
30 #define vtkBoostGraphAdapter_h
48 #include <boost/version.hpp>
58 struct read_write_property_map_tag;
60 #define vtkPropertyMapMacro(T, V) \
62 struct property_traits<T*> \
64 typedef V value_type; \
65 typedef V reference; \
66 typedef vtkIdType key_type; \
67 typedef read_write_property_map_tag category; \
70 inline property_traits<T*>::reference \
73 property_traits<T*>::key_type key) \
75 return arr->GetValue(key); \
81 property_traits<T*>::key_type key, \
82 const property_traits<T*>::value_type & value) \
84 arr->InsertValue(key, value); \
135 #if defined(_MSC_VER)
145 #include <boost/config.hpp>
146 #include <boost/iterator/iterator_facade.hpp>
147 #include <boost/graph/graph_traits.hpp>
148 #include <boost/graph/properties.hpp>
149 #include <boost/graph/adjacency_iterator.hpp>
158 public iterator_facade<vtk_vertex_iterator,
160 bidirectional_traversal_tag,
168 vtkIdType dereference()
const {
return index; }
171 {
return index == other.index; }
173 void increment() { index++; }
174 void decrement() { index--; }
182 public iterator_facade<vtk_edge_iterator,
184 forward_traversal_tag,
190 directed(false), vertex(v), lastVertex(v), iter(0), end(0), graph(g)
210 while (vertex < lastVertex && this->graph->
GetOutDegree(vertex) == 0)
215 if (vertex < lastVertex)
232 && vertex > iter->
Target)))
250 {
return vertex == other.vertex && iter == other.iter; }
272 && vertex > iter->
Target)))
286 while (vertex < lastVertex && this->graph->
GetOutDegree(vertex) == 0)
291 if (vertex < lastVertex)
315 public iterator_facade<vtk_out_edge_pointer_iterator,
317 bidirectional_traversal_tag,
328 g->GetOutEdges(vertex, iter, nedges);
340 {
return iter == other.iter; }
342 void increment() { iter++; }
343 void decrement() { iter--; }
352 public iterator_facade<vtk_in_edge_pointer_iterator,
354 bidirectional_traversal_tag,
365 g->GetInEdges(vertex, iter, nedges);
377 {
return iter == other.iter; }
379 void increment() { iter++; }
380 void decrement() { iter--; }
395 public virtual bidirectional_graph_tag,
396 public virtual edge_list_graph_tag,
397 public virtual vertex_list_graph_tag,
398 public virtual adjacency_graph_tag { };
418 typedef adjacency_iterator_generator<
vtkGraph*,
422 #if BOOST_VERSION >= 104500
424 struct graph_property_type<
vtkGraph* > {
425 typedef no_property
type;
439 #if BOOST_VERSION >= 104500
441 struct graph_bundle_type<
vtkGraph* > {
442 typedef no_property
type;
491 #if BOOST_VERSION >= 104500
495 : graph_property_type< vtkGraph* > { };
500 : graph_property_type< vtkGraph* > { };
523 #if BOOST_VERSION >= 104500
527 : graph_bundle_type< vtkGraph* > { };
532 : graph_bundle_type< vtkGraph* > { };
585 #if BOOST_VERSION >= 104500
589 : graph_property_type< vtkGraph* > { };
594 : graph_property_type< vtkGraph* > { };
617 #if BOOST_VERSION >= 104500
621 : graph_bundle_type< vtkGraph* > { };
626 : graph_bundle_type< vtkGraph* > { };
663 #if BOOST_VERSION >= 104500
667 : graph_property_type< vtkDirectedGraph* > { };
672 : graph_property_type< vtkDirectedGraph* > { };
695 #if BOOST_VERSION >= 104500
699 : graph_bundle_type< vtkDirectedGraph* > { };
704 : graph_bundle_type< vtkDirectedGraph* > { };
741 #if BOOST_VERSION >= 104500
745 : graph_property_type< vtkUndirectedGraph* > { };
750 : graph_property_type< vtkUndirectedGraph* > { };
773 #if BOOST_VERSION >= 104500
777 : graph_bundle_type< vtkUndirectedGraph* > { };
782 : graph_bundle_type< vtkUndirectedGraph* > { };
836 boost::graph_traits< vtkGraph* >::vertex_iterator >
839 typedef boost::graph_traits< vtkGraph* >::vertex_iterator Iter;
848 return std::make_pair( Iter(start),
854 boost::graph_traits< vtkGraph* >::edge_iterator >
857 typedef boost::graph_traits< vtkGraph* >::edge_iterator Iter;
863 boost::graph_traits< vtkGraph* >::out_edge_iterator >
868 typedef boost::graph_traits< vtkGraph* >::out_edge_iterator Iter;
869 std::pair<Iter, Iter> p = std::make_pair( Iter(g, u), Iter(g, u,
true) );
875 boost::graph_traits< vtkGraph* >::in_edge_iterator >
880 typedef boost::graph_traits< vtkGraph* >::in_edge_iterator Iter;
881 std::pair<Iter, Iter> p = std::make_pair( Iter(g, u), Iter(g, u,
true) );
887 boost::graph_traits< vtkGraph* >::adjacency_iterator >
892 typedef boost::graph_traits< vtkGraph* >::adjacency_iterator Iter;
893 typedef boost::graph_traits< vtkGraph* >::out_edge_iterator OutEdgeIter;
894 std::pair<OutEdgeIter, OutEdgeIter> out =
out_edges(u, g);
895 return std::make_pair( Iter(out.first, &g), Iter(out.second, &g) );
948 boost::graph_traits< vtkMutableDirectedGraph* >::edge_descriptor e = g->
AddEdge(u, v);
949 return std::make_pair(e,
true);
966 boost::graph_traits< vtkMutableUndirectedGraph* >::edge_descriptor e = g->
AddEdge(u, v);
967 return std::make_pair(e,
true);
998 template<
typename PMap>
1010 template<
typename PMap>
1016 return get(helper.
pmap,
key.Id);
1019 template<
typename PMap>
1055 template<
typename PMap>
1068 template<
typename PMap>
1077 template<
typename PMap>
1141 #if BOOST_VERSION > 104000
1142 #include <boost/property_map/vector_property_map.hpp>
1144 #include <boost/vector_property_map.hpp>
1148 #endif // vtkBoostGraphAdapter_h
static vtkDirectedGraph * SafeDownCast(vtkObjectBase *o)
virtual vtkIdType GetNumberOfEdges()
helper for the vtkGraph class that allows the graph to be distributed across multiple memory spaces...
property_traits< PMap >::reference reference
property_traits< PMap >::category category
vtk_out_edge_pointer_iterator(vtkGraph *g=0, vtkIdType v=0, bool end=false)
vtkEdgeType AddEdge(vtkIdType u, vtkIdType v)
vtkGraphEdgePropertyMapHelper(PMap m)
void put(vtkGraphPropertyMapMultiplier< PMap > multi, const typename property_traits< PMap >::key_type key, const typename property_traits< PMap >::value_type &value)
virtual vtkInformation * GetInformation()
read_write_property_map_tag category
Forward declaration required for Boost serialization.
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
virtual vtkIdType GetNumberOfVertices()
virtual vtkVariant GetVariantValue(vtkIdType idx)
vtk_out_edge_pointer_iterator out_edge_iterator
property_traits< PMap >::reference reference
vtkIdType degree_size_type
vtkPropertyMapMacro(vtkIntArray, int) vtkPropertyMapMacro(vtkIdTypeArray
Abstract superclass for all arrays.
vtkGraphPropertyMapMultiplier(PMap m, float multi=1)
friend class iterator_core_access
void SetTuple1(vtkIdType i, double value)
vtkIdType GetEdgeOwner(vtkIdType e_id) const
vtkGraph_traversal_category traversal_category
directed_tag directed_category
vtk_in_edge_pointer_iterator in_edge_iterator
vtkIdType edges_size_type
dynamic, self-adjusting array of float
vtkIdType GetVertexOwner(vtkIdType v) const
vtk_edge_iterator edge_iterator
dynamic, self-adjusting array of vtkIdType
virtual void InsertVariantValue(vtkIdType idx, vtkVariant value)=0
property_traits< PMap >::key_type key_type
read_write_property_map_tag category
vtkGraphIndexMap const_type
boost::graph_traits< vtkGraph * >::edges_size_type num_edges(vtkGraph *g)
vtkIdType vertices_size_type
boost::graph_traits< vtkMutableDirectedGraph * >::vertex_descriptor add_vertex(vtkMutableDirectedGraph *g)
vtkEdgeType edge_descriptor
A atomic type representing the union of many types.
boost::graph_traits< vtkDirectedGraph * >::degree_size_type in_degree(boost::graph_traits< vtkDirectedGraph * >::vertex_descriptor u, vtkDirectedGraph *g)
dynamic, self-adjusting array of double
void remove_edge(graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *g)
Base class for graph data types.
readable_property_map_tag category
dynamic, self-adjusting array of int
static vtkInformationIntegerKey * DATA_PIECE_NUMBER()
adjacency_iterator_generator< vtkGraph *, vertex_descriptor, out_edge_iterator >::type adjacency_iterator
vtkEdgeType AddEdge(vtkIdType u, vtkIdType v)
virtual vtkIdType GetDegree(vtkIdType v)
undirected_tag directed_category
static vertex_descriptor null_vertex()
vtkIdType vertex_descriptor
allow_parallel_edge_tag edge_parallel_category
static edge_descriptor null_edge()
property_traits< PMap >::category category
friend class iterator_core_access
friend class iterator_core_access
abstract superclass for arrays of numeric data
std::pair< boost::graph_traits< vtkGraph * >::vertex_iterator, boost::graph_traits< vtkGraph * >::vertex_iterator > vertices(vtkGraph *g)
void put(vtkDataArray *arr, vtkIdType key, const double &value)
An editable directed graph.
bool has_no_edges(vtkGraph *g)
An editable undirected graph.
virtual vtkIdType GetInDegree(vtkIdType v)
vtkGraphIndexMap const_type
property_traits< PMap >::value_type value_type
boost::graph_traits< vtkGraph * >::vertices_size_type num_vertices(vtkGraph *g)
static vtkMutableDirectedGraph * SafeDownCast(vtkObjectBase *o)
vtkDistributedGraphHelper * GetDistributedGraphHelper()
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
double GetTuple1(vtkIdType i)
vtk_in_edge_pointer_iterator(vtkGraph *g=0, vtkIdType v=0, bool end=false)
vtk_vertex_iterator(vtkIdType i=0)
vtk_edge_iterator(vtkGraph *g=0, vtkIdType v=0)
readable_property_map_tag category
vtk_vertex_iterator vertex_iterator
boost::graph_traits< vtkGraph * >::degree_size_type degree(boost::graph_traits< vtkGraph * >::vertex_descriptor u, vtkGraph *g)
A rooted tree data structure.
friend class iterator_core_access
virtual void GetOutEdges(vtkIdType v, vtkOutEdgeIterator *it)
std::pair< boost::graph_traits< vtkGraph * >::adjacency_iterator, boost::graph_traits< vtkGraph * >::adjacency_iterator > adjacent_vertices(boost::graph_traits< vtkGraph * >::vertex_descriptor u, vtkGraph *g)
property_traits< PMap >::value_type value_type
std::pair< boost::graph_traits< vtkMutableDirectedGraph * >::edge_descriptor, bool > add_edge(boost::graph_traits< vtkMutableDirectedGraph * >::vertex_descriptor u, boost::graph_traits< vtkMutableDirectedGraph * >::vertex_descriptor v, vtkMutableDirectedGraph *g)
std::pair< boost::graph_traits< vtkGraph * >::out_edge_iterator, boost::graph_traits< vtkGraph * >::out_edge_iterator > out_edges(boost::graph_traits< vtkGraph * >::vertex_descriptor u, vtkGraph *g)
void RemoveEdge(vtkIdType e)
boost::graph_traits< vtkGraph * >::degree_size_type out_degree(boost::graph_traits< vtkGraph * >::vertex_descriptor u, vtkGraph *g)
void RemoveEdge(vtkIdType e)
vtkIdType MakeDistributedId(int owner, vtkIdType local)
static vtkMutableUndirectedGraph * SafeDownCast(vtkObjectBase *o)
std::pair< boost::graph_traits< vtkGraph * >::edge_iterator, boost::graph_traits< vtkGraph * >::edge_iterator > edges(vtkGraph *g)
std::pair< boost::graph_traits< vtkGraph * >::in_edge_iterator, boost::graph_traits< vtkGraph * >::in_edge_iterator > in_edges(boost::graph_traits< vtkGraph * >::vertex_descriptor u, vtkGraph *g)
virtual vtkIdType GetOutDegree(vtkIdType v)
vtkGraphIndexMap get(edge_index_t, vtkGraph *)