diff --git a/Combinatorial_map/doc/Combinatorial_map/Concepts/CombinatorialMap.h b/Combinatorial_map/doc/Combinatorial_map/Concepts/CombinatorialMap.h index eca858bb1d7..be87736f655 100644 --- a/Combinatorial_map/doc/Combinatorial_map/Concepts/CombinatorialMap.h +++ b/Combinatorial_map/doc/Combinatorial_map/Concepts/CombinatorialMap.h @@ -893,33 +893,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. @@ -927,31 +927,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 23d7515c94d..38ae3e75795 100644 --- a/Combinatorial_map/examples/Combinatorial_map/map_3_marks.cpp +++ b/Combinatorial_map/examples/Combinatorial_map/map_3_marks.cpp @@ -7,17 +7,25 @@ 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_no_more_available_mark Exception_no_more_available_mark; + int main() { CMap_3 cm; - + // 1) Reserve a mark. - int mark = cm.get_new_mark(); - if ( mark==-1 ) - { - std::cerr<<"No more free mark, exit."<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::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. @@ -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::INVALID_MARK; // 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::INVALID_MARK; // 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 6a84b6ba0a5..f8eed48a1e6 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map.h @@ -46,6 +46,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 @@ -94,6 +95,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 INVALID_MARK = NB_MARKS; static const unsigned int dimension = Base::dimension; typedef typename Base::Null_handle_type Null_handle_type; @@ -142,6 +145,8 @@ namespace CGAL { public Base::template Attribute_const_range {}; + class Exception_no_more_available_mark {}; + public: /** Default Combinatorial_map constructor. * The map is empty. @@ -160,7 +165,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; @@ -335,7 +340,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); @@ -465,7 +470,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]]; @@ -757,31 +762,29 @@ 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)amark1 ) { @@ -1003,14 +997,14 @@ namespace CGAL { // 1) We remove amark from the array mused_marks_stack by // replacing it with the last mark in this array. - mused_marks_stack[mindex_marks[(size_type)amark]] = + mused_marks_stack[mindex_marks[amark]] = mused_marks_stack[--mnb_used_marks]; mindex_marks[mused_marks_stack[mnb_used_marks]] = - mindex_marks[(size_type)amark]; + mindex_marks[amark]; // 2) We add amark in the array mfree_marks_stack and update its index. mfree_marks_stack[ mnb_used_marks ] = amark; - mindex_marks[(size_type)amark] = mnb_used_marks; + mindex_marks[amark] = mnb_used_marks; mnb_times_reserved_marks[amark]=0; } @@ -1099,9 +1093,9 @@ namespace CGAL { { bool valid = true; unsigned int i = 0, j = 0; - std::vector marks(dimension+1); + std::vector marks(dimension+1); for ( i=0; i<=dimension; ++i) - marks[i] = -1; + marks[i] = INVALID_MARK; Helper::template Foreach_enabled_attributes >:: @@ -1113,7 +1107,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]!=INVALID_MARK) mark(it,marks[i]); } else { @@ -1186,7 +1180,7 @@ namespace CGAL { } } for ( i=0; i<=dimension; ++i) - if ( marks[i]!=-1 ) + if ( marks[i]!=INVALID_MARK ) { CGAL_assertion( is_whole_map_marked(marks[i]) ); free_mark(marks[i]); @@ -1198,9 +1192,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] = INVALID_MARK; Helper::template Foreach_enabled_attributes >:: @@ -1215,7 +1209,7 @@ namespace CGAL { } for ( unsigned int i=0; i<=dimension; ++i) - if ( marks[i]!=-1 ) + if ( marks[i]!=INVALID_MARK ) { CGAL_assertion( is_whole_map_marked(marks[i]) ); free_mark(marks[i]); @@ -1272,7 +1266,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) { @@ -1868,7 +1862,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 ) @@ -1962,7 +1956,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 ) @@ -1971,8 +1965,7 @@ namespace CGAL { dartv.push_back(it); } - int mark = get_new_mark(); - CGAL_assertion( mark!=-1 ); + size_type mark = get_new_mark(); CGAL::CMap_dart_iterator_basic_of_involution I1(*this, adart1, mark); @@ -2034,7 +2027,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 ) @@ -2043,8 +2036,7 @@ namespace CGAL { dartv.push_back(it); } - int mark = get_new_mark(); - CGAL_assertion( mark!=-1 ); + size_type mark = get_new_mark(); CGAL::CMap_dart_iterator_basic_of_involution I1(*this, adart1, mark); @@ -2100,8 +2092,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=get_new_mark(); CGAL::CMap_dart_iterator_basic_of_involution I1(*this, adart1, mark); @@ -2175,7 +2166,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 ) @@ -2253,7 +2244,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; @@ -2307,7 +2298,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; @@ -2442,23 +2433,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 tounmark; + std::vector tounmark; 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); @@ -2561,10 +2552,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=INVALID_MARK): Base(amap, adart, amark) {} }; @@ -2621,7 +2612,7 @@ namespace CGAL { Base; Dart_of_orbit_basic_const_range(const Self &amap, Dart_const_handle - adart, int amark=-1): + adart, size_type amark=INVALID_MARK): Base(amap, adart, amark) {} }; @@ -2665,12 +2656,12 @@ namespace CGAL { //-------------------------------------------------------------------------- template Dart_of_orbit_basic_range darts_of_orbit_basic(Dart_handle adart, - int amark=-1) + 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, int amark=-1) 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 @@ -2691,7 +2682,7 @@ namespace CGAL { B6,B7,B8,B9> > Base; Dart_of_orbit_basic_range(Self &amap, Dart_handle adart, - int /*amark*/=-1): + size_type /*amark*/=INVALID_MARK): Base(amap, adart) {} }; @@ -2709,7 +2700,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=INVALID_MARK): Base(amap, adart, amark) {} }; @@ -2855,104 +2846,104 @@ namespace CGAL { //-------------------------------------------------------------------------- // Basic versions Dart_of_orbit_basic_range<> darts_of_orbit_basic(Dart_handle adart, - int amark=-1) + 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,int amark=-1) 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, - int amark=-1) + 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, int amark=-1) 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, - int amark=-1) + 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, int amark=-1) 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, - int amark=-1) + 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, int amark=-1) 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, int amark=-1) + (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, int amark=-1) 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, int amark=-1) + (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, int amark=-1) 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, int amark=-1) + (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, int amark=-1) 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, int amark=-1) + (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, int amark=-1) 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, int amark=-1) + (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, int amark=-1) 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); } //-------------------------------------------------------------------------- @@ -2960,7 +2951,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=INVALID_MARK) { return Dart_of_orbit_basic_range (*this,adart,amark); } //-------------------------------------------------------------------------- @@ -2968,7 +2959,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=INVALID_MARK) const { return Dart_of_orbit_basic_const_range (*this,adart,amark); } //************************************************************************** @@ -2984,7 +2975,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=INVALID_MARK) : Base(amap, adart, amark) {} }; @@ -2998,7 +2989,7 @@ namespace CGAL { > Base; Dart_of_cell_basic_const_range(const Self &amap, Dart_const_handle adart, - int amark=-1) : + size_type amark=INVALID_MARK) : Base(amap, adart, amark) {} }; @@ -3034,22 +3025,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=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, int amark=-1) 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, int amark=-1) + 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, int amark=-1) const + darts_of_cell_basic(Dart_const_handle adart, size_type amark=INVALID_MARK) const { return darts_of_cell_basic(adart,amark); } //-------------------------------------------------------------------------- template @@ -3080,7 +3071,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=INVALID_MARK): Base(amap, adart, amark) {} }; @@ -3096,30 +3087,30 @@ namespace CGAL { Dart_of_involution_basic_const_range(const Self &amap, Dart_const_handle adart, - int amark=-1) : + size_type amark=INVALID_MARK) : 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=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, int amark=-1) 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, int amark=-1) + 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, int amark=-1) 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); } //************************************************************************** @@ -3135,7 +3126,7 @@ namespace CGAL { Base; Dart_of_involution_inv_basic_range(Self &amap, Dart_handle adart, - int amark=-1): + size_type amark=INVALID_MARK): Base(amap, adart, amark) {} }; @@ -3152,31 +3143,31 @@ namespace CGAL { Dart_of_involution_inv_basic_const_range(const Self &amap, Dart_const_handle adart, - int amark=-1) : + size_type amark=INVALID_MARK) : 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=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, int amark=-1) 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, int amark=-1) + 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, int amark=-1) 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); } //************************************************************************** @@ -3535,8 +3526,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); @@ -3752,10 +3743,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..ae57c78837b 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,10 @@ 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; + mark = amap.get_new_mark(); + treated = amap.get_new_mark(); typename Map::template Dart_of_cell_basic_range::const_iterator it(amap, adart, mark); @@ -316,9 +317,10 @@ 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; + mark = amap.get_new_mark(); + treated = amap.get_new_mark(); typename Map::template Dart_of_cell_basic_range::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 f87aab4d186..527728eb326 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map_functors.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map_functors.h @@ -65,8 +65,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(); } }; // **************************************************************************** @@ -94,7 +96,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..3c9d6b602c1 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::INVALID_MARK); 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::INVALID_MARK); 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::INVALID_MARK); 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::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 = -1; // 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. @@ -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::INVALID_MARK; 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_::INVALID_MARK): 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_::INVALID_MARK): mmap(amap), mdart(adart), msize(0), mmark(amark) {} const_iterator begin() const { return const_iterator(mmap,mdart,mmark); } @@ -595,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 453d27633ae..4481c2e1874 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,8 +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(); -// int mark_modified_darts = amap.get_new_mark(); + typename CMap::size_type mark = amap.get_new_mark(); // First we store and mark all the darts of the 0-cell to remove. std::deque to_erase; @@ -544,8 +543,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,8 +698,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(); -// int mark_modified_darts = amap.get_new_mark(); + typename CMap::size_type mark = 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/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..919394eef9e 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::INVALID_MARK); 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::INVALID_MARK); 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::INVALID_MARK); 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::INVALID_MARK); 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::INVALID_MARK); 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::INVALID_MARK); 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::INVALID_MARK); 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::INVALID_MARK); 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::INVALID_MARK); 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::INVALID_MARK); 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::INVALID_MARK); 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::INVALID_MARK); 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::INVALID_MARK); 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::INVALID_MARK); 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 e6dc19c79a7..6c6b830ee09 100644 --- a/Combinatorial_map/include/CGAL/internal/Combinatorial_map_group_functors.h +++ b/Combinatorial_map/include/CGAL/internal/Combinatorial_map_group_functors.h @@ -521,7 +521,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 @@ -579,7 +579,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::INVALID_MARK) { CGAL_static_assertion( 1<=i && i<=CMap::dimension ); CGAL_assertion( i!=j ); @@ -595,7 +595,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 ) @@ -608,7 +608,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::INVALID_MARK ) amap->unmark(*it, mark_modified_darts); if ( !amap->is_marked(*it, mark) ) @@ -623,7 +623,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::INVALID_MARK) { CGAL_static_assertion( 1<=i && i<=CMap::dimension ); CGAL_assertion( i!=j ); @@ -639,7 +639,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 ) @@ -659,7 +659,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::INVALID_MARK ) amap->unmark(*it, mark_modified_darts); if ( !amap->is_marked(*it, mark) ) @@ -667,7 +667,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::INVALID_MARK ) amap->unmark(*it2, mark_modified_darts); if ( !amap->is_marked(*it2, mark) ) @@ -685,7 +685,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::INVALID_MARK) { CGAL_assertion( j!=0 && j!=1 ); CGAL_assertion( amap!=NULL ); @@ -701,7 +701,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 ) @@ -719,7 +719,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::INVALID_MARK ) amap->unmark(*it, mark_modified_darts); if ( !amap->is_marked(*it, mark) ) @@ -738,7 +738,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::INVALID_MARK) { CGAL_assertion( j!=0 && j!=1 ); CGAL_assertion( amap!=NULL ); @@ -754,7 +754,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 ) @@ -784,7 +784,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::INVALID_MARK ) amap->unmark(*it, mark_modified_darts); if ( !amap->is_marked(*it, mark) ) @@ -796,7 +796,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::INVALID_MARK ) amap->unmark(*it2, mark_modified_darts); if ( !amap->is_marked(*it2, mark) ) @@ -819,14 +819,14 @@ template struct Test_split_attribute_functor_run { static void run( CMap*, const std::deque&, - int =-1) + 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, - int mark_modified_darts=-1) + typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK) { CGAL_assertion( amap!=NULL ); CGAL_static_assertion_msg(CMap::Helper::template @@ -841,7 +841,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 ) @@ -863,7 +863,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::INVALID_MARK ) amap->unmark(*it, mark_modified_darts); if ( !amap->is_marked(*it, mark) ) @@ -871,7 +871,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::INVALID_MARK ) amap->unmark(*it2, mark_modified_darts); od=amap->other_extremity(*it2); @@ -889,12 +889,12 @@ template struct Test_split_attribute_functor_run { static void run( CMap*, const std::deque&, - int =-1) + 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, int mark_modified_darts=-1) + 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); } }; @@ -903,10 +903,10 @@ template struct Test_split_attribute_functor_run { static void run( CMap*, const std::deque&, - int=-1) + typename CMap::size_type=CMap::INVALID_MARK) {} static void run( CMap*, const std::deque&, - const std::deque&, int=-1) + const std::deque&, typename CMap::size_type=CMap::INVALID_MARK) {} }; // Specialization for i=j. @@ -914,10 +914,10 @@ template struct Test_split_attribute_functor_run { static void run( CMap*, const std::deque&, - int=-1) + typename CMap::size_type=CMap::INVALID_MARK) {} static void run( CMap*, const std::deque&, - const std::deque&, int=-1) + const std::deque&, typename CMap::size_type=CMap::INVALID_MARK) {} }; // Specialization for i=1 and j=0 (edge attributes are not modified @@ -926,10 +926,10 @@ template struct Test_split_attribute_functor_run { static void run( CMap*, const std::deque&, - int=-1) + typename CMap::size_type=CMap::INVALID_MARK) {} static void run( CMap*, const std::deque&, - const std::deque&, int=-1) + const std::deque&, typename CMap::size_type=CMap::INVALID_MARK) {} }; // ************************************************************************ @@ -948,7 +948,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::INVALID_MARK) { CGAL::internal::Test_split_attribute_functor_run:: run(amap, modified_darts, mark_modified_darts); @@ -959,7 +959,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::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 a0ea69faf74..a399f0e75d6 100644 --- a/Combinatorial_map/include/CGAL/internal/Combinatorial_map_internal_functors.h +++ b/Combinatorial_map/include/CGAL/internal/Combinatorial_map_internal_functors.h @@ -186,17 +186,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; @@ -266,10 +268,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 @@ -277,7 +281,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); @@ -327,13 +331,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::INVALID_MARK && !amap->is_marked(adart, (*amarks)[i]) ) { ++ (*ares)[i]; CGAL::mark_cell(*amap, adart, (*amarks)[i]); @@ -675,7 +681,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(), @@ -729,7 +735,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(), @@ -766,7 +772,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). @@ -825,7 +831,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:"< Map8; typedef CGAL::Combinatorial_map<4, Map_dart_max_items_4> Map9; +bool test_get_new_mark() +{ + cout << "***************************** TEST GET_NEW_MARK:" + << endl; + + Map1 map; + + Map1::size_type marks[Map1::NB_MARKS]; + for (Map1::size_type i=0; i() ) { std::cout<<"ERROR during test2D."<get_new_mark (); + LCC::size_type mark = scene.lcc->get_new_mark (); scene.lcc->negate_mark (mark); std::vector cells; @@ -724,7 +724,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 @@ -829,7 +829,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); @@ -1485,7 +1485,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(), @@ -1504,7 +1504,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 @@ -1559,7 +1559,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 @@ -1679,9 +1679,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) @@ -1994,7 +1994,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); @@ -2025,7 +2025,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; @@ -2085,8 +2085,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; @@ -2322,8 +2322,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) @@ -2446,7 +2446,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++) { @@ -2546,7 +2546,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++) { @@ -2860,8 +2860,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; @@ -3060,8 +3060,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) @@ -3247,8 +3247,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 2e58379a474..ebf7ebb304e 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/MainWindow.h +++ b/Linear_cell_complex/demo/Linear_cell_complex/MainWindow.h @@ -196,7 +196,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); @@ -218,10 +218,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 f44524f267d..2bdfe37f064 100644 --- a/Linear_cell_complex/include/CGAL/Linear_cell_complex.h +++ b/Linear_cell_complex/include/CGAL/Linear_cell_complex.h @@ -119,7 +119,7 @@ namespace CGAL { using Base::unmark; using Base::free_mark; using Base::get_new_mark; - + Linear_cell_complex_base() : Base() {} @@ -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::INVALID_MARK; 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::INVALID_MARK ) { CGAL_assertion( this->is_whole_map_marked(marks[i]) ); free_mark(marks[i]); @@ -414,13 +414,12 @@ 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; // First we fill the std::map by one dart per facet, and by using // the minimal point as index. @@ -486,7 +485,7 @@ namespace CGAL { /// (all the facets of the map are considered) unsigned int sew3_same_facets() { - int mark = this->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 d87f88ed19d..aa292442063 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);