Add concept checking for Seam_mesh

This commit is contained in:
Andreas Fabri 2017-05-11 14:50:17 +02:00 committed by Mael Rouxel-Labbé
parent 531496b72f
commit ff14334f7d
4 changed files with 78 additions and 11 deletions

View File

@ -444,6 +444,7 @@ public:
{
public:
halfedge_descriptor hd;
const Self* mesh_;
#ifdef CGAL_SEAM_MESH_INSERT_OPERATOR
friend
@ -453,9 +454,24 @@ public:
return os;
}
#endif
edge_descriptor(const halfedge_descriptor& hd)
: hd(hd)
{ }
edge_descriptor()
: mesh_(NULL)
{}
edge_descriptor(const halfedge_descriptor& hd, const Self* m)
: hd(hd), mesh_(m)
{}
friend bool operator==(edge_descriptor e1, edge_descriptor e2)
{
return (e1.hd == e2.hd) || (e1.hd == e2.mesh_->opposite(e2.hd));
}
friend bool operator!=(edge_descriptor e1, edge_descriptor e2)
{
return ! (e1 == e2);
}
};
#ifndef DOXYGEN_RUNNING
@ -534,9 +550,9 @@ public:
// on the opposite virtual border
if(seam)
return edge_descriptor(mesh_->opposite(halfedge_descriptor(*hd, true)));
return edge_descriptor(mesh_->opposite(halfedge_descriptor(*hd, true)), mesh_);
else
return edge_descriptor(halfedge_descriptor(*hd, false));
return edge_descriptor(halfedge_descriptor(*hd, false), mesh_);
}
};
#endif
@ -758,7 +774,7 @@ public:
/// Returns the edge that contains halfedge `h` as one of its two halfedges.
edge_descriptor edge(halfedge_descriptor h) const
{
return h;
return edge_descriptor(h,this);
}
/// Returns the halfedge corresponding to the edge `e`.
@ -827,7 +843,7 @@ public:
std::pair<edge_descriptor, bool> edge(vertex_descriptor u, vertex_descriptor v) const
{
std::pair<halfedge_descriptor, bool> he = halfedge(u, v);
return std::make_pair(he.first, he.second);
return std::make_pair(edge_descriptor(he.first, this), he.second);
}
/// Returns a halfedge of face `f`.

View File

@ -107,8 +107,8 @@ public:
typedef typename SM::face_iterator face_iterator;
typedef typename SM::faces_size_type faces_size_type;
//typedef CGAL::In_edge_iterator<SM> in_edge_iterator;
//typedef CGAL::Out_edge_iterator<SM> out_edge_iterator;
typedef CGAL::In_edge_iterator<SM> in_edge_iterator;
typedef CGAL::Out_edge_iterator<SM> out_edge_iterator;
// nulls
static vertex_descriptor null_vertex() { return vertex_descriptor(); }
@ -209,7 +209,7 @@ edges(const CGAL::Seam_mesh<TM, SEM, SVM>& sm)
return sm.edges();
}
#if 0
#if 1
template <class TM, class SEM, class SVM>
Iterator_range<typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::in_edge_iterator>
in_edges(typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::vertex_descriptor v,
@ -279,7 +279,7 @@ typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::halfedge_descripto
halfedge(typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::edge_descriptor e,
const CGAL::Seam_mesh<TM, SEM, SVM>& sm)
{
return sm.edge(e);
return sm.halfedge(e);
}
template <class TM, class SEM, class SVM>

View File

@ -73,6 +73,8 @@ create_single_source_cgal_program( "graph_concept_Triangulation_2.cpp" )
create_single_source_cgal_program( "graph_concept_Surface_mesh.cpp" )
create_single_source_cgal_program( "graph_concept_Seam_mesh_Surface_mesh.cpp" )
create_single_source_cgal_program( "graph_concept_Gwdwg_Surface_mesh.cpp" )
create_single_source_cgal_program( "test_clear.cpp" )

View File

@ -0,0 +1,49 @@
#include <CGAL/boost/graph/graph_traits_Surface_mesh.h>
#include <CGAL/boost/graph/properties_Surface_mesh.h>
#include <CGAL/boost/graph/Seam_mesh.h>
#include <CGAL/Simple_cartesian.h>
#include <boost/graph/graph_concepts.hpp>
#include <CGAL/boost/graph/graph_concepts.h>
typedef CGAL::Simple_cartesian<double> K;
typedef CGAL::Surface_mesh<K::Point_3> Mesh;
typedef boost::graph_traits<Mesh>::vertex_descriptor SM_vertex_descriptor;
typedef boost::graph_traits<Mesh>::halfedge_descriptor SM_halfedge_descriptor;
typedef boost::graph_traits<Mesh>::edge_descriptor SM_edge_descriptor;
typedef boost::graph_traits<Mesh>::face_descriptor SM_face_descriptor;
typedef Mesh::Property_map<SM_edge_descriptor, bool> Seam_edge_pmap;
typedef Mesh::Property_map<SM_vertex_descriptor, bool> Seam_vertex_pmap;
typedef CGAL::Seam_mesh<Mesh, Seam_edge_pmap, Seam_vertex_pmap> Seam_mesh;
typedef boost::graph_traits< Seam_mesh > Traits;
typedef Traits::edge_descriptor edge_descriptor;
typedef Traits::halfedge_descriptor halfedge_descriptor;
typedef Traits::vertex_descriptor vertex_descriptor;
typedef Traits::face_descriptor face_descriptor;
void concept_check_surface_mesh()
{
boost::function_requires< boost::GraphConcept<Seam_mesh> >();
boost::function_requires< boost::VertexListGraphConcept<Seam_mesh> >();
boost::function_requires< boost::EdgeListGraphConcept<Seam_mesh> >();
boost::function_requires< boost::IncidenceGraphConcept<Seam_mesh> >();
boost::function_requires< boost::AdjacencyMatrixConcept<Seam_mesh> >();
boost::function_requires< boost::BidirectionalGraphConcept<Seam_mesh> >();
boost::function_requires< CGAL::HalfedgeGraphConcept<Seam_mesh> >();
boost::function_requires< CGAL::HalfedgeListGraphConcept<Seam_mesh> >();
boost::function_requires< CGAL::FaceGraphConcept<Seam_mesh> >();
boost::function_requires< CGAL::FaceListGraphConcept<Seam_mesh> >();
// null
boost::graph_traits<Seam_mesh>::null_vertex();
boost::graph_traits<Seam_mesh>::null_face();
}
int main()
{
concept_check_surface_mesh();
return 0;
}