fix warnings and compilation issues

This commit is contained in:
Sébastien Loriot 2014-12-10 17:34:33 +01:00
parent 036c0c0231
commit ad1954afc4
20 changed files with 72 additions and 63 deletions

View File

@ -84,8 +84,8 @@ main(int,char*[])
for(std::list<edge_descriptor>::iterator it = mst.begin(); it != mst.end(); ++it){
edge_descriptor ed = *it;
vertex_descriptor svd = boost::source(ed,t);
vertex_descriptor tvd = boost::target(ed,t);
vertex_descriptor svd = source(ed,t);
vertex_descriptor tvd = target(ed,t);
Triangulation::Vertex_handle sv = svd;
Triangulation::Vertex_handle tv = tvd;
std::cout << "[ " << sv->point() << " | " << tv->point() << " ] " << std::endl;

View File

@ -9,6 +9,8 @@
#include <CGAL/Surface_mesh_simplification/edge_collapse.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h>
#include <CGAL/use.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel Epic;
typedef CGAL::Projection_traits_xy_3<Epic> K;
typedef K::Point_2 Point;
@ -111,6 +113,7 @@ main(int,char*[])
for(boost::tie(eit,ee) = edges(t); eit!= ee; ++eit){
edge_descriptor ed = *eit;
vertex_descriptor vd = source(ed,t);
CGAL_USE(vd);
++index;
}
@ -121,6 +124,7 @@ main(int,char*[])
for(boost::tie(hit,he) = halfedges(t); hit!= he; ++hit){
halfedge_descriptor hd = *hit;
vertex_descriptor vd = source(hd,t);
CGAL_USE(vd);
++index;
}
std::cerr << index << " halfedges" << std::endl;
@ -142,12 +146,12 @@ main(int,char*[])
// The surface and stop conditions are mandatory arguments.
// The index maps are needed because the vertices and edges
// of this surface lack an "id()" field.
int r = SMS::edge_collapse
(t
,stop
,CGAL::vertex_index_map(vertex_index_pmap)
.halfedge_index_map (halfedge_index_pmap)
);
SMS::edge_collapse
(t
,stop
,CGAL::vertex_index_map(vertex_index_pmap)
.halfedge_index_map (halfedge_index_pmap)
);
ppmap[*(++vertices(t).first)] = Point(78,1,2);

View File

@ -366,7 +366,7 @@ namespace CGAL {
put(PropertyTag p, CGAL::Delaunay_triangulation_2<Gt,Tds>& g,
const Key& key, const Value& value)
{
typedef typename property_map<CGAL::Delaunay_triangulation_2<Gt,Tds>, PropertyTag>::type Map;
typedef typename boost::property_map<CGAL::Delaunay_triangulation_2<Gt,Tds>, PropertyTag>::type Map;
Map pmap = get(p, g);
put(pmap, key, value);
}

View File

@ -372,7 +372,7 @@ halfedge(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vert
// HalfedgeListGraph
//
template <typename K>
CGA::Iterator_range<typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_iterator>
CGAL::Iterator_range<typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::halfedge_iterator>
halfedges(const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
{
return CGAL::make_range(sm.halfedges_sbegin(), sm.halfedges_end());

View File

@ -527,7 +527,7 @@ add_face(InputIterator begin, InputIterator end, CGAL::Surface_mesh<P>& sm)
template<typename P>
bool is_valid(CGAL::Surface_mesh<P>& sm, bool verbose = false)
{
return true;
return sm.is_valid(verbose);
}
} // namespace CGAL

View File

@ -402,7 +402,7 @@ namespace CGAL {
template <class Gt, class Tds>
typename boost::graph_traits< Triangulation_2<Gt,Tds> >::face_descriptor
face(typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor e,
const Triangulation_2<Gt,Tds>& g)
const Triangulation_2<Gt,Tds>&)
{
return e.first;
}
@ -410,7 +410,7 @@ namespace CGAL {
template <class Gt, class Tds>
typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor
halfedge(typename boost::graph_traits< Triangulation_2<Gt,Tds> >::face_descriptor f,
const Triangulation_2<Gt,Tds>& g)
const Triangulation_2<Gt,Tds>&)
{
typedef typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor halfedge_descriptor;
return halfedge_descriptor(f,0);
@ -431,7 +431,7 @@ namespace CGAL {
template <class Gt, class Tds>
typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor
halfedge(typename boost::graph_traits< Triangulation_2<Gt,Tds> >::edge_descriptor e,
const Triangulation_2<Gt,Tds>& g)
const Triangulation_2<Gt,Tds>&)
{
typedef typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor halfedge_descriptor;
return halfedge_descriptor(e.first,e.second);
@ -440,7 +440,7 @@ namespace CGAL {
template <class Gt, class Tds>
typename boost::graph_traits< Triangulation_2<Gt,Tds> >::edge_descriptor
edge(typename boost::graph_traits< Triangulation_2<Gt,Tds> >::halfedge_descriptor e,
const Triangulation_2<Gt,Tds>& g)
const Triangulation_2<Gt,Tds>&)
{
typedef typename boost::graph_traits< Triangulation_2<Gt,Tds> >::edge_descriptor edge_descriptor;
return edge_descriptor(e.first,e.second);
@ -619,23 +619,23 @@ namespace CGAL {
template <class Gt, class Tds>
class T2_vertex_point_map
: public boost::put_get_helper<typename Tds::Vertex::Point, T2_vertex_point_map<Gt,Tds> >
{
public:
typedef boost::readable_property_map_tag category;
typedef boost::lvalue_property_map_tag category;
typedef typename Tds::Vertex::Point value_type;
typedef value_type& reference;
typedef typename CGAL::Triangulation_2<Gt,Tds>::Vertex_handle key_type;
T2_vertex_point_map()
{}
value_type operator[](key_type vh) const {
friend reference get(T2_vertex_point_map<Gt,Tds>, key_type vh)
{
return vh->point();
}
reference operator[](key_type vh) {
return vh->point();
friend void put(T2_vertex_point_map<Gt,Tds>, key_type vh, const reference v)
{
vh->point()=v;
}
reference operator[](key_type vh) const {
return vh->point();
}
};
@ -790,7 +790,7 @@ namespace CGAL {
put(PropertyTag p, Triangulation_2<Gt,Tds>& g,
const Key& key, const Value& value)
{
typedef typename property_map<Triangulation_2<Gt,Tds>, PropertyTag>::type Map;
typedef typename boost::property_map<Triangulation_2<Gt,Tds>, PropertyTag>::type Map;
Map pmap = get(p, g);
put(pmap, key, value);
}

View File

@ -94,7 +94,7 @@ template <typename Point, typename T>
typename property_map<CGAL::Surface_mesh<Point>, boost::vertex_property_t<T> >::const_type
get(boost::vertex_property_t<T> vprop, const CGAL::Surface_mesh<Point>& sm)
{
return sm.template property_map<typename CGAL::Surface_mesh<Point>::Vertex_index, T>(vprop.s);
return sm.template get_property_map<typename CGAL::Surface_mesh<Point>::Vertex_index, T>(vprop.s);
}
template <typename Point, typename T>
@ -261,7 +261,7 @@ put(CGAL::vertex_point_t p, const CGAL::Surface_mesh<K>& g,
const K& point) {
typedef CGAL::Surface_mesh<K> SM;
CGAL_assertion(g.is_valid(x));
typename SM::Property_map< typename boost::graph_traits<SM>::vertex_descriptor,
typename SM::template Property_map< typename boost::graph_traits<SM>::vertex_descriptor,
K> prop = get(p, g);
prop[x] = point;
}

View File

@ -50,12 +50,12 @@ void test_edge_iterators(const G& g)
typedef typename Traits::edge_descriptor edge_descriptor;
typedef typename Traits::edge_iterator edge_iterator;
assert(g.size_of_halfedges() / 2 == num_edges(g));
// assert(g.size_of_halfedges() / 2 == num_edges(g));
// do we iterate as many as that?
edge_iterator eb, ee;
boost::tie(eb, ee) = edges(g);
assert(std::distance(eb, ee) == static_cast<std::ptrdiff_t>(g.size_of_halfedges() / 2));
assert(std::distance(eb, ee) == num_edges(g));
id_map ids;
unsigned int count = 0;

View File

@ -22,16 +22,15 @@ if ( CGAL_FOUND )
include( CGAL_CreateSingleSourceCGALProgram )
include_directories (BEFORE "../../include")
include_directories (BEFORE "../include")
create_single_source_cgal_program( "sm_aabbtree.cpp" )
create_single_source_cgal_program( "sm_bgl.cpp" )
create_single_source_cgal_program( "sm_circulators.cpp" )
create_single_source_cgal_program( "sm_do_intersect.cpp" )
create_single_source_cgal_program( "sm_iterators.cpp" )
create_single_source_cgal_program( "sm_circulators.cpp" )
create_single_source_cgal_program( "sm_properties.cpp" )
create_single_source_cgal_program( "sm_memory.cpp" )
create_single_source_cgal_program( "sm_kruskal.cpp" )
create_single_source_cgal_program( "sm_bgl.cpp" )
create_single_source_cgal_program( "sm_memory.cpp" )
create_single_source_cgal_program( "sm_properties.cpp" )
else()

View File

@ -29,7 +29,7 @@ int main()
vertex_descriptor w = m.add_vertex(K::Point_3(1,0,0));
vertex_descriptor x = m.add_vertex(K::Point_3(1,1,0));
face_descriptor f = m.add_face(u,v,w,x);
/* face_descriptor f = */ m.add_face(u,v,w,x);
{
std::cout << "all vertices " << std::endl;
@ -57,9 +57,11 @@ int main()
}
// or the C+11 for loop. Note that there is a ':' and not a ',' as in BOOST_FOREACH
#ifndef CGAL_NO_CPP0X_RANGE_BASED_FOR
for(vertex_descriptor vd : m.vertices()){
std::cout << vd << std::endl;
}
#endif
}

View File

@ -2,6 +2,7 @@
#include <CGAL/Surface_mesh.h>
#include <iostream>
#include <fstream>
#include <list>
#include <boost/graph/kruskal_min_spanning_tree.hpp>
@ -57,10 +58,11 @@ kruskal(const Mesh& P)
}
int main() {
int main(int,char** argv) {
Mesh P;
std::cin >> P;
std::ifstream input(argv[1]);
input >> P;
kruskal(P);

View File

@ -48,10 +48,6 @@ int main()
boost::tie(gnus, found) = m.property_map<face_descriptor,std::string>("v:gnus");
assert(! found);
typedef boost::property_map<Mesh, boost::vertex_point_t>::type Ppmap;
Ppmap ppmap = m.points();
// retrieve the point property for which exists a convenience function
Mesh::Property_map<vertex_descriptor, K::Point_3> location = m.points();
BOOST_FOREACH( vertex_descriptor vd, m.vertices()) {

View File

@ -69,8 +69,8 @@ bool read_off_binary(Surface_mesh<Point_3>& mesh,
typename Mesh::Vertex_index v;
// properties
Mesh::Property_map<typename Mesh::Vertex_index, Normal> normals;
Mesh::Property_map<typename Mesh::Vertex_index, Texture_coordinate> texcoords;
typename Mesh:: template Property_map<typename Mesh::Vertex_index, Normal> normals;
typename Mesh:: template Property_map<typename Mesh::Vertex_index, Texture_coordinate> texcoords;
if (has_normals) normals = mesh.template add_property_map<typename Mesh::Vertex_index, Normal>("v:normal").first;
if (has_texcoords) texcoords = mesh.template add_property_map<typename Mesh::Vertex_index, Texture_coordinate>("v:texcoord").first;
@ -145,8 +145,8 @@ bool read_off_ascii(Surface_mesh<Point_3>& mesh,
typename Mesh::Vertex_index v;
// properties
Mesh::Property_map<typename Mesh::Vertex_index, Normal> normals;
Mesh::Property_map<typename Mesh::Vertex_index, Texture_coordinate> texcoords;
typename Mesh::template Property_map<typename Mesh::Vertex_index, Normal> normals;
typename Mesh::template Property_map<typename Mesh::Vertex_index, Texture_coordinate> texcoords;
if (has_normals) normals = mesh.template add_property_map<typename Mesh::Vertex_index, Normal>("v:normal").first;
if (has_texcoords) texcoords = mesh.template add_property_map<typename Mesh::Vertex_index, Texture_coordinate>("v:texcoord").first;
@ -343,7 +343,7 @@ bool write_off(const Surface_mesh<K>& mesh, const std::string& filename)
// vertices
Mesh::Property_map<typename Mesh::Vertex_index, Point_3> points
typename Mesh::template Property_map<typename Mesh::Vertex_index, Point_3> points
= mesh.template property_map<typename Mesh::Vertex_index, Point_3>("v:point").first;
for (typename Mesh::Vertex_iterator vit=mesh.vertices_begin(); vit!=mesh.vertices_end(); ++vit)
{
@ -360,7 +360,7 @@ bool write_off(const Surface_mesh<K>& mesh, const std::string& filename)
typename Surface_mesh<K>::Vertex_around_face_circulator fvit(mesh.halfedge(*fit),mesh), fvend=fvit;
do
{
Surface_mesh<K>::size_type idx = *fvit;
typename Surface_mesh<K>::size_type idx = *fvit;
fprintf(out, " %d", idx);
}
while (++fvit != fvend);

View File

@ -169,7 +169,7 @@ public: // virtual interface of Base_property_array
virtual Base_property_array* clone() const
{
Property_array<T>* p = new Property_array<T>(name_, value_);
Property_array<T>* p = new Property_array<T>(this->name_, this->value_);
p->data_ = data_;
return p;
}
@ -338,7 +338,7 @@ public:
// delete a property
template <class T> void remove(Property_map<Key, T>& h)
{
std::vector<Base_property_array*>::iterator it=parrays_.begin(), end=parrays_.end();
typename std::vector<Base_property_array*>::iterator it=parrays_.begin(), end=parrays_.end();
for (; it!=end; ++it)
{
if (*it == h.parray_)
@ -1505,38 +1505,44 @@ public:
valid = valid && next(*it).is_valid();
valid = valid && opposite(*it).is_valid();
if(!valid) {
std::cerr << "Integrity of halfedge " << *it << " corrupted." << std::endl;
if (verbose)
std::cerr << "Integrity of halfedge " << *it << " corrupted." << std::endl;
break;
}
valid = valid && (opposite(*it) != *it);
valid = valid && (opposite(opposite(*it)) == *it);
if(!valid) {
if (verbose)
std::cerr << "Integrity of opposite halfedge of " << *it << " corrupted." << std::endl;
break;
}
valid = valid && (next(prev(*it)) == *it);
if(!valid) {
std::cerr << "Integrity of previous halfedge of " << *it << " corrupted." << std::endl;
if (verbose)
std::cerr << "Integrity of previous halfedge of " << *it << " corrupted." << std::endl;
break;
}
valid = valid && (prev(next(*it)) == *it);
if(!valid) {
std::cerr << "Integrity of next halfedge of " << *it << " corrupted." << std::endl;
if (verbose)
std::cerr << "Integrity of next halfedge of " << *it << " corrupted." << std::endl;
break;
}
valid = valid && target(*it).is_valid();
if(!valid) {
std::cerr << "Integrity of vertex of halfedge " << *it << " corrupted." << std::endl;
if (verbose)
std::cerr << "Integrity of vertex of halfedge " << *it << " corrupted." << std::endl;
break;
}
valid = valid && (target(*it) == target(opposite(next(*it))));
if(!valid) {
std::cerr << "Halfedge vertex of next opposite is not the same for " << *it << "." << std::endl;
if (verbose)
std::cerr << "Halfedge vertex of next opposite is not the same for " << *it << "." << std::endl;
break;
}
}
@ -1546,7 +1552,8 @@ public:
// not an isolated vertex
valid = valid && (target(halfedge(*it)) == *it);
if(!valid) {
std::cerr << "Halfedge of " << *it << " is not an incoming halfedge." << std::endl;
if (verbose)
std::cerr << "Halfedge of " << *it << " is not an incoming halfedge." << std::endl;
break;
}
}
@ -2138,8 +2145,6 @@ private: //------------------------------------------------------- private data
std::istream& operator>>(std::istream& is, Surface_mesh<P>& sm)
{
typedef Surface_mesh<P> Mesh;
typedef typename Mesh::Vertex_index Vertex_index;
typedef typename Mesh::Face_index Face_index;
typedef typename Mesh::size_type size_type;
sm.clear();
int n, f, e;

View File

@ -11,12 +11,12 @@ int main()
{
Sm m;
Sm::vertex_index u;
std::cout << m.num_vertices() << " " << m.num_removed_vertices() << std::endl;
std::cout << m.num_vertices() << " " << m.number_of_removed_vertices() << std::endl;
for(int i=0; i < 10; i++){
u = m.add_vertex(Point_3(0,0,0));
m.remove_vertex(u);
}
std::cout << m.num_vertices() << " " << m.num_removed_vertices() << std::endl;
std::cout << m.num_vertices() << " " << m.number_of_removed_vertices() << std::endl;
return 0;
}

View File

@ -10,6 +10,8 @@
#include <boost/bind.hpp>
#include <boost/range/algorithm.hpp>
#include <CGAL/use.h>
BOOST_AUTO_TEST_CASE( constructors_test )
{
Sm mesh;
@ -141,7 +143,6 @@ BOOST_AUTO_TEST_CASE( memory_reuse_test )
BOOST_CHECK_EQUAL(f.m.number_of_faces() , 0);
BOOST_CHECK_EQUAL(f.m.number_of_removed_edges(), old_edge_size + old_removed_edge_size);
int fc = 0;
// add all again
for(Faces::iterator it = faces.begin(); it != faces.end(); ++it) {
Sm::Face_index fd = f.m.add_face(*it);
@ -151,7 +152,7 @@ BOOST_AUTO_TEST_CASE( memory_reuse_test )
Sm::Halfedge_index h = f.m.halfedge(*it2);
Sm::Face_index fa = f.m.face(h);
CGAL_USE(fa);
}
}

View File

@ -73,7 +73,7 @@ int main( int argc, char** argv )
Surface_mesh::Property_map<halfedge_descriptor,std::pair<Point_3, Point_3> > constrained_halfedges;
constrained_halfedges = surface_mesh.add_property_map<halfedge_descriptor,std::pair<Point_3, Point_3>>("h:vertices").first;
constrained_halfedges = surface_mesh.add_property_map<halfedge_descriptor,std::pair<Point_3, Point_3> >("h:vertices").first;
std::size_t nb_border_edges=0;
BOOST_FOREACH(halfedge_descriptor hd, halfedges(surface_mesh)){