From d402dddf2f7a0fe1dff20e79294dc19af110113c Mon Sep 17 00:00:00 2001 From: Sylvain Brandel Date: Thu, 26 Mar 2015 10:02:37 +0100 Subject: [PATCH 1/6] added a new example file to test exceptions --- .../map_3_marks_with_exception.cpp | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 Combinatorial_map/examples/Combinatorial_map/map_3_marks_with_exception.cpp diff --git a/Combinatorial_map/examples/Combinatorial_map/map_3_marks_with_exception.cpp b/Combinatorial_map/examples/Combinatorial_map/map_3_marks_with_exception.cpp new file mode 100644 index 00000000000..c79f8215a57 --- /dev/null +++ b/Combinatorial_map/examples/Combinatorial_map/map_3_marks_with_exception.cpp @@ -0,0 +1,72 @@ +#include +#include +#include +#include +#include + +typedef CGAL::Combinatorial_map<3> CMap_3; +typedef CMap_3::Dart_handle Dart_handle; + +int main() +{ + CMap_3 cm; + + // 1) Reserve a mark. + std::cout << cm.NB_MARKS << " available marks\n"; + + // we try to reserve more marks than available + int marks[cm.NB_MARKS+1]; + for (unsigned int i=0;i(dh1, dh2); + + // 4) Mark the darts belonging to the first tetrahedron. + for (CMap_3::Dart_of_cell_range<3>::iterator + it(cm.darts_of_cell<3>(dh1).begin()), + itend(cm.darts_of_cell<3>(dh1).end()); it!=itend; ++it) + cm.mark(it, mark); + + // 4) Remove the common 2-cell between the two cubes: + // the two tetrahedra are merged. + CGAL::remove_cell(cm, dh1); + + // 5) Thanks to the mark, we know which darts come from the first tetrahedron. + unsigned int res=0; + for (CMap_3::Dart_range::iterator it(cm.darts().begin()), + itend(cm.darts().end()); it!=itend; ++it) + { + if ( cm.is_marked(it, mark) ) + ++res; + } + + std::cout<<"Number of darts from the first tetrahedron: "< Date: Thu, 26 Mar 2015 10:03:42 +0100 Subject: [PATCH 2/6] wip --- .../include/CGAL/Combinatorial_map.h | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map.h b/Combinatorial_map/include/CGAL/Combinatorial_map.h index 0f357852dfd..68a33e9b9c1 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map.h @@ -745,7 +745,7 @@ namespace CGAL { bool is_reserved(int amark) const { CGAL_assertion(amark>=0 && (size_type)amark1 ) { From 41464f142f663dad75f4d756c83ccd6e5ef15ffb Mon Sep 17 00:00:00 2001 From: Sylvain Brandel Date: Wed, 1 Apr 2015 15:36:34 +0200 Subject: [PATCH 3/6] type of boolean marks modified from int to size_type in both Combinatorial_map and Linear_cell_complex --- .../Combinatorial_map/map_3_marks.cpp | 34 ++- .../map_3_marks_with_exception.cpp | 72 ----- .../include/CGAL/Cell_iterators.h | 14 +- .../include/CGAL/Combinatorial_map.h | 267 ++++++++++-------- .../CGAL/Combinatorial_map_basic_operations.h | 72 +++-- .../include/CGAL/Combinatorial_map_functors.h | 8 +- .../CGAL/Combinatorial_map_insertions.h | 18 +- .../CGAL/Combinatorial_map_iterators_base.h | 40 ++- .../CGAL/Combinatorial_map_operations.h | 14 +- .../include/CGAL/Combinatorial_map_storages.h | 6 +- Combinatorial_map/include/CGAL/Dart.h | 18 +- .../include/CGAL/Dart_const_iterators.h | 19 +- .../include/CGAL/Dart_iterators.h | 173 +++++++----- .../Combinatorial_map_group_functors.h | 60 ++-- .../Combinatorial_map_internal_functors.h | 26 +- .../CGAL/internal/Combinatorial_map_sewable.h | 6 +- .../Combinatorial_map_2_test.h | 2 +- .../Combinatorial_map_3_test.h | 2 +- .../Linear_cell_complex_3_subdivision.cpp | 6 +- .../Linear_cell_complex_pqq_subdivision.cpp | 12 +- .../demo/Linear_cell_complex/MainWindow.cpp | 46 +-- .../demo/Linear_cell_complex/MainWindow.h | 6 +- .../linear_cell_complex_3_viewer_vtk.h | 4 +- .../Linear_cell_complex/voronoi_2.cpp | 2 +- .../Linear_cell_complex/voronoi_3.cpp | 2 +- .../include/CGAL/Linear_cell_complex.h | 23 +- .../CGAL/Linear_cell_complex_constructors.h | 2 +- .../CGAL/Linear_cell_complex_storages.h | 6 +- 28 files changed, 536 insertions(+), 424 deletions(-) delete mode 100644 Combinatorial_map/examples/Combinatorial_map/map_3_marks_with_exception.cpp diff --git a/Combinatorial_map/examples/Combinatorial_map/map_3_marks.cpp b/Combinatorial_map/examples/Combinatorial_map/map_3_marks.cpp index 23d7515c94d..d711c8dd111 100644 --- a/Combinatorial_map/examples/Combinatorial_map/map_3_marks.cpp +++ b/Combinatorial_map/examples/Combinatorial_map/map_3_marks.cpp @@ -7,13 +7,43 @@ typedef CGAL::Combinatorial_map<3> CMap_3; typedef CMap_3::Dart_handle Dart_handle; +typedef CMap_3::size_type size_type; + +typedef CMap_3::Exception_mark_is_out_of_border Exception_mark_is_out_of_border; + int main() { CMap_3 cm; + // we try to reserve more marks than available + std::cout << cm.NB_MARKS << " available marks\n"; + size_type marks[cm.NB_MARKS+1]; + for (size_type i=0;i -#include -#include -#include -#include - -typedef CGAL::Combinatorial_map<3> CMap_3; -typedef CMap_3::Dart_handle Dart_handle; - -int main() -{ - CMap_3 cm; - - // 1) Reserve a mark. - std::cout << cm.NB_MARKS << " available marks\n"; - - // we try to reserve more marks than available - int marks[cm.NB_MARKS+1]; - for (unsigned int i=0;i(dh1, dh2); - - // 4) Mark the darts belonging to the first tetrahedron. - for (CMap_3::Dart_of_cell_range<3>::iterator - it(cm.darts_of_cell<3>(dh1).begin()), - itend(cm.darts_of_cell<3>(dh1).end()); it!=itend; ++it) - cm.mark(it, mark); - - // 4) Remove the common 2-cell between the two cubes: - // the two tetrahedra are merged. - CGAL::remove_cell(cm, dh1); - - // 5) Thanks to the mark, we know which darts come from the first tetrahedron. - unsigned int res=0; - for (CMap_3::Dart_range::iterator it(cm.darts().begin()), - itend(cm.darts().end()); it!=itend; ++it) - { - if ( cm.is_marked(it, mark) ) - ++res; - } - - std::cout<<"Number of darts from the first tetrahedron: "<mmap->free_mark(mcell_mark_number); this->mmap->free_mark(this->mmark_number); - this->mcell_mark_number = -1; // To avoid basic class to try to unmark darts. - this->mmark_number = -1; // To avoid basic class to try to unmark darts. + this->mcell_mark_number = Map::MARK_ERROR; // To avoid basic class to try to unmark darts. + this->mmark_number = Map::MARK_ERROR; // To avoid basic class to try to unmark darts. } /// Copy constructor. @@ -163,7 +163,7 @@ namespace CGAL { private: /// A mark used to mark treated cells. - int mcell_mark_number; + typename Map::size_type mcell_mark_number; }; //**************************************************************************** /* Class CMap_cell_iterator: to iterate onto the @@ -217,7 +217,7 @@ namespace CGAL { if (this->mmap->get_number_of_times_mark_reserved(mmark_number)==1) unmark_treated_darts(); this->mmap->free_mark(mmark_number); - this->mmark_number = -1; // To avoid basic class to try to unmark darts. + this->mmark_number = Map::MARK_ERROR; // To avoid basic class to try to unmark darts. } /// Copy constructor. @@ -268,7 +268,7 @@ namespace CGAL { private: /// A mark used to mark treated cells. - int mmark_number; + typename Map::size_type mmark_number; }; //**************************************************************************** /* Class CMap_cell_iterator, @@ -333,7 +333,7 @@ namespace CGAL { if (this->mmap->get_number_of_times_mark_reserved(mmark_number)==1) unmark_treated_darts(); this->mmap->free_mark(mmark_number); - this->mmark_number = -1; // To avoid basic class to try to unmark darts. + this->mmark_number = Map::MARK_ERROR; // To avoid basic class to try to unmark darts. } /// Copy constructor. @@ -384,7 +384,7 @@ namespace CGAL { private: /// A mark used to mark treated cells. - int mmark_number; + typename Map::size_type mmark_number; }; //**************************************************************************** /* Class CMap_one_dart_per_incident_cell_iterator: to iterate diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map.h b/Combinatorial_map/include/CGAL/Combinatorial_map.h index 68a33e9b9c1..dab4fcdb061 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map.h @@ -47,6 +47,7 @@ namespace CGAL { * Definition of generic dD Combinatorial map. */ + /** Generic definition of combinatorial map in dD. * The Combinatorial_map class describes an dD combinatorial map. It allows * mainly to create darts, to use marks onto these darts, to get and set @@ -95,6 +96,8 @@ namespace CGAL { typedef typename Base::Use_index Use_index; static const size_type NB_MARKS = Base::NB_MARKS; + // to fix the use of -1 to test unused marks in several algorithms + static const size_type MARK_ERROR = NB_MARKS; static const unsigned int dimension = Base::dimension; typedef typename Base::Null_handle_type Null_handle_type; @@ -143,6 +146,8 @@ namespace CGAL { public Base::template Attribute_const_range {}; + class Exception_mark_is_out_of_border {}; + public: /** Default Combinatorial_map constructor. * The map is empty. @@ -161,7 +166,7 @@ namespace CGAL { for ( size_type i = 0; i < NB_MARKS; ++i) { - this->mfree_marks_stack[i] = (int)i; + this->mfree_marks_stack[i] = i; this->mindex_marks[i] = i; this->mnb_marked_darts[i] = 0; this->mnb_times_reserved_marks[i] = 0; @@ -336,7 +341,7 @@ namespace CGAL { void clear() { mdarts.clear(); - for ( unsigned int i = 0; i < NB_MARKS; ++i) + for ( size_type i = 0; i < NB_MARKS; ++i) this->mnb_marked_darts[i] = 0; internal::Clear_all::run(mattribute_containers); @@ -454,7 +459,7 @@ namespace CGAL { void erase_dart(Dart_handle adart) { // 1) We update the number of marked darts. - for ( unsigned int i = 0; i < mnb_used_marks; ++i) + for ( size_type i = 0; i < mnb_used_marks; ++i) { if (is_marked(adart, mused_marks_stack[i])) --mnb_marked_darts[mused_marks_stack[i]]; @@ -742,31 +747,31 @@ namespace CGAL { /** Test if a given mark is reserved. * @return true iff the mark is reserved (ie in used). */ - bool is_reserved(int amark) const + bool is_reserved(size_type amark) const { - CGAL_assertion(amark>=0 && (size_type)amark=0 && amark marks(dimension+1); + std::vector marks(dimension+1); for ( i=0; i<=dimension; ++i) - marks[i] = -1; + marks[i] = MARK_ERROR; Helper::template Foreach_enabled_attributes >:: @@ -1098,7 +1105,7 @@ namespace CGAL { if ( !valid ) { // We continue the traversal to mark all the darts. for ( i=0; i<=dimension; ++i) - if (marks[i]!=-1) mark(it,marks[i]); + if (marks[i]!=MARK_ERROR) mark(it,marks[i]); } else { @@ -1171,7 +1178,7 @@ namespace CGAL { } } for ( i=0; i<=dimension; ++i) - if ( marks[i]!=-1 ) + if ( marks[i]!=MARK_ERROR ) { CGAL_assertion( is_whole_map_marked(marks[i]) ); free_mark(marks[i]); @@ -1183,9 +1190,9 @@ namespace CGAL { /// correct invalid attributes in the map void correct_invalid_attributes() { - std::vector marks(dimension+1); + std::vector marks(dimension+1); for ( unsigned int i=0; i<=dimension; ++i) - marks[i] = -1; + marks[i] = MARK_ERROR; Helper::template Foreach_enabled_attributes >:: @@ -1200,7 +1207,7 @@ namespace CGAL { } for ( unsigned int i=0; i<=dimension; ++i) - if ( marks[i]!=-1 ) + if ( marks[i]!=MARK_ERROR ) { CGAL_assertion( is_whole_map_marked(marks[i]) ); free_mark(marks[i]); @@ -1257,7 +1264,7 @@ namespace CGAL { CGAL_static_assertion( (boost::is_same::value) ); unsigned int nb = 0; - int amark = get_new_mark(); + size_type amark = get_new_mark(); for ( typename Dart_range::const_iterator it1(darts().begin()), itend(darts().end()); it1!=itend; ++it1) { @@ -1843,7 +1850,7 @@ namespace CGAL { } else { - int m = get_new_mark(); + size_type m = get_new_mark(); std::deque dartv; for ( CGAL::CMap_dart_iterator_basic_of_cell it(*this, adart1, m); it.cont(); ++it ) @@ -1937,7 +1944,7 @@ namespace CGAL { return; } - int m = get_new_mark(); + size_type m = get_new_mark(); std::deque dartv; for ( CGAL::CMap_dart_iterator_basic_of_cell it(*this, adart1, m); it.cont(); ++it ) @@ -1946,8 +1953,18 @@ namespace CGAL { dartv.push_back(it); } - int mark = get_new_mark(); - CGAL_assertion( mark!=-1 ); + // size_type mark = get_new_mark(); + // CGAL_assertion( mark!=-1 ); + size_type mark; + try + { + mark = get_new_mark(); + } + catch (Exception_mark_is_out_of_border e) + { + std::cerr<<"No more free mark, exit."< I1(*this, adart1, mark); @@ -2009,7 +2026,7 @@ namespace CGAL { return; } - int m = get_new_mark(); + size_type m = get_new_mark(); std::deque dartv; for ( CGAL::CMap_dart_iterator_basic_of_cell it(*this, adart1, m); it.cont(); ++it ) @@ -2018,8 +2035,18 @@ namespace CGAL { dartv.push_back(it); } - int mark = get_new_mark(); - CGAL_assertion( mark!=-1 ); + // int mark = get_new_mark(); + // CGAL_assertion( mark!=-1 ); + size_type mark; + try + { + mark = get_new_mark(); + } + catch (Exception_mark_is_out_of_border e) + { + std::cerr<<"No more free mark, exit."< I1(*this, adart1, mark); @@ -2075,8 +2102,18 @@ namespace CGAL { CGAL_assertion( 2<=i && i<=dimension ); CGAL_assertion( (is_sewable(adart1,adart2)) ); - int mark=get_new_mark(); - CGAL_assertion( mark!=-1 ); + // int mark=get_new_mark(); + // CGAL_assertion( mark!=-1 ); + size_type mark; + try + { + mark = get_new_mark(); + } + catch (Exception_mark_is_out_of_border e) + { + std::cerr<<"No more free mark, exit."< I1(*this, adart1, mark); @@ -2150,7 +2187,7 @@ namespace CGAL { { CGAL_assertion( !this->template is_free<1>(adart) ); - int m = get_new_mark(); + size_type m = get_new_mark(); std::deque dartv; for ( CGAL::CMap_dart_iterator_basic_of_cell it(*this, adart, m); it.cont(); ++it ) @@ -2228,7 +2265,7 @@ namespace CGAL { { CGAL_assertion( !this->template is_free<0>(adart) ); - int m=get_new_mark(); + size_type m=get_new_mark(); std::deque dartv; std::deque modified_darts; std::deque modified_darts2; @@ -2282,7 +2319,7 @@ namespace CGAL { { CGAL_assertion( !this->template is_free<1>(adart) ); - int m = get_new_mark(); + size_type m = get_new_mark(); std::deque dartv; std::deque modified_darts; std::deque modified_darts2; @@ -2417,23 +2454,23 @@ namespace CGAL { * @return a vector containing the number of cells. */ std::vector - count_marked_cells(int amark, const std::vector& acells) const + count_marked_cells(size_type amark, const std::vector& acells) const { std::vector res(dimension+2); - std::vector marks(dimension+2); + std::vector marks(dimension+2); // Initialization of the result for ( unsigned int i=0; i& acells) const { std::vector res; - int m = get_new_mark(); + size_type m = get_new_mark(); negate_mark(m); // We mark all the cells. res = count_marked_cells(m, acells); @@ -2536,10 +2573,10 @@ namespace CGAL { * @param amark the mark. * @return the mask associated to mark amark. */ - bool get_mask_mark(int amark) const + bool get_mask_mark(size_type amark) const { - CGAL_assertion(amark>=0 && (size_type)amark=0 && amark, CGAL::CMap_dart_const_iterator_basic_of_orbit > Base; - Dart_of_orbit_basic_range(Self &amap, Dart_handle adart, int amark=-1): + Dart_of_orbit_basic_range(Self &amap, Dart_handle adart, size_type amark=MARK_ERROR): Base(amap, adart, amark) {} }; @@ -2596,7 +2633,7 @@ namespace CGAL { Base; Dart_of_orbit_basic_const_range(const Self &amap, Dart_const_handle - adart, int amark=-1): + adart, size_type amark=MARK_ERROR): Base(amap, adart, amark) {} }; @@ -2640,12 +2677,12 @@ namespace CGAL { //-------------------------------------------------------------------------- template Dart_of_orbit_basic_range darts_of_orbit_basic(Dart_handle adart, - int amark=-1) + size_type amark=MARK_ERROR) { return Dart_of_orbit_basic_range(*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_orbit_basic_const_range - darts_of_orbit_basic(Dart_const_handle adart, int amark=-1) const + darts_of_orbit_basic(Dart_const_handle adart, size_type amark=MARK_ERROR) const { return Dart_of_orbit_basic_const_range(*this,adart,amark); } //************************************************************************** #else @@ -2666,7 +2703,7 @@ namespace CGAL { B6,B7,B8,B9> > Base; Dart_of_orbit_basic_range(Self &amap, Dart_handle adart, - int /*amark*/=-1): + size_type /*amark*/=MARK_ERROR): Base(amap, adart) {} }; @@ -2684,7 +2721,7 @@ namespace CGAL { > Base; Dart_of_orbit_basic_const_range(const Self &amap, - Dart_const_handle adart, int amark=-1): + Dart_const_handle adart, size_type amark=MARK_ERROR): Base(amap, adart, amark) {} }; @@ -2830,104 +2867,104 @@ namespace CGAL { //-------------------------------------------------------------------------- // Basic versions Dart_of_orbit_basic_range<> darts_of_orbit_basic(Dart_handle adart, - int amark=-1) + size_type amark=MARK_ERROR) { return Dart_of_orbit_basic_range<>(*this,adart,amark); } //-------------------------------------------------------------------------- Dart_of_orbit_basic_const_range<> darts_of_orbit_basic - (Dart_const_handle adart,int amark=-1) const + (Dart_const_handle adart,size_type amark=MARK_ERROR) const { return Dart_of_orbit_basic_const_range<>(*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_orbit_basic_range darts_of_orbit_basic(Dart_handle adart, - int amark=-1) + size_type amark=MARK_ERROR) { return Dart_of_orbit_basic_range(*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_orbit_basic_const_range darts_of_orbit_basic - (Dart_const_handle adart, int amark=-1) const + (Dart_const_handle adart, size_type amark=MARK_ERROR) const { return Dart_of_orbit_basic_const_range(*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_orbit_basic_range darts_of_orbit_basic(Dart_handle adart, - int amark=-1) + size_type amark=MARK_ERROR) { return Dart_of_orbit_basic_range(*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_orbit_basic_const_range darts_of_orbit_basic - (Dart_const_handle adart, int amark=-1) const + (Dart_const_handle adart, size_type amark=MARK_ERROR) const { return Dart_of_orbit_basic_const_range(*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_orbit_basic_range darts_of_orbit_basic(Dart_handle adart, - int amark=-1) + size_type amark=MARK_ERROR) { return Dart_of_orbit_basic_range(*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_orbit_basic_const_range darts_of_orbit_basic - (Dart_const_handle adart, int amark=-1) const + (Dart_const_handle adart, size_type amark=MARK_ERROR) const { return Dart_of_orbit_basic_const_range(*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_orbit_basic_range darts_of_orbit_basic - (Dart_handle adart, int amark=-1) + (Dart_handle adart, size_type amark=MARK_ERROR) { return Dart_of_orbit_basic_range(*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_orbit_basic_const_range - darts_of_orbit_basic(Dart_const_handle adart, int amark=-1) const + darts_of_orbit_basic(Dart_const_handle adart, size_type amark=MARK_ERROR) const { return Dart_of_orbit_basic_const_range(*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_orbit_basic_range darts_of_orbit_basic - (Dart_handle adart, int amark=-1) + (Dart_handle adart, size_type amark=MARK_ERROR) { return Dart_of_orbit_basic_range(*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_orbit_basic_const_range - darts_of_orbit_basic(Dart_const_handle adart, int amark=-1) const + darts_of_orbit_basic(Dart_const_handle adart, size_type amark=MARK_ERROR) const { return Dart_of_orbit_basic_const_range (*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_orbit_basic_range darts_of_orbit_basic - (Dart_handle adart, int amark=-1) + (Dart_handle adart, size_type amark=MARK_ERROR) { return Dart_of_orbit_basic_range(*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_orbit_basic_const_range - darts_of_orbit_basic(Dart_const_handle adart, int amark=-1) const + darts_of_orbit_basic(Dart_const_handle adart, size_type amark=MARK_ERROR) const { return Dart_of_orbit_basic_const_range (*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_orbit_basic_range darts_of_orbit_basic - (Dart_handle adart, int amark=-1) + (Dart_handle adart, size_type amark=MARK_ERROR) { return Dart_of_orbit_basic_range (*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_orbit_basic_const_range - darts_of_orbit_basic(Dart_const_handle adart, int amark=-1) const + darts_of_orbit_basic(Dart_const_handle adart, size_type amark=MARK_ERROR) const { return Dart_of_orbit_basic_const_range (*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_orbit_basic_range darts_of_orbit - (Dart_handle adart, int amark=-1) + (Dart_handle adart, size_type amark=MARK_ERROR) { return Dart_of_orbit_basic_range (*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_orbit_basic_const_range - darts_of_orbit_basic(Dart_const_handle adart, int amark=-1) const + darts_of_orbit_basic(Dart_const_handle adart, size_type amark=MARK_ERROR) const { return Dart_of_orbit_basic_const_range (*this,adart,amark); } //-------------------------------------------------------------------------- @@ -2935,7 +2972,7 @@ namespace CGAL { unsigned int B5,unsigned int B6,unsigned int B7,unsigned int B8, unsigned int B9> Dart_of_orbit_basic_range - darts_of_orbit_basic(Dart_handle adart, int amark=-1) + darts_of_orbit_basic(Dart_handle adart, size_type amark=MARK_ERROR) { return Dart_of_orbit_basic_range (*this,adart,amark); } //-------------------------------------------------------------------------- @@ -2943,7 +2980,7 @@ namespace CGAL { unsigned int B5,unsigned int B6,unsigned int B7,unsigned int B8, unsigned int B9> Dart_of_orbit_basic_const_range - darts_of_orbit_basic(Dart_const_handle adart, int amark=-1) const + darts_of_orbit_basic(Dart_const_handle adart, size_type amark=MARK_ERROR) const { return Dart_of_orbit_basic_const_range (*this,adart,amark); } //************************************************************************** @@ -2959,7 +2996,7 @@ namespace CGAL { , CGAL::CMap_dart_const_iterator_basic_of_cell > Base; - Dart_of_cell_basic_range(Self &amap, Dart_handle adart, int amark=-1) : + Dart_of_cell_basic_range(Self &amap, Dart_handle adart, size_type amark=MARK_ERROR) : Base(amap, adart, amark) {} }; @@ -2973,7 +3010,7 @@ namespace CGAL { > Base; Dart_of_cell_basic_const_range(const Self &amap, Dart_const_handle adart, - int amark=-1) : + size_type amark=MARK_ERROR) : Base(amap, adart, amark) {} }; @@ -3009,22 +3046,22 @@ namespace CGAL { /// @return a range on all the darts of the given i-cell template Dart_of_cell_basic_range darts_of_cell_basic(Dart_handle adart, - int amark=-1) + size_type amark=MARK_ERROR) { return Dart_of_cell_basic_range(*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_cell_basic_const_range darts_of_cell_basic - (Dart_const_handle adart, int amark=-1) const + (Dart_const_handle adart, size_type amark=MARK_ERROR) const { return Dart_of_cell_basic_const_range(*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_cell_basic_range - darts_of_cell_basic(Dart_handle adart, int amark=-1) + darts_of_cell_basic(Dart_handle adart, size_type amark=MARK_ERROR) { return darts_of_cell_basic(adart,amark); } //-------------------------------------------------------------------------- template Dart_of_cell_basic_const_range - darts_of_cell_basic(Dart_const_handle adart, int amark=-1) const + darts_of_cell_basic(Dart_const_handle adart, size_type amark=MARK_ERROR) const { return darts_of_cell_basic(adart,amark); } //-------------------------------------------------------------------------- template @@ -3055,7 +3092,7 @@ namespace CGAL { CGAL::CMap_dart_const_iterator_basic_of_involution > Base; Dart_of_involution_basic_range(Self &amap, Dart_handle adart, - int amark=-1): + size_type amark=MARK_ERROR): Base(amap, adart, amark) {} }; @@ -3071,30 +3108,30 @@ namespace CGAL { Dart_of_involution_basic_const_range(const Self &amap, Dart_const_handle adart, - int amark=-1) : + size_type amark=MARK_ERROR) : Base(amap, adart, amark) {} }; //************************************************************************** template Dart_of_involution_basic_range - darts_of_involution_basic(Dart_handle adart, int amark=-1) + darts_of_involution_basic(Dart_handle adart, size_type amark=MARK_ERROR) { return Dart_of_involution_basic_range(*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_involution_basic_const_range - darts_of_involution_basic(Dart_const_handle adart, int amark=-1) const + darts_of_involution_basic(Dart_const_handle adart, size_type amark=MARK_ERROR) const { return Dart_of_involution_basic_const_range(*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_involution_basic_range - darts_of_involution_basic(Dart_handle adart, int amark=-1) + darts_of_involution_basic(Dart_handle adart, size_type amark=MARK_ERROR) { return Dart_of_involution_basic_range (*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_involution_basic_const_range - darts_of_involution_basic(Dart_const_handle adart, int amark=-1) const + darts_of_involution_basic(Dart_const_handle adart, size_type amark=MARK_ERROR) const { return Dart_of_involution_basic_const_range (*this,adart,amark); } //************************************************************************** @@ -3110,7 +3147,7 @@ namespace CGAL { Base; Dart_of_involution_inv_basic_range(Self &amap, Dart_handle adart, - int amark=-1): + size_type amark=MARK_ERROR): Base(amap, adart, amark) {} }; @@ -3127,31 +3164,31 @@ namespace CGAL { Dart_of_involution_inv_basic_const_range(const Self &amap, Dart_const_handle adart, - int amark=-1) : + size_type amark=MARK_ERROR) : Base(amap, adart, amark) {} }; //************************************************************************** template Dart_of_involution_inv_basic_range - darts_of_involution_inv_basic(Dart_handle adart, int amark=-1) + darts_of_involution_inv_basic(Dart_handle adart, size_type amark=MARK_ERROR) { return Dart_of_involution_inv_basic_range(*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_involution_inv_basic_const_range - darts_of_involution_inv_basic(Dart_const_handle adart, int amark=-1) const + darts_of_involution_inv_basic(Dart_const_handle adart, size_type amark=MARK_ERROR) const { return Dart_of_involution_inv_basic_const_range (*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_involution_inv_basic_range - darts_of_involution_inv_basic(Dart_handle adart, int amark=-1) + darts_of_involution_inv_basic(Dart_handle adart, size_type amark=MARK_ERROR) { return Dart_of_involution_inv_basic_range (*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_involution_inv_basic_const_range - darts_of_involution_inv_basic(Dart_const_handle adart, int amark=-1) const + darts_of_involution_inv_basic(Dart_const_handle adart, size_type amark=MARK_ERROR) const { return Dart_of_involution_inv_basic_const_range (*this,adart,amark); } //************************************************************************** @@ -3510,8 +3547,8 @@ namespace CGAL { std::deque< Dart_const_handle > toTreat1; std::deque< typename Map2::Dart_const_handle > toTreat2; - int m1 = get_new_mark(); - int m2 = map2.get_new_mark(); + size_type m1 = get_new_mark(); + size_type m2 = map2.get_new_mark(); toTreat1.push_back(dh1); toTreat2.push_back(dh2); @@ -3727,10 +3764,10 @@ namespace CGAL { mutable size_type mindex_marks[NB_MARKS]; /// "Stack" of free marks. - mutable int mfree_marks_stack[NB_MARKS]; + mutable size_type mfree_marks_stack[NB_MARKS]; /// "Stack" of used marks. - mutable int mused_marks_stack[NB_MARKS]; + mutable size_type mused_marks_stack[NB_MARKS]; /// Number of marked darts for each used marks. mutable size_type mnb_marked_darts[NB_MARKS]; diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map_basic_operations.h b/Combinatorial_map/include/CGAL/Combinatorial_map_basic_operations.h index 2e197858b91..a9f468f56b8 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map_basic_operations.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map_basic_operations.h @@ -61,7 +61,7 @@ namespace CGAL template < class Map, class Iterator > bool is_whole_orbit_marked(const Map & amap, typename Map::Dart_const_handle adart, - int amark) + typename Map::size_type amark) { CGAL_static_assertion( (boost::is_same::value) ); @@ -84,7 +84,7 @@ namespace CGAL template < class Map, class Iterator > bool is_whole_orbit_unmarked(const Map & amap, typename Map::Dart_const_handle adart, - int amark) + typename Map::size_type amark) { amap.negate_mark(amark); bool res=CGAL::is_whole_orbit_marked(amap, adart, amark); @@ -102,7 +102,7 @@ namespace CGAL template < class Map, class Iterator > typename Map::size_type mark_orbit(const Map & amap, typename Map::Dart_const_handle adart, - int amark) + typename Map::size_type amark) { CGAL_static_assertion( (boost::is_same::value) ); @@ -130,7 +130,7 @@ namespace CGAL template < class Map, class Iterator > typename Map::size_type unmark_orbit(const Map & amap, typename Map::Dart_const_handle adart, - int amark) + typename Map::size_type amark) { amap.negate_mark(amark); typename Map::size_type @@ -173,7 +173,7 @@ namespace CGAL template < class Map, unsigned int i, unsigned int d> bool is_whole_cell_marked(const Map & amap, typename Map::Dart_const_handle adart, - int amark) + typename Map::size_type amark) { return CGAL::is_whole_orbit_marked::const_iterator> @@ -183,7 +183,7 @@ namespace CGAL template < class Map, unsigned int i> bool is_whole_cell_marked(const Map & amap, typename Map::Dart_const_handle adart, - int amark) + typename Map::size_type amark) { return CGAL::is_whole_cell_marked(amap,adart,amark); } @@ -197,7 +197,7 @@ namespace CGAL template < class Map, unsigned int i, unsigned int d > bool is_whole_cell_unmarked(const Map & amap, typename Map::Dart_const_handle adart, - int amark) + typename Map::size_type amark) { return CGAL::is_whole_orbit_unmarked::iterator> @@ -207,7 +207,7 @@ namespace CGAL template < class Map, unsigned int i> bool is_whole_cell_unmarked(const Map & amap, typename Map::Dart_const_handle adart, - int amark) + typename Map::size_type amark) { return CGAL::is_whole_cell_unmarked (amap,adart,amark); @@ -223,7 +223,7 @@ namespace CGAL template < class Map, unsigned int i, unsigned int d > typename Map::size_type mark_cell(const Map & amap, typename Map::Dart_const_handle adart, - int amark) + typename Map::size_type amark) { return CGAL::mark_orbit::const_iterator> (amap, adart, amark); } @@ -231,7 +231,7 @@ namespace CGAL template < class Map, unsigned int i> typename Map::size_type mark_cell(const Map & amap, typename Map::Dart_const_handle adart, - int amark) + typename Map::size_type amark) { return CGAL::mark_cell(amap, adart, amark);} /** Unmark a given orbit with a given mark. @@ -244,7 +244,7 @@ namespace CGAL template < class Map, unsigned int i, unsigned int d > typename Map::size_type unmark_cell(const Map & amap, typename Map::Dart_handle adart, - int amark) + typename Map::size_type amark) { return CGAL::unmark_orbit::const_iterator> (amap, adart, amark);} @@ -252,7 +252,7 @@ namespace CGAL template < class Map, unsigned int i > typename Map::size_type unmark_cell(const Map & amap, typename Map::Dart_handle adart, - int amark) + typename Map::size_type amark) { return CGAL::unmark_cell(amap, adart, amark); } /** Compute the degree of a given i-cell c. @@ -268,9 +268,27 @@ namespace CGAL CGAL_assertion(adart != NULL); typename Map::size_type nbIncident = 0; - int mark = amap.get_new_mark(); - int treated = amap.get_new_mark(); - CGAL_assume(mark != -1); CGAL_assume( treated != -1); + typename Map::size_type mark; + typename Map::size_type treated; + // CGAL_assume(mark != -1); CGAL_assume( treated != -1); + try + { + mark = amap.get_new_mark(); + } + catch (typename Map::Exception_mark_is_out_of_border e) + { + std::cerr<<"No more free mark, exit."<::const_iterator it(amap, adart, mark); @@ -316,9 +334,27 @@ namespace CGAL CGAL_assertion(adart != NULL); typename Map::size_type nbIncident = 0; - int mark = amap.get_new_mark(); - int treated = amap.get_new_mark(); - CGAL_assume(mark != -1); CGAL_assume( treated != -1); + typename Map::size_type mark; + typename Map::size_type treated; + // CGAL_assume(mark != -1); CGAL_assume( treated != -1); + try + { + mark = amap.get_new_mark(); + } + catch (typename Map::Exception_mark_is_out_of_border e) + { + std::cerr<<"No more free mark, exit."<::const_iterator it(amap, adart, mark); diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map_functors.h b/Combinatorial_map/include/CGAL/Combinatorial_map_functors.h index cbdef1f5945..2cd89014262 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map_functors.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map_functors.h @@ -57,8 +57,10 @@ namespace CGAL template struct Reserve_mark_functor { + typedef typename CMap::size_type size_type; + template - static void run(const CMap* amap, std::vector* marks) + static void run(const CMap* amap, std::vector* marks) { (*marks)[i] = amap->get_new_mark(); } }; // **************************************************************************** @@ -86,7 +88,9 @@ struct Test_is_valid_attribute_functor static bool run(const CMap* amap, typename CMap::Dart_const_handle adart) { - int mark=amap->get_new_mark(); + typedef typename CMap::size_type size_type; + + size_type mark=amap->get_new_mark(); bool res = true; CGAL::internal::Test_is_valid_attribute_functor:: run(amap, adart, mark, &res); diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map_insertions.h b/Combinatorial_map/include/CGAL/Combinatorial_map_insertions.h index 7466c507035..613188a498e 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map_insertions.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map_insertions.h @@ -43,11 +43,11 @@ insert_cell_0_in_cell_1( CMap& amap, typename CMap::Dart_handle adart, bool update_attributes=true ) { typename CMap::Dart_handle d1, d2; - int mark=amap.get_new_mark(); + typename CMap::size_type mark=amap.get_new_mark(); // 1) We store all the darts of the edge. std::deque vect; - int m=amap.get_new_mark(); + typename CMap::size_type m=amap.get_new_mark(); { for ( typename CMap::template Dart_of_cell_basic_range<1>::iterator it=amap.template darts_of_cell_basic<1>(adart, m).begin(); @@ -144,7 +144,7 @@ insert_cell_0_in_cell_2( CMap& amap, typename CMap::Dart_handle adart, first = amap.template beta<0>(first); // Mark used to mark darts already treated. - int treated = amap.get_new_mark(); + typename CMap::size_type treated = amap.get_new_mark(); // Stack of marked darts std::deque tounmark; @@ -296,7 +296,7 @@ insert_dangling_cell_1_in_cell_2( CMap& amap, Attribute_handle<0>::type ah=CMap::null_handle, bool update_attributes=true ) { - int mark1 = amap.get_new_mark(); + typename CMap::size_type mark1 = amap.get_new_mark(); std::deque to_unmark; { for ( CMap_dart_iterator_basic_of_cell it(amap,adart1,mark1); @@ -311,7 +311,7 @@ insert_dangling_cell_1_in_cell_2( CMap& amap, typename CMap::Dart_handle d2 = amap.null_handle; unsigned int s1 = 0; - int treated=amap.get_new_mark(); + typename CMap::size_type treated=amap.get_new_mark(); CGAL::CMap_dart_iterator_basic_of_involution it1(amap, adart1, treated); @@ -426,13 +426,13 @@ insert_cell_1_in_cell_2(CMap& amap, CGAL_assertion(is_insertable_cell_1_in_cell_2(amap, adart1, adart2)); - int m1=amap.get_new_mark(); + typename CMap::size_type m1=amap.get_new_mark(); CGAL::CMap_dart_iterator_basic_of_involution it1(amap, adart1, m1); - int m2=amap.get_new_mark(); + typename CMap::size_type m2=amap.get_new_mark(); CGAL::CMap_dart_iterator_basic_of_involution it2(amap, adart2, m2); - int mark1=amap.get_new_mark(); + typename CMap::size_type mark1=amap.get_new_mark(); std::deque to_unmark; { for ( CGAL::CMap_dart_iterator_basic_of_cell it(amap,adart1,mark1); @@ -447,7 +447,7 @@ insert_cell_1_in_cell_2(CMap& amap, typename CMap::Dart_handle d2=amap.null_handle; unsigned int s1=0; - int treated=amap.get_new_mark(); + typename CMap::size_type treated=amap.get_new_mark(); for ( ; it1.cont(); ++it1, ++it2) { diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map_iterators_base.h b/Combinatorial_map/include/CGAL/Combinatorial_map_iterators_base.h index ff5e51719b9..c328bb0d00d 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map_iterators_base.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map_iterators_base.h @@ -96,6 +96,8 @@ namespace CGAL { /// true iff this iterator is basic typedef Tag_true Basic_iterator; + typedef typename Map::size_type size_type; + public: /// Main constructor. CMap_dart_iterator(Map& amap, Dart_handle adart): @@ -150,7 +152,7 @@ namespace CGAL { protected: /// test if adart->beta(ai) exists and is not marked for amark - bool is_unmarked(Dart_handle adart, unsigned int ai, unsigned amark) const + bool is_unmarked(Dart_handle adart, unsigned int ai, size_type amark) const { return #ifdef CGAL_CMAP_DEPRECATED !mmap->is_free(adart,ai) && // Pb with static null_dart_handle for windows @@ -164,7 +166,7 @@ namespace CGAL { /// test if adart->beta(ai)->beta(aj) exists and is not marked for amark bool is_unmarked2(Dart_handle adart, unsigned int ai, unsigned int aj, - unsigned amark) const + typename Map::size_type amark) const { return #ifdef CGAL_CMAP_DEPRECATED exist_betaij(adart, ai, aj) && // Pb with static null_dart_handle for windows @@ -200,12 +202,14 @@ namespace CGAL { typedef Tag_true Use_mark; + typedef typename Map::size_type size_type; + CGAL_static_assertion( (Bi<=Map::dimension && boost::is_same::value) ); public: /// Main constructor. - CMap_extend_iterator(Map& amap, Dart_handle adart, int amark): + CMap_extend_iterator(Map& amap, Dart_handle adart, size_type amark): Base(amap, adart), mmark_number(amark), minitial_dart(adart) @@ -226,7 +230,7 @@ namespace CGAL { /// Rewind of the iterator to its beginning. void rewind() { - CGAL_assertion(mmark_number != -1); + CGAL_assertion(mmark_number != Map::MARK_ERROR); Base::operator= ( Base(*this->mmap,minitial_dart) ); mto_treat = std::queue(); this->mmap->mark(minitial_dart, mmark_number); @@ -242,7 +246,7 @@ namespace CGAL { /// Prefix ++ operator. Self& operator++() { - CGAL_assertion(mmark_number != -1); + CGAL_assertion(mmark_number != Map::MARK_ERROR); CGAL_assertion(this->cont()); do @@ -298,7 +302,7 @@ namespace CGAL { std::queue mto_treat; /// Index of the used mark. - int mmark_number; + size_type mmark_number; /// Initial dart Dart_handle minitial_dart; @@ -320,8 +324,10 @@ namespace CGAL { typedef Tag_true Use_mark; + typedef typename Map::size_type size_type; + /// Main constructor. - CMap_extend_iterator(Map& amap, Dart_handle adart, int amark): + CMap_extend_iterator(Map& amap, Dart_handle adart, size_type amark): Base(amap, adart, amark) { if ( this->minitial_dart!=amap.null_handle && @@ -336,7 +342,7 @@ namespace CGAL { /// Rewind of the iterator to its beginning. void rewind() { - CGAL_assertion(this->mmark_number != -1); + CGAL_assertion(this->mmark_number != Map::MARK_ERROR); Base::rewind(); if ( !this->mmap->is_free(this->minitial_dart, Bi) && this->mmap->beta(this->minitial_dart, Bi)!=this->minitial_dart ) @@ -393,6 +399,8 @@ namespace CGAL { /// True iff this iterator is basic typedef Tag_false Basic_iterator; + typedef typename Map::size_type size_type; + CGAL_static_assertion( (boost::is_same::value) ); @@ -404,12 +412,12 @@ namespace CGAL { /// Destructor. ~CMap_non_basic_iterator() { - CGAL_assertion( this->mmark_number!=-1 ); + CGAL_assertion( this->mmark_number!=Map::MARK_ERROR ); if (this->mmap->get_number_of_times_mark_reserved (this->mmark_number)==1) unmark_treated_darts(); this->mmap->free_mark(this->mmark_number); - this->mmark_number = -1; // To avoid basic class to try to unmark darts. + this->mmark_number = Map::MARK_ERROR; // To avoid basic class to try to unmark darts. } /// Copy constructor. @@ -426,7 +434,7 @@ namespace CGAL { (this->mmark_number)==1) unmark_treated_darts(); this->mmap->free_mark(this->mmark_number); - this->mmark_number = -1; + this->mmark_number = Map::MARK_ERROR; Base::operator=(aiterator); this->mmap->share_a_mark(this->mmark_number); @@ -522,7 +530,10 @@ namespace CGAL { typedef CMap_range Base_cmap_range; typedef It iterator; typedef Const_it const_iterator; - CMap_range(Map_ &amap, typename Map_::Dart_handle adart, int amark=-1): + + typedef typename Map_::size_type size_type; + + CMap_range(Map_ &amap, typename Map_::Dart_handle adart, size_type amark=Map_::MARK_ERROR): mmap(amap), mdart(adart), msize(0), mmark(amark) {} iterator begin() { return iterator(mmap,mdart,mmark); } @@ -543,7 +554,7 @@ namespace CGAL { Map_ & mmap; typename Map_::Dart_handle mdart; mutable typename Map_::size_type msize; - int mmark; + size_type mmark; }; //**************************************************************************** template { typedef Const_it const_iterator; + typedef typename Map_::size_type size_type; CMap_const_range(const Map_ &amap, typename Map_::Dart_const_handle adart, - int amark=-1): + size_type amark=Map_::MARK_ERROR): mmap(amap), mdart(adart), msize(0), mmark(amark) {} const_iterator begin() const { return const_iterator(mmap,mdart,mmark); } diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map_operations.h b/Combinatorial_map/include/CGAL/Combinatorial_map_operations.h index 453d27633ae..e138b05906d 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map_operations.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map_operations.h @@ -99,8 +99,8 @@ namespace CGAL typename CMap::Dart_handle d1, d2; typename CMap::Dart_handle dg1=amap.null_handle, dg2=amap.null_handle; - int mark = amap.get_new_mark(); - int mark_modified_darts = amap.get_new_mark(); + typename CMap::size_type mark = amap.get_new_mark(); + typename CMap::size_type mark_modified_darts = amap.get_new_mark(); std::deque to_erase; @@ -280,7 +280,7 @@ namespace CGAL { static size_t run(CMap& amap, typename CMap::Dart_handle adart, bool update_attributes) { - int mark = amap.get_new_mark(); + typename CMap::size_type mark = amap.get_new_mark(); std::deque to_erase; size_t res = 0; @@ -355,7 +355,7 @@ namespace CGAL typename CMap::Dart_handle d1, d2; typename CMap::Dart_handle dg1=amap.null_handle, dg2=amap.null_handle; - int mark = amap.get_new_mark(); + typename CMap::size_type mark = amap.get_new_mark(); // int mark_modified_darts = amap.get_new_mark(); // First we store and mark all the darts of the 0-cell to remove. @@ -544,8 +544,8 @@ namespace CGAL typename CMap::Dart_handle d1, d2; typename CMap::Dart_handle dg1=amap.null_handle, dg2=amap.null_handle; - int mark = amap.get_new_mark(); - int mark_modified_darts = amap.get_new_mark(); + typename CMap::size_type mark = amap.get_new_mark(); + typename CMap::size_type mark_modified_darts = amap.get_new_mark(); const int imuinv = CGAL_BETAINV(i-1); @@ -699,7 +699,7 @@ namespace CGAL typename CMap::Dart_handle d1, d2; typename CMap::Dart_handle dg1=amap.null_handle, dg2=amap.null_handle; - int mark = amap.get_new_mark(); + typename CMap::size_type mark = amap.get_new_mark(); // int mark_modified_darts = amap.get_new_mark(); // First we store and mark all the darts of the 1-cell to contract. diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map_storages.h b/Combinatorial_map/include/CGAL/Combinatorial_map_storages.h index 0476dfd6cae..76eb62cbaef 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map_storages.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map_storages.h @@ -144,21 +144,21 @@ namespace CGAL { return ADart->get_marks(); } /// Return the mark value of dart a given mark number. - bool get_dart_mark(Dart_const_handle ADart, int amark) const + bool get_dart_mark(Dart_const_handle ADart, size_type amark) const { CGAL_assertion( ADart!=NULL ); return ADart->get_mark(amark); } /// Set the mark of a given mark number to a given value. - void set_dart_mark(Dart_const_handle ADart, int amark, bool avalue) const + void set_dart_mark(Dart_const_handle ADart, size_type amark, bool avalue) const { CGAL_assertion( ADart!=NULL ); ADart->set_mark(amark, avalue); } /// Flip the mark of a given mark number to a given value. - void flip_dart_mark(Dart_const_handle ADart, int amark) const + void flip_dart_mark(Dart_const_handle ADart, size_type amark) const { CGAL_assertion( ADart!=NULL ); ADart->flip_mark(amark); diff --git a/Combinatorial_map/include/CGAL/Dart.h b/Combinatorial_map/include/CGAL/Dart.h index cbf54b49e45..c0980577dd9 100644 --- a/Combinatorial_map/include/CGAL/Dart.h +++ b/Combinatorial_map/include/CGAL/Dart.h @@ -267,28 +267,28 @@ namespace CGAL { * @param amark the mark number. * @return the value for this number. */ - bool get_mark(int amark) const + bool get_mark(size_type amark) const { - CGAL_assertion(amark>=0 && (size_type)amark=0 && amark=0 && (size_type)amark=0 && amark=0 && (size_type)amark=0 && amark Base; typedef typename Map_::Dart_const_handle Dart_const_handle; + typedef typename Map_::size_type size_type; /// Main constructor. CMap_dart_const_iterator_basic_of_orbit(const Map_& amap, @@ -56,7 +57,7 @@ namespace CGAL { /// Main constructor. CMap_dart_const_iterator_basic_of_orbit(const Map_& amap, Dart_const_handle adart, - int amark): + size_type amark): Base(amap,adart,amark) {} /// Constructor from non const version. @@ -105,6 +106,7 @@ namespace CGAL { B5,B6,B7,B8,B9> Base; typedef typename Map_::Dart_const_handle Dart_const_handle; + typedef typename Map_::size_type size_type; /// Main constructor. CMap_dart_const_iterator_basic_of_orbit(const Map_& amap, @@ -114,7 +116,7 @@ namespace CGAL { /// Main constructor. CMap_dart_const_iterator_basic_of_orbit(const Map_& amap, Dart_const_handle adart, - int amark): + size_type amark): Base(amap,adart,amark) {} /// Constructor from non const version. @@ -162,6 +164,7 @@ namespace CGAL { public: typedef CMap_dart_iterator_basic_of_all Base; typedef typename Map_::Dart_const_handle Dart_const_handle; + typedef typename Map_::size_type size_type; /* Main constructor. */ CMap_dart_const_iterator_basic_of_all(const Map_& amap, @@ -171,7 +174,7 @@ namespace CGAL { /* Main constructor. */ CMap_dart_const_iterator_basic_of_all(const Map_& amap, Dart_const_handle adart, - int /*amark*/): + size_type /*amark*/): Base(amap,adart) {} /// Constructor from non const version. @@ -189,6 +192,7 @@ namespace CGAL { public: typedef CMap_dart_iterator_basic_of_cell Base; typedef typename Map_::Dart_const_handle Dart_const_handle; + typedef typename Map_::size_type size_type; /* Main constructor. */ CMap_dart_const_iterator_basic_of_cell(const Map_& amap, @@ -197,7 +201,8 @@ namespace CGAL { {} /* Main constructor. */ CMap_dart_const_iterator_basic_of_cell(const Map_& amap, - Dart_const_handle adart, int amark): + Dart_const_handle adart, + size_type amark): Base(amap,adart,amark) {} /// Constructor from non const version. @@ -236,6 +241,7 @@ namespace CGAL { public: typedef CMap_dart_iterator_basic_of_involution Base; typedef typename Map_::Dart_const_handle Dart_const_handle; + typedef typename Map_::size_type size_type; /* Main constructor. */ CMap_dart_const_iterator_basic_of_involution(const Map_& amap, @@ -245,7 +251,7 @@ namespace CGAL { /* Main constructor. */ CMap_dart_const_iterator_basic_of_involution(const Map_& amap, Dart_const_handle adart, - int amark): + size_type amark): Base(amap,adart,amark) {} /// Constructor from non const version. @@ -284,6 +290,7 @@ namespace CGAL { public: typedef CMap_dart_iterator_basic_of_involution_inv Base; typedef typename Map_::Dart_const_handle Dart_const_handle; + typedef typename Map_::size_type size_type; /* Main constructor. */ CMap_dart_const_iterator_basic_of_involution_inv(const Map_& amap, @@ -293,7 +300,7 @@ namespace CGAL { /* Main constructor. */ CMap_dart_const_iterator_basic_of_involution_inv(const Map_& amap, Dart_const_handle adart, - int amark): + size_type amark): Base(amap,adart,amark) {} /// Constructor from non const version. diff --git a/Combinatorial_map/include/CGAL/Dart_iterators.h b/Combinatorial_map/include/CGAL/Dart_iterators.h index b14ea3eba1a..c5bbd7f6dca 100644 --- a/Combinatorial_map/include/CGAL/Dart_iterators.h +++ b/Combinatorial_map/include/CGAL/Dart_iterators.h @@ -147,6 +147,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; typedef Tag_false Use_mark; @@ -158,7 +159,7 @@ namespace CGAL { /// Main constructor. CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart, - int /*amark*/): + size_type /*amark*/): Base(amap, adart) {} @@ -190,6 +191,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; typedef Tag_false Use_mark; @@ -202,7 +204,7 @@ namespace CGAL { /// Main constructor. CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart, - int /*amark*/): + size_type /*amark*/): Base(amap, adart), mfirst_dir(true) {} @@ -291,6 +293,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; typedef Tag_false Use_mark; @@ -303,7 +306,7 @@ namespace CGAL { /// Main constructor. CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart, - int /*amark*/): + size_type /*amark*/): Base(amap, adart), mfirst_dir(true) {} @@ -381,6 +384,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; typedef Tag_false Use_mark; @@ -392,7 +396,7 @@ namespace CGAL { /// Main constructor. CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart, - int /*amark*/): + size_type /*amark*/): Base(amap, adart) { CGAL_static_assertion( Bi>=2 && Bi<=Map::dimension ); } @@ -435,6 +439,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; typedef Tag_false Use_mark; @@ -449,7 +454,7 @@ namespace CGAL { /// Main constructor. CMap_dart_iterator_basic_of_two_beta(Map& amap, Dart_handle adart, - int /*amark*/): + size_type /*amark*/): Base(amap, adart), mcurdart(0) {} @@ -548,6 +553,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; typedef Tag_true Use_mark; @@ -556,7 +562,7 @@ namespace CGAL { public: /// Main constructor. CMap_dart_iterator_basic_of_two_beta(Map& amap, Dart_handle adart, - int amark): + size_type amark): Base(amap, adart, amark) {} }; @@ -580,6 +586,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; typedef Tag_true Use_mark; @@ -588,7 +595,7 @@ namespace CGAL { public: /// Main constructor. CMap_dart_iterator_basic_of_two_beta(Map& amap, Dart_handle adart, - int amark): + size_type amark): Base(amap, adart, amark) {} }; @@ -610,6 +617,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; typedef Tag_false Use_mark; @@ -628,7 +636,7 @@ namespace CGAL { /// Main constructor. CMap_dart_iterator_basic_of_two_beta(Map& amap, Dart_handle adart, - int /*amark*/): + size_type /*amark*/): Base(amap, adart), mit(amap, adart), mexist_betaj(false), @@ -710,6 +718,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; typedef Tag_false Use_mark; @@ -728,7 +737,7 @@ namespace CGAL { /// Main constructor. CMap_dart_iterator_basic_of_two_beta(Map& amap, Dart_handle adart, - int /*amark*/): + size_type /*amark*/): Base(amap, adart), mit(amap, adart), mexist_betaj(false), @@ -810,6 +819,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; typedef Tag_false Use_mark; @@ -825,7 +835,7 @@ namespace CGAL { /// Main constructor. CMap_dart_iterator_basic_of_two_beta(Map& amap, Dart_handle adart, - int /*amark*/): + size_type /*amark*/): Base(amap, adart), mfirst_dir(true), mnext_try_betai(true) @@ -964,6 +974,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; typedef typename Base::Use_mark Use_mark; @@ -975,7 +986,7 @@ namespace CGAL { /// Main constructor. CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart, - int amark): + size_type amark): Base(amap, adart, amark) {} }; @@ -1000,6 +1011,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; /// True iff this iterator is basic typedef Tag_true Basic_iterator; @@ -1007,7 +1019,7 @@ namespace CGAL { public: /// Main constructor. CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart, - int amark): + size_type amark): Base(amap, adart, amark) {} }; @@ -1029,6 +1041,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; /// True iff this iterator is basic typedef Tag_true Basic_iterator; @@ -1036,7 +1049,7 @@ namespace CGAL { public: /// Main constructor. CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart, - int amark): + size_type amark): Base(amap, adart, amark) {} }; @@ -1055,13 +1068,14 @@ namespace CGAL { typedef CMap_dart_iterator_basic_of_orbit_generic Base; typedef typename Map::Dart_handle Dart_handle; + typedef typename Map::size_type size_type; /// Main constructor. CMap_dart_iterator_basic_of_orbit(Map& amap,Dart_handle adart): Base(amap,adart) {} /// Main constructor. - CMap_dart_iterator_basic_of_orbit(Map& amap,Dart_handle adart,int amark): + CMap_dart_iterator_basic_of_orbit(Map& amap,Dart_handle adart,size_type amark): Base(amap,adart,amark) {} }; @@ -1080,13 +1094,14 @@ namespace CGAL { ::type Base; typedef typename Map::Dart_handle Dart_handle; + typedef typename Map::size_type size_type; /// Main constructor. CMap_dart_iterator_basic_of_orbit(Map& amap,Dart_handle adart): Base(amap,adart) {} /// Main constructor. - CMap_dart_iterator_basic_of_orbit(Map& amap,Dart_handle adart,int amark): + CMap_dart_iterator_basic_of_orbit(Map& amap,Dart_handle adart,size_type amark): Base(amap,adart,amark) {} }; @@ -1104,6 +1119,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; typedef Tag_false Use_mark; @@ -1113,7 +1129,7 @@ namespace CGAL { Base(amap, amap.darts().begin()) {} /// Main constructor. - CMap_dart_iterator_basic_of_all(Map& amap, int /*amark*/): + CMap_dart_iterator_basic_of_all(Map& amap, size_type /*amark*/): Base(amap, amap.darts().begin()) {} @@ -1123,7 +1139,7 @@ namespace CGAL { {} /// Constructor with a dart in parameter (for end iterator). CMap_dart_iterator_basic_of_all(Map& amap, Dart_handle adart, - int /*amark*/): + size_type /*amark*/): Base(amap, adart) {} @@ -1163,6 +1179,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; typedef Tag_true Use_mark; @@ -1172,7 +1189,7 @@ namespace CGAL { /// Main constructor. CMap_dart_iterator_basic_of_cell(Map& amap, Dart_handle adart, - int amark): + size_type amark): Base(amap, adart), mmark_number(amark) { @@ -1186,7 +1203,7 @@ namespace CGAL { /// Rewind of the iterator to its beginning. void rewind() { - CGAL_assertion(mmark_number != -1); + CGAL_assertion(mmark_number != Map::MARK_ERROR); Base::rewind(); mto_treat = std::queue(); this->mmap->mark(*this, mmark_number); @@ -1196,7 +1213,7 @@ namespace CGAL { /// Prefix ++ operator. Self& operator++() { - CGAL_assertion(mmark_number != -1); + CGAL_assertion(mmark_number != Map::MARK_ERROR); CGAL_assertion(this->cont()); Dart_handle nd = this->mmap->null_handle; @@ -1262,7 +1279,7 @@ namespace CGAL { std::queue mto_treat; /// Index of the used mark. - int mmark_number; + size_type mmark_number; }; //**************************************************************************** // i-Cell iterator in combinatorial map of dimension d, i==1. @@ -1276,6 +1293,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; typedef Tag_true Use_mark; @@ -1283,7 +1301,7 @@ namespace CGAL { /// Main constructor. CMap_dart_iterator_basic_of_cell(Map& amap, Dart_handle adart, - int amark): + size_type amark): Base(amap, adart), mmark_number(amark) { @@ -1297,7 +1315,7 @@ namespace CGAL { /// Rewind of the iterator to its beginning. void rewind() { - CGAL_assertion(mmark_number != -1); + CGAL_assertion(mmark_number != Map::MARK_ERROR); Base::rewind(); mto_treat = std::queue(); this->mmap->mark((*this), mmark_number); @@ -1307,7 +1325,7 @@ namespace CGAL { /// Prefix ++ operator. Self& operator++() { - CGAL_assertion(mmark_number != -1); + CGAL_assertion(mmark_number != Map::MARK_ERROR); CGAL_assertion(this->cont()); Dart_handle nd = this->mmap->null_handle; @@ -1358,7 +1376,7 @@ namespace CGAL { std::queue mto_treat; /// Index of the used mark. - int mmark_number; + size_type mmark_number; }; //**************************************************************************** // 0-Cell iterator in combinatorial map of dimension d @@ -1372,6 +1390,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; typedef Tag_true Use_mark; @@ -1379,7 +1398,7 @@ namespace CGAL { /// Main constructor. CMap_dart_iterator_basic_of_cell(Map& amap, Dart_handle adart, - int amark): + size_type amark): Base(amap, adart), mmark_number(amark) { if (adart!=this->mmap->null_handle) @@ -1392,7 +1411,7 @@ namespace CGAL { /// Rewind of the iterator to its beginning. void rewind() { - CGAL_assertion(mmark_number != -1); + CGAL_assertion(mmark_number != Map::MARK_ERROR); Base::rewind(); mto_treat = std::queue(); this->mmap->mark((*this), mmark_number); @@ -1402,7 +1421,7 @@ namespace CGAL { /// Prefix ++ operator. Self& operator++() { - CGAL_assertion(mmark_number != -1); + CGAL_assertion(mmark_number != Map::MARK_ERROR); CGAL_assertion(this->cont()); Dart_handle nd = this->mmap->null_handle; @@ -1498,7 +1517,7 @@ namespace CGAL { std::queue mto_treat; /// Index of the used mark. - int mmark_number; + size_type mmark_number; }; //**************************************************************************** // Specialization for edge in 2D @@ -1512,6 +1531,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; /// Main constructor. CMap_dart_iterator_basic_of_cell(Map& amap, @@ -1522,7 +1542,7 @@ namespace CGAL { /// Main constructor. CMap_dart_iterator_basic_of_cell(Map& amap, Dart_handle adart, - int /*amark*/): + size_type /*amark*/): Base(amap, adart) {} }; @@ -1538,6 +1558,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; /// Main constructor. CMap_dart_iterator_basic_of_cell(Map& amap, @@ -1548,7 +1569,7 @@ namespace CGAL { /// Main constructor. CMap_dart_iterator_basic_of_cell(Map& amap, Dart_handle adart, - int /*amark*/): + size_type /*amark*/): Base(amap, adart) {} }; @@ -1564,11 +1585,12 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; /// Main constructor. CMap_dart_iterator_basic_of_cell(Map& amap, Dart_handle adart, - int amark): + size_type amark): Base(amap, adart, amark) {} }; @@ -1584,6 +1606,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; /// Main constructor. CMap_dart_iterator_basic_of_cell(Map& amap, @@ -1594,7 +1617,7 @@ namespace CGAL { /// Main constructor. CMap_dart_iterator_basic_of_cell(Map& amap, Dart_handle adart, - int /*amark*/): Base(amap, adart) + size_type /*amark*/): Base(amap, adart) {} }; //**************************************************************************** @@ -1609,6 +1632,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; /// Main constructor. CMap_dart_iterator_basic_of_cell(Map& amap, @@ -1619,7 +1643,7 @@ namespace CGAL { /// Main constructor. CMap_dart_iterator_basic_of_cell(Map& amap, Dart_handle adart, - int /*amark*/): Base(amap, adart) + size_type /*amark*/): Base(amap, adart) {} }; //**************************************************************************** @@ -1634,11 +1658,12 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; /// Main constructor. CMap_dart_iterator_basic_of_cell(Map& amap, Dart_handle adart, - int amark): + size_type amark): Base(amap, adart, amark) {} }; @@ -1654,11 +1679,12 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; /// Main constructor. CMap_dart_iterator_basic_of_cell(Map& amap, Dart_handle adart, - int amark): + size_type amark): Base(amap, adart, amark) {} }; @@ -1676,6 +1702,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; typedef Tag_false Use_mark; @@ -1690,7 +1717,7 @@ namespace CGAL { /// Main constructor. CMap_dart_iterator_basic_of_cell(Map& amap, Dart_handle adart, - int /*amark*/): + size_type /*amark*/): Base(amap, adart), mfirst_dir(true) {} @@ -1885,6 +1912,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; typedef Tag_true Use_mark; @@ -1895,7 +1923,7 @@ namespace CGAL { /// Main constructor. CMap_dart_iterator_basic_of_involution(Map& amap, Dart_handle adart, - int amark): + size_type amark): Base(amap, adart), mmark_number(amark) { @@ -1911,7 +1939,7 @@ namespace CGAL { /// Rewind of the iterator to its beginning. void rewind() { - CGAL_assertion(mmark_number != -1); + CGAL_assertion(mmark_number != Map::MARK_ERROR); Base::rewind(); mto_treat = std::queue(); this->mmap->mark((*this), mmark_number); @@ -1921,7 +1949,7 @@ namespace CGAL { /// Prefix ++ operator. Self& operator++() { - CGAL_assertion(mmark_number != -1); + CGAL_assertion(mmark_number != Map::MARK_ERROR); CGAL_assertion(this->cont()); Dart_handle nd = this->mmap->null_handle; @@ -1990,7 +2018,7 @@ namespace CGAL { std::queue mto_treat; /// Index of the used mark. - int mmark_number; + size_type mmark_number; }; //**************************************************************************** // i-involution iterator in combinatorial map of dimension d, @@ -2007,6 +2035,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; typedef Tag_true Use_mark; @@ -2017,7 +2046,7 @@ namespace CGAL { /// Main constructor. CMap_dart_iterator_basic_of_involution_inv(Map& amap, Dart_handle adart, - int amark): + size_type amark): Base(amap, adart), mmark_number(amark) { @@ -2032,7 +2061,7 @@ namespace CGAL { /// Rewind of the iterator to its beginning. void rewind() { - CGAL_assertion(mmark_number != -1); + CGAL_assertion(mmark_number != Map::MARK_ERROR); Base::rewind(); mto_treat = std::queue(); this->mmap->mark((*this), mmark_number); @@ -2042,7 +2071,7 @@ namespace CGAL { /// Prefix ++ operator. Self& operator++() { - CGAL_assertion(mmark_number != -1); + CGAL_assertion(mmark_number != Map::MARK_ERROR); CGAL_assertion(this->cont()); Dart_handle nd = this->mmap->null_handle; @@ -2110,7 +2139,7 @@ namespace CGAL { std::queue mto_treat; /// Index of the used mark. - int mmark_number; + size_type mmark_number; }; //**************************************************************************** // 1-involution iterator in combinatorial map of dimension d. @@ -2125,6 +2154,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; typedef Tag_true Use_mark; @@ -2135,7 +2165,7 @@ namespace CGAL { /// Main constructor. CMap_dart_iterator_basic_of_involution(Map& amap, Dart_handle adart, - int amark): + size_type amark): Base(amap, adart), mmark_number(amark) { if (adart!=this->mmap->null_handle) @@ -2148,7 +2178,7 @@ namespace CGAL { /// Rewind of the iterator to its beginning. void rewind() { - CGAL_assertion(mmark_number != -1); + CGAL_assertion(mmark_number != Map::MARK_ERROR); Base::rewind(); mto_treat = std::queue(); this->mmap->mark_null_dart(mmark_number); @@ -2158,7 +2188,7 @@ namespace CGAL { /// Prefix ++ operator. Self& operator++() { - CGAL_assertion(mmark_number != -1); + CGAL_assertion(mmark_number != Map::MARK_ERROR); CGAL_assertion(this->cont()); Dart_handle nd = this->mmap->null_handle; @@ -2208,7 +2238,7 @@ namespace CGAL { std::queue mto_treat; /// Index of the used mark. - int mmark_number; + size_type mmark_number; }; //**************************************************************************** // 1-involution iterator in combinatorial map of dimension d. @@ -2223,6 +2253,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; typedef Tag_true Use_mark; @@ -2233,7 +2264,7 @@ namespace CGAL { /// Main constructor. CMap_dart_iterator_basic_of_involution_inv(Map& amap, Dart_handle adart, - int amark): + size_type amark): Base(amap, adart,amark) {} }; @@ -2250,6 +2281,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; typedef Tag_true Use_mark; @@ -2260,7 +2292,7 @@ namespace CGAL { /// Main constructor. CMap_dart_iterator_basic_of_involution(Map& amap, Dart_handle adart, - int amark): + size_type amark): Base(amap, adart), mmark_number(amark) { if ( adart!=this->mmap->null_handle) @@ -2273,7 +2305,7 @@ namespace CGAL { /// Rewind of the iterator to its beginning. void rewind() { - CGAL_assertion(mmark_number != -1); + CGAL_assertion(mmark_number != Map::MARK_ERROR); Base::rewind(); mto_treat = std::queue(); this->mmap->mark((*this), mmark_number); @@ -2283,7 +2315,7 @@ namespace CGAL { /// Prefix ++ operator. Self& operator++() { - CGAL_assertion(mmark_number != -1); + CGAL_assertion(mmark_number != Map::MARK_ERROR); CGAL_assertion(this->cont()); Dart_handle nd = this->mmap->null_handle; @@ -2333,7 +2365,7 @@ namespace CGAL { std::queue mto_treat; /// Index of the used mark. - int mmark_number; + size_type mmark_number; }; //**************************************************************************** // 2-involution iterator in combinatorial map of dimension d. @@ -2348,6 +2380,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; typedef Tag_true Use_mark; @@ -2358,7 +2391,7 @@ namespace CGAL { /// Main constructor. CMap_dart_iterator_basic_of_involution_inv(Map& amap, Dart_handle adart, - int amark): + size_type amark): Base(amap, adart,amark) {} }; @@ -2375,6 +2408,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; typedef Tag_false Use_mark; @@ -2385,7 +2419,7 @@ namespace CGAL { /// Main constructor. CMap_dart_iterator_basic_of_involution(Map& amap, Dart_handle adart, - int /*amark*/): + size_type /*amark*/): Base(amap, adart) {} /// Main constructor. @@ -2407,6 +2441,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; typedef Tag_false Use_mark; @@ -2417,7 +2452,7 @@ namespace CGAL { /// Main constructor. CMap_dart_iterator_basic_of_involution_inv(Map& amap, Dart_handle adart, - int /*amark*/): + size_type /*amark*/): Base(amap, adart) {} /// Main constructor. @@ -2439,6 +2474,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; typedef Tag_false Use_mark; @@ -2449,7 +2485,7 @@ namespace CGAL { /// Main constructor. CMap_dart_iterator_basic_of_involution(Map& amap, Dart_handle adart, - int /*amark*/): + size_type /*amark*/): Base(amap, adart) {} /// Main constructor. @@ -2471,6 +2507,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; typedef Tag_false Use_mark; @@ -2481,7 +2518,7 @@ namespace CGAL { /// Main constructor. CMap_dart_iterator_basic_of_involution_inv(Map& amap, Dart_handle adart, - int /*amark*/): + size_type /*amark*/): Base(amap, adart) {} /// Main constructor. @@ -2503,6 +2540,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; typedef Tag_false Use_mark; @@ -2513,7 +2551,7 @@ namespace CGAL { /// Main constructor. CMap_dart_iterator_basic_of_involution(Map& amap, Dart_handle adart, - int /*amark*/): + size_type /*amark*/): Base(amap, adart) {} /// Main constructor. @@ -2535,6 +2573,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; typedef Tag_false Use_mark; @@ -2545,7 +2584,7 @@ namespace CGAL { /// Main constructor. CMap_dart_iterator_basic_of_involution_inv(Map& amap, Dart_handle adart, - int /*amark*/): + size_type /*amark*/): Base(amap, adart) {} /// Main constructor. @@ -2567,6 +2606,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; typedef Tag_false Use_mark; @@ -2577,7 +2617,7 @@ namespace CGAL { /// Main constructor. CMap_dart_iterator_basic_of_involution(Map& amap, Dart_handle adart, - int /* amark*/): + size_type /* amark*/): Base(amap, adart) {} /// Main constructor. @@ -2599,6 +2639,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; typedef Tag_false Use_mark; @@ -2609,7 +2650,7 @@ namespace CGAL { /// Main constructor. CMap_dart_iterator_basic_of_involution_inv(Map& amap, Dart_handle adart, - int /*amark*/): + size_type /*amark*/): Base(amap, adart) {} /// Main constructor. @@ -2631,6 +2672,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; typedef Tag_false Use_mark; @@ -2641,7 +2683,7 @@ namespace CGAL { /// Main constructor. CMap_dart_iterator_basic_of_involution(Map& amap, Dart_handle adart, - int /*amark*/): + size_type /*amark*/): Base(amap, adart) {} /// Main constructor. @@ -2663,6 +2705,7 @@ namespace CGAL { typedef typename Base::Dart_handle Dart_handle; typedef typename Base::Map Map; + typedef typename Map::size_type size_type; typedef Tag_false Use_mark; @@ -2673,7 +2716,7 @@ namespace CGAL { /// Main constructor. CMap_dart_iterator_basic_of_involution_inv(Map& amap, Dart_handle adart, - int /*amark*/): + size_type /*amark*/): Base(amap, adart) {} /// Main constructor. diff --git a/Combinatorial_map/include/CGAL/internal/Combinatorial_map_group_functors.h b/Combinatorial_map/include/CGAL/internal/Combinatorial_map_group_functors.h index 2a408a948fd..5bcc9a3abcd 100644 --- a/Combinatorial_map/include/CGAL/internal/Combinatorial_map_group_functors.h +++ b/Combinatorial_map/include/CGAL/internal/Combinatorial_map_group_functors.h @@ -522,7 +522,7 @@ void test_split_attribute_functor_one_dart ( CMap* amap, typename CMap::Dart_handle adart, CGAL::Unique_hash_map::type, unsigned int, typename CMap::Hash_function> & - found_attributes, int mark ) + found_attributes, typename CMap::size_type mark ) { CGAL_assertion( amap!=NULL ); CGAL_static_assertion_msg(CMap::Helper::template @@ -580,7 +580,7 @@ struct Test_split_attribute_functor_run static void run( CMap* amap, const std::deque &modified_darts, - int mark_modified_darts=-1) + typename CMap::size_type mark_modified_darts=CMap::MARK_ERROR) { CGAL_static_assertion( 1<=i && i<=CMap::dimension ); CGAL_assertion( i!=j ); @@ -596,7 +596,7 @@ struct Test_split_attribute_functor_run CGAL::Unique_hash_map found_attributes; - int mark = amap->get_new_mark(); // to mark incident cells. + typename CMap::size_type mark = amap->get_new_mark(); // to mark incident cells. typename std::deque::const_iterator it=modified_darts.begin(); for ( ; it!=modified_darts.end(); ++it ) @@ -609,7 +609,7 @@ struct Test_split_attribute_functor_run amap->negate_mark(mark); for ( it=modified_darts.begin(); it!=modified_darts.end(); ++it ) { - if ( mark_modified_darts!=-1 ) + if ( mark_modified_darts!=CMap::MARK_ERROR ) amap->unmark(*it, mark_modified_darts); if ( !amap->is_marked(*it, mark) ) @@ -624,7 +624,7 @@ struct Test_split_attribute_functor_run &modified_darts, const std::deque &modified_darts2, - int mark_modified_darts=-1) + typename CMap::size_type mark_modified_darts=CMap::MARK_ERROR) { CGAL_static_assertion( 1<=i && i<=CMap::dimension ); CGAL_assertion( i!=j ); @@ -640,7 +640,7 @@ struct Test_split_attribute_functor_run CGAL::Unique_hash_map found_attributes; - int mark = amap->get_new_mark(); // to mark incident cells. + typename CMap::size_type mark = amap->get_new_mark(); // to mark incident cells. typename std::deque::const_iterator it=modified_darts.begin(); for ( ; it!=modified_darts.end(); ++it ) @@ -660,7 +660,7 @@ struct Test_split_attribute_functor_run amap->negate_mark(mark); for ( it=modified_darts.begin(); it!=modified_darts.end(); ++it ) { - if ( mark_modified_darts!=-1 ) + if ( mark_modified_darts!=CMap::MARK_ERROR ) amap->unmark(*it, mark_modified_darts); if ( !amap->is_marked(*it, mark) ) @@ -668,7 +668,7 @@ struct Test_split_attribute_functor_run } for ( it2=modified_darts2.begin(); it2!=modified_darts2.end(); ++it2 ) { - if ( mark_modified_darts!=-1 ) + if ( mark_modified_darts!=CMap::MARK_ERROR ) amap->unmark(*it2, mark_modified_darts); if ( !amap->is_marked(*it2, mark) ) @@ -686,7 +686,7 @@ struct Test_split_attribute_functor_run static void run( CMap* amap, const std::deque &modified_darts, - int mark_modified_darts=-1) + typename CMap::size_type mark_modified_darts=CMap::MARK_ERROR) { CGAL_assertion( j!=0 && j!=1 ); CGAL_assertion( amap!=NULL ); @@ -702,7 +702,7 @@ struct Test_split_attribute_functor_run typename CMap::Hash_function> found_attributes; typename CMap::Dart_handle od=amap->null_handle; - int mark = amap->get_new_mark(); // to mark incident cells. + typename CMap::size_type mark = amap->get_new_mark(); // to mark incident cells. typename std::deque::const_iterator it=modified_darts.begin(); for ( ; it!=modified_darts.end(); ++it ) @@ -720,7 +720,7 @@ struct Test_split_attribute_functor_run amap->negate_mark(mark); for ( it=modified_darts.begin(); it!=modified_darts.end(); ++it ) { - if ( mark_modified_darts!=-1 ) + if ( mark_modified_darts!=CMap::MARK_ERROR ) amap->unmark(*it, mark_modified_darts); if ( !amap->is_marked(*it, mark) ) @@ -739,7 +739,7 @@ struct Test_split_attribute_functor_run &modified_darts, const std::deque &modified_darts2, - int mark_modified_darts=-1) + typename CMap::size_type mark_modified_darts=CMap::MARK_ERROR) { CGAL_assertion( j!=0 && j!=1 ); CGAL_assertion( amap!=NULL ); @@ -755,7 +755,7 @@ struct Test_split_attribute_functor_run typename CMap::Hash_function> found_attributes; typename CMap::Dart_handle od=amap->null_handle; - int mark = amap->get_new_mark(); // to mark incident cells. + typename CMap::size_type mark = amap->get_new_mark(); // to mark incident cells. typename std::deque::const_iterator it=modified_darts.begin(); for ( ; it!=modified_darts.end(); ++it ) @@ -785,7 +785,7 @@ struct Test_split_attribute_functor_run amap->negate_mark(mark); for ( it=modified_darts.begin(); it!=modified_darts.end(); ++it ) { - if ( mark_modified_darts!=-1 ) + if ( mark_modified_darts!=CMap::MARK_ERROR ) amap->unmark(*it, mark_modified_darts); if ( !amap->is_marked(*it, mark) ) @@ -797,7 +797,7 @@ struct Test_split_attribute_functor_run } for ( it2=modified_darts2.begin(); it2!=modified_darts2.end(); ++it2 ) { - if ( mark_modified_darts!=-1 ) + if ( mark_modified_darts!=CMap::MARK_ERROR ) amap->unmark(*it2, mark_modified_darts); if ( !amap->is_marked(*it2, mark) ) @@ -820,14 +820,14 @@ template struct Test_split_attribute_functor_run { static void run( CMap*, const std::deque&, - int =-1) + typename CMap::size_type =CMap::MARK_ERROR) { CGAL_assertion(false); } static void run( CMap* amap, const std::deque &modified_darts, const std::deque &modified_darts2, - int mark_modified_darts=-1) + typename CMap::size_type mark_modified_darts=CMap::MARK_ERROR) { CGAL_assertion( amap!=NULL ); CGAL_static_assertion_msg(CMap::Helper::template @@ -842,7 +842,7 @@ struct Test_split_attribute_functor_run typename CMap::Hash_function> found_attributes; typename CMap::Dart_handle od=amap->null_handle; - int mark = amap->get_new_mark(); // to mark incident cells. + typename CMap::size_type mark = amap->get_new_mark(); // to mark incident cells. typename std::deque::const_iterator it=modified_darts.begin(); for ( ; it!=modified_darts.end(); ++it ) @@ -864,7 +864,7 @@ struct Test_split_attribute_functor_run amap->negate_mark(mark); for ( it=modified_darts.begin(); it!=modified_darts.end(); ++it ) { - if ( mark_modified_darts!=-1 ) + if ( mark_modified_darts!=CMap::MARK_ERROR ) amap->unmark(*it, mark_modified_darts); if ( !amap->is_marked(*it, mark) ) @@ -872,7 +872,7 @@ struct Test_split_attribute_functor_run } for ( it2=modified_darts2.begin(); it2!=modified_darts2.end(); ++it2 ) { - if ( mark_modified_darts!=-1 ) + if ( mark_modified_darts!=CMap::MARK_ERROR ) amap->unmark(*it2, mark_modified_darts); od=amap->other_extremity(*it2); @@ -890,12 +890,12 @@ template struct Test_split_attribute_functor_run { static void run( CMap*, const std::deque&, - int =-1) + typename CMap::size_type =CMap::MARK_ERROR) { CGAL_assertion(false); } static void run( CMap* amap, const std::deque& modified_darts, const std::deque& - modified_darts2, int mark_modified_darts=-1) + modified_darts2, typename CMap::size_type mark_modified_darts=CMap::MARK_ERROR) { CGAL::internal::Test_split_attribute_functor_run:: run(amap, modified_darts, modified_darts2, mark_modified_darts); } }; @@ -904,10 +904,10 @@ template struct Test_split_attribute_functor_run { static void run( CMap*, const std::deque&, - int=-1) + typename CMap::size_type=CMap::MARK_ERROR) {} static void run( CMap*, const std::deque&, - const std::deque&, int=-1) + const std::deque&, typename CMap::size_type=CMap::MARK_ERROR) {} }; // Specialization for i=j. @@ -915,10 +915,10 @@ template struct Test_split_attribute_functor_run { static void run( CMap*, const std::deque&, - int=-1) + typename CMap::size_type=CMap::MARK_ERROR) {} static void run( CMap*, const std::deque&, - const std::deque&, int=-1) + const std::deque&, typename CMap::size_type=CMap::MARK_ERROR) {} }; // Specialization for i=1 and j=0 (edge attributes are not modified @@ -927,10 +927,10 @@ template struct Test_split_attribute_functor_run { static void run( CMap*, const std::deque&, - int=-1) + typename CMap::size_type=CMap::MARK_ERROR) {} static void run( CMap*, const std::deque&, - const std::deque&, int=-1) + const std::deque&, typename CMap::size_type=CMap::MARK_ERROR) {} }; // ************************************************************************ @@ -949,7 +949,7 @@ struct Test_split_attribute_functor static void run( CMap* amap, const std::deque &modified_darts, - int mark_modified_darts=-1) + typename CMap::size_type mark_modified_darts=CMap::MARK_ERROR) { CGAL::internal::Test_split_attribute_functor_run:: run(amap, modified_darts, mark_modified_darts); @@ -960,7 +960,7 @@ struct Test_split_attribute_functor &modified_darts, const std::deque &modified_darts2, - int mark_modified_darts=-1) + typename CMap::size_type mark_modified_darts=CMap::MARK_ERROR) { CGAL::internal::Test_split_attribute_functor_run:: run(amap, modified_darts, modified_darts2, mark_modified_darts); diff --git a/Combinatorial_map/include/CGAL/internal/Combinatorial_map_internal_functors.h b/Combinatorial_map/include/CGAL/internal/Combinatorial_map_internal_functors.h index bcf4b0c4d00..239197adb7a 100644 --- a/Combinatorial_map/include/CGAL/internal/Combinatorial_map_internal_functors.h +++ b/Combinatorial_map/include/CGAL/internal/Combinatorial_map_internal_functors.h @@ -188,17 +188,19 @@ struct Test_is_valid_attribute_functor * @param amark a mark used to mark darts of the i-cell. * @return true iff all the darts of the i-cell link to the same attribute. */ + typedef typename CMap::size_type size_type; + template static void run(const CMap* amap, typename CMap::Dart_const_handle adart, - std::vector* marks, bool *ares) + std::vector* marks, bool *ares) { CGAL_static_assertion_msg(CMap::Helper::template Dimension_index::value>=0, "Test_is_valid_attribute_functor but " " i-attributes are disabled"); - int amark = (*marks)[i]; + size_type amark = (*marks)[i]; if ( amap->is_marked(adart, amark) ) return; // dart already test. bool valid = true; @@ -268,10 +270,12 @@ struct Test_is_valid_attribute_functor template struct Correct_invalid_attributes_functor { + typedef typename CMap::size_type size_type; + template static void run(CMap* amap, typename CMap::Dart_handle adart, - std::vector* marks) + std::vector* marks) { // std::cout << "Correct_invalid_attributes_functor for " << i << "-cell" << std::endl; CGAL_static_assertion_msg(CMap::Helper::template @@ -279,7 +283,7 @@ struct Correct_invalid_attributes_functor "Correct_invalid_attributes_functor but " " i-attributes are disabled"); - int amark = (*marks)[i]; + size_type amark = (*marks)[i]; typename CMap::template Attribute_handle::type a=amap->template attribute(adart); @@ -329,13 +333,15 @@ struct Correct_invalid_attributes_functor template struct Count_cell_functor { + typedef typename CMap::size_type size_type; + template static void run( const CMap* amap, typename CMap::Dart_const_handle adart, - std::vector* amarks, + std::vector* amarks, std::vector* ares ) { - if ( (*amarks)[i]!=-1 && !amap->is_marked(adart, (*amarks)[i]) ) + if ( (*amarks)[i]!=CMap::MARK_ERROR && !amap->is_marked(adart, (*amarks)[i]) ) { ++ (*ares)[i]; CGAL::mark_cell(*amap, adart, (*amarks)[i]); @@ -705,7 +711,7 @@ struct Reverse_orientation_of_map_functor { static void run(CMap *amap) { - int mark = amap->get_new_mark(); + typename CMap::size_type mark = amap->get_new_mark(); CGAL_precondition(amap->is_whole_map_unmarked(mark)); CGAL_precondition(amap->is_valid()); for (typename CMap::Dart_range::iterator current_dart=amap->darts().begin(), @@ -759,7 +765,7 @@ struct Reverse_orientation_of_map_functor { static void run(CMap *amap) { - int mark = amap->get_new_mark(); + typename CMap::size_type mark = amap->get_new_mark(); CGAL_precondition(amap->is_whole_map_unmarked(mark)); CGAL_precondition(amap->is_valid()); for (typename CMap::Dart_range::iterator current_dart=amap->darts().begin(), @@ -796,7 +802,7 @@ struct Reverse_orientation_of_connected_component_functor { static void run(CMap *amap, typename CMap::Dart_handle adart) { - int mark = amap->get_new_mark(); + typename CMap::size_type mark = amap->get_new_mark(); CGAL_precondition(amap->is_whole_map_unmarked(mark)); for (typename CMap::template Dart_of_cell_range::iterator current_dart=amap->template darts_of_cell(adart). @@ -855,7 +861,7 @@ struct Reverse_orientation_of_connected_component_functor { static void run(CMap *amap, typename CMap::Dart_handle adart) { - int mark = amap->get_new_mark(); + typename CMap::size_type mark = amap->get_new_mark(); CGAL_precondition(amap->is_whole_map_unmarked(mark)); for (typename CMap::template Dart_of_cell_range::iterator current_dart=amap->template darts_of_cell(adart). diff --git a/Combinatorial_map/include/CGAL/internal/Combinatorial_map_sewable.h b/Combinatorial_map/include/CGAL/internal/Combinatorial_map_sewable.h index e3753271f9a..1201401becc 100644 --- a/Combinatorial_map/include/CGAL/internal/Combinatorial_map_sewable.h +++ b/Combinatorial_map/include/CGAL/internal/Combinatorial_map_sewable.h @@ -56,14 +56,14 @@ struct Is_sewable_functor typename CMap::Dart_const_handle, typename CMap::Hash_function> bijection; - int m1 = amap->get_new_mark(); - int m2 = amap->get_new_mark(); + typename CMap::size_type m1 = amap->get_new_mark(); + typename CMap::size_type m2 = amap->get_new_mark(); CGAL::CMap_dart_const_iterator_basic_of_involution I1(*amap, adart1, m1); CGAL::CMap_dart_const_iterator_basic_of_involution_inv I2(*amap, adart2, m2); bool res = true; - int mbijection = amap->get_new_mark(); + typename CMap::size_type mbijection = amap->get_new_mark(); while ( res && I1.cont() && I2.cont() ) { diff --git a/Combinatorial_map/test/Combinatorial_map/Combinatorial_map_2_test.h b/Combinatorial_map/test/Combinatorial_map/Combinatorial_map_2_test.h index 998fd602e74..aae58567bf7 100644 --- a/Combinatorial_map/test/Combinatorial_map/Combinatorial_map_2_test.h +++ b/Combinatorial_map/test/Combinatorial_map/Combinatorial_map_2_test.h @@ -45,7 +45,7 @@ bool test2D() Map map; Dart_handle dh, dh2, d1, d2, d3; - int mark; + typename Map::size_type mark; unsigned int nbc, nb2; cout<<"Size of dart:"<get_new_mark (); + LCC::size_type mark = scene.lcc->get_new_mark (); scene.lcc->negate_mark (mark); std::vector cells; @@ -571,7 +571,7 @@ void MainWindow::on_actionCompute_Voronoi_3D_triggered () // We remove the infinite volume and all its adjacent volumes. { std::stack toremove; - int mark_toremove=scene.lcc->get_new_mark(); + LCC::size_type mark_toremove=scene.lcc->get_new_mark(); toremove.push(ddh); CGAL::mark_cell(*scene.lcc, ddh, mark_toremove); for (LCC::Dart_of_cell_range<3>::iterator @@ -676,7 +676,7 @@ void MainWindow::on_actionClose_volume_triggered() void MainWindow::on_actionSew3_same_facets_triggered() { - int mymark = scene.lcc->get_new_mark(); + LCC::size_type mymark = scene.lcc->get_new_mark(); mark_all_filled_and_visible_volumes(mymark); QApplication::setOverrideCursor (Qt::WaitCursor); @@ -1060,7 +1060,7 @@ void MainWindow::onHeaderClicked(int col) } } -void MainWindow::mark_all_filled_and_visible_volumes(int amark) +void MainWindow::mark_all_filled_and_visible_volumes(LCC::size_type amark) { for (LCC::Attribute_range<3>::type::iterator it=scene.lcc->attributes<3>().begin(), @@ -1079,7 +1079,7 @@ void MainWindow::on_actionExtend_filled_volumes_triggered() std::vector::type> tofill; - int mark_volume = scene.lcc->get_new_mark(); + LCC::size_type mark_volume = scene.lcc->get_new_mark(); bool already_tofill; for (LCC::Attribute_range<3>::type::iterator @@ -1134,7 +1134,7 @@ void MainWindow::on_actionExtend_hidden_volumes_triggered() std::vector::type> tohide; - int mark_volume = scene.lcc->get_new_mark(); + LCC::size_type mark_volume = scene.lcc->get_new_mark(); bool already_tohide; for (LCC::Attribute_range<3>::type::iterator @@ -1254,9 +1254,9 @@ void MainWindow::onMengerInc() std::vector faces; std::size_t nbvolinit = mengerVolumes.size(); - int markEdges = (scene.lcc)->get_new_mark(); - int markFaces = (scene.lcc)->get_new_mark(); - int markVols = (scene.lcc)->get_new_mark(); + LCC::size_type markEdges = (scene.lcc)->get_new_mark(); + LCC::size_type markFaces = (scene.lcc)->get_new_mark(); + LCC::size_type markVols = (scene.lcc)->get_new_mark(); for(std::vector::iterator itvol=mengerVolumes.begin(); itvol!=mengerVolumes.end(); ++itvol) @@ -1569,7 +1569,7 @@ void MainWindow::split_vol_in_twentyseven(Dart_handle dh) void MainWindow::process_full_slice(Dart_handle init, std::vector& faces, - int markVols) + LCC::size_type markVols) { Dart_handle d[12]; d[0]=scene.lcc->beta(init,1,2); @@ -1600,7 +1600,7 @@ void MainWindow::process_full_slice(Dart_handle init, void MainWindow::process_inter_slice(Dart_handle init, std::vector& faces, - int markVols) + LCC::size_type markVols) { Dart_handle d[24]; d[0]=init; @@ -1660,8 +1660,8 @@ void MainWindow::onMengerDec() // thus we can directly "cut" the std::vector to the correct size. mengerVolumes.resize(CGAL::ipower(20,mengerLevel)); - int markVols = (scene.lcc)->get_new_mark(); - int markVertices = (scene.lcc)->get_new_mark(); + LCC::size_type markVols = (scene.lcc)->get_new_mark(); + LCC::size_type markVertices = (scene.lcc)->get_new_mark(); std::vector faces; std::vector edges; @@ -1955,8 +1955,8 @@ void MainWindow::onSierpinskiCarpetInc() std::vector edges; nbfacesinit = sierpinskiCarpetSurfaces.size(); - int markEdges = (scene.lcc)->get_new_mark(); - int markFaces = (scene.lcc)->get_new_mark(); + LCC::size_type markEdges = (scene.lcc)->get_new_mark(); + LCC::size_type markFaces = (scene.lcc)->get_new_mark(); for(std::vector::iterator itfaces=sierpinskiCarpetSurfaces.begin(); itfaces!=sierpinskiCarpetSurfaces.end(); ++itfaces) @@ -2079,7 +2079,7 @@ void MainWindow::sierpinski_carpet_update_geometry() if (updateAttributesMethodTraversal)*/ { - int markVertices = (scene.lcc)->get_new_mark(); + LCC::size_type markVertices = (scene.lcc)->get_new_mark(); for(std::size_t i = 0; i < nbfacesinit; i++) { @@ -2179,7 +2179,7 @@ void MainWindow::sierpinski_carpet_update_geometry() void MainWindow::sierpinski_carpet_compute_geometry() { - int markVertices = (scene.lcc)->get_new_mark(); + LCC::size_type markVertices = (scene.lcc)->get_new_mark(); for(std::size_t i = 0; i < nbfacesinit; i++) { @@ -2493,8 +2493,8 @@ void MainWindow::onSierpinskiCarpetDec() // thus we can directly "cut" the std::vector to the correct size. sierpinskiCarpetSurfaces.resize(CGAL::ipower(8,sierpinskiCarpetLevel)); - int markSurfaces = (scene.lcc)->get_new_mark(); - int markVertices = (scene.lcc)->get_new_mark(); + LCC::size_type markSurfaces = (scene.lcc)->get_new_mark(); + LCC::size_type markVertices = (scene.lcc)->get_new_mark(); std::vector edges; std::vector vertices; @@ -2693,8 +2693,8 @@ void MainWindow::onSierpinskiTriangleInc() std::vector edges; nbfacesinit = sierpinskiTriangleSurfaces.size(); - int markEdges = (scene.lcc)->get_new_mark(); - int markFaces = (scene.lcc)->get_new_mark(); + LCC::size_type markEdges = (scene.lcc)->get_new_mark(); + LCC::size_type markFaces = (scene.lcc)->get_new_mark(); for(std::vector::iterator itfaces=sierpinskiTriangleSurfaces.begin(); itfaces!=sierpinskiTriangleSurfaces.end(); ++itfaces) @@ -2880,8 +2880,8 @@ void MainWindow::onSierpinskiTriangleDec() // thus we can directly "cut" the std::vector to the correct size. sierpinskiTriangleSurfaces.resize(CGAL::ipower(3,sierpinskiTriangleLevel)); - int markSurfaces = (scene.lcc)->get_new_mark(); - int markVertices = (scene.lcc)->get_new_mark(); + LCC::size_type markSurfaces = (scene.lcc)->get_new_mark(); + LCC::size_type markVertices = (scene.lcc)->get_new_mark(); std::vector edges; std::vector vertices; diff --git a/Linear_cell_complex/demo/Linear_cell_complex/MainWindow.h b/Linear_cell_complex/demo/Linear_cell_complex/MainWindow.h index aefe94b1f3b..8b97c4be126 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/MainWindow.h +++ b/Linear_cell_complex/demo/Linear_cell_complex/MainWindow.h @@ -187,7 +187,7 @@ protected: void on_new_volume(Dart_handle adart); void on_delete_volume(Dart_handle adart); void init_all_new_volumes(); - void mark_all_filled_and_visible_volumes(int amark); + void mark_all_filled_and_visible_volumes(LCC::size_type amark); Dart_handle make_iso_cuboid(const Point_3 basepoint, LCC::FT lg); @@ -209,10 +209,10 @@ protected: void split_vol_in_twentyseven(Dart_handle dh); void process_full_slice(Dart_handle init, std::vector& faces, - int markVols); + LCC::size_type markVols); void process_inter_slice(Dart_handle init, std::vector& faces, - int markVols); + LCC::size_type markVols); void sierpinski_carpet_copy_attributes_and_embed_vertex(Dart_handle dh, LCC::Point& p); diff --git a/Linear_cell_complex/examples/Linear_cell_complex/linear_cell_complex_3_viewer_vtk.h b/Linear_cell_complex/examples/Linear_cell_complex/linear_cell_complex_3_viewer_vtk.h index 75d026352a8..2f473b8d175 100644 --- a/Linear_cell_complex/examples/Linear_cell_complex/linear_cell_complex_3_viewer_vtk.h +++ b/Linear_cell_complex/examples/Linear_cell_complex/linear_cell_complex_3_viewer_vtk.h @@ -151,8 +151,8 @@ public: vtkPolyData *polydata = vtkPolyData::New(); - int facettreated = lcc.get_new_mark(); - int vertextreated = lcc.get_new_mark(); + typename LCC::size_type facettreated = lcc.get_new_mark(); + typename LCC::size_type vertextreated = lcc.get_new_mark(); vtkCellArray* polygons = vtkCellArray::New(); vtkCellArray* vertices = vtkCellArray::New(); diff --git a/Linear_cell_complex/examples/Linear_cell_complex/voronoi_2.cpp b/Linear_cell_complex/examples/Linear_cell_complex/voronoi_2.cpp index 24c117476af..c6cbf93f319 100644 --- a/Linear_cell_complex/examples/Linear_cell_complex/voronoi_2.cpp +++ b/Linear_cell_complex/examples/Linear_cell_complex/voronoi_2.cpp @@ -34,7 +34,7 @@ void display_voronoi(LCC_2& alcc, Dart_handle adart) // Indeed, we cannot view these faces since they do not have // a "correct geometry". std::stack toremove; - int mark_toremove=alcc.get_new_mark(); + LCC_2::size_type mark_toremove=alcc.get_new_mark(); // adart belongs to the infinite face. toremove.push(adart); diff --git a/Linear_cell_complex/examples/Linear_cell_complex/voronoi_3.cpp b/Linear_cell_complex/examples/Linear_cell_complex/voronoi_3.cpp index 1a21c4236bd..fe6bf9b8114 100644 --- a/Linear_cell_complex/examples/Linear_cell_complex/voronoi_3.cpp +++ b/Linear_cell_complex/examples/Linear_cell_complex/voronoi_3.cpp @@ -34,7 +34,7 @@ void display_voronoi(LCC_3& alcc, Dart_handle adart) // Indeed, we cannot view these volumes since they do not have // a "correct geometry". std::stack toremove; - int mark_toremove=alcc.get_new_mark(); + LCC_3::size_type mark_toremove=alcc.get_new_mark(); // adart belongs to the infinite volume. toremove.push(adart); diff --git a/Linear_cell_complex/include/CGAL/Linear_cell_complex.h b/Linear_cell_complex/include/CGAL/Linear_cell_complex.h index d32aab62cd0..b0ab8454966 100644 --- a/Linear_cell_complex/include/CGAL/Linear_cell_complex.h +++ b/Linear_cell_complex/include/CGAL/Linear_cell_complex.h @@ -361,9 +361,9 @@ namespace CGAL { // Copy of the code in CMap::correct_invalid_attributes() to avoid // 2 iterations through the darts of the map. - std::vector marks(dimension+1); + std::vector marks(dimension+1); for ( unsigned int i=0; i<=dimension; ++i) - marks[i] = -1; + marks[i] = Base::MARK_ERROR; Helper::template Foreach_enabled_attributes >:: @@ -384,7 +384,7 @@ namespace CGAL { } for ( unsigned int i=0; i<=dimension; ++i) - if ( marks[i]!=-1 ) + if ( marks[i]!=Base::MARK_ERROR ) { CGAL_assertion( this->is_whole_map_marked(marks[i]) ); free_mark(marks[i]); @@ -414,13 +414,22 @@ namespace CGAL { /// Sew3 the marked facets having same geometry /// (a facet is considered marked if one of its dart is marked). - unsigned int sew3_same_facets(int AMark) + unsigned int sew3_same_facets(size_type AMark) { unsigned int res = 0; std::map > one_dart_per_facet; - int mymark = this->get_new_mark(); - CGAL_assertion( mymark!=-1 ); + size_type mymark; + // CGAL_assertion( mymark!=-1 ); + try + { + mymark = this->get_new_mark(); + } + catch (typename Base::Exception_mark_is_out_of_border e) + { + std::cerr<<"No more free mark, exit."<get_new_mark(); + size_type mark = this->get_new_mark(); this->negate_mark(mark); unsigned int res=sew3_same_facets(mark); this->free_mark(mark); diff --git a/Linear_cell_complex/include/CGAL/Linear_cell_complex_constructors.h b/Linear_cell_complex/include/CGAL/Linear_cell_complex_constructors.h index e426b3453f7..84c5123a371 100644 --- a/Linear_cell_complex/include/CGAL/Linear_cell_complex_constructors.h +++ b/Linear_cell_complex/include/CGAL/Linear_cell_complex_constructors.h @@ -577,7 +577,7 @@ namespace CGAL { alcc.vertex_attributes().end()); writer.write_facet_header(); - int m = alcc.get_new_mark(); + typename LCC::size_type m = alcc.get_new_mark(); for ( typename LCC::Dart_range::iterator itall = alcc.darts().begin(), itallend = alcc.darts().end(); itall!=itallend; ++itall ) 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 29243b4b017..b55ccd62865 100644 --- a/Linear_cell_complex/include/CGAL/Linear_cell_complex_storages.h +++ b/Linear_cell_complex/include/CGAL/Linear_cell_complex_storages.h @@ -153,21 +153,21 @@ namespace CGAL { return ADart->get_marks(); } /// Return the mark value of dart a given mark number. - bool get_dart_mark(Dart_const_handle ADart, int amark) const + bool get_dart_mark(Dart_const_handle ADart, size_type amark) const { CGAL_assertion( ADart!=NULL ); return ADart->get_mark(amark); } /// Set the mark of a given mark number to a given value. - void set_dart_mark(Dart_const_handle ADart, int amark, bool avalue) const + void set_dart_mark(Dart_const_handle ADart, size_type amark, bool avalue) const { CGAL_assertion( ADart!=NULL ); ADart->set_mark(amark, avalue); } /// Flip the mark of a given mark number to a given value. - void flip_dart_mark(Dart_const_handle ADart, int amark) const + void flip_dart_mark(Dart_const_handle ADart, size_type amark) const { CGAL_assertion( ADart!=NULL ); ADart->flip_mark(amark); From df9340115a1ac7ae7f135907d9427b957e9b31ee Mon Sep 17 00:00:00 2001 From: Sylvain Brandel Date: Thu, 4 Jun 2015 14:52:19 +0200 Subject: [PATCH 4/6] wip --- .../examples/Combinatorial_map/map_3_marks.cpp | 2 ++ STL_Extension/include/CGAL/Compact_container.h | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/Combinatorial_map/examples/Combinatorial_map/map_3_marks.cpp b/Combinatorial_map/examples/Combinatorial_map/map_3_marks.cpp index d711c8dd111..ea572427f22 100644 --- a/Combinatorial_map/examples/Combinatorial_map/map_3_marks.cpp +++ b/Combinatorial_map/examples/Combinatorial_map/map_3_marks.cpp @@ -18,6 +18,7 @@ int main() // we try to reserve more marks than available std::cout << cm.NB_MARKS << " available marks\n"; size_type marks[cm.NB_MARKS+1]; +#if 0 for (size_type i=0;i Date: Fri, 12 Jun 2015 15:11:04 +0200 Subject: [PATCH 5/6] mark type modified from int to size_type, exception thrown in get_new_mark and test added in the test-suite --- .../Concepts/CombinatorialMap.h | 22 +-- .../Combinatorial_map/map_3_marks.cpp | 33 +--- .../include/CGAL/Cell_iterators.h | 8 +- .../include/CGAL/Combinatorial_map.h | 164 +++++++----------- .../CGAL/Combinatorial_map_basic_operations.h | 42 +---- .../CGAL/Combinatorial_map_iterators_base.h | 18 +- .../CGAL/Combinatorial_map_operations.h | 2 - .../include/CGAL/Dart_iterators.h | 28 +-- .../Combinatorial_map_group_functors.h | 48 ++--- .../Combinatorial_map_internal_functors.h | 2 +- .../Combinatorial_map_test.cpp | 57 ++++++ .../include/CGAL/Linear_cell_complex.h | 10 -- 12 files changed, 190 insertions(+), 244 deletions(-) diff --git a/Combinatorial_map/doc/Combinatorial_map/Concepts/CombinatorialMap.h b/Combinatorial_map/doc/Combinatorial_map/Concepts/CombinatorialMap.h index cda24ce7eac..25e9e422a87 100644 --- a/Combinatorial_map/doc/Combinatorial_map/Concepts/CombinatorialMap.h +++ b/Combinatorial_map/doc/Combinatorial_map/Concepts/CombinatorialMap.h @@ -883,33 +883,33 @@ void reverse_orientation_connected_component(Dart_handle adart); /*! Reserves a new mark. Returns its -index. Returns -1 if there is no more available free mark. +index. If there is no more available free mark, throw the exception Exception_no_more_available_mark. */ -int get_new_mark() const; +size_type get_new_mark() const; /*! Returns true iff `m` is a reserved mark of the combinatorial map. \pre 0\f$ \leq\f$m\f$ <\f$\ref CombinatorialMap::NB_MARKS "NB_MARKS". */ -bool is_reserved(int m) const; +bool is_reserved(size_type m) const; /*! Returns true iff `*dh` is marked for `m`. \pre \ref CombinatorialMap::is_reserved "is_reserved(m)" and `*dh`\f$ \in\f$`darts()`. */ -bool is_marked(Dart_const_handle dh, int m) const; +bool is_marked(Dart_const_handle dh, size_type m) const; /*! Marks `*dh` for `m`. \pre \ref CombinatorialMap::is_reserved "is_reserved(m)" and `*dh`\f$ \in\f$`darts()`. */ -void mark(Dart_const_handle dh, int m) const; +void mark(Dart_const_handle dh, size_type m) const; /*! Unmarks `*dh` for the mark `m`. \pre \ref CombinatorialMap::is_reserved "is_reserved(m)" and `*dh`\f$ \in\f$`darts()`. */ -void unmark(Dart_const_handle dh, int m) const; +void unmark(Dart_const_handle dh, size_type m) const; /*! Inverse the mark `m` for all the darts of the combinatorial map. @@ -917,31 +917,31 @@ All the marked darts become unmarked and all the unmarked darts become marked. \pre \ref CombinatorialMap::is_reserved "is_reserved(m)". */ -void negate_mark(int m) const; +void negate_mark(size_type m) const; /*! Unmarks all the darts of the combinatorial map for `m`. \pre \ref CombinatorialMap::is_reserved "is_reserved(m)". */ -void unmark_all(int m) const; +void unmark_all(size_type m) const; /*! Returns the number of marked darts for `m`. \pre \ref CombinatorialMap::is_reserved "is_reserved(m)". */ -size_type number_of_marked_darts(int m) const; +size_type number_of_marked_darts(size_type m) const; /*! Return the number of unmarked darts for `m`. \pre \ref CombinatorialMap::is_reserved "is_reserved(m)". */ -size_type number_of_unmarked_darts(int m) const; +size_type number_of_unmarked_darts(size_type m) const; /*! Frees mark `m`. \pre \ref CombinatorialMap::is_reserved "is_reserved(m)". */ -void free_mark(int m) const; +void free_mark(size_type m) const; /// @} }; /* end CombinatorialMap */ diff --git a/Combinatorial_map/examples/Combinatorial_map/map_3_marks.cpp b/Combinatorial_map/examples/Combinatorial_map/map_3_marks.cpp index ea572427f22..c3580759e69 100644 --- a/Combinatorial_map/examples/Combinatorial_map/map_3_marks.cpp +++ b/Combinatorial_map/examples/Combinatorial_map/map_3_marks.cpp @@ -9,43 +9,24 @@ typedef CMap_3::Dart_handle Dart_handle; typedef CMap_3::size_type size_type; -typedef CMap_3::Exception_mark_is_out_of_border Exception_mark_is_out_of_border; +typedef CMap_3::Exception_no_more_available_mark Exception_no_more_available_mark; int main() { CMap_3 cm; - - // we try to reserve more marks than available - std::cout << cm.NB_MARKS << " available marks\n"; - size_type marks[cm.NB_MARKS+1]; -#if 0 - for (size_type i=0;immap->free_mark(mcell_mark_number); this->mmap->free_mark(this->mmark_number); - this->mcell_mark_number = Map::MARK_ERROR; // To avoid basic class to try to unmark darts. - this->mmark_number = Map::MARK_ERROR; // To avoid basic class to try to unmark darts. + this->mcell_mark_number = Map::INVALID_MARK; // To avoid basic class to try to unmark darts. + this->mmark_number = Map::INVALID_MARK; // To avoid basic class to try to unmark darts. } /// Copy constructor. @@ -217,7 +217,7 @@ namespace CGAL { 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::MARK_ERROR; // To avoid basic class to try to unmark darts. + this->mmark_number = Map::INVALID_MARK; // To avoid basic class to try to unmark darts. } /// Copy constructor. @@ -333,7 +333,7 @@ namespace CGAL { 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::MARK_ERROR; // To avoid basic class to try to unmark darts. + this->mmark_number = Map::INVALID_MARK; // To avoid basic class to try to unmark darts. } /// Copy constructor. diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map.h b/Combinatorial_map/include/CGAL/Combinatorial_map.h index dab4fcdb061..1b75df4a65d 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map.h @@ -97,7 +97,7 @@ namespace CGAL { static const size_type NB_MARKS = Base::NB_MARKS; // to fix the use of -1 to test unused marks in several algorithms - static const size_type MARK_ERROR = NB_MARKS; + static const size_type INVALID_MARK = NB_MARKS; static const unsigned int dimension = Base::dimension; typedef typename Base::Null_handle_type Null_handle_type; @@ -146,7 +146,7 @@ namespace CGAL { public Base::template Attribute_const_range {}; - class Exception_mark_is_out_of_border {}; + class Exception_no_more_available_mark {}; public: /** Default Combinatorial_map constructor. @@ -749,8 +749,7 @@ namespace CGAL { */ bool is_reserved(size_type amark) const { - CGAL_assertion(amark>=0 && amark1 ) { @@ -1093,7 +1080,7 @@ namespace CGAL { unsigned int i = 0, j = 0; std::vector marks(dimension+1); for ( i=0; i<=dimension; ++i) - marks[i] = MARK_ERROR; + marks[i] = INVALID_MARK; Helper::template Foreach_enabled_attributes >:: @@ -1105,7 +1092,7 @@ namespace CGAL { if ( !valid ) { // We continue the traversal to mark all the darts. for ( i=0; i<=dimension; ++i) - if (marks[i]!=MARK_ERROR) mark(it,marks[i]); + if (marks[i]!=INVALID_MARK) mark(it,marks[i]); } else { @@ -1178,7 +1165,7 @@ namespace CGAL { } } for ( i=0; i<=dimension; ++i) - if ( marks[i]!=MARK_ERROR ) + if ( marks[i]!=INVALID_MARK ) { CGAL_assertion( is_whole_map_marked(marks[i]) ); free_mark(marks[i]); @@ -1192,7 +1179,7 @@ namespace CGAL { { std::vector marks(dimension+1); for ( unsigned int i=0; i<=dimension; ++i) - marks[i] = MARK_ERROR; + marks[i] = INVALID_MARK; Helper::template Foreach_enabled_attributes >:: @@ -1207,7 +1194,7 @@ namespace CGAL { } for ( unsigned int i=0; i<=dimension; ++i) - if ( marks[i]!=MARK_ERROR ) + if ( marks[i]!=INVALID_MARK ) { CGAL_assertion( is_whole_map_marked(marks[i]) ); free_mark(marks[i]); @@ -1953,18 +1940,7 @@ namespace CGAL { dartv.push_back(it); } - // size_type mark = get_new_mark(); - // CGAL_assertion( mark!=-1 ); - size_type mark; - try - { - mark = get_new_mark(); - } - catch (Exception_mark_is_out_of_border e) - { - std::cerr<<"No more free mark, exit."< I1(*this, adart1, mark); @@ -2035,18 +2011,7 @@ namespace CGAL { dartv.push_back(it); } - // int mark = get_new_mark(); - // CGAL_assertion( mark!=-1 ); - size_type mark; - try - { - mark = get_new_mark(); - } - catch (Exception_mark_is_out_of_border e) - { - std::cerr<<"No more free mark, exit."< I1(*this, adart1, mark); @@ -2102,18 +2067,7 @@ namespace CGAL { CGAL_assertion( 2<=i && i<=dimension ); CGAL_assertion( (is_sewable(adart1,adart2)) ); - // int mark=get_new_mark(); - // CGAL_assertion( mark!=-1 ); - size_type mark; - try - { - mark = get_new_mark(); - } - catch (Exception_mark_is_out_of_border e) - { - std::cerr<<"No more free mark, exit."< I1(*this, adart1, mark); @@ -2463,14 +2417,14 @@ namespace CGAL { for ( unsigned int i=0; i tounmark; + std::vector tounmark; for ( unsigned int i=0; i, CGAL::CMap_dart_const_iterator_basic_of_orbit > Base; - Dart_of_orbit_basic_range(Self &amap, Dart_handle adart, size_type amark=MARK_ERROR): + Dart_of_orbit_basic_range(Self &amap, Dart_handle adart, size_type amark=INVALID_MARK): Base(amap, adart, amark) {} }; @@ -2633,7 +2587,7 @@ namespace CGAL { Base; Dart_of_orbit_basic_const_range(const Self &amap, Dart_const_handle - adart, size_type amark=MARK_ERROR): + adart, size_type amark=INVALID_MARK): Base(amap, adart, amark) {} }; @@ -2677,12 +2631,12 @@ namespace CGAL { //-------------------------------------------------------------------------- template Dart_of_orbit_basic_range darts_of_orbit_basic(Dart_handle adart, - size_type amark=MARK_ERROR) + size_type amark=INVALID_MARK) { return Dart_of_orbit_basic_range(*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_orbit_basic_const_range - darts_of_orbit_basic(Dart_const_handle adart, size_type amark=MARK_ERROR) const + darts_of_orbit_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const { return Dart_of_orbit_basic_const_range(*this,adart,amark); } //************************************************************************** #else @@ -2703,7 +2657,7 @@ namespace CGAL { B6,B7,B8,B9> > Base; Dart_of_orbit_basic_range(Self &amap, Dart_handle adart, - size_type /*amark*/=MARK_ERROR): + size_type /*amark*/=INVALID_MARK): Base(amap, adart) {} }; @@ -2721,7 +2675,7 @@ namespace CGAL { > Base; Dart_of_orbit_basic_const_range(const Self &amap, - Dart_const_handle adart, size_type amark=MARK_ERROR): + Dart_const_handle adart, size_type amark=INVALID_MARK): Base(amap, adart, amark) {} }; @@ -2867,104 +2821,104 @@ namespace CGAL { //-------------------------------------------------------------------------- // Basic versions Dart_of_orbit_basic_range<> darts_of_orbit_basic(Dart_handle adart, - size_type amark=MARK_ERROR) + size_type amark=INVALID_MARK) { return Dart_of_orbit_basic_range<>(*this,adart,amark); } //-------------------------------------------------------------------------- Dart_of_orbit_basic_const_range<> darts_of_orbit_basic - (Dart_const_handle adart,size_type amark=MARK_ERROR) const + (Dart_const_handle adart,size_type amark=INVALID_MARK) const { return Dart_of_orbit_basic_const_range<>(*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_orbit_basic_range darts_of_orbit_basic(Dart_handle adart, - size_type amark=MARK_ERROR) + size_type amark=INVALID_MARK) { return Dart_of_orbit_basic_range(*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_orbit_basic_const_range darts_of_orbit_basic - (Dart_const_handle adart, size_type amark=MARK_ERROR) const + (Dart_const_handle adart, size_type amark=INVALID_MARK) const { return Dart_of_orbit_basic_const_range(*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_orbit_basic_range darts_of_orbit_basic(Dart_handle adart, - size_type amark=MARK_ERROR) + size_type amark=INVALID_MARK) { return Dart_of_orbit_basic_range(*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_orbit_basic_const_range darts_of_orbit_basic - (Dart_const_handle adart, size_type amark=MARK_ERROR) const + (Dart_const_handle adart, size_type amark=INVALID_MARK) const { return Dart_of_orbit_basic_const_range(*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_orbit_basic_range darts_of_orbit_basic(Dart_handle adart, - size_type amark=MARK_ERROR) + size_type amark=INVALID_MARK) { return Dart_of_orbit_basic_range(*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_orbit_basic_const_range darts_of_orbit_basic - (Dart_const_handle adart, size_type amark=MARK_ERROR) const + (Dart_const_handle adart, size_type amark=INVALID_MARK) const { return Dart_of_orbit_basic_const_range(*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_orbit_basic_range darts_of_orbit_basic - (Dart_handle adart, size_type amark=MARK_ERROR) + (Dart_handle adart, size_type amark=INVALID_MARK) { return Dart_of_orbit_basic_range(*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_orbit_basic_const_range - darts_of_orbit_basic(Dart_const_handle adart, size_type amark=MARK_ERROR) const + darts_of_orbit_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const { return Dart_of_orbit_basic_const_range(*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_orbit_basic_range darts_of_orbit_basic - (Dart_handle adart, size_type amark=MARK_ERROR) + (Dart_handle adart, size_type amark=INVALID_MARK) { return Dart_of_orbit_basic_range(*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_orbit_basic_const_range - darts_of_orbit_basic(Dart_const_handle adart, size_type amark=MARK_ERROR) const + darts_of_orbit_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const { return Dart_of_orbit_basic_const_range (*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_orbit_basic_range darts_of_orbit_basic - (Dart_handle adart, size_type amark=MARK_ERROR) + (Dart_handle adart, size_type amark=INVALID_MARK) { return Dart_of_orbit_basic_range(*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_orbit_basic_const_range - darts_of_orbit_basic(Dart_const_handle adart, size_type amark=MARK_ERROR) const + darts_of_orbit_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const { return Dart_of_orbit_basic_const_range (*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_orbit_basic_range darts_of_orbit_basic - (Dart_handle adart, size_type amark=MARK_ERROR) + (Dart_handle adart, size_type amark=INVALID_MARK) { return Dart_of_orbit_basic_range (*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_orbit_basic_const_range - darts_of_orbit_basic(Dart_const_handle adart, size_type amark=MARK_ERROR) const + darts_of_orbit_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const { return Dart_of_orbit_basic_const_range (*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_orbit_basic_range darts_of_orbit - (Dart_handle adart, size_type amark=MARK_ERROR) + (Dart_handle adart, size_type amark=INVALID_MARK) { return Dart_of_orbit_basic_range (*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_orbit_basic_const_range - darts_of_orbit_basic(Dart_const_handle adart, size_type amark=MARK_ERROR) const + darts_of_orbit_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const { return Dart_of_orbit_basic_const_range (*this,adart,amark); } //-------------------------------------------------------------------------- @@ -2972,7 +2926,7 @@ namespace CGAL { unsigned int B5,unsigned int B6,unsigned int B7,unsigned int B8, unsigned int B9> Dart_of_orbit_basic_range - darts_of_orbit_basic(Dart_handle adart, size_type amark=MARK_ERROR) + darts_of_orbit_basic(Dart_handle adart, size_type amark=INVALID_MARK) { return Dart_of_orbit_basic_range (*this,adart,amark); } //-------------------------------------------------------------------------- @@ -2980,7 +2934,7 @@ namespace CGAL { unsigned int B5,unsigned int B6,unsigned int B7,unsigned int B8, unsigned int B9> Dart_of_orbit_basic_const_range - darts_of_orbit_basic(Dart_const_handle adart, size_type amark=MARK_ERROR) const + darts_of_orbit_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const { return Dart_of_orbit_basic_const_range (*this,adart,amark); } //************************************************************************** @@ -2996,7 +2950,7 @@ namespace CGAL { , CGAL::CMap_dart_const_iterator_basic_of_cell > Base; - Dart_of_cell_basic_range(Self &amap, Dart_handle adart, size_type amark=MARK_ERROR) : + Dart_of_cell_basic_range(Self &amap, Dart_handle adart, size_type amark=INVALID_MARK) : Base(amap, adart, amark) {} }; @@ -3010,7 +2964,7 @@ namespace CGAL { > Base; Dart_of_cell_basic_const_range(const Self &amap, Dart_const_handle adart, - size_type amark=MARK_ERROR) : + size_type amark=INVALID_MARK) : Base(amap, adart, amark) {} }; @@ -3046,22 +3000,22 @@ namespace CGAL { /// @return a range on all the darts of the given i-cell template Dart_of_cell_basic_range darts_of_cell_basic(Dart_handle adart, - size_type amark=MARK_ERROR) + size_type amark=INVALID_MARK) { return Dart_of_cell_basic_range(*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_cell_basic_const_range darts_of_cell_basic - (Dart_const_handle adart, size_type amark=MARK_ERROR) const + (Dart_const_handle adart, size_type amark=INVALID_MARK) const { return Dart_of_cell_basic_const_range(*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_cell_basic_range - darts_of_cell_basic(Dart_handle adart, size_type amark=MARK_ERROR) + darts_of_cell_basic(Dart_handle adart, size_type amark=INVALID_MARK) { return darts_of_cell_basic(adart,amark); } //-------------------------------------------------------------------------- template Dart_of_cell_basic_const_range - darts_of_cell_basic(Dart_const_handle adart, size_type amark=MARK_ERROR) const + darts_of_cell_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const { return darts_of_cell_basic(adart,amark); } //-------------------------------------------------------------------------- template @@ -3092,7 +3046,7 @@ namespace CGAL { CGAL::CMap_dart_const_iterator_basic_of_involution > Base; Dart_of_involution_basic_range(Self &amap, Dart_handle adart, - size_type amark=MARK_ERROR): + size_type amark=INVALID_MARK): Base(amap, adart, amark) {} }; @@ -3108,30 +3062,30 @@ namespace CGAL { Dart_of_involution_basic_const_range(const Self &amap, Dart_const_handle adart, - size_type amark=MARK_ERROR) : + size_type amark=INVALID_MARK) : Base(amap, adart, amark) {} }; //************************************************************************** template Dart_of_involution_basic_range - darts_of_involution_basic(Dart_handle adart, size_type amark=MARK_ERROR) + darts_of_involution_basic(Dart_handle adart, size_type amark=INVALID_MARK) { return Dart_of_involution_basic_range(*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_involution_basic_const_range - darts_of_involution_basic(Dart_const_handle adart, size_type amark=MARK_ERROR) const + darts_of_involution_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const { return Dart_of_involution_basic_const_range(*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_involution_basic_range - darts_of_involution_basic(Dart_handle adart, size_type amark=MARK_ERROR) + darts_of_involution_basic(Dart_handle adart, size_type amark=INVALID_MARK) { return Dart_of_involution_basic_range (*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_involution_basic_const_range - darts_of_involution_basic(Dart_const_handle adart, size_type amark=MARK_ERROR) const + darts_of_involution_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const { return Dart_of_involution_basic_const_range (*this,adart,amark); } //************************************************************************** @@ -3147,7 +3101,7 @@ namespace CGAL { Base; Dart_of_involution_inv_basic_range(Self &amap, Dart_handle adart, - size_type amark=MARK_ERROR): + size_type amark=INVALID_MARK): Base(amap, adart, amark) {} }; @@ -3164,31 +3118,31 @@ namespace CGAL { Dart_of_involution_inv_basic_const_range(const Self &amap, Dart_const_handle adart, - size_type amark=MARK_ERROR) : + size_type amark=INVALID_MARK) : Base(amap, adart, amark) {} }; //************************************************************************** template Dart_of_involution_inv_basic_range - darts_of_involution_inv_basic(Dart_handle adart, size_type amark=MARK_ERROR) + darts_of_involution_inv_basic(Dart_handle adart, size_type amark=INVALID_MARK) { return Dart_of_involution_inv_basic_range(*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_involution_inv_basic_const_range - darts_of_involution_inv_basic(Dart_const_handle adart, size_type amark=MARK_ERROR) const + darts_of_involution_inv_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const { return Dart_of_involution_inv_basic_const_range (*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_involution_inv_basic_range - darts_of_involution_inv_basic(Dart_handle adart, size_type amark=MARK_ERROR) + darts_of_involution_inv_basic(Dart_handle adart, size_type amark=INVALID_MARK) { return Dart_of_involution_inv_basic_range (*this,adart,amark); } //-------------------------------------------------------------------------- template Dart_of_involution_inv_basic_const_range - darts_of_involution_inv_basic(Dart_const_handle adart, size_type amark=MARK_ERROR) const + darts_of_involution_inv_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const { return Dart_of_involution_inv_basic_const_range (*this,adart,amark); } //************************************************************************** diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map_basic_operations.h b/Combinatorial_map/include/CGAL/Combinatorial_map_basic_operations.h index a9f468f56b8..ae57c78837b 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map_basic_operations.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map_basic_operations.h @@ -270,25 +270,8 @@ namespace CGAL typename Map::size_type nbIncident = 0; typename Map::size_type mark; typename Map::size_type treated; - // CGAL_assume(mark != -1); CGAL_assume( treated != -1); - try - { - mark = amap.get_new_mark(); - } - catch (typename Map::Exception_mark_is_out_of_border e) - { - std::cerr<<"No more free mark, exit."<::const_iterator it(amap, adart, mark); @@ -336,25 +319,8 @@ namespace CGAL typename Map::size_type nbIncident = 0; typename Map::size_type mark; typename Map::size_type treated; - // CGAL_assume(mark != -1); CGAL_assume( treated != -1); - try - { - mark = amap.get_new_mark(); - } - catch (typename Map::Exception_mark_is_out_of_border e) - { - std::cerr<<"No more free mark, exit."<::const_iterator it(amap, adart, mark); diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map_iterators_base.h b/Combinatorial_map/include/CGAL/Combinatorial_map_iterators_base.h index c328bb0d00d..3c9d6b602c1 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map_iterators_base.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map_iterators_base.h @@ -230,7 +230,7 @@ namespace CGAL { /// Rewind of the iterator to its beginning. void rewind() { - CGAL_assertion(mmark_number != Map::MARK_ERROR); + CGAL_assertion(mmark_number != Map::INVALID_MARK); Base::operator= ( Base(*this->mmap,minitial_dart) ); mto_treat = std::queue(); this->mmap->mark(minitial_dart, mmark_number); @@ -246,7 +246,7 @@ namespace CGAL { /// Prefix ++ operator. Self& operator++() { - CGAL_assertion(mmark_number != Map::MARK_ERROR); + CGAL_assertion(mmark_number != Map::INVALID_MARK); CGAL_assertion(this->cont()); do @@ -342,7 +342,7 @@ namespace CGAL { /// Rewind of the iterator to its beginning. void rewind() { - CGAL_assertion(this->mmark_number != Map::MARK_ERROR); + CGAL_assertion(this->mmark_number != Map::INVALID_MARK); Base::rewind(); if ( !this->mmap->is_free(this->minitial_dart, Bi) && this->mmap->beta(this->minitial_dart, Bi)!=this->minitial_dart ) @@ -412,12 +412,12 @@ namespace CGAL { /// Destructor. ~CMap_non_basic_iterator() { - CGAL_assertion( this->mmark_number!=Map::MARK_ERROR ); + CGAL_assertion( this->mmark_number!=Map::INVALID_MARK ); if (this->mmap->get_number_of_times_mark_reserved (this->mmark_number)==1) unmark_treated_darts(); this->mmap->free_mark(this->mmark_number); - this->mmark_number = Map::MARK_ERROR; // To avoid basic class to try to unmark darts. + this->mmark_number = Map::INVALID_MARK; // To avoid basic class to try to unmark darts. } /// Copy constructor. @@ -434,7 +434,7 @@ namespace CGAL { (this->mmark_number)==1) unmark_treated_darts(); this->mmap->free_mark(this->mmark_number); - this->mmark_number = Map::MARK_ERROR; + this->mmark_number = Map::INVALID_MARK; Base::operator=(aiterator); this->mmap->share_a_mark(this->mmark_number); @@ -533,7 +533,7 @@ namespace CGAL { typedef typename Map_::size_type size_type; - CMap_range(Map_ &amap, typename Map_::Dart_handle adart, size_type amark=Map_::MARK_ERROR): + CMap_range(Map_ &amap, typename Map_::Dart_handle adart, size_type amark=Map_::INVALID_MARK): mmap(amap), mdart(adart), msize(0), mmark(amark) {} iterator begin() { return iterator(mmap,mdart,mmark); } @@ -588,7 +588,7 @@ namespace CGAL { typedef Const_it const_iterator; typedef typename Map_::size_type size_type; CMap_const_range(const Map_ &amap, typename Map_::Dart_const_handle adart, - size_type amark=Map_::MARK_ERROR): + size_type amark=Map_::INVALID_MARK): mmap(amap), mdart(adart), msize(0), mmark(amark) {} const_iterator begin() const { return const_iterator(mmap,mdart,mmark); } @@ -607,7 +607,7 @@ namespace CGAL { const Map_ & mmap; typename Map_::Dart_const_handle mdart; mutable typename Map_::size_type msize; - int mmark; + size_type mmark; }; //**************************************************************************** } // namespace CGAL diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map_operations.h b/Combinatorial_map/include/CGAL/Combinatorial_map_operations.h index e138b05906d..4481c2e1874 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map_operations.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map_operations.h @@ -356,7 +356,6 @@ namespace CGAL typename CMap::Dart_handle dg1=amap.null_handle, dg2=amap.null_handle; typename CMap::size_type mark = amap.get_new_mark(); -// int mark_modified_darts = amap.get_new_mark(); // First we store and mark all the darts of the 0-cell to remove. std::deque to_erase; @@ -700,7 +699,6 @@ namespace CGAL typename CMap::Dart_handle dg1=amap.null_handle, dg2=amap.null_handle; typename CMap::size_type mark = amap.get_new_mark(); -// int mark_modified_darts = amap.get_new_mark(); // First we store and mark all the darts of the 1-cell to contract. std::deque to_erase; diff --git a/Combinatorial_map/include/CGAL/Dart_iterators.h b/Combinatorial_map/include/CGAL/Dart_iterators.h index c5bbd7f6dca..919394eef9e 100644 --- a/Combinatorial_map/include/CGAL/Dart_iterators.h +++ b/Combinatorial_map/include/CGAL/Dart_iterators.h @@ -1203,7 +1203,7 @@ namespace CGAL { /// Rewind of the iterator to its beginning. void rewind() { - CGAL_assertion(mmark_number != Map::MARK_ERROR); + CGAL_assertion(mmark_number != Map::INVALID_MARK); Base::rewind(); mto_treat = std::queue(); this->mmap->mark(*this, mmark_number); @@ -1213,7 +1213,7 @@ namespace CGAL { /// Prefix ++ operator. Self& operator++() { - CGAL_assertion(mmark_number != Map::MARK_ERROR); + CGAL_assertion(mmark_number != Map::INVALID_MARK); CGAL_assertion(this->cont()); Dart_handle nd = this->mmap->null_handle; @@ -1315,7 +1315,7 @@ namespace CGAL { /// Rewind of the iterator to its beginning. void rewind() { - CGAL_assertion(mmark_number != Map::MARK_ERROR); + CGAL_assertion(mmark_number != Map::INVALID_MARK); Base::rewind(); mto_treat = std::queue(); this->mmap->mark((*this), mmark_number); @@ -1325,7 +1325,7 @@ namespace CGAL { /// Prefix ++ operator. Self& operator++() { - CGAL_assertion(mmark_number != Map::MARK_ERROR); + CGAL_assertion(mmark_number != Map::INVALID_MARK); CGAL_assertion(this->cont()); Dart_handle nd = this->mmap->null_handle; @@ -1411,7 +1411,7 @@ namespace CGAL { /// Rewind of the iterator to its beginning. void rewind() { - CGAL_assertion(mmark_number != Map::MARK_ERROR); + CGAL_assertion(mmark_number != Map::INVALID_MARK); Base::rewind(); mto_treat = std::queue(); this->mmap->mark((*this), mmark_number); @@ -1421,7 +1421,7 @@ namespace CGAL { /// Prefix ++ operator. Self& operator++() { - CGAL_assertion(mmark_number != Map::MARK_ERROR); + CGAL_assertion(mmark_number != Map::INVALID_MARK); CGAL_assertion(this->cont()); Dart_handle nd = this->mmap->null_handle; @@ -1939,7 +1939,7 @@ namespace CGAL { /// Rewind of the iterator to its beginning. void rewind() { - CGAL_assertion(mmark_number != Map::MARK_ERROR); + CGAL_assertion(mmark_number != Map::INVALID_MARK); Base::rewind(); mto_treat = std::queue(); this->mmap->mark((*this), mmark_number); @@ -1949,7 +1949,7 @@ namespace CGAL { /// Prefix ++ operator. Self& operator++() { - CGAL_assertion(mmark_number != Map::MARK_ERROR); + CGAL_assertion(mmark_number != Map::INVALID_MARK); CGAL_assertion(this->cont()); Dart_handle nd = this->mmap->null_handle; @@ -2061,7 +2061,7 @@ namespace CGAL { /// Rewind of the iterator to its beginning. void rewind() { - CGAL_assertion(mmark_number != Map::MARK_ERROR); + CGAL_assertion(mmark_number != Map::INVALID_MARK); Base::rewind(); mto_treat = std::queue(); this->mmap->mark((*this), mmark_number); @@ -2071,7 +2071,7 @@ namespace CGAL { /// Prefix ++ operator. Self& operator++() { - CGAL_assertion(mmark_number != Map::MARK_ERROR); + CGAL_assertion(mmark_number != Map::INVALID_MARK); CGAL_assertion(this->cont()); Dart_handle nd = this->mmap->null_handle; @@ -2178,7 +2178,7 @@ namespace CGAL { /// Rewind of the iterator to its beginning. void rewind() { - CGAL_assertion(mmark_number != Map::MARK_ERROR); + CGAL_assertion(mmark_number != Map::INVALID_MARK); Base::rewind(); mto_treat = std::queue(); this->mmap->mark_null_dart(mmark_number); @@ -2188,7 +2188,7 @@ namespace CGAL { /// Prefix ++ operator. Self& operator++() { - CGAL_assertion(mmark_number != Map::MARK_ERROR); + CGAL_assertion(mmark_number != Map::INVALID_MARK); CGAL_assertion(this->cont()); Dart_handle nd = this->mmap->null_handle; @@ -2305,7 +2305,7 @@ namespace CGAL { /// Rewind of the iterator to its beginning. void rewind() { - CGAL_assertion(mmark_number != Map::MARK_ERROR); + CGAL_assertion(mmark_number != Map::INVALID_MARK); Base::rewind(); mto_treat = std::queue(); this->mmap->mark((*this), mmark_number); @@ -2315,7 +2315,7 @@ namespace CGAL { /// Prefix ++ operator. Self& operator++() { - CGAL_assertion(mmark_number != Map::MARK_ERROR); + CGAL_assertion(mmark_number != Map::INVALID_MARK); CGAL_assertion(this->cont()); Dart_handle nd = this->mmap->null_handle; diff --git a/Combinatorial_map/include/CGAL/internal/Combinatorial_map_group_functors.h b/Combinatorial_map/include/CGAL/internal/Combinatorial_map_group_functors.h index 5bcc9a3abcd..9a48162447b 100644 --- a/Combinatorial_map/include/CGAL/internal/Combinatorial_map_group_functors.h +++ b/Combinatorial_map/include/CGAL/internal/Combinatorial_map_group_functors.h @@ -580,7 +580,7 @@ struct Test_split_attribute_functor_run static void run( CMap* amap, const std::deque &modified_darts, - typename CMap::size_type mark_modified_darts=CMap::MARK_ERROR) + typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK) { CGAL_static_assertion( 1<=i && i<=CMap::dimension ); CGAL_assertion( i!=j ); @@ -609,7 +609,7 @@ struct Test_split_attribute_functor_run amap->negate_mark(mark); for ( it=modified_darts.begin(); it!=modified_darts.end(); ++it ) { - if ( mark_modified_darts!=CMap::MARK_ERROR ) + if ( mark_modified_darts!=CMap::INVALID_MARK ) amap->unmark(*it, mark_modified_darts); if ( !amap->is_marked(*it, mark) ) @@ -624,7 +624,7 @@ struct Test_split_attribute_functor_run &modified_darts, const std::deque &modified_darts2, - typename CMap::size_type mark_modified_darts=CMap::MARK_ERROR) + typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK) { CGAL_static_assertion( 1<=i && i<=CMap::dimension ); CGAL_assertion( i!=j ); @@ -660,7 +660,7 @@ struct Test_split_attribute_functor_run amap->negate_mark(mark); for ( it=modified_darts.begin(); it!=modified_darts.end(); ++it ) { - if ( mark_modified_darts!=CMap::MARK_ERROR ) + if ( mark_modified_darts!=CMap::INVALID_MARK ) amap->unmark(*it, mark_modified_darts); if ( !amap->is_marked(*it, mark) ) @@ -668,7 +668,7 @@ struct Test_split_attribute_functor_run } for ( it2=modified_darts2.begin(); it2!=modified_darts2.end(); ++it2 ) { - if ( mark_modified_darts!=CMap::MARK_ERROR ) + if ( mark_modified_darts!=CMap::INVALID_MARK ) amap->unmark(*it2, mark_modified_darts); if ( !amap->is_marked(*it2, mark) ) @@ -686,7 +686,7 @@ struct Test_split_attribute_functor_run static void run( CMap* amap, const std::deque &modified_darts, - typename CMap::size_type mark_modified_darts=CMap::MARK_ERROR) + typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK) { CGAL_assertion( j!=0 && j!=1 ); CGAL_assertion( amap!=NULL ); @@ -720,7 +720,7 @@ struct Test_split_attribute_functor_run amap->negate_mark(mark); for ( it=modified_darts.begin(); it!=modified_darts.end(); ++it ) { - if ( mark_modified_darts!=CMap::MARK_ERROR ) + if ( mark_modified_darts!=CMap::INVALID_MARK ) amap->unmark(*it, mark_modified_darts); if ( !amap->is_marked(*it, mark) ) @@ -739,7 +739,7 @@ struct Test_split_attribute_functor_run &modified_darts, const std::deque &modified_darts2, - typename CMap::size_type mark_modified_darts=CMap::MARK_ERROR) + typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK) { CGAL_assertion( j!=0 && j!=1 ); CGAL_assertion( amap!=NULL ); @@ -785,7 +785,7 @@ struct Test_split_attribute_functor_run amap->negate_mark(mark); for ( it=modified_darts.begin(); it!=modified_darts.end(); ++it ) { - if ( mark_modified_darts!=CMap::MARK_ERROR ) + if ( mark_modified_darts!=CMap::INVALID_MARK ) amap->unmark(*it, mark_modified_darts); if ( !amap->is_marked(*it, mark) ) @@ -797,7 +797,7 @@ struct Test_split_attribute_functor_run } for ( it2=modified_darts2.begin(); it2!=modified_darts2.end(); ++it2 ) { - if ( mark_modified_darts!=CMap::MARK_ERROR ) + if ( mark_modified_darts!=CMap::INVALID_MARK ) amap->unmark(*it2, mark_modified_darts); if ( !amap->is_marked(*it2, mark) ) @@ -820,14 +820,14 @@ template struct Test_split_attribute_functor_run { static void run( CMap*, const std::deque&, - typename CMap::size_type =CMap::MARK_ERROR) + typename CMap::size_type =CMap::INVALID_MARK) { CGAL_assertion(false); } static void run( CMap* amap, const std::deque &modified_darts, const std::deque &modified_darts2, - typename CMap::size_type mark_modified_darts=CMap::MARK_ERROR) + typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK) { CGAL_assertion( amap!=NULL ); CGAL_static_assertion_msg(CMap::Helper::template @@ -864,7 +864,7 @@ struct Test_split_attribute_functor_run amap->negate_mark(mark); for ( it=modified_darts.begin(); it!=modified_darts.end(); ++it ) { - if ( mark_modified_darts!=CMap::MARK_ERROR ) + if ( mark_modified_darts!=CMap::INVALID_MARK ) amap->unmark(*it, mark_modified_darts); if ( !amap->is_marked(*it, mark) ) @@ -872,7 +872,7 @@ struct Test_split_attribute_functor_run } for ( it2=modified_darts2.begin(); it2!=modified_darts2.end(); ++it2 ) { - if ( mark_modified_darts!=CMap::MARK_ERROR ) + if ( mark_modified_darts!=CMap::INVALID_MARK ) amap->unmark(*it2, mark_modified_darts); od=amap->other_extremity(*it2); @@ -890,12 +890,12 @@ template struct Test_split_attribute_functor_run { static void run( CMap*, const std::deque&, - typename CMap::size_type =CMap::MARK_ERROR) + typename CMap::size_type =CMap::INVALID_MARK) { CGAL_assertion(false); } static void run( CMap* amap, const std::deque& modified_darts, const std::deque& - modified_darts2, typename CMap::size_type mark_modified_darts=CMap::MARK_ERROR) + modified_darts2, typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK) { CGAL::internal::Test_split_attribute_functor_run:: run(amap, modified_darts, modified_darts2, mark_modified_darts); } }; @@ -904,10 +904,10 @@ template struct Test_split_attribute_functor_run { static void run( CMap*, const std::deque&, - typename CMap::size_type=CMap::MARK_ERROR) + typename CMap::size_type=CMap::INVALID_MARK) {} static void run( CMap*, const std::deque&, - const std::deque&, typename CMap::size_type=CMap::MARK_ERROR) + const std::deque&, typename CMap::size_type=CMap::INVALID_MARK) {} }; // Specialization for i=j. @@ -915,10 +915,10 @@ template struct Test_split_attribute_functor_run { static void run( CMap*, const std::deque&, - typename CMap::size_type=CMap::MARK_ERROR) + typename CMap::size_type=CMap::INVALID_MARK) {} static void run( CMap*, const std::deque&, - const std::deque&, typename CMap::size_type=CMap::MARK_ERROR) + const std::deque&, typename CMap::size_type=CMap::INVALID_MARK) {} }; // Specialization for i=1 and j=0 (edge attributes are not modified @@ -927,10 +927,10 @@ template struct Test_split_attribute_functor_run { static void run( CMap*, const std::deque&, - typename CMap::size_type=CMap::MARK_ERROR) + typename CMap::size_type=CMap::INVALID_MARK) {} static void run( CMap*, const std::deque&, - const std::deque&, typename CMap::size_type=CMap::MARK_ERROR) + const std::deque&, typename CMap::size_type=CMap::INVALID_MARK) {} }; // ************************************************************************ @@ -949,7 +949,7 @@ struct Test_split_attribute_functor static void run( CMap* amap, const std::deque &modified_darts, - typename CMap::size_type mark_modified_darts=CMap::MARK_ERROR) + typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK) { CGAL::internal::Test_split_attribute_functor_run:: run(amap, modified_darts, mark_modified_darts); @@ -960,7 +960,7 @@ struct Test_split_attribute_functor &modified_darts, const std::deque &modified_darts2, - typename CMap::size_type mark_modified_darts=CMap::MARK_ERROR) + typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK) { CGAL::internal::Test_split_attribute_functor_run:: run(amap, modified_darts, modified_darts2, mark_modified_darts); diff --git a/Combinatorial_map/include/CGAL/internal/Combinatorial_map_internal_functors.h b/Combinatorial_map/include/CGAL/internal/Combinatorial_map_internal_functors.h index 239197adb7a..4305d6b5e48 100644 --- a/Combinatorial_map/include/CGAL/internal/Combinatorial_map_internal_functors.h +++ b/Combinatorial_map/include/CGAL/internal/Combinatorial_map_internal_functors.h @@ -341,7 +341,7 @@ struct Count_cell_functor std::vector* amarks, std::vector* ares ) { - if ( (*amarks)[i]!=CMap::MARK_ERROR && !amap->is_marked(adart, (*amarks)[i]) ) + if ( (*amarks)[i]!=CMap::INVALID_MARK && !amap->is_marked(adart, (*amarks)[i]) ) { ++ (*ares)[i]; CGAL::mark_cell(*amap, adart, (*amarks)[i]); diff --git a/Combinatorial_map/test/Combinatorial_map/Combinatorial_map_test.cpp b/Combinatorial_map/test/Combinatorial_map/Combinatorial_map_test.cpp index 201be241a8f..ef808561711 100644 --- a/Combinatorial_map/test/Combinatorial_map/Combinatorial_map_test.cpp +++ b/Combinatorial_map/test/Combinatorial_map/Combinatorial_map_test.cpp @@ -132,8 +132,65 @@ typedef CGAL::Combinatorial_map<4, Map_dart_items_4> Map8; typedef CGAL::Combinatorial_map<4, Map_dart_max_items_4> Map9; +bool test_get_new_mark() +{ + cout << "***************************** TEST GET_NEW_MARK:" + << endl; + + bool res = false; + + Map1 map; + + Map1::size_type marks[Map1::NB_MARKS]; + for (unsigned int i=0; i() ) { std::cout<<"ERROR during test2D."< > one_dart_per_facet; size_type mymark; - // CGAL_assertion( mymark!=-1 ); - try - { - mymark = this->get_new_mark(); - } - catch (typename Base::Exception_mark_is_out_of_border e) - { - std::cerr<<"No more free mark, exit."< Date: Fri, 12 Jun 2015 15:23:45 +0200 Subject: [PATCH 6/6] removed code badly pushed in STL_Extension/include/CGAL/Compact_container.h --- STL_Extension/include/CGAL/Compact_container.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/STL_Extension/include/CGAL/Compact_container.h b/STL_Extension/include/CGAL/Compact_container.h index 70c96c94661..8b96bce8ba5 100644 --- a/STL_Extension/include/CGAL/Compact_container.h +++ b/STL_Extension/include/CGAL/Compact_container.h @@ -308,12 +308,6 @@ public: delete time_stamper; } - //ADDON SYLVAIN - bool is_used(const_iterator ptr) const - { - return (type(&*ptr)== USED); - } - bool is_used(size_type i) const { typename Self::size_type block_number, index_in_block;