mirror of https://github.com/CGAL/cgal
BGL: Add adjacency_iterator for several classes
This commit is contained in:
parent
8a88edc676
commit
abb54bf0b8
|
|
@ -21,6 +21,7 @@ typedef LCC::Traits::Point Point_3;
|
||||||
template<typename Graph>
|
template<typename Graph>
|
||||||
void concept_check_polyhedron() {
|
void concept_check_polyhedron() {
|
||||||
boost::function_requires< boost::GraphConcept<LCC> >();
|
boost::function_requires< boost::GraphConcept<LCC> >();
|
||||||
|
boost::function_requires< boost::AdjacencyGraphConcept<LCC> >();
|
||||||
boost::function_requires< boost::VertexListGraphConcept<LCC> >();
|
boost::function_requires< boost::VertexListGraphConcept<LCC> >();
|
||||||
boost::function_requires< boost::EdgeListGraphConcept<LCC> >();
|
boost::function_requires< boost::EdgeListGraphConcept<LCC> >();
|
||||||
boost::function_requires< boost::IncidenceGraphConcept<LCC> >();
|
boost::function_requires< boost::IncidenceGraphConcept<LCC> >();
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ typedef Kernel::Point_3 Point_3;
|
||||||
template<typename Graph>
|
template<typename Graph>
|
||||||
void concept_check_polyhedron() {
|
void concept_check_polyhedron() {
|
||||||
boost::function_requires< boost::GraphConcept<Polyhedron> >();
|
boost::function_requires< boost::GraphConcept<Polyhedron> >();
|
||||||
|
boost::function_requires< boost::AdjacencyGraphConcept<Polyhedron> >();
|
||||||
boost::function_requires< boost::VertexListGraphConcept<Polyhedron> >();
|
boost::function_requires< boost::VertexListGraphConcept<Polyhedron> >();
|
||||||
boost::function_requires< boost::EdgeListGraphConcept<Polyhedron> >();
|
boost::function_requires< boost::EdgeListGraphConcept<Polyhedron> >();
|
||||||
boost::function_requires< boost::IncidenceGraphConcept<Polyhedron> >();
|
boost::function_requires< boost::IncidenceGraphConcept<Polyhedron> >();
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ typedef Traits::face_descriptor face_descriptor;
|
||||||
void concept_check_surface_mesh()
|
void concept_check_surface_mesh()
|
||||||
{
|
{
|
||||||
boost::function_requires< boost::GraphConcept<Surface_mesh> >();
|
boost::function_requires< boost::GraphConcept<Surface_mesh> >();
|
||||||
|
boost::function_requires< boost::AdjacencyGraphConcept<Surface_mesh> >();
|
||||||
boost::function_requires< boost::VertexListGraphConcept<Surface_mesh> >();
|
boost::function_requires< boost::VertexListGraphConcept<Surface_mesh> >();
|
||||||
boost::function_requires< boost::EdgeListGraphConcept<Surface_mesh> >();
|
boost::function_requires< boost::EdgeListGraphConcept<Surface_mesh> >();
|
||||||
boost::function_requires< boost::IncidenceGraphConcept<Surface_mesh> >();
|
boost::function_requires< boost::IncidenceGraphConcept<Surface_mesh> >();
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
#include <boost/iterator/iterator_adaptor.hpp>
|
#include <boost/iterator/iterator_adaptor.hpp>
|
||||||
#include <CGAL/boost/iterator/transform_iterator.hpp>
|
#include <CGAL/boost/iterator/transform_iterator.hpp>
|
||||||
|
#include <boost/graph/adjacency_iterator.hpp>
|
||||||
#include <boost/type_traits/remove_const.hpp>
|
#include <boost/type_traits/remove_const.hpp>
|
||||||
|
|
||||||
#include <boost/graph/graph_traits.hpp>
|
#include <boost/graph/graph_traits.hpp>
|
||||||
|
|
@ -155,7 +156,8 @@ struct HDS_graph_traits
|
||||||
private:
|
private:
|
||||||
struct HDS_graph_traversal_category : public virtual boost::bidirectional_graph_tag,
|
struct HDS_graph_traversal_category : public virtual boost::bidirectional_graph_tag,
|
||||||
public virtual boost::vertex_list_graph_tag,
|
public virtual boost::vertex_list_graph_tag,
|
||||||
public virtual boost::edge_list_graph_tag
|
public virtual boost::edge_list_graph_tag,
|
||||||
|
public virtual boost::adjacency_graph_tag
|
||||||
{};
|
{};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
@ -179,6 +181,8 @@ public:
|
||||||
|
|
||||||
typedef In_edge_iterator<HDS> in_edge_iterator;
|
typedef In_edge_iterator<HDS> in_edge_iterator;
|
||||||
|
|
||||||
|
typedef typename boost::adjacency_iterator_generator<HDS, vertex_descriptor, out_edge_iterator>::type adjacency_iterator;
|
||||||
|
|
||||||
typedef boost::undirected_tag directed_category;
|
typedef boost::undirected_tag directed_category;
|
||||||
typedef boost::disallow_parallel_edge_tag edge_parallel_category;
|
typedef boost::disallow_parallel_edge_tag edge_parallel_category;
|
||||||
typedef HDS_graph_traversal_category traversal_category;
|
typedef HDS_graph_traversal_category traversal_category;
|
||||||
|
|
|
||||||
|
|
@ -172,6 +172,16 @@ out_edges( typename boost::graph_traits< HalfedgeDS_default<T,I,A> const>::verte
|
||||||
return make_range(Iter(halfedge(u,p),p), Iter(halfedge(u,p),p,1));
|
return make_range(Iter(halfedge(u,p),p), Iter(halfedge(u,p),p,1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class T, class I, class A>
|
||||||
|
inline Iterator_range<typename boost::graph_traits< HalfedgeDS_default<T,I,A> const>::adjacency_iterator>
|
||||||
|
adjacent_vertices( typename boost::graph_traits< HalfedgeDS_default<T,I,A> const>::vertex_descriptor u
|
||||||
|
, const HalfedgeDS_default<T,I,A>& p)
|
||||||
|
{
|
||||||
|
typedef typename boost::graph_traits< HalfedgeDS_default<T,I,A> const>::out_edge_iterator OutEdgeIter;
|
||||||
|
typedef typename boost::graph_traits< HalfedgeDS_default<T,I,A> const>::adjacency_iterator Iter;
|
||||||
|
return make_range(Iter(OutEdgeIter(halfedge(u,p),p),&p), Iter(OutEdgeIter(halfedge(u,p),p,1), &p));
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// MutableHalfedgeGraph
|
// MutableHalfedgeGraph
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
#include <boost/graph/graph_traits.hpp>
|
#include <boost/graph/graph_traits.hpp>
|
||||||
#include <boost/graph/properties.hpp>
|
#include <boost/graph/properties.hpp>
|
||||||
|
#include <boost/graph/adjacency_iterator.hpp>
|
||||||
#include <CGAL/boost/graph/iterator.h>
|
#include <CGAL/boost/graph/iterator.h>
|
||||||
#include <CGAL/boost/graph/properties_Linear_cell_complex_for_combinatorial_map.h>
|
#include <CGAL/boost/graph/properties_Linear_cell_complex_for_combinatorial_map.h>
|
||||||
#include <CGAL/boost/graph/graph_traits_HalfedgeDS.h>
|
#include <CGAL/boost/graph/graph_traits_HalfedgeDS.h>
|
||||||
|
|
@ -178,7 +179,8 @@ struct CMap_Base_graph_traits
|
||||||
public :
|
public :
|
||||||
struct CMap_graph_traversal_category : public virtual boost::bidirectional_graph_tag,
|
struct CMap_graph_traversal_category : public virtual boost::bidirectional_graph_tag,
|
||||||
public virtual boost::vertex_list_graph_tag,
|
public virtual boost::vertex_list_graph_tag,
|
||||||
public virtual boost::edge_list_graph_tag
|
public virtual boost::edge_list_graph_tag,
|
||||||
|
public virtual boost::adjacency_graph_tag
|
||||||
{};
|
{};
|
||||||
|
|
||||||
// Expose types required by the boost::Graph concept.
|
// Expose types required by the boost::Graph concept.
|
||||||
|
|
@ -206,6 +208,8 @@ public :
|
||||||
typedef CGAL::In_edge_iterator<CMap> in_edge_iterator;
|
typedef CGAL::In_edge_iterator<CMap> in_edge_iterator;
|
||||||
typedef CGAL::Out_edge_iterator<CMap> out_edge_iterator;
|
typedef CGAL::Out_edge_iterator<CMap> out_edge_iterator;
|
||||||
|
|
||||||
|
typedef typename boost::adjacency_iterator_generator<CMap, vertex_descriptor, out_edge_iterator>::type adjacency_iterator;
|
||||||
|
|
||||||
// nulls
|
// nulls
|
||||||
static vertex_descriptor null_vertex() { return nullptr; }
|
static vertex_descriptor null_vertex() { return nullptr; }
|
||||||
static face_descriptor null_face() { return nullptr; }
|
static face_descriptor null_face() { return nullptr; }
|
||||||
|
|
@ -391,6 +395,16 @@ out_edges(typename boost::graph_traits<CGAL_LCC_TYPE>::vertex_descriptor v,
|
||||||
return make_range(Iter(halfedge(v, lcc), lcc), Iter(halfedge(v, lcc), lcc, 1));
|
return make_range(Iter(halfedge(v, lcc), lcc), Iter(halfedge(v, lcc), lcc, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CGAL_LCC_TEMPLATE_ARGS
|
||||||
|
CGAL::Iterator_range<typename boost::graph_traits<CGAL_LCC_TYPE>::adjacency_iterator>
|
||||||
|
adjacent_vertices(typename boost::graph_traits<CGAL_LCC_TYPE>::vertex_descriptor v,
|
||||||
|
const CGAL_LCC_TYPE& lcc)
|
||||||
|
{
|
||||||
|
typedef typename boost::graph_traits<CGAL_LCC_TYPE>::out_edge_iterator OutEdgeIter;
|
||||||
|
typedef typename boost::graph_traits<CGAL_LCC_TYPE>::adjacency_iterator Iter;
|
||||||
|
return make_range(Iter(OutEdgeIter(halfedge(v, lcc), lcc), &lcc), Iter(OutEdgeIter(halfedge(v, lcc), lcc, 1), &lcc));
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// 2) HalfedgeGraph
|
// 2) HalfedgeGraph
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@
|
||||||
#include <CGAL/Surface_mesh.h>
|
#include <CGAL/Surface_mesh.h>
|
||||||
#include <CGAL/assertions.h>
|
#include <CGAL/assertions.h>
|
||||||
|
|
||||||
|
#include <boost/graph/adjacency_iterator.hpp>
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
|
|
||||||
|
|
@ -41,7 +42,8 @@ private:
|
||||||
|
|
||||||
struct SM_graph_traversal_category : public virtual boost::bidirectional_graph_tag,
|
struct SM_graph_traversal_category : public virtual boost::bidirectional_graph_tag,
|
||||||
public virtual boost::vertex_list_graph_tag,
|
public virtual boost::vertex_list_graph_tag,
|
||||||
public virtual boost::edge_list_graph_tag
|
public virtual boost::edge_list_graph_tag,
|
||||||
|
public virtual boost::adjacency_graph_tag
|
||||||
{};
|
{};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
@ -77,10 +79,14 @@ public:
|
||||||
typedef typename SM::size_type degree_size_type;
|
typedef typename SM::size_type degree_size_type;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef CGAL::In_edge_iterator<SM> in_edge_iterator;
|
typedef CGAL::In_edge_iterator<SM> in_edge_iterator;
|
||||||
|
|
||||||
typedef CGAL::Out_edge_iterator<SM> out_edge_iterator;
|
typedef CGAL::Out_edge_iterator<SM> out_edge_iterator;
|
||||||
|
|
||||||
|
typedef typename boost::adjacency_iterator_generator<SM, vertex_descriptor, out_edge_iterator>::type adjacency_iterator;
|
||||||
|
|
||||||
// nulls
|
// nulls
|
||||||
static vertex_descriptor null_vertex() { return vertex_descriptor(); }
|
static vertex_descriptor null_vertex() { return vertex_descriptor(); }
|
||||||
static face_descriptor null_face() { return face_descriptor(); }
|
static face_descriptor null_face() { return face_descriptor(); }
|
||||||
|
|
@ -217,6 +223,16 @@ out_edges(typename boost::graph_traits<CGAL::Surface_mesh<P> >::vertex_descripto
|
||||||
return make_range(Iter(halfedge(v,sm),sm), Iter(halfedge(v,sm),sm,1));
|
return make_range(Iter(halfedge(v,sm),sm), Iter(halfedge(v,sm),sm,1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename P>
|
||||||
|
Iterator_range<typename boost::graph_traits<CGAL::Surface_mesh<P> >::adjacency_iterator>
|
||||||
|
adjacent_vertices(typename boost::graph_traits<CGAL::Surface_mesh<P> >::vertex_descriptor v,
|
||||||
|
const CGAL::Surface_mesh<P>& sm)
|
||||||
|
{
|
||||||
|
typedef typename boost::graph_traits<CGAL::Surface_mesh<P> >::out_edge_iterator OutEdgeIter;
|
||||||
|
typedef typename boost::graph_traits<CGAL::Surface_mesh<P> >::adjacency_iterator Iter;
|
||||||
|
return make_range(Iter(OutEdgeIter(halfedge(v,sm),sm), &sm),
|
||||||
|
Iter(OutEdgeIter(halfedge(v,sm),sm,1), &sm));
|
||||||
|
}
|
||||||
|
|
||||||
template<typename P>
|
template<typename P>
|
||||||
std::pair<typename boost::graph_traits<CGAL::Surface_mesh<P> >::edge_descriptor,
|
std::pair<typename boost::graph_traits<CGAL::Surface_mesh<P> >::edge_descriptor,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue