Update BGL LCC examples and tests following the modification of the API (helper class)

This commit is contained in:
Guillaume Damiand 2017-05-10 13:27:37 -04:00
parent 8799b904b6
commit a22a5fbd21
16 changed files with 57 additions and 89 deletions

View File

@ -40,17 +40,8 @@ include_directories( BEFORE ../../include )
include( CGAL_CreateSingleSourceCGALProgram ) include( CGAL_CreateSingleSourceCGALProgram )
create_single_source_cgal_program( "distance_lcc.cpp" ) # create a target per cppfile
file(GLOB_RECURSE cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
create_single_source_cgal_program( "incident_vertices_lcc.cpp" ) foreach(cppfile ${cppfiles})
create_single_source_cgal_program("${cppfile}")
create_single_source_cgal_program( "kruskal_lcc.cpp" ) endforeach()
create_single_source_cgal_program( "normals_lcc.cpp" )
create_single_source_cgal_program( "range_lcc.cpp" )
create_single_source_cgal_program( "transform_iterator_lcc.cpp" )
create_single_source_cgal_program( "copy_lcc.cpp" )

View File

@ -5,14 +5,7 @@
#include <CGAL/IO/Polyhedron_iostream.h> #include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h> #include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
#include <CGAL/Surface_mesh.h> #include <CGAL/boost/graph/graph_traits_Linear_cell_complex_for_combinatorial_map.h>
#include <CGAL/boost/graph/graph_traits_Surface_mesh.h>
#if defined(CGAL_USE_OPENMESH)
#include <OpenMesh/Core/IO/MeshIO.hh>
#include <OpenMesh/Core/Mesh/PolyMesh_ArrayKernelT.hh>
#include <CGAL/boost/graph/graph_traits_PolyMesh_ArrayKernelT.h>
#endif
#include <CGAL/boost/graph/copy_face_graph.h> #include <CGAL/boost/graph/copy_face_graph.h>
@ -30,6 +23,9 @@ typedef boost::graph_traits<Source>::face_descriptor sm_face_descriptor;
typedef CGAL::Exact_predicates_exact_constructions_kernel Other_kernel; typedef CGAL::Exact_predicates_exact_constructions_kernel Other_kernel;
typedef Other_kernel::Point_3 Point; typedef Other_kernel::Point_3 Point;
typedef CGAL::Linear_cell_complex_traits<3, Other_kernel> LCC_traits;
typedef CGAL::Linear_cell_complex_for_bgl_combinatorial_map_helper
<2, 3, LCC_traits>::type LCC;
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
@ -40,33 +36,13 @@ int main(int argc, char* argv[])
// Note that the vertex_point property of the Source and Target1 // Note that the vertex_point property of the Source and Target1
// come from different kernels. // come from different kernels.
typedef CGAL::Surface_mesh<Point> Target1; typedef LCC Target1;
Target1 T1; Target1 T1;
{ {
CGAL::copy_face_graph(S, T1); CGAL::copy_face_graph(S, T1);
std::ofstream out("sm.off"); CGAL::write_off(T1, "lcc.off");
out << T1;
} }
#if defined(CGAL_USE_OPENMESH)
typedef OpenMesh::PolyMesh_ArrayKernelT</* MyTraits*/> Target2;
Target2 T2;
{
typedef boost::graph_traits<Target2>::vertex_descriptor tm_vertex_descriptor;
typedef boost::graph_traits<Target2>::halfedge_descriptor tm_halfedge_descriptor;
typedef boost::graph_traits<Target2>::face_descriptor tm_face_descriptor;
// Use an unordered_map to keep track of elements.
boost::unordered_map<sm_vertex_descriptor, tm_vertex_descriptor> v2v;
boost::unordered_map<sm_halfedge_descriptor, tm_halfedge_descriptor> h2h;
boost::unordered_map<sm_face_descriptor, tm_face_descriptor> f2f;
CGAL::copy_face_graph(S, T2, std::inserter(v2v, v2v.end()),
std::inserter(h2h, h2h.end()),
std::inserter(f2f, f2f.end()));
OpenMesh::IO::write_mesh(T2, "om.off");
}
#endif
S.clear(); S.clear();
{ {
typedef boost::graph_traits<Target1>::vertex_descriptor source_vertex_descriptor; typedef boost::graph_traits<Target1>::vertex_descriptor source_vertex_descriptor;
@ -80,7 +56,7 @@ int main(int argc, char* argv[])
CGAL::copy_face_graph(T1, S, std::inserter(v2v, v2v.end()), std::inserter(h2h, h2h.end())); CGAL::copy_face_graph(T1, S, std::inserter(v2v, v2v.end()), std::inserter(h2h, h2h.end()));
std::ofstream out("reverse.off"); std::ofstream out("reverse.off");
out << T1; out << S;
} }
return 0; return 0;
} }

View File

@ -1,5 +1,5 @@
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/boost/graph/graph_traits_Linear_cell_complex.h> #include <CGAL/boost/graph/graph_traits_Linear_cell_complex_for_combinatorial_map.h>
#include <boost/graph/breadth_first_search.hpp> #include <boost/graph/breadth_first_search.hpp>
@ -9,7 +9,8 @@ typedef CGAL::Simple_cartesian<double> Kernel;
typedef Kernel::Point_3 Point; typedef Kernel::Point_3 Point;
typedef CGAL::Linear_cell_complex_traits<3, Kernel> LCC_traits; typedef CGAL::Linear_cell_complex_traits<3, Kernel> LCC_traits;
typedef CGAL::Linear_cell_complex_for_bgl_combinatorial_map<2, 3, LCC_traits> LCC; typedef CGAL::Linear_cell_complex_for_bgl_combinatorial_map_helper
<2, 3, LCC_traits>::type LCC;
typedef boost::graph_traits<LCC>::vertex_descriptor vertex_descriptor; typedef boost::graph_traits<LCC>::vertex_descriptor vertex_descriptor;
typedef boost::graph_traits<LCC>::vertex_iterator vertex_iterator; typedef boost::graph_traits<LCC>::vertex_iterator vertex_iterator;

View File

@ -1,5 +1,5 @@
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/boost/graph/graph_traits_Linear_cell_complex.h> #include <CGAL/boost/graph/graph_traits_Linear_cell_complex_for_combinatorial_map.h>
#include <CGAL/boost/graph/iterator.h> #include <CGAL/boost/graph/iterator.h>
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
@ -8,7 +8,8 @@
typedef CGAL::Simple_cartesian<double> Kernel; typedef CGAL::Simple_cartesian<double> Kernel;
typedef CGAL::Linear_cell_complex_traits<3, Kernel> LCC_traits; typedef CGAL::Linear_cell_complex_traits<3, Kernel> LCC_traits;
typedef CGAL::Linear_cell_complex_for_bgl_combinatorial_map<2, 3, LCC_traits> LCC; typedef CGAL::Linear_cell_complex_for_bgl_combinatorial_map_helper
<2, 3, LCC_traits>::type LCC;
typedef boost::graph_traits<LCC> GraphTraits; typedef boost::graph_traits<LCC> GraphTraits;
typedef GraphTraits::vertex_descriptor vertex_descriptor; typedef GraphTraits::vertex_descriptor vertex_descriptor;

View File

@ -1,5 +1,5 @@
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/boost/graph/graph_traits_Linear_cell_complex.h> #include <CGAL/boost/graph/graph_traits_Linear_cell_complex_for_combinatorial_map.h>
#include <iostream> #include <iostream>
#include <list> #include <list>
@ -10,7 +10,8 @@ typedef CGAL::Simple_cartesian<double> Kernel;
typedef Kernel::Point_3 Point; typedef Kernel::Point_3 Point;
typedef CGAL::Linear_cell_complex_traits<3, Kernel> LCC_traits; typedef CGAL::Linear_cell_complex_traits<3, Kernel> LCC_traits;
typedef CGAL::Linear_cell_complex_for_bgl_combinatorial_map<2, 3, LCC_traits> LCC; typedef CGAL::Linear_cell_complex_for_bgl_combinatorial_map_helper
<2, 3, LCC_traits>::type LCC;
typedef boost::graph_traits<LCC>::vertex_descriptor vertex_descriptor; typedef boost::graph_traits<LCC>::vertex_descriptor vertex_descriptor;
typedef boost::graph_traits<LCC>::vertex_iterator vertex_iterator; typedef boost::graph_traits<LCC>::vertex_iterator vertex_iterator;
@ -21,7 +22,7 @@ typedef boost::graph_traits<LCC>::edge_descriptor edge_descriptor;
void kruskal(const LCC& lcc) void kruskal(const LCC& lcc)
{ {
// We use the default edge weight which is the length of the edge // We use the default edge weight which is the length of the edge
// This property map is defined in graph_traits_Linear_cell_complex.h // This property map is defined in graph_traits_Linear_cell_complex_for_combinatorial_map.h
// This function call requires a vertex_index_map named parameter which // This function call requires a vertex_index_map named parameter which
// when ommitted defaults to "get(vertex_index,graph)". // when ommitted defaults to "get(vertex_index,graph)".

View File

@ -6,14 +6,15 @@
#include <CGAL/basic.h> #include <CGAL/basic.h>
#include <CGAL/Kernel/global_functions.h> #include <CGAL/Kernel/global_functions.h>
#include <CGAL/Cartesian.h> #include <CGAL/Cartesian.h>
#include <CGAL/boost/graph/graph_traits_Linear_cell_complex.h> #include <CGAL/boost/graph/graph_traits_Linear_cell_complex_for_combinatorial_map.h>
typedef CGAL::Cartesian<double> Kernel; typedef CGAL::Cartesian<double> Kernel;
typedef Kernel::Point_3 Point; typedef Kernel::Point_3 Point;
typedef Kernel::Vector_3 Vector; typedef Kernel::Vector_3 Vector;
typedef CGAL::Linear_cell_complex_traits<3, Kernel> LCC_traits; typedef CGAL::Linear_cell_complex_traits<3, Kernel> LCC_traits;
typedef CGAL::Linear_cell_complex_for_bgl_combinatorial_map<2, 3, LCC_traits> LCC; typedef CGAL::Linear_cell_complex_for_bgl_combinatorial_map_helper
<2, 3, LCC_traits>::type LCC;
template<typename HalfedgeGraph, template<typename HalfedgeGraph,
typename PointMap, typename PointMap,

View File

@ -1,6 +1,6 @@
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/Iterator_range.h> #include <CGAL/Iterator_range.h>
#include <CGAL/boost/graph/graph_traits_Linear_cell_complex.h> #include <CGAL/boost/graph/graph_traits_Linear_cell_complex_for_combinatorial_map.h>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <iostream> #include <iostream>
@ -11,7 +11,8 @@
typedef CGAL::Simple_cartesian<double> Kernel; typedef CGAL::Simple_cartesian<double> Kernel;
typedef CGAL::Linear_cell_complex_traits<3, Kernel> LCC_traits; typedef CGAL::Linear_cell_complex_traits<3, Kernel> LCC_traits;
typedef CGAL::Linear_cell_complex_for_bgl_combinatorial_map<2, 3, LCC_traits> LCC; typedef CGAL::Linear_cell_complex_for_bgl_combinatorial_map_helper
<2, 3, LCC_traits>::type LCC;
typedef boost::graph_traits<LCC>::vertex_descriptor vertex_descriptor; typedef boost::graph_traits<LCC>::vertex_descriptor vertex_descriptor;
typedef boost::graph_traits<LCC>::vertex_iterator vertex_iterator; typedef boost::graph_traits<LCC>::vertex_iterator vertex_iterator;

View File

@ -1,6 +1,6 @@
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/IO/Polyhedron_iostream.h> #include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/boost/graph/graph_traits_Linear_cell_complex.h> #include <CGAL/boost/graph/graph_traits_Linear_cell_complex_for_combinatorial_map.h>
#include <CGAL/boost/graph/iterator.h> #include <CGAL/boost/graph/iterator.h>
#include <fstream> #include <fstream>
@ -9,7 +9,8 @@
typedef CGAL::Simple_cartesian<double> Kernel; typedef CGAL::Simple_cartesian<double> Kernel;
typedef CGAL::Linear_cell_complex_traits<3, Kernel> LCC_traits; typedef CGAL::Linear_cell_complex_traits<3, Kernel> LCC_traits;
typedef CGAL::Linear_cell_complex_for_bgl_combinatorial_map<2, 3, LCC_traits> LCC; typedef CGAL::Linear_cell_complex_for_bgl_combinatorial_map_helper
<2, 3, LCC_traits>::type LCC;
typedef boost::graph_traits<LCC> GraphTraits; typedef boost::graph_traits<LCC> GraphTraits;
typedef GraphTraits::vertex_descriptor vertex_descriptor; typedef GraphTraits::vertex_descriptor vertex_descriptor;

View File

@ -1,6 +1,6 @@
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/boost/graph/graph_traits_Linear_cell_complex.h> #include <CGAL/boost/graph/graph_traits_Linear_cell_complex_for_combinatorial_map.h>
#include <CGAL/boost/graph/properties_Linear_cell_complex.h> #include <CGAL/boost/graph/properties_Linear_cell_complex_for_combinatorial_map.h>
#include <boost/graph/graph_concepts.hpp> #include <boost/graph/graph_concepts.hpp>
#include <CGAL/boost/graph/graph_concepts.h> #include <CGAL/boost/graph/graph_concepts.h>
@ -8,7 +8,8 @@
typedef CGAL::Simple_cartesian<double> Kernel; typedef CGAL::Simple_cartesian<double> Kernel;
typedef CGAL::Linear_cell_complex_traits<3, Kernel> MyTraits; typedef CGAL::Linear_cell_complex_traits<3, Kernel> MyTraits;
typedef CGAL::Linear_cell_complex_for_bgl_combinatorial_map<2, 3, MyTraits> LCC; typedef CGAL::Linear_cell_complex_for_bgl_combinatorial_map_helper
<2, 3, MyTraits>::type LCC;
typedef boost::graph_traits< LCC > Traits; typedef boost::graph_traits< LCC > Traits;
typedef Traits::edge_descriptor edge_descriptor; typedef Traits::edge_descriptor edge_descriptor;

View File

@ -15,9 +15,9 @@
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h> #include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
#include <CGAL/Linear_cell_complex_for_bgl_combinatorial_map.h> #include <CGAL/Linear_cell_complex_for_bgl_combinatorial_map_helper.h>
#include <CGAL/boost/graph/graph_traits_Linear_cell_complex.h> #include <CGAL/boost/graph/graph_traits_Linear_cell_complex_for_combinatorial_map.h>
#include <CGAL/boost/graph/properties_Linear_cell_complex.h> #include <CGAL/boost/graph/properties_Linear_cell_complex_for_combinatorial_map.h>
#ifdef CGAL_USE_SURFACE_MESH #ifdef CGAL_USE_SURFACE_MESH
#include <CGAL/Surface_mesh.h> #include <CGAL/Surface_mesh.h>
@ -38,7 +38,8 @@ typedef Kernel::Triangle_3 Triangle_3;
typedef Kernel::Iso_cuboid_3 Iso_cuboid_3; typedef Kernel::Iso_cuboid_3 Iso_cuboid_3;
typedef CGAL::Linear_cell_complex_traits<3, Kernel> MyTraits; typedef CGAL::Linear_cell_complex_traits<3, Kernel> MyTraits;
typedef CGAL::Linear_cell_complex_for_bgl_combinatorial_map<2, 3, MyTraits> LCC; typedef CGAL::Linear_cell_complex_for_bgl_combinatorial_map_helper
<2, 3, MyTraits>::type LCC;
#ifdef CGAL_USE_SURFACE_MESH #ifdef CGAL_USE_SURFACE_MESH

View File

@ -214,8 +214,8 @@ namespace CGAL {
/** Definition of nD dart for combinatorial map. Add functions beta and attributes which /** Definition of nD dart for combinatorial map. Add functions beta and attributes which
* are now deprecated. * are now deprecated.
*/ */
template <unsigned int d, typename Refs> template <unsigned int d, typename Refs, class WithID=Tag_false>
struct CGAL_DEPRECATED Dart : public Dart_without_info<d, Refs> struct CGAL_DEPRECATED Dart : public Dart_without_info<d, Refs, WithID>
{ {
template<unsigned int, class, class> template<unsigned int, class, class>
friend class Combinatorial_map_storage_1; friend class Combinatorial_map_storage_1;
@ -229,7 +229,7 @@ namespace CGAL {
template <class, class> template <class, class>
friend class Concurrent_compact_container; friend class Concurrent_compact_container;
typedef Dart_without_info<d, Refs> Base; typedef Dart_without_info<d, Refs, WithID> Base;
using Base::dimension; using Base::dimension;
using Base::mf; using Base::mf;

View File

@ -21,6 +21,7 @@
#define CGAL_LINEAR_CELL_COMPLEX_BGL_MIN_ITEMS_H 1 #define CGAL_LINEAR_CELL_COMPLEX_BGL_MIN_ITEMS_H 1
#include <CGAL/Cell_attribute_with_point_and_id.h> #include <CGAL/Cell_attribute_with_point_and_id.h>
#include <CGAL/Cell_attribute_with_id.h>
namespace CGAL { namespace CGAL {

View File

@ -39,9 +39,9 @@ namespace CGAL {
class Alloc_ = CGAL_ALLOCATOR(int), class Alloc_ = CGAL_ALLOCATOR(int),
template<unsigned int,class,class,class,class> template<unsigned int,class,class,class,class>
class CMap = Combinatorial_map_base, class CMap = Combinatorial_map_base,
class Storage_ = CMap_linear_cell_complex_storage_1<d_, ambient_dim, class Storage_ = CMap_linear_cell_complex_storage_1
Traits_, Items_, <d_, ambient_dim, Traits_,
Alloc_> > CGAL::Linear_cell_complex_bgl_min_items, Alloc_> >
struct Linear_cell_complex_for_bgl_combinatorial_map_helper struct Linear_cell_complex_for_bgl_combinatorial_map_helper
{ {
public: public:

View File

@ -27,10 +27,11 @@
#include <boost/graph/graph_traits.hpp> #include <boost/graph/graph_traits.hpp>
#include <boost/graph/properties.hpp> #include <boost/graph/properties.hpp>
#include <CGAL/boost/graph/iterator.h> #include <CGAL/boost/graph/iterator.h>
#include <CGAL/boost/graph/properties_Linear_cell_complex.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>
#include <CGAL/Linear_cell_complex_for_bgl_combinatorial_map.h> #include <CGAL/Linear_cell_complex_for_bgl_combinatorial_map_helper.h>
#include <CGAL/Linear_cell_complex_for_combinatorial_map.h>
#include <CGAL/Linear_cell_complex_incremental_builder_for_bgl.h> #include <CGAL/Linear_cell_complex_incremental_builder_for_bgl.h>
#include <CGAL/Dart_iterators.h> #include <CGAL/Dart_iterators.h>
@ -52,7 +53,7 @@
class CMap, \ class CMap, \
class Storage_, class Storage_,
#define CGAL_LCC_TYPE CGAL::Linear_cell_complex_for_bgl_combinatorial_map \ #define CGAL_LCC_TYPE CGAL::Linear_cell_complex_for_combinatorial_map \
<d_, ambient_dim, Traits_, Items_, Alloc_, CMap, Storage_> <d_, ambient_dim, Traits_, Items_, Alloc_, CMap, Storage_>
namespace CGAL { namespace CGAL {

View File

@ -21,7 +21,7 @@
#define CGAL_BOOST_GRAPH_PROPERTIES_LINEAR_CELL_COMPLEX_H #define CGAL_BOOST_GRAPH_PROPERTIES_LINEAR_CELL_COMPLEX_H
#include <CGAL/boost/graph/properties.h> #include <CGAL/boost/graph/properties.h>
#include <CGAL/Linear_cell_complex_for_bgl_combinatorial_map.h> #include <CGAL/Linear_cell_complex_for_combinatorial_map.h>
#include <CGAL/Unique_hash_map.h> #include <CGAL/Unique_hash_map.h>
#include <CGAL/boost/graph/properties_Polyhedron_3.h> #include <CGAL/boost/graph/properties_Polyhedron_3.h>
@ -40,7 +40,7 @@
CMap, \ CMap, \
Storage_ Storage_
#define CGAL_LCC_TYPE CGAL::Linear_cell_complex_for_bgl_combinatorial_map\ #define CGAL_LCC_TYPE CGAL::Linear_cell_complex_for_combinatorial_map\
<d_, ambient_dim, Traits_, Items_, Alloc_, CMap , Storage_> <d_, ambient_dim, Traits_, Items_, Alloc_, CMap , Storage_>
namespace CGAL { namespace CGAL {

View File

@ -4,7 +4,8 @@
#include <CGAL/Linear_cell_complex_for_combinatorial_map.h> #include <CGAL/Linear_cell_complex_for_combinatorial_map.h>
#include <CGAL/boost/graph/graph_traits_Surface_mesh.h> #include <CGAL/boost/graph/graph_traits_Surface_mesh.h>
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h> #include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
#include <CGAL/boost/graph/graph_traits_Linear_cell_complex.h> #include <CGAL/boost/graph/graph_traits_Linear_cell_complex_for_combinatorial_map.h>
#include <CGAL/Linear_cell_complex_for_bgl_combinatorial_map_helper.h>
#include <CGAL/iterator.h> #include <CGAL/iterator.h>
#include <CGAL/Polygon_mesh_processing/intersection.h> #include <CGAL/Polygon_mesh_processing/intersection.h>
@ -21,18 +22,8 @@ typedef CGAL::Surface_mesh<Point> Mesh;
typedef CGAL::Polyhedron_3<Kernel> Polyhedron; typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
typedef CGAL::Linear_cell_complex_traits<3, Kernel> MyTraits; typedef CGAL::Linear_cell_complex_traits<3, Kernel> MyTraits;
struct Myitem typedef CGAL::Linear_cell_complex_for_bgl_combinatorial_map_helper
{ <2, 3, MyTraits>::type LCC;
template<class Refs>
struct Dart_wrapper
{
typedef CGAL::Tag_true Darts_with_id;
typedef CGAL::Cell_attribute_with_point_and_id< Refs > Vertex_attribute;
typedef CGAL::Cell_attribute_with_id< Refs > Face_attribute;
typedef CGAL::cpp11::tuple<Vertex_attribute, void, Face_attribute> Attributes;
};
};
typedef CGAL::Linear_cell_complex_for_combinatorial_map<2, 3, MyTraits, Myitem> LCC;
template <class TriangleMesh> template <class TriangleMesh>
void run(const char* filename1, const char* filename2, const char* msg) void run(const char* filename1, const char* filename2, const char* msg)