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."<