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) 143 #include <vtksys/stl/utility> 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,
171 {
return index == other.index; }
173 void increment() {
index++; }
174 void decrement() {
index--; }
178 friend class iterator_core_access;
182 public iterator_facade<vtk_edge_iterator,
184 forward_traversal_tag,
190 directed(false), vertex(v), lastVertex(v), iter(0), end(0), graph(g)
194 lastVertex = graph->GetNumberOfVertices();
199 = this->graph? this->graph->GetDistributedGraphHelper() : 0;
210 while (vertex < lastVertex && this->graph->GetOutDegree(vertex) == 0)
215 if (vertex < lastVertex)
220 graph->GetOutEdges(vertex, iter, nedges);
232 && vertex > iter->Target)))
247 {
return vtkEdgeType(vertex, iter->Target, iter->Id); }
250 {
return vertex == other.vertex && iter == other.iter; }
259 = this->graph? this->graph->GetDistributedGraphHelper() : 0;
272 && vertex > iter->Target)))
286 while (vertex < lastVertex && this->graph->GetOutDegree(vertex) == 0)
291 if (vertex < lastVertex)
294 graph->GetOutEdges(vertex, iter, nedges);
311 friend class iterator_core_access;
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--; }
348 friend class iterator_core_access;
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--; }
385 friend class iterator_core_access;
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 494 struct graph_property_type< vtkDirectedGraph* >
495 : graph_property_type< vtkGraph* > { };
499 struct graph_property_type< vtkDirectedGraph*
const >
500 : graph_property_type< vtkGraph* > { };
505 struct vertex_property_type< vtkDirectedGraph* >
510 struct vertex_property_type< vtkDirectedGraph*
const >
515 struct edge_property_type< vtkDirectedGraph* >
520 struct edge_property_type< vtkDirectedGraph*
const >
523 #if BOOST_VERSION >= 104500 526 struct graph_bundle_type< vtkDirectedGraph* >
527 : graph_bundle_type< vtkGraph* > { };
531 struct graph_bundle_type< vtkDirectedGraph*
const >
532 : graph_bundle_type< vtkGraph* > { };
537 struct vertex_bundle_type< vtkDirectedGraph* >
542 struct vertex_bundle_type< vtkDirectedGraph*
const >
547 struct edge_bundle_type< vtkDirectedGraph* >
552 struct edge_bundle_type< vtkDirectedGraph*
const >
585 #if BOOST_VERSION >= 104500 588 struct graph_property_type< vtkUndirectedGraph* >
589 : graph_property_type< vtkGraph* > { };
593 struct graph_property_type< vtkUndirectedGraph*
const >
594 : graph_property_type< vtkGraph* > { };
599 struct vertex_property_type< vtkUndirectedGraph* >
604 struct vertex_property_type< vtkUndirectedGraph*
const >
609 struct edge_property_type< vtkUndirectedGraph* >
614 struct edge_property_type< vtkUndirectedGraph*
const >
617 #if BOOST_VERSION >= 104500 620 struct graph_bundle_type< vtkUndirectedGraph* >
621 : graph_bundle_type< vtkGraph* > { };
625 struct graph_bundle_type< vtkUndirectedGraph*
const >
626 : graph_bundle_type< vtkGraph* > { };
631 struct vertex_bundle_type< vtkUndirectedGraph* >
636 struct vertex_bundle_type< vtkUndirectedGraph*
const >
641 struct edge_bundle_type< vtkUndirectedGraph* >
646 struct edge_bundle_type< vtkUndirectedGraph*
const >
663 #if BOOST_VERSION >= 104500 666 struct graph_property_type< vtkMutableDirectedGraph* >
667 : graph_property_type< vtkDirectedGraph* > { };
671 struct graph_property_type< vtkMutableDirectedGraph*
const >
672 : graph_property_type< vtkDirectedGraph* > { };
677 struct vertex_property_type< vtkMutableDirectedGraph* >
682 struct vertex_property_type< vtkMutableDirectedGraph*
const >
687 struct edge_property_type< vtkMutableDirectedGraph* >
692 struct edge_property_type< vtkMutableDirectedGraph*
const >
695 #if BOOST_VERSION >= 104500 698 struct graph_bundle_type< vtkMutableDirectedGraph* >
699 : graph_bundle_type< vtkDirectedGraph* > { };
703 struct graph_bundle_type< vtkMutableDirectedGraph*
const >
704 : graph_bundle_type< vtkDirectedGraph* > { };
709 struct vertex_bundle_type< vtkMutableDirectedGraph* >
714 struct vertex_bundle_type< vtkMutableDirectedGraph*
const >
719 struct edge_bundle_type< vtkMutableDirectedGraph* >
724 struct edge_bundle_type< vtkMutableDirectedGraph*
const >
741 #if BOOST_VERSION >= 104500 744 struct graph_property_type< vtkMutableUndirectedGraph* >
745 : graph_property_type< vtkUndirectedGraph* > { };
749 struct graph_property_type< vtkMutableUndirectedGraph*
const >
750 : graph_property_type< vtkUndirectedGraph* > { };
755 struct vertex_property_type< vtkMutableUndirectedGraph* >
760 struct vertex_property_type< vtkMutableUndirectedGraph*
const >
765 struct edge_property_type< vtkMutableUndirectedGraph* >
770 struct edge_property_type< vtkMutableUndirectedGraph*
const >
773 #if BOOST_VERSION >= 104500 776 struct graph_bundle_type< vtkMutableUndirectedGraph* >
777 : graph_bundle_type< vtkUndirectedGraph* > { };
781 struct graph_bundle_type< vtkMutableUndirectedGraph*
const >
782 : graph_bundle_type< vtkUndirectedGraph* > { };
787 struct vertex_bundle_type< vtkMutableUndirectedGraph* >
792 struct vertex_bundle_type< vtkMutableUndirectedGraph*
const >
797 struct edge_bundle_type< vtkMutableUndirectedGraph* >
802 struct edge_bundle_type< vtkMutableUndirectedGraph*
const >
834 inline vtksys_stl::pair<
845 start = helper->MakeDistributedId(rank, start);
848 return vtksys_stl::make_pair( Iter(start),
852 inline vtksys_stl::pair<
861 inline vtksys_stl::pair<
869 vtksys_stl::pair<Iter, Iter> p = vtksys_stl::make_pair( Iter(g, u), Iter(g, u,
true) );
873 inline vtksys_stl::pair<
881 vtksys_stl::pair<Iter, Iter> p = vtksys_stl::make_pair( Iter(g, u), Iter(g, u,
true) );
885 inline vtksys_stl::pair<
894 vtksys_stl::pair<OutEdgeIter, OutEdgeIter> out =
out_edges(u, g);
895 return vtksys_stl::make_pair( Iter(out.first, &g), Iter(out.second, &g) );
940 inline vtksys_stl::pair<
949 return vtksys_stl::make_pair(e,
true);
958 inline vtksys_stl::pair<
967 return vtksys_stl::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)
vtksys_stl::pair< boost::graph_traits< vtkGraph * >::vertex_iterator, boost::graph_traits< vtkGraph * >::vertex_iterator > vertices(vtkGraph *g)
vtk_out_edge_pointer_iterator out_edge_iterator
vtksys_stl::pair< boost::graph_traits< vtkGraph * >::edge_iterator, boost::graph_traits< vtkGraph * >::edge_iterator > edges(vtkGraph *g)
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)
void SetTuple1(vtkIdType i, double value)
vtkIdType GetEdgeOwner(vtkIdType e_id) const
vtkGraph_traversal_category traversal_category
directed_tag directed_category
vtksys_stl::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)
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
vtksys_stl::pair< boost::graph_traits< vtkGraph * >::adjacency_iterator, boost::graph_traits< vtkGraph * >::adjacency_iterator > adjacent_vertices(boost::graph_traits< vtkGraph * >::vertex_descriptor u, vtkGraph *g)
dynamic, self-adjusting array of vtkIdType
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
vtksys_stl::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)
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
abstract superclass for arrays of numeric data
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
virtual void InsertVariantValue(vtkIdType idx, vtkVariant value)
boost::graph_traits< vtkGraph * >::degree_size_type degree(boost::graph_traits< vtkGraph * >::vertex_descriptor u, vtkGraph *g)
vtksys_stl::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)
A rooted tree data structure.
property_traits< PMap >::value_type value_type
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)
virtual vtkIdType GetOutDegree(vtkIdType v)
vtkGraphIndexMap get(edge_index_t, vtkGraph *)