From 289f04cd5c27ebbb498cb235c01a6781b228bc2f Mon Sep 17 00:00:00 2001 From: Fernando Cacciola Date: Mon, 28 Aug 2006 15:53:54 +0000 Subject: [PATCH] Specific property maps now passed as arguments --- .gitattributes | 3 +- .../Edge_cached_pointer_map.h | 45 +++++++++++ .../Edge_index_map.h | 47 ++++++++++++ .../Polyhedron_edge_cached_pointer_map.h | 76 ------------------- .../Polyhedron_is_vertex_fixed_map.h | 76 ------------------- .../Vertex_is_fixed_map.h | 46 +++++++++++ .../edge_collapse_test.cpp | 8 +- 7 files changed, 145 insertions(+), 156 deletions(-) create mode 100644 Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Edge_cached_pointer_map.h create mode 100644 Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Edge_index_map.h delete mode 100644 Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Polyhedron_edge_cached_pointer_map.h delete mode 100644 Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Polyhedron_is_vertex_fixed_map.h create mode 100644 Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Vertex_is_fixed_map.h diff --git a/.gitattributes b/.gitattributes index e1b114647d6..1888a26312e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1905,6 +1905,8 @@ Surface_mesh_parameterization/test/Surface_mesh_parameterization/data/cube.off - Surface_mesh_parameterization/test/Surface_mesh_parameterization/data/high_genus.off -text svneol=unset#application/octet-stream Surface_mesh_parameterization/test/Surface_mesh_parameterization/data/knot2.off -text svneol=unset#application/octet-stream Surface_mesh_parameterization/test/Surface_mesh_parameterization/data/oni.off -text svneol=unset#application/octet-stream +Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Edge_cached_pointer_map.h -text +Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Edge_index_map.h -text Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Cached_cost.h -text Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Cached_placement.h -text Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Full_collapse_data.h -text @@ -1914,7 +1916,6 @@ Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Ed Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Partial_collapse_data.h -text Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Set_full_collapse_data.h -text Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Set_partial_collapse_data.h -text -Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Polyhedron_edge_cached_pointer_map.h -text Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_test.cpp -text Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_test.kdevelop -text Surface_mesher/demo/Surface_mesher/windows/Mesh.suo -text diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Edge_cached_pointer_map.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Edge_cached_pointer_map.h new file mode 100644 index 00000000000..7b0a7a188ff --- /dev/null +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Edge_cached_pointer_map.h @@ -0,0 +1,45 @@ +// Copyright (c) 2006 Geometry Factory (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you may redistribute it under +// the terms of the Q Public License version 1.0. +// See the file LICENSE.QPL distributed with CGAL. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL: svn+ssh://fcacciola@scm.gforge.inria.fr/svn/cgal/trunk/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Edge_stored_extra_pointer_map.h $ +// $Id: Edge_stored_extra_pointer_map.h 32048 2006-06-23 13:59:36Z lsaboret $ +// +// +// Author(s): Fernando Cacciola + +#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_EDGE_STORED_EXTRA_POINTER_MAP_H +#define CGAL_SURFACE_MESH_SIMPLIFICATION_EDGE_STORED_EXTRA_POINTER_MAP_H + +namespace boost +{ + +template +class Edge_stored_extra_pointer_map : public put_get_helper > +{ +private: + + typedef Graph_ Graph ; + +public: + + typedef lvalue_property_map_tag category; + typedef void* value_type; + typedef void*& reference; + typedef typename graph_traits::edge_descriptor key_type; + + reference operator[](key_type const& e) const { return e->extra_pointer() ; } +}; + +} // namespace boost + +#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_EDGE_STORED_EXTRA_POINTER_MAP_H diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Edge_index_map.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Edge_index_map.h new file mode 100644 index 00000000000..eefdd725ec3 --- /dev/null +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Edge_index_map.h @@ -0,0 +1,47 @@ +// Copyright (c) 2006 Geometry Factory (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you may redistribute it under +// the terms of the Q Public License version 1.0. +// See the file LICENSE.QPL distributed with CGAL. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL: svn+ssh://fcacciola@scm.gforge.inria.fr/svn/cgal/trunk/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Polyhedron_edge_cached_pointer_map.h $ +// $Id: Polyhedron_edge_cached_pointer_map.h 32048 2006-06-23 13:59:36Z lsaboret $ +// +// +// Author(s): Fernando Cacciola + +#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_EDGE_STORED_INDEX_MAP_H +#define CGAL_SURFACE_MESH_SIMPLIFICATION_EDGE_STORED_INDEX_MAP_H + +namespace boost +{ + +template +class Edge_stored_index_map : public put_get_helper< typename Graph_::size_type, Edge_stored_index_map > +{ +private: + + typedef Graph_ Graph ; + +public: + + typedef typename G::size_type size_type ; + + typedef readable_property_map_tag category; + typedef size_type value_type; + typedef size_type reference; + typedef typename graph_traits::edge_descriptor key_type; + + reference operator[](key_type const& e) const { return e->id(); } +}; + +} // namespace boost + +#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_EDGE_STORED_INDEX_MAP_H diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Polyhedron_edge_cached_pointer_map.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Polyhedron_edge_cached_pointer_map.h deleted file mode 100644 index 30e6e14c01e..00000000000 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Polyhedron_edge_cached_pointer_map.h +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) 2006 Geometry Factory (France). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org); you may redistribute it under -// the terms of the Q Public License version 1.0. -// See the file LICENSE.QPL distributed with CGAL. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL: svn+ssh://fcacciola@scm.gforge.inria.fr/svn/cgal/trunk/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Polyhedron_edge_cached_pointer_map.h $ -// $Id: Polyhedron_edge_cached_pointer_map.h 32048 2006-06-23 13:59:36Z lsaboret $ -// -// -// Author(s): Fernando Cacciola - -#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLYHEDRON_EDGE_CACHED_POINTER_MAP_H -#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLYHEDRON_EDGE_CACHED_POINTER_MAP_H - -#include -#include - -#ifndef CGAL_CFG_NO_TMPL_IN_TMPL_PARAM -# define CGAL_HDS_PARAM_ template < class Traits, class Items, class Alloc> class HDS -#else -# define CGAL_HDS_PARAM_ class HDS -#endif - -namespace boost -{ - -struct edge_cached_pointer_t {} ; - -template -class Polyhedron_edge_cached_pointer_map : public put_get_helper > -{ -private: - - typedef CGAL::Polyhedron_3 Polyhedron ; - -public: - - typedef lvalue_property_map_tag category; - typedef void* value_type; - typedef void*& reference; - typedef typename graph_traits::edge_descriptor key_type; - - reference operator[](key_type const& e) const { return e->cached_pointer() ; } -}; - -template -inline Polyhedron_edge_cached_pointer_map -get(edge_cached_pointer_t, CGAL::Polyhedron_3& p) -{ - Polyhedron_edge_cached_pointer_map m(p); - return m; -} - -template <> -struct Polyhedron_property_map -{ - template - struct bind_ { - typedef Polyhedron_edge_cached_pointer_map type; - typedef Polyhedron_edge_cached_pointer_map const_type; - }; -}; - -} // namespace boost - -#undef CGAL_HDS_PARAM_ - -#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLYHEDRON_EDGE_CACHED_POINTER_MAP_H diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Polyhedron_is_vertex_fixed_map.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Polyhedron_is_vertex_fixed_map.h deleted file mode 100644 index 2a6e27031a6..00000000000 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Polyhedron_is_vertex_fixed_map.h +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) 2006 Geometry Factory (France). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org); you may redistribute it under -// the terms of the Q Public License version 1.0. -// See the file LICENSE.QPL distributed with CGAL. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// -// -// Author(s): Fernando Cacciola - -#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLYHEDRON_IS_VERTEX_FIXED_MAP_H -#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLYHEDRON_IS_VERTEX_FIXED_MAP_H - -#include -#include - -#ifndef CGAL_CFG_NO_TMPL_IN_TMPL_PARAM -# define CGAL_HDS_PARAM_ template < class Traits, class Items, class Alloc> class HDS -#else -# define CGAL_HDS_PARAM_ class HDS -#endif - -namespace boost -{ - -struct vertex_is_fixed_t {} ; - -template -class Polyhedron_is_vertex_fixed_map : public put_get_helper > -{ -private: - - typedef CGAL::Polyhedron_3 Polyhedron ; - -public: - - typedef readable_property_map_tag category; - typedef bool value_type; - typedef bool reference; - typedef typename graph_traits::vertex_descriptor key_type; - - reference operator[](key_type const& e) const { e->is_fixed() ; } -}; - -template -inline Polyhedron_is_vertex_fixed_map -get(vertex_is_fixed_t, const CGAL::Polyhedron_3& p) -{ - Polyhedron_is_vertex_fixed_map m(p); - return m; -} - -template <> -struct Polyhedron_property_map -{ - template - struct bind_ { - typedef Polyhedron_is_vertex_fixed_map type; - typedef Polyhedron_is_vertex_fixed_map const_type; - }; -}; - -} // namespace boost - -#undef CGAL_HDS_PARAM_ - -#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_POLYHEDRON_IS_VERTEX_FIXED_MAP_H diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Vertex_is_fixed_map.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Vertex_is_fixed_map.h new file mode 100644 index 00000000000..14c71d2cda1 --- /dev/null +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Vertex_is_fixed_map.h @@ -0,0 +1,46 @@ +// Copyright (c) 2006 Geometry Factory (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you may redistribute it under +// the terms of the Q Public License version 1.0. +// See the file LICENSE.QPL distributed with CGAL. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// +// +// Author(s): Fernando Cacciola + +#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_STORED_IS_VERTEX_FIXED_MAP_H +#define CGAL_SURFACE_MESH_SIMPLIFICATION_STORED_IS_VERTEX_FIXED_MAP_H + +namespace boost +{ + +template +class Vertex_stored_is_fixed_map : public put_get_helper > +{ +private: + + typedef Graph_ Graph ; + +public: + + typedef readable_property_map_tag category; + typedef bool value_type; + typedef bool reference; + typedef typename graph_traits::vertex_descriptor key_type; + + reference operator[](key_type const& v) const { v->is_fixed() ; } +}; + + +} // namespace boost + +#endif // CGAL_SURFACE_MESH_SIMPLIFICATION_STORED_IS_VERTEX_FIXED_MAP_H diff --git a/Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_test.cpp b/Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_test.cpp index 7780f9ea4d3..fd9c9df0bbc 100644 --- a/Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_test.cpp +++ b/Surface_mesh_simplification/test/Surface_mesh_simplification/edge_collapse_test.cpp @@ -48,9 +48,9 @@ void Surface_simplification_external_trace( std::string s ) int exit_code = 0 ; #include -#include -#include -#include +#include +#include +#include #include #include #include @@ -556,6 +556,8 @@ bool Test ( int aStopA, int aStopR, bool aJustPrintSurfaceData, string aName, Me Dummy_params lDummy_params; LT_params lLT_params ; + + Edge_index_map P_Edge_index_map ; Visitor lVisitor(lRequestedEdgeCount) ;