From 0e80ecf8c0706f0e1c060843eccc39b9f3c61c99 Mon Sep 17 00:00:00 2001 From: Guillaume Damiand Date: Fri, 17 Jun 2016 10:45:25 +0200 Subject: [PATCH] Work to be able to use LCC with GMap as underlying DS (nyf) --- .../include/CGAL/Combinatorial_map.h | 32 ++- .../include/CGAL/GMap_cell_iterators.h | 122 ++++++++- Generalized_map/include/CGAL/GMap_dart.h | 3 + .../include/CGAL/GMap_dart_iterators.h | 10 + .../include/CGAL/Generalized_map.h | 55 ++++- .../include/CGAL/Generalized_map_save_load.h | 233 ++++++++++++++++++ .../internal/Generalized_map_group_functors.h | 8 +- .../Linear_cell_complex/CMakeLists.txt | 2 + .../include/CGAL/Linear_cell_complex.h | 112 ++++++++- .../CGAL/Linear_cell_complex_min_items.h | 24 +- .../CGAL/Linear_cell_complex_storages.h | 2 +- 11 files changed, 575 insertions(+), 28 deletions(-) create mode 100644 Generalized_map/include/CGAL/Generalized_map_save_load.h diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map.h b/Combinatorial_map/include/CGAL/Combinatorial_map.h index c7d073708ff..b725d6fb001 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map.h @@ -774,6 +774,32 @@ namespace CGAL { { return beta(beta(ADart)); } #endif + // Generic function to iterate on CMap or GMap in a generic way + bool exist_previous_dart_in_face(Dart_const_handle ADart) const + { return !is_free<0>(ADart); } + bool exist_next_dart_in_face(Dart_const_handle ADart) const + { return !is_free<1>(ADart); } + template + bool exist_opposite_dart(Dart_const_handle ADart) const + { return !is_free(ADart); } + + Dart_handle get_previous_dart_in_face(Dart_handle ADart) + { return beta<0>(ADart); } + Dart_const_handle get_previous_dart_in_face(Dart_const_handle ADart) const + { return beta<0>(ADart); } + + Dart_handle get_next_dart_in_face(Dart_handle ADart) + { return beta<1>(ADart); } + Dart_const_handle get_next_dart_in_face(Dart_const_handle ADart) const + { return beta<1>(ADart); } + + template + Dart_handle get_opposite_dart(Dart_handle ADart) + { return beta(ADart); } + template + Dart_const_handle get_opposite_dart(Dart_const_handle ADart) const + { return beta(ADart); } + /** Count the number of used marks. * @return the number of used marks. */ @@ -786,7 +812,6 @@ namespace CGAL { bool is_reserved(size_type amark) const { CGAL_assertion(amark::run(this, d1, ah); } diff --git a/Generalized_map/include/CGAL/GMap_cell_iterators.h b/Generalized_map/include/CGAL/GMap_cell_iterators.h index fb7a44d585d..2ec2f682122 100644 --- a/Generalized_map/include/CGAL/GMap_cell_iterators.h +++ b/Generalized_map/include/CGAL/GMap_cell_iterators.h @@ -20,7 +20,7 @@ #ifndef CGAL_GMAP_CELL_ITERATORS_H #define CGAL_GMAP_CELL_ITERATORS_H 1 -#include +#include #include // TODO do all the orbit iterator of any orbit ? @@ -32,8 +32,126 @@ namespace CGAL { * - GMap_cell_iterator: one dart per each i-cell * - GMap_one_dart_per_incident_cell_iterator * - GMap_one_dart_per_cell_iterator + * - one specialisation of the CMap_cell_iterator for the + * GMap_dart_iterator_basic_of_all iterator */ + //**************************************************************************** + /* Class CMap_cell_iterator, + i,dim,Tag_false>: specialization to iterate onto + * all the cells of the gmap. + */ + template + class CMap_cell_iterator, + i,dim,Const,Tag_false>: + public GMap_dart_iterator_basic_of_all + { + public: + typedef GMap_dart_iterator_basic_of_all Base; + typedef CMap_cell_iterator Self; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + protected: + /// Unmark all the marked darts during the iterator. + void unmark_treated_darts() + { + if (this->mmap->is_whole_map_unmarked(mmark_number)) return; + + this->mmap->negate_mark(mmark_number); + + if (this->mmap->is_whole_map_unmarked(mmark_number)) return; + + Base::rewind(); + mark_cell(*this->mmap, (*this), + mmark_number); + while (this->mmap->number_of_unmarked_darts(mmark_number) > 0) + this->operator++(); + this->mmap->negate_mark(mmark_number); + CGAL_assertion(this->mmap->is_whole_map_unmarked(mmark_number)); + } + + public: + /// Main constructor. + CMap_cell_iterator(Map& amap): + Base(amap), + mmark_number(amap.get_new_mark()) + { + CGAL_static_assertion( (boost::is_same::value) ); + CGAL_assertion(amap.is_whole_map_unmarked(mmark_number)); + mark_cell(amap, (*this), mmark_number); + } + + /// Constructor with a dart in parameter (for end iterator). + CMap_cell_iterator(Map& amap, Dart_handle adart): + Base(amap, adart), + mmark_number(amap.get_new_mark()) + { + if (adart!=this->mmap->null_handle) + mark_cell(amap, (*this), mmark_number); + } + + /// Destructor. + ~CMap_cell_iterator() + { + if (this->mmap->get_number_of_times_mark_reserved(mmark_number)==1) + unmark_treated_darts(); + this->mmap->free_mark(mmark_number); + this->mmark_number = Map::INVALID_MARK; // To avoid basic class to try to unmark darts. + } + + /// Copy constructor. + CMap_cell_iterator(const Self& aiterator): + Base(aiterator), + mmark_number(aiterator.mmark_number) + { this->mmap->share_a_mark(mmark_number); } + + /// Assignment operator. + Self& operator=(const Self& aiterator) + { + if (this != &aiterator) + { + Base::operator=(aiterator); + mmark_number = aiterator.mmark_number; + this->mmap->share_a_mark(mmark_number); + } + return *this; + } + + /// Rewind of the iterator to its beginning. + void rewind() + { + unmark_treated_darts(); + Base::rewind(); + mark_cell(*this->mmap, (*this), mmark_number); + } + + /// Postfix ++ operator. + Self operator++(int) + { Self res=*this; operator ++(); return res; } + + /// Prefix ++ operator. + Self& operator++() + { + CGAL_assertion(this->cont()); + do + { + Base::operator++(); + } + while (this->cont() && + this->mmap->is_marked((*this), mmark_number)); + + if (this->cont()) + mark_cell(*this->mmap, (*this), mmark_number); + return *this; + } + + private: + /// A mark used to mark treated cells. + typename Map::size_type mmark_number; + }; //**************************************************************************** /* Class GMap_cell_iterator: to iterate onto * all the cells of the gmap. @@ -178,7 +296,7 @@ namespace CGAL { }; //**************************************************************************** /* Class GMap_one_dart_per_cell_iterator: to iterate onto the - * i-cells incident of the map (one dart by each i-cell). + * i-cells of the map (one dart by each i-cell). */ template diff --git a/Generalized_map/include/CGAL/GMap_dart.h b/Generalized_map/include/CGAL/GMap_dart.h index 78c4237e70a..d431ea6b3aa 100644 --- a/Generalized_map/include/CGAL/GMap_dart.h +++ b/Generalized_map/include/CGAL/GMap_dart.h @@ -57,6 +57,9 @@ struct GMap_dart template < unsigned int, class, class > friend class Generalized_map_storage_2; + template < unsigned int, unsigned int, class, class, class > + friend class GMap_linear_cell_complex_storage_1; + template friend class Compact_container; diff --git a/Generalized_map/include/CGAL/GMap_dart_iterators.h b/Generalized_map/include/CGAL/GMap_dart_iterators.h index 3c751322129..2440c6200c1 100644 --- a/Generalized_map/include/CGAL/GMap_dart_iterators.h +++ b/Generalized_map/include/CGAL/GMap_dart_iterators.h @@ -994,6 +994,16 @@ namespace CGAL { Base(amap, amap.darts().begin()) {} + /// Constructor with a dart in parameter (for end iterator). + GMap_dart_iterator_basic_of_all(Map& amap, Dart_handle adart): + Base(amap, adart) + {} + /// Constructor with a dart in parameter (for end iterator). + GMap_dart_iterator_basic_of_all(Map& amap, Dart_handle adart, + size_type /*amark*/): + Base(amap, adart) + {} + /// Prefix ++ operator. Self& operator++() { diff --git a/Generalized_map/include/CGAL/Generalized_map.h b/Generalized_map/include/CGAL/Generalized_map.h index 6c3c60a1cee..309ac69f512 100644 --- a/Generalized_map/include/CGAL/Generalized_map.h +++ b/Generalized_map/include/CGAL/Generalized_map.h @@ -42,6 +42,11 @@ #include +#if defined( __INTEL_COMPILER ) +// Workarounf for warning in function basic_link_beta_0 +#pragma warning disable 1017 +#endif + namespace CGAL { /** @file Generalized_map.h @@ -720,6 +725,32 @@ namespace CGAL { { return alpha(alpha(ADart)); } #endif + // Generic function to iterate on CMap or GMap in a generic way + bool exist_previous_dart_in_face(Dart_const_handle ADart) const + { return !is_free<0>(ADart) && !is_free<1>(alpha<0>(ADart)); } + bool exist_next_dart_in_face(Dart_const_handle ADart) const + { return !is_free<1>(ADart) && !is_free<0>(alpha<1>(ADart)); } + template + bool exist_opposite_dart(Dart_const_handle ADart) const + { return !is_free(ADart) && !is_free<0>(alpha(ADart)); } + + Dart_handle get_previous_dart_in_face(Dart_handle ADart) + { return alpha<1, 0>(ADart); } + Dart_const_handle get_previous_dart_in_face(Dart_const_handle ADart) const + { return alpha<1, 0>(ADart); } + + Dart_handle get_next_dart_in_face(Dart_handle ADart) + { return alpha<0, 1>(ADart); } + Dart_const_handle get_next_dart_in_face(Dart_const_handle ADart) const + { return alpha<0, 1>(ADart); } + + template + Dart_handle get_opposite_dart(Dart_handle ADart) + { return alpha<0, dim>(ADart); } + template + Dart_const_handle get_opposite_dart(Dart_const_handle ADart) const + { return alpha<0, dim>(ADart); } + /** Count the number of used marks. * @return the number of used marks. */ @@ -2895,7 +2926,7 @@ namespace CGAL { { Dart_handle d1 = create_dart(); Dart_handle d2 = create_dart(); - basic_link_alpha(d1, d2, 0); + basic_link_alpha<0>(d1, d2); return d1; } @@ -3368,7 +3399,9 @@ namespace CGAL { insert_cell_1_in_cell_2(GMap& amap, typename GMap::Dart_handle adart1, typename GMap::Dart_handle adart2, - bool update_attributes=true) + bool update_attributes=true, + typename Attribute_handle<0>::type + ah=null_handle) { if ( adart2!=amap.null_handle) { @@ -3417,6 +3450,11 @@ namespace CGAL { amap.template link_alpha<1>(it2, d2); ++it2; } + + if (are_attributes_automatically_managed() && update_attributes && ah!=NULL) + { + internal::Set_i_attribute_of_dart_functor::run(this, d1, ah); + } } if (amap.are_attributes_automatically_managed() && update_attributes) @@ -3455,9 +3493,20 @@ namespace CGAL { CGAL_assertion( amap.is_valid() ); #endif - return amap.template alpha<1>(adart1); + return amap.template alpha<1,0>(adart1); } + /** Insert a dangling edge in a 2-cell between given by a dart. + * @param adart1 a first dart of the facet (!=NULL && !=null_dart_handle). + * @param update_attributes a boolean to update the enabled attributes + * @return a dart of the new edge, not incident to the vertex of adart1. + */ + Dart_handle insert_dangling_cell_1_in_cell_2( Dart_handle adart1, + typename Attribute_handle<0>::type + ah=null_handle, + bool update_attributes=true ) + { return insert_cell_1_in_cell_2(adart1, NULL, update_attributes, ah); } + /** Test if a 2-cell can be inserted onto a given 3-cell along * a path of edges. * @param amap the used generalized map. diff --git a/Generalized_map/include/CGAL/Generalized_map_save_load.h b/Generalized_map/include/CGAL/Generalized_map_save_load.h new file mode 100644 index 00000000000..d515b2fbc69 --- /dev/null +++ b/Generalized_map/include/CGAL/Generalized_map_save_load.h @@ -0,0 +1,233 @@ +// Copyright (c) 2016 CNRS and LIRIS' Establishments (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// 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) : Guillaume Damiand +// +#ifndef CGAL_GENERALIZED_MAP_SAVE_LOAD_H +#define CGAL_GENERALIZED_MAP_SAVE_LOAD_H + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +/* We reuse the following functions from Combinatorial_map_save_load.h: + * write_cmap_dart_node + * write_cmap_attribute_node + * My_functor_cmap_save_one_attrib + * My_functor_cmap_save_attrib + * cmap_save_attributes + * + * read_cmap_dart_node + * read_cmap_attribute_node + * My_functor_cmap_load_one_attrib + * My_functor_cmap_load_attrib + * cmap_load_attributes + */ + +namespace CGAL { + + typedef Exact_predicates_inexact_constructions_kernel::Point_3 RPoint_3; + typedef Exact_predicates_exact_constructions_kernel::Point_3 EPoint_3; + + // Tags used in xml tree: + // For darts: + // + // // new dart + // neighbor dart index for alpha0 + // ... + // value of dart (optional) + // + // ... + // + // For attributes: + // + // // new type of non void attribute + // type of the info associated + // // new attribute + // dart index + // value of attribute + // + // ... + // + + template < class GMap > + boost::property_tree::ptree gmap_save_darts + (const GMap& amap, std::map& myDarts) + { + CGAL_assertion( myDarts.empty() ); + + // First we numbered each dart by using the std::map. + typename GMap::Dart_range::const_iterator it(amap.darts().begin()); + for(typename GMap::size_type num=1; num<=amap.number_of_darts(); + ++num, ++it) + { + myDarts[it] = num; + } + + // make a tree + using boost::property_tree::ptree; + ptree pt; + + // Now we save each dart, and its neighbors. + it=amap.darts().begin(); + for(typename GMap::size_type num=0; num.i", dim); + } + } + + // update property node to add a value node (if user defined its own + // function) + write_cmap_dart_node(ndart, it); + } + + return pt; + } + + template < class GMap > + bool save_generalized_map(const GMap& amap, std::ostream & output) + { + using boost::property_tree::ptree; + ptree data; + + // map dart => number + std::map myDarts; + + // Get darts + ptree pt_darts; + pt_darts = gmap_save_darts(amap, myDarts); + data.add_child("data.darts",pt_darts); + + // Get attributes + ptree pt_attr; + pt_attr = cmap_save_attributes(amap, myDarts); + data.add_child("data.attributes", pt_attr); + + // save data in output + write_xml(output, data); + + return true; + } + + template < class GMap > + bool save_generalized_map(const GMap& amap, const char* filename) + { + std::ofstream output(filename); + if (!output) return false; + return save_generalized_map(amap, output); + } + + template < class GMap > + bool gmap_load_darts(boost::property_tree::ptree &pt, GMap& amap, + std::vector& myDarts) + { + // use a boost::property_tree + using boost::property_tree::ptree; + + // make darts + BOOST_FOREACH( const ptree::value_type &v, pt.get_child("data.darts") ) + { + if( v.first == "d" ) + myDarts.push_back(amap.create_dart()); + } + + // update beta links + unsigned int index; + unsigned int currentDartInt = 0; + unsigned int nextDartInt; + + BOOST_FOREACH( const ptree::value_type &v, pt.get_child("data.darts") ) + { + if( v.first == "d" ) + { + BOOST_FOREACH( const ptree::value_type &v2, v.second ) + { + if (v2.first == "b") + { + index = v2.second.get(".i", 0); + nextDartInt = boost::lexical_cast< int >(v2.second.data())-1; + + if ( index<=amap.dimension ) + { + // A->B + amap.basic_link_alpha(myDarts[currentDartInt], + myDarts[nextDartInt], + index); + + //B->A + amap.basic_link_alpha(myDarts[nextDartInt], + myDarts[currentDartInt], + index); + } + } + else if (v2.first=="v") + read_cmap_dart_node(v2,myDarts[currentDartInt]); + } + } + ++currentDartInt; + } + + return true; + } + + template < class GMap > + bool load_generalized_map(std::ifstream & input, GMap& amap) + { + using boost::property_tree::ptree; + ptree pt; + read_xml(input, pt); + std::vector myDarts; + gmap_load_darts(pt,amap,myDarts); + cmap_load_attributes(pt,amap,myDarts); + return true; + } + + template < class GMap > + bool load_generalized_map(const char* filename, GMap& amap) + { + std::ifstream input(filename); + if (!input) return false; + return load_generalized_map(input, amap); + } + +} // namespace CGAL + +#endif // CGAL_GENERALIZED_MAP_SAVE_LOAD_H // +// EOF // diff --git a/Generalized_map/include/CGAL/internal/Generalized_map_group_functors.h b/Generalized_map/include/CGAL/internal/Generalized_map_group_functors.h index 622edf5fe62..466ba5f6b2b 100644 --- a/Generalized_map/include/CGAL/internal/Generalized_map_group_functors.h +++ b/Generalized_map/include/CGAL/internal/Generalized_map_group_functors.h @@ -279,7 +279,7 @@ struct GMap_degroup_attribute_functor_run // We mark (with mark) all the darts of the i-cell containing adart to // process them exactly once. template -void test_split_attribute_functor_one_dart +void GMap_test_split_attribute_functor_one_dart ( CMap* amap, typename CMap::Dart_handle adart, CGAL::Unique_hash_map::type, unsigned int, typename CMap::Hash_function> & @@ -362,7 +362,7 @@ struct GMap_test_split_attribute_functor_run it=modified_darts.begin(); for ( ; it!=modified_darts.end(); ++it ) { - CGAL::internal::test_split_attribute_functor_one_dart + CGAL::internal::GMap_test_split_attribute_functor_one_dart (amap, *it, found_attributes, mark); } @@ -406,14 +406,14 @@ struct GMap_test_split_attribute_functor_run it=modified_darts.begin(); for ( ; it!=modified_darts.end(); ++it ) { - CGAL::internal::test_split_attribute_functor_one_dart + CGAL::internal::GMap_test_split_attribute_functor_one_dart (amap, *it, found_attributes, mark); } typename std::deque::const_iterator it2=modified_darts2.begin(); for ( ; it2!=modified_darts2.end(); ++it2 ) { - CGAL::internal::test_split_attribute_functor_one_dart + CGAL::internal::GMap_test_split_attribute_functor_one_dart (amap, *it2, found_attributes, mark); } diff --git a/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt b/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt index e9b9d2d7f14..95b4ac0b40d 100644 --- a/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt +++ b/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt @@ -50,6 +50,8 @@ if ( CGAL_FOUND ) ${MAP_VIEWER_LIBRARIES}) # qt5_use_modules(voronoi_3 ${MAP_VIEWER_MODULES}) + create_single_source_cgal_program( "gmap_linear_cell_complex_3.cpp" ) + else() message(STATUS "This program requires the CGAL library, " diff --git a/Linear_cell_complex/include/CGAL/Linear_cell_complex.h b/Linear_cell_complex/include/CGAL/Linear_cell_complex.h index 84870775a67..63416ffc09d 100644 --- a/Linear_cell_complex/include/CGAL/Linear_cell_complex.h +++ b/Linear_cell_complex/include/CGAL/Linear_cell_complex.h @@ -27,6 +27,9 @@ #include #include +#include +#include + namespace CGAL { /** @file Linear_cell_complex.h @@ -110,8 +113,6 @@ namespace CGAL { /// To use previous definition of create_dart methods. using Base::create_dart; - using Base::beta; - using Base::is_free; using Base::attribute; using Base::null_handle; using Base::point_of_vertex_attribute; @@ -457,8 +458,9 @@ namespace CGAL { typename std::vector::iterator it2=it1; for ( ++it2; it2!= it1end; ++it2 ) { - if ( *it1!=*it2 && is_free(*it1, 3) && - is_free(*it2, 3) && + if ( *it1!=*it2 && + !this->template exist_opposite_dart<3>(*it1) && + !this->template exist_opposite_dart<3>(*it2) && are_facets_same_geometry(*it1,beta(*it2, 0)) ) { ++res; @@ -494,7 +496,7 @@ namespace CGAL { { Dart_handle d1 = this->make_edge(); set_vertex_attribute_of_dart(d1,h0); - set_vertex_attribute_of_dart(beta(d1, 2),h1); + set_vertex_attribute_of_dart(this->other_extremity(d1),h1); return d1; } @@ -523,8 +525,8 @@ namespace CGAL { Dart_handle d1 = this->make_combinatorial_polygon(3); set_vertex_attribute_of_dart(d1,h0); - set_vertex_attribute_of_dart(beta(d1, 1),h1); - set_vertex_attribute_of_dart(beta(d1, 0),h2); + set_vertex_attribute_of_dart(this->get_next_dart_in_face(d1),h1); + set_vertex_attribute_of_dart(this->get_previous_dart_in_face(d1),h2); return d1; } @@ -559,9 +561,10 @@ namespace CGAL { Dart_handle d1 = this->make_combinatorial_polygon(4); set_vertex_attribute_of_dart(d1,h0); - set_vertex_attribute_of_dart(beta(d1, 1),h1); - set_vertex_attribute_of_dart(beta(d1, 1, 1),h2); - set_vertex_attribute_of_dart(beta(d1, 0),h3); + set_vertex_attribute_of_dart(this->get_next_dart_in_face(d1),h1); + set_vertex_attribute_of_dart(this->get_next_dart_in_face + (this->get_next_dart_in_face(d1)), h2); + set_vertex_attribute_of_dart(this->get_previous_dart_in_face(d1),h3); return d1; } @@ -838,7 +841,7 @@ namespace CGAL { // Linear_cell_complex using compact container with handle. // No difference with class Linear_cell_complex_base except the default - // template parameters for Refs class. + // template parameters for Refs class which is a combinatorial map. template < unsigned int d_, unsigned int ambient_dim = d_, class Traits_ = Linear_cell_complex_traits, class Items_ = Linear_cell_complex_min_items, @@ -923,6 +926,93 @@ namespace CGAL { }; + // GMap_linear_cell_complex using compact container with handle. + // No difference with class Linear_cell_complex_base except the default + // template parameters for Refs class which is a generalized map. + template < unsigned int d_, unsigned int ambient_dim = d_, + class Traits_ = Linear_cell_complex_traits, + class Items_ = GMap_linear_cell_complex_min_items, + class Alloc_ = CGAL_ALLOCATOR(int), + template + class CMap = Generalized_map_base, + class Storage_ = GMap_linear_cell_complex_storage_1 > + class GMap_linear_cell_complex: public Linear_cell_complex_base, + Storage_> + { + public: + typedef GMap_linear_cell_complex Self; + + typedef Linear_cell_complex_base Base; + + typedef Traits_ Traits; + typedef Items_ Items; + typedef Alloc_ Alloc; + + static const unsigned int ambient_dimension = Base::ambient_dimension; + static const unsigned int dimension = Base::dimension; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Dart_const_handle Dart_const_handle; + typedef typename Base::Helper Helper; + + typedef typename Base::Point Point; + typedef typename Base::Vector Vector; + typedef typename Base::FT FT; + + typedef typename Base::Dart_range Dart_range; + + typedef typename Base::template Attribute_type<0>::type Vertex_attribute; + typedef typename Base::template Attribute_handle<0>::type + Vertex_attribute_handle; + typedef typename Base::template Attribute_const_handle<0>::type + Vertex_attribute_const_handle; + + typedef typename Base::template Attribute_range<0>::type + Vertex_attribute_range; + typedef typename Base::template Attribute_const_range<0>::type + Vertex_attribute_const_range; + + typedef typename Base::size_type size_type; + + typedef typename Base::Use_index Use_index; + typedef typename Base::Storage Storage; + typedef typename Base::Exception_no_more_available_mark + Exception_no_more_available_mark; + + GMap_linear_cell_complex() : Base() + {} + + /** Copy the given linear cell complex into *this. + * Note that both LCC can have different dimensions and/or non void attributes. + * @param alcc the linear cell complex to copy. + * @post *this is valid. + */ + GMap_linear_cell_complex(const Self & alcc) : Base() + { Base::template copy(alcc); } + + template < class LCC2 > + GMap_linear_cell_complex(const LCC2& alcc) + { Base::template copy(alcc);} + + template < class LCC2, typename Converters > + GMap_linear_cell_complex(const LCC2& alcc, Converters& converters) + { Base::template copy(alcc, converters);} + + template < class LCC2, typename Converters, typename Pointconverter > + GMap_linear_cell_complex(const LCC2& alcc, Converters& converters, + const Pointconverter& pointconverter) + { Base::template copy + (alcc, converters, pointconverter);} + + }; + } // namespace CGAL #endif // CGAL_LINEAR_CELL_COMPLEX_H // diff --git a/Linear_cell_complex/include/CGAL/Linear_cell_complex_min_items.h b/Linear_cell_complex/include/CGAL/Linear_cell_complex_min_items.h index 427b16c4561..8bdca276ab8 100644 --- a/Linear_cell_complex/include/CGAL/Linear_cell_complex_min_items.h +++ b/Linear_cell_complex/include/CGAL/Linear_cell_complex_min_items.h @@ -21,6 +21,7 @@ #define CGAL_LINEAR_CELL_COMPLEX_MIN_ITEMS_H 1 #include +#include #include namespace CGAL { @@ -32,7 +33,7 @@ namespace CGAL { /** Minimal items for linear cell complexes. * Linear_cell_complex_min_items defines what is the item class * for a linear cell complex. It provides definitions for attributes - * associated to vertices (containing points), and darts. + * associated to vertices (containing points), and darts. */ template struct Linear_cell_complex_min_items @@ -43,7 +44,26 @@ namespace CGAL { { typedef CGAL::Dart Dart; - typedef Cell_attribute_with_point Vertex_attrib; + typedef Cell_attribute_with_point Vertex_attrib; + typedef CGAL::cpp11::tuple Attributes; + }; + }; + + /** Minimal items for linear cell complexes for GMaps. + * Linear_cell_complex_min_items defines what is the item class + * for a linear cell complex. It provides definitions for attributes + * associated to vertices (containing points), and darts. + */ + template + struct GMap_linear_cell_complex_min_items + { + /// Dart_wrapper defines the type of darts used. + template + struct Dart_wrapper + { + typedef CGAL::GMap_dart Dart; + + typedef Cell_attribute_with_point Vertex_attrib; typedef CGAL::cpp11::tuple Attributes; }; }; diff --git a/Linear_cell_complex/include/CGAL/Linear_cell_complex_storages.h b/Linear_cell_complex/include/CGAL/Linear_cell_complex_storages.h index 8c400255a08..ed17008b036 100644 --- a/Linear_cell_complex/include/CGAL/Linear_cell_complex_storages.h +++ b/Linear_cell_complex/include/CGAL/Linear_cell_complex_storages.h @@ -38,7 +38,7 @@ namespace CGAL { // Copy of Combinatorial_map_storage_1 and add new types related // to geometry (not possible to inherith because we use Self type // as template parameter of Dart_wrapper. If we inherit, Self is not - // the correct type.) + // the correct type). template class Linear_cell_complex_storage_1