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); \
105 return arr->GetTuple1(
key);
127 return arr->GetVariantValue(
key);
137 #include <vtksys/stl/utility>
139 #include <boost/config.hpp>
140 #include <boost/iterator/iterator_facade.hpp>
141 #include <boost/graph/graph_traits.hpp>
142 #include <boost/graph/properties.hpp>
143 #include <boost/graph/adjacency_iterator.hpp>
152 public iterator_facade<vtk_vertex_iterator,
154 bidirectional_traversal_tag,
162 vtkIdType dereference()
const {
return index; }
165 {
return index == other.index; }
167 void increment() { index++; }
168 void decrement() { index--; }
176 public iterator_facade<vtk_edge_iterator,
178 forward_traversal_tag,
184 directed(false), vertex(v), lastVertex(v), iter(0), end(0), graph(g)
204 while (vertex < lastVertex && this->graph->
GetOutDegree(vertex) == 0)
209 if (vertex < lastVertex)
226 && vertex > iter->
Target)))
244 {
return vertex == other.vertex && iter == other.iter; }
266 && vertex > iter->
Target)))
280 while (vertex < lastVertex && this->graph->
GetOutDegree(vertex) == 0)
285 if (vertex < lastVertex)
309 public iterator_facade<vtk_out_edge_pointer_iterator,
311 bidirectional_traversal_tag,
322 g->GetOutEdges(vertex, iter, nedges);
334 {
return iter == other.iter; }
336 void increment() { iter++; }
337 void decrement() { iter--; }
346 public iterator_facade<vtk_in_edge_pointer_iterator,
348 bidirectional_traversal_tag,
359 g->GetInEdges(vertex, iter, nedges);
371 {
return iter == other.iter; }
373 void increment() { iter++; }
374 void decrement() { iter--; }
389 public virtual bidirectional_graph_tag,
390 public virtual edge_list_graph_tag,
391 public virtual vertex_list_graph_tag,
392 public virtual adjacency_graph_tag { };
412 typedef adjacency_iterator_generator<
vtkGraph*,
416 #if BOOST_VERSION >= 104500
418 struct graph_property_type<
vtkGraph* > {
419 typedef no_property
type;
433 #if BOOST_VERSION >= 104500
435 struct graph_bundle_type<
vtkGraph* > {
436 typedef no_property
type;
485 #if BOOST_VERSION >= 104500
489 : graph_property_type< vtkGraph* > { };
494 : graph_property_type< vtkGraph* > { };
517 #if BOOST_VERSION >= 104500
521 : graph_bundle_type< vtkGraph* > { };
526 : graph_bundle_type< vtkGraph* > { };
579 #if BOOST_VERSION >= 104500
583 : graph_property_type< vtkGraph* > { };
588 : graph_property_type< vtkGraph* > { };
611 #if BOOST_VERSION >= 104500
615 : graph_bundle_type< vtkGraph* > { };
620 : graph_bundle_type< vtkGraph* > { };
657 #if BOOST_VERSION >= 104500
661 : graph_property_type< vtkDirectedGraph* > { };
666 : graph_property_type< vtkDirectedGraph* > { };
689 #if BOOST_VERSION >= 104500
693 : graph_bundle_type< vtkDirectedGraph* > { };
698 : graph_bundle_type< vtkDirectedGraph* > { };
735 #if BOOST_VERSION >= 104500
739 : graph_property_type< vtkUndirectedGraph* > { };
744 : graph_property_type< vtkUndirectedGraph* > { };
767 #if BOOST_VERSION >= 104500
771 : graph_bundle_type< vtkUndirectedGraph* > { };
776 : graph_bundle_type< vtkUndirectedGraph* > { };
828 inline vtksys_stl::pair<
830 boost::graph_traits< vtkGraph* >::vertex_iterator >
833 typedef boost::graph_traits< vtkGraph* >::vertex_iterator Iter;
842 return vtksys_stl::make_pair( Iter(start),
846 inline vtksys_stl::pair<
848 boost::graph_traits< vtkGraph* >::edge_iterator >
851 typedef boost::graph_traits< vtkGraph* >::edge_iterator Iter;
855 inline vtksys_stl::pair<
857 boost::graph_traits< vtkGraph* >::out_edge_iterator >
862 typedef boost::graph_traits< vtkGraph* >::out_edge_iterator Iter;
863 vtksys_stl::pair<Iter, Iter> p = vtksys_stl::make_pair( Iter(g, u), Iter(g, u,
true) );
867 inline vtksys_stl::pair<
869 boost::graph_traits< vtkGraph* >::in_edge_iterator >
874 typedef boost::graph_traits< vtkGraph* >::in_edge_iterator Iter;
875 vtksys_stl::pair<Iter, Iter> p = vtksys_stl::make_pair( Iter(g, u), Iter(g, u,
true) );
879 inline vtksys_stl::pair<
881 boost::graph_traits< vtkGraph* >::adjacency_iterator >
886 typedef boost::graph_traits< vtkGraph* >::adjacency_iterator Iter;
887 typedef boost::graph_traits< vtkGraph* >::out_edge_iterator OutEdgeIter;
888 vtksys_stl::pair<OutEdgeIter, OutEdgeIter> out =
out_edges(u, g);
889 return vtksys_stl::make_pair( Iter(out.first, &g), Iter(out.second, &g) );
934 inline vtksys_stl::pair<
942 boost::graph_traits< vtkMutableDirectedGraph* >::edge_descriptor e = g->
AddEdge(u, v);
943 return vtksys_stl::make_pair(e,
true);
952 inline vtksys_stl::pair<
960 boost::graph_traits< vtkMutableUndirectedGraph* >::edge_descriptor e = g->
AddEdge(u, v);
961 return vtksys_stl::make_pair(e,
true);
992 template<
typename PMap>
1004 template<
typename PMap>
1010 return get(helper.pmap,
key.Id);
1013 template<
typename PMap>
1049 template<
typename PMap>
1062 template<
typename PMap>
1068 return multi.multiplier *
get(multi.pmap,
key);
1071 template<
typename PMap>
1135 #if BOOST_VERSION > 104000
1136 #include <boost/property_map/vector_property_map.hpp>
1138 #include <boost/vector_property_map.hpp>
1142 #endif // __vtkBoostGraphAdapter_h