mirror of https://github.com/CGAL/cgal
merge from next
And modify the licenses to LGPLv3+ for the following new files: include/CGAL/Combinatorial_map_iterators_base.h include/CGAL/internal/Combinatorial_map_utility_novariadic.h
This commit is contained in:
commit
fcd1bc0677
|
|
@ -1387,6 +1387,7 @@ Combinatorial_map/include/CGAL/Cell_iterators.h -text
|
|||
Combinatorial_map/include/CGAL/Combinatorial_map.h -text
|
||||
Combinatorial_map/include/CGAL/Combinatorial_map_basic_operations.h -text
|
||||
Combinatorial_map/include/CGAL/Combinatorial_map_constructors.h -text
|
||||
Combinatorial_map/include/CGAL/Combinatorial_map_iterators_base.h -text
|
||||
Combinatorial_map/include/CGAL/Combinatorial_map_min_items.h -text
|
||||
Combinatorial_map/include/CGAL/Combinatorial_map_operations.h -text
|
||||
Combinatorial_map/include/CGAL/Dart.h -text
|
||||
|
|
@ -1394,6 +1395,7 @@ Combinatorial_map/include/CGAL/Dart_const_iterators.h -text
|
|||
Combinatorial_map/include/CGAL/Dart_iterators.h -text
|
||||
Combinatorial_map/include/CGAL/internal/Combinatorial_map_functors.h -text
|
||||
Combinatorial_map/include/CGAL/internal/Combinatorial_map_utility.h -text
|
||||
Combinatorial_map/include/CGAL/internal/Combinatorial_map_utility_novariadic.h -text
|
||||
Combinatorial_map/package_info/Combinatorial_map/description.txt -text
|
||||
Combinatorial_map/package_info/Combinatorial_map/long_description.txt -text
|
||||
Combinatorial_map/package_info/Combinatorial_map/maintainer -text
|
||||
|
|
|
|||
|
|
@ -31,9 +31,10 @@ namespace CGAL {
|
|||
* All the cell iterators. Not commented in doxygen to avoid too much
|
||||
* classes in the documentation.
|
||||
* There are 3 classes:
|
||||
* - CMap_cell_iterator<Map,Ite,i,dim>
|
||||
* - CMap_one_dart_per_incident_cell_iterator<Map,Ite,i,dim>
|
||||
* - CMap_one_dart_per_cell_iterator<Map,Ite,i,dim>
|
||||
* - CMap_cell_iterator<Map,Ite,i,dim>: "tools" class used for the
|
||||
* two following iterators.
|
||||
* * - CMap_one_dart_per_incident_cell_iterator<Map,Ite,i,dim>
|
||||
* * - CMap_one_dart_per_cell_iterator<Map,Ite,i,dim>
|
||||
*/
|
||||
|
||||
//****************************************************************************
|
||||
|
|
@ -88,7 +89,8 @@ namespace CGAL {
|
|||
Ite(amap, adart, amap.get_new_mark()),
|
||||
mcell_mark_number(amap.get_new_mark())
|
||||
{
|
||||
CGAL_assertion( Ite::is_basic_iterator() );
|
||||
CGAL_static_assertion( (boost::is_same<typename Ite::Basic_iterator,
|
||||
Tag_true>::value) );
|
||||
CGAL_assertion(amap.is_whole_map_unmarked(mcell_mark_number));
|
||||
|
||||
mark_cell<Map,i,dim>(amap, adart, mcell_mark_number);
|
||||
|
|
@ -195,8 +197,9 @@ namespace CGAL {
|
|||
CMap_cell_iterator(Map& amap, Dart_handle adart):
|
||||
Ite(amap, adart),
|
||||
mmark_number(amap.get_new_mark())
|
||||
{
|
||||
CGAL_assertion( Ite::is_basic_iterator() );
|
||||
{
|
||||
CGAL_static_assertion( (boost::is_same<typename Ite::Basic_iterator,
|
||||
Tag_true>::value) );
|
||||
CGAL_assertion(amap.is_whole_map_unmarked(mmark_number));
|
||||
mark_cell<Map,i,dim>(amap, adart, mmark_number);
|
||||
}
|
||||
|
|
@ -298,7 +301,8 @@ namespace CGAL {
|
|||
Base(amap),
|
||||
mmark_number(amap.get_new_mark())
|
||||
{
|
||||
CGAL_assertion( Base::is_basic_iterator() );
|
||||
CGAL_static_assertion( (boost::is_same<typename Base::Basic_iterator,
|
||||
Tag_true>::value) );
|
||||
CGAL_assertion(amap.is_whole_map_unmarked(mmark_number));
|
||||
mark_cell<Map,i,dim>(amap, (*this), mmark_number);
|
||||
}
|
||||
|
|
@ -379,6 +383,9 @@ namespace CGAL {
|
|||
typedef typename Base::Dart_handle Dart_handle;
|
||||
typedef typename Base::Map Map;
|
||||
|
||||
typedef Tag_false Use_mark;
|
||||
typedef Tag_false Basic_iterator;
|
||||
|
||||
/// Main constructor.
|
||||
CMap_one_dart_per_incident_cell_iterator(Map& amap, Dart_handle adart):
|
||||
Base(amap, adart)
|
||||
|
|
@ -402,6 +409,9 @@ namespace CGAL {
|
|||
|
||||
typedef typename Base::Dart_handle Dart_handle;
|
||||
typedef typename Base::Map Map;
|
||||
|
||||
typedef Tag_false Use_mark;
|
||||
typedef Tag_false Basic_iterator;
|
||||
|
||||
/// Main constructor.
|
||||
CMap_one_dart_per_cell_iterator(Map& amap): Base(amap)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -37,7 +37,8 @@ bool belong_to_same_orbit(const Map & amap,
|
|||
typename Map::Dart_const_handle adart1,
|
||||
typename Map::Dart_const_handle adart2)
|
||||
{
|
||||
CGAL_assertion( (!Iterator::is_basic_iterator()) );
|
||||
CGAL_static_assertion( (boost::is_same<typename Iterator::Basic_iterator,
|
||||
Tag_false>::value) );
|
||||
bool found = false;
|
||||
|
||||
for (Iterator it(amap, adart1); !found && it.cont(); ++it)
|
||||
|
|
@ -59,7 +60,8 @@ bool is_whole_orbit_marked(const Map & amap,
|
|||
typename Map::Dart_const_handle adart,
|
||||
int amark)
|
||||
{
|
||||
CGAL_assertion( !Iterator::is_basic_iterator() );
|
||||
CGAL_static_assertion( (boost::is_same<typename Iterator::Basic_iterator,
|
||||
Tag_false>::value) );
|
||||
bool res = true;
|
||||
|
||||
for ( Iterator it(amap, adart); res && it.cont(); ++it )
|
||||
|
|
@ -99,7 +101,8 @@ typename Map::size_type mark_orbit(const Map & amap,
|
|||
typename Map::Dart_const_handle adart,
|
||||
unsigned int amark)
|
||||
{
|
||||
CGAL_assertion( Iterator::is_basic_iterator() );
|
||||
CGAL_static_assertion( (boost::is_same<typename Iterator::Basic_iterator,
|
||||
Tag_true>::value) );
|
||||
CGAL_assertion( (is_whole_orbit_unmarked<Map,
|
||||
CMap_non_basic_iterator<Map,Iterator> >
|
||||
(amap, adart, amark)) );
|
||||
|
|
@ -143,7 +146,9 @@ typename Map::size_type unmark_orbit(const Map & amap,
|
|||
typename Map::Dart_const_handle adart1,
|
||||
typename Map::Dart_const_handle adart2)
|
||||
{
|
||||
return belong_to_same_orbit<Map,CMap_dart_const_iterator_of_cell<Map,i,d> >
|
||||
return belong_to_same_orbit<Map,
|
||||
typename Map::template
|
||||
Dart_of_cell_range<i,d>::const_iterator>
|
||||
(amap, adart1, adart2);
|
||||
}
|
||||
|
||||
|
|
@ -167,7 +172,9 @@ bool is_whole_cell_marked(const Map & amap,
|
|||
typename Map::Dart_const_handle adart,
|
||||
unsigned int amark)
|
||||
{
|
||||
return is_whole_orbit_marked<Map,CMap_dart_const_iterator_of_cell<Map,i,d> >
|
||||
return is_whole_orbit_marked<Map,
|
||||
typename Map::template
|
||||
Dart_of_cell_range<i,d>::const_iterator>
|
||||
(amap, adart, amark);
|
||||
}
|
||||
|
||||
|
|
@ -190,7 +197,9 @@ bool is_whole_cell_unmarked(const Map & amap,
|
|||
typename Map::Dart_const_handle adart,
|
||||
unsigned int amark)
|
||||
{
|
||||
return is_whole_orbit_unmarked<Map,CMap_dart_const_iterator_of_cell<Map,i,d> >
|
||||
return is_whole_orbit_unmarked<Map,
|
||||
typename Map::template
|
||||
Dart_of_cell_range<i,d>::iterator>
|
||||
(amap, adart, amark);
|
||||
}
|
||||
|
||||
|
|
@ -211,9 +220,11 @@ bool is_whole_cell_unmarked(const Map & amap,
|
|||
*/
|
||||
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)
|
||||
{ return mark_orbit<Map,CMap_dart_const_iterator_basic_of_cell<Map,i,d> >
|
||||
typename Map::Dart_const_handle adart,
|
||||
int amark)
|
||||
{ return mark_orbit<Map,
|
||||
typename Map::template
|
||||
Dart_of_cell_basic_range<i,d>::const_iterator>
|
||||
(amap, adart, amark); }
|
||||
|
||||
template < class Map, unsigned int i>
|
||||
|
|
@ -231,9 +242,11 @@ typename Map::size_type mark_cell(const Map & amap,
|
|||
*/
|
||||
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)
|
||||
{ return unmark_orbit<Map,CMap_dart_const_iterator_basic_of_cell<Map,i,d> >
|
||||
typename Map::Dart_handle adart,
|
||||
int amark)
|
||||
{ return unmark_orbit<Map,
|
||||
typename Map::template
|
||||
Dart_of_cell_basic_range<i,d>::const_iterator>
|
||||
(amap, adart, amark);}
|
||||
|
||||
template < class Map, unsigned int i >
|
||||
|
|
@ -258,7 +271,8 @@ typename Map::size_type degree( const Map & amap,
|
|||
int mark = amap.get_new_mark();
|
||||
int treated = amap.get_new_mark();
|
||||
|
||||
CMap_dart_const_iterator_basic_of_cell<Map,i> it(amap, adart, mark);
|
||||
typename Map::template
|
||||
Dart_of_cell_basic_range<i>::const_iterator it(amap, adart, mark);
|
||||
for ( ;it.cont(); ++it )
|
||||
{
|
||||
if (!amap.is_marked(*it, treated))
|
||||
|
|
@ -304,7 +318,8 @@ typename Map::size_type codegree(const Map & amap,
|
|||
int mark = amap.get_new_mark();
|
||||
int treated = amap.get_new_mark();
|
||||
|
||||
CMap_dart_const_iterator_basic_of_cell<Map,i> it(amap, adart, mark);
|
||||
typename Map::template
|
||||
Dart_of_cell_basic_range<i>::const_iterator it(amap, adart, mark);
|
||||
for ( ; it.cont(); ++it)
|
||||
{
|
||||
if (!amap.is_marked(*it, treated))
|
||||
|
|
|
|||
|
|
@ -0,0 +1,550 @@
|
|||
// Copyright (c) 2010-2011 CNRS and LIRIS' Establishments (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; either version 3 of the License,
|
||||
// or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
// Author(s) : Guillaume Damiand <guillaume.damiand@liris.cnrs.fr>
|
||||
//
|
||||
#ifndef CGAL_COMBINATORIAL_MAP_ITERATORS_BASE_HH
|
||||
#define CGAL_COMBINATORIAL_MAP_ITERATORS_BASE_HH 1
|
||||
|
||||
#include <queue>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
/** @file Combinatorial_map_iterators_base.h
|
||||
* Basic classes that serve as tools for definition of iterators.
|
||||
There are 3 classes:
|
||||
* - CMap_dart_iterator<Map,Const> is the basic generic class defining
|
||||
* what is an interator on darts.
|
||||
* - CMap_extend_iterator<Map,Ite,Bi> to extend the given iterator by adding
|
||||
* the involution Bi.
|
||||
* - CMap_non_basic_iterator<Map_,Ite> to transform the basic iterator Ite
|
||||
* into the corresponding non basic iterator.
|
||||
*/
|
||||
//****************************************************************************
|
||||
/// OperationState: type to keep the last operation used by the previous ++.
|
||||
typedef char OperationState;
|
||||
|
||||
/// Enum of all the possible operations used by the ++ operator.
|
||||
enum
|
||||
{
|
||||
OP_NONE = -1, ///< Beginning of the iterator (there is not yet operator++).
|
||||
OP_BETAI, ///< Previous op was the first beta.
|
||||
OP_BETAI_INV, ///< Previous op was the inverse of the first beta.
|
||||
OP_BETAJ, ///< Previous op was the second beta.
|
||||
OP_BETAK, ///< Previous op was the third beta.
|
||||
OP_BETA0I, ///< Previous op was beta0 o the first beta.
|
||||
OP_BETAI1, ///< Previous op was the first beta o beta1.
|
||||
OP_BETAIJ, ///< Previous op was the composition of two beta.
|
||||
OP_BETAJI, ///< Previous op was the composition of two beta.
|
||||
OP_BETA21, ///< Previous op was beta21.
|
||||
OP_JUMP, ///< Previous op was a jump .
|
||||
OP_POP, ///< Previous op pop a dart from a stack or a queue.
|
||||
OP_END ///< Previous op go out of the iterator.
|
||||
};
|
||||
//****************************************************************************
|
||||
/** Generic class of iterator onto darts.
|
||||
* Class CMap_dart_iterator is a generic iterator. All the combinatorial
|
||||
* map iterator classes inherit from this class (or one of its subclass).
|
||||
*/
|
||||
template < typename Map_,bool Const=false >
|
||||
class CMap_dart_iterator:
|
||||
public internal::CC_iterator<typename Map_::Dart_container,Const>
|
||||
{
|
||||
public:
|
||||
typedef CMap_dart_iterator<Map_,Const> Self;
|
||||
typedef internal::CC_iterator<typename Map_::Dart_container,Const> Base;
|
||||
|
||||
typedef Base Dart_handle;
|
||||
typedef typename boost::mpl::if_c< Const, const Map_,
|
||||
Map_>::type Map;
|
||||
|
||||
typedef std::input_iterator_tag iterator_category;
|
||||
typedef typename Base::value_type value_type;
|
||||
typedef typename Base::difference_type difference_type;
|
||||
typedef typename Base::pointer pointer;
|
||||
typedef typename Base::reference reference;
|
||||
|
||||
/// true iff this iterator is basic
|
||||
typedef Tag_true Basic_iterator;
|
||||
|
||||
public:
|
||||
/// Main constructor.
|
||||
CMap_dart_iterator(Map& amap, Dart_handle adart):
|
||||
Base(adart),
|
||||
mmap(&amap),
|
||||
mfirst_dart(adart),
|
||||
mprev_op(OP_NONE)
|
||||
{}
|
||||
|
||||
/// == operator.
|
||||
bool operator==(const Self& aiterator) const
|
||||
{
|
||||
return ( ((*this==NULL) && (aiterator==NULL)) ||
|
||||
(mfirst_dart == aiterator.mfirst_dart &&
|
||||
((const Base&)*this==(const Base&)aiterator)) );
|
||||
}
|
||||
|
||||
/// != operator.
|
||||
bool operator!=(const Self& aiterator) const
|
||||
{ return !operator==(aiterator); }
|
||||
|
||||
/// Accessor to the initial dart of the iterator.
|
||||
Dart_handle get_first_dart() const { return mfirst_dart; }
|
||||
|
||||
/// Accessor to the combinatorial map.
|
||||
Map* get_combinatorial_map() const { return mmap; }
|
||||
|
||||
/// Rewind of the iterator to its beginning.
|
||||
void rewind()
|
||||
{ set_current_dart(mfirst_dart); mprev_op = OP_NONE; }
|
||||
|
||||
/// Test if the iterator is at its end.
|
||||
bool cont() const { return *this != NULL; }
|
||||
|
||||
/// Get the previous operation used for the last ++.
|
||||
OperationState prev_operation() const { return mprev_op; }
|
||||
|
||||
protected:
|
||||
/// Set the current dart to a given dart
|
||||
void set_current_dart(Dart_handle adart)
|
||||
{ Base::operator=(adart); }
|
||||
|
||||
private:
|
||||
/// operator -- in private to invalidate the base operator.
|
||||
Self& operator--()
|
||||
{ return *this; }
|
||||
/// operator -- in private to invalidate the base operator.
|
||||
void operator--(int)
|
||||
{}
|
||||
|
||||
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
|
||||
{ return !adart->is_free(ai) &&
|
||||
!mmap->is_marked(adart->beta(ai), amark); }
|
||||
|
||||
/// test if adart->beta(ai)->beta(aj) exists
|
||||
bool exist_betaij(Dart_handle adart, unsigned int ai, unsigned int aj) const
|
||||
{ return !adart->is_free(ai) && !adart->beta(ai)->is_free(aj); }
|
||||
|
||||
/// 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
|
||||
{ return exist_betaij(adart,ai,aj) &&
|
||||
!mmap->is_marked(adart->beta(ai)->beta(aj), amark); }
|
||||
|
||||
protected:
|
||||
/// The map containing the darts to iterate on.
|
||||
Map* mmap;
|
||||
|
||||
/// The initial dart of the iterator.
|
||||
Dart_handle mfirst_dart;
|
||||
|
||||
/// The last operation used for the ++ operator.
|
||||
OperationState mprev_op;
|
||||
};
|
||||
//****************************************************************************
|
||||
/* Class CMap_extend_iterator<Map,Ite,Bi> which extend a given iterator by
|
||||
* adding Bi and by using a stack and a mark.
|
||||
* General case when Ite does not have already a stack.
|
||||
*/
|
||||
template <typename Map_,typename Ite,int Bi,
|
||||
typename Ite_has_stack=typename Ite::Use_mark>
|
||||
class CMap_extend_iterator: public Ite
|
||||
{
|
||||
public:
|
||||
typedef CMap_extend_iterator<Map_,Ite,Bi, Ite_has_stack> Self;
|
||||
typedef Ite Base;
|
||||
|
||||
typedef typename Base::Dart_handle Dart_handle;
|
||||
typedef typename Base::Map Map;
|
||||
|
||||
typedef Tag_true Use_mark;
|
||||
|
||||
CGAL_static_assertion( (Bi<=Map::dimension &&
|
||||
boost::is_same<Ite_has_stack,Tag_false>::value) );
|
||||
|
||||
public:
|
||||
/// Main constructor.
|
||||
CMap_extend_iterator(Map& amap, Dart_handle adart, int amark):
|
||||
Base(amap, adart),
|
||||
mmark_number(amark),
|
||||
minitial_dart(adart)
|
||||
{
|
||||
if ( adart!=NULL )
|
||||
{
|
||||
this->mmap->mark(adart, mmark_number);
|
||||
if (!(*this)->is_free(Bi))
|
||||
mto_treat.push((*this)->beta(Bi));
|
||||
}
|
||||
}
|
||||
|
||||
/// Rewind of the iterator to its beginning.
|
||||
void rewind()
|
||||
{
|
||||
CGAL_assertion(mmark_number != -1);
|
||||
Base::operator= ( Base(*this->mmap,minitial_dart) );
|
||||
mto_treat = std::queue<Dart_handle>();
|
||||
this->mmap->mark((*this), mmark_number);
|
||||
if (!(*this)->is_free(Bi))
|
||||
mto_treat.push((*this)->beta(Bi));
|
||||
}
|
||||
|
||||
/// Prefix ++ operator.
|
||||
Self& operator++()
|
||||
{
|
||||
CGAL_assertion(mmark_number != -1);
|
||||
CGAL_assertion(this->cont());
|
||||
|
||||
Base::operator++();
|
||||
|
||||
if ( !this->cont() )
|
||||
{
|
||||
if ( !mto_treat.empty() )
|
||||
{
|
||||
Dart_handle res=NULL;
|
||||
do
|
||||
{
|
||||
res = mto_treat.front();
|
||||
mto_treat.pop();
|
||||
}
|
||||
while (!mto_treat.empty() &&
|
||||
this->mmap->is_marked(res, mmark_number));
|
||||
|
||||
if (!this->mmap->is_marked(res, mmark_number))
|
||||
{
|
||||
Base::operator= ( Base(*this->mmap,res) );
|
||||
this->mprev_op = OP_POP;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( this->cont() )
|
||||
{
|
||||
CGAL_assertion( !this->mmap->is_marked((*this),
|
||||
mmark_number) );
|
||||
this->mmap->mark((*this), mmark_number);
|
||||
|
||||
if (!(*this)->is_free(Bi) &&
|
||||
!this->mmap->is_marked((*this)->beta(Bi),
|
||||
mmark_number))
|
||||
mto_treat.push((*this)->beta(Bi));
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// Postfix ++ operator.
|
||||
Self operator++(int)
|
||||
{ Self res=*this; operator ++(); return res; }
|
||||
|
||||
protected:
|
||||
/// Queue of darts to process.
|
||||
std::queue<Dart_handle> mto_treat;
|
||||
|
||||
/// Index of the used mark.
|
||||
int mmark_number;
|
||||
|
||||
/// Initial dart
|
||||
Dart_handle minitial_dart;
|
||||
};
|
||||
//****************************************************************************
|
||||
/* Class CMap_extend_iterator<Map,Ite,Bi> which extend a given iterator by
|
||||
* adding Bi and by using a stack and a mark.
|
||||
* Specialization when Ite has already a stack.
|
||||
*/
|
||||
template <typename Map_,typename Ite,int Bi>
|
||||
class CMap_extend_iterator<Map_,Ite,Bi,Tag_true>: public Ite
|
||||
{
|
||||
public:
|
||||
typedef CMap_extend_iterator<Map_,Ite,Bi,Tag_true> Self;
|
||||
typedef Ite Base;
|
||||
|
||||
typedef typename Base::Dart_handle Dart_handle;
|
||||
typedef typename Base::Map Map;
|
||||
|
||||
typedef Tag_true Use_mark;
|
||||
|
||||
/// Main constructor.
|
||||
CMap_extend_iterator(Map& amap, Dart_handle adart, int amark):
|
||||
Base(amap, adart, amark)
|
||||
{
|
||||
if (adart!=NULL)
|
||||
{
|
||||
if (!adart->is_free(Bi) &&
|
||||
!this->mmap->is_marked(adart->beta(Bi), this->mmark_number))
|
||||
this->mto_treat.push(adart->beta(Bi));
|
||||
}
|
||||
}
|
||||
|
||||
/// Rewind of the iterator to its beginning.
|
||||
void rewind()
|
||||
{
|
||||
CGAL_assertion(this->mmark_number != -1);
|
||||
Base::rewind();
|
||||
if (!(*this)->is_free(Bi) &&
|
||||
!this->mmap->is_marked((*this)->beta(Bi),
|
||||
this->mmark_number))
|
||||
this->mto_treat.push((*this)->beta(Bi));
|
||||
}
|
||||
|
||||
/// Prefix ++ operator.
|
||||
Self& operator++()
|
||||
{
|
||||
Base::operator++();
|
||||
|
||||
if ( this->cont() )
|
||||
{
|
||||
if (!(*this)->is_free(Bi) &&
|
||||
!this->mmap->is_marked((*this)->beta(Bi),
|
||||
this->mmark_number))
|
||||
this->mto_treat.push((*this)->beta(Bi));
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// Postfix ++ operator.
|
||||
Self operator++(int)
|
||||
{ Self res=*this; operator ++(); return res; }
|
||||
};
|
||||
//****************************************************************************
|
||||
//* Class CMap_non_basic_iterator allows to transform a basic_iterator onto
|
||||
//* a non basic one, depending if the basic iterator uses mark or not.
|
||||
template <typename Map_,typename Basic_iterator,
|
||||
typename Use_mark=typename Basic_iterator::Use_mark>
|
||||
class CMap_non_basic_iterator;
|
||||
//****************************************************************************
|
||||
template <typename Map_,typename Base_>
|
||||
class CMap_non_basic_iterator<Map_,Base_,Tag_true>:
|
||||
public Base_
|
||||
{
|
||||
public:
|
||||
typedef CMap_non_basic_iterator<Map_,Base_,Tag_true> Self;
|
||||
typedef Base_ Base;
|
||||
|
||||
typedef typename Base::Map Map;
|
||||
typedef typename Base::Dart_handle Dart_handle;
|
||||
|
||||
/// True iff this iterator is basic
|
||||
typedef Tag_false Basic_iterator;
|
||||
|
||||
CGAL_static_assertion( (boost::is_same<typename Base::Basic_iterator,
|
||||
Tag_true>::value) );
|
||||
|
||||
/// Main constructor.
|
||||
CMap_non_basic_iterator(Map& amap, Dart_handle adart1):
|
||||
Base(amap, adart1, amap.get_new_mark())
|
||||
{}
|
||||
|
||||
/// Destructor.
|
||||
~CMap_non_basic_iterator()
|
||||
{
|
||||
if (this->mmark_number != -1)
|
||||
{
|
||||
unmark_treated_darts();
|
||||
CGAL_assertion( this->mmap->is_whole_map_unmarked
|
||||
(this->mmark_number) );
|
||||
this->mmap->free_mark(this->mmark_number);
|
||||
}
|
||||
}
|
||||
|
||||
/// Copy constructor.
|
||||
CMap_non_basic_iterator(const Self& aiterator):
|
||||
Base(aiterator)
|
||||
{ this->mmark_number = -1; }
|
||||
|
||||
/// Assignment operator.
|
||||
Self& operator=(const Self& aiterator)
|
||||
{
|
||||
if (this != &aiterator)
|
||||
{
|
||||
Base::operator=(aiterator);
|
||||
this->mmark_number = -1;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// Rewind of the iterator to its beginning.
|
||||
void rewind()
|
||||
{
|
||||
CGAL_assertion(this->mmark_number != -1);
|
||||
unmark_treated_darts();
|
||||
Base::rewind();
|
||||
}
|
||||
|
||||
using Base::operator++;
|
||||
|
||||
/// Postfix ++ operator.
|
||||
void operator++(int)
|
||||
{ operator ++(); }
|
||||
|
||||
protected:
|
||||
/// Unmark all the marked darts during the iterator.
|
||||
void unmark_treated_darts()
|
||||
{
|
||||
CGAL_assertion(this->mmark_number != -1);
|
||||
if (this->mmap->is_whole_map_unmarked(this->mmark_number)) return;
|
||||
|
||||
this->mmap->negate_mark(this->mmark_number);
|
||||
|
||||
if (this->mmap->is_whole_map_unmarked(this->mmark_number)) return;
|
||||
|
||||
Base::rewind();
|
||||
while (this->mmap->number_of_unmarked_darts(this->mmark_number) > 0)
|
||||
this->operator++();
|
||||
this->mmap->negate_mark(this->mmark_number);
|
||||
CGAL_assertion(this->mmap->is_whole_map_unmarked(this->mmark_number));
|
||||
}
|
||||
};
|
||||
//****************************************************************************
|
||||
template <typename Map_,typename Base_>
|
||||
class CMap_non_basic_iterator<Map_,Base_,Tag_false>:
|
||||
public Base_
|
||||
{
|
||||
public:
|
||||
typedef CMap_non_basic_iterator<Map_,Base_,Tag_false> Self;
|
||||
typedef Base_ Base;
|
||||
|
||||
typedef typename Base::Map Map;
|
||||
typedef typename Base::Dart_handle Dart_handle;
|
||||
|
||||
/// True iff this iterator is basic
|
||||
typedef Tag_false Basic_iterator;
|
||||
|
||||
CGAL_static_assertion( (boost::is_same<typename Base::Basic_iterator,
|
||||
Tag_true>::value) );
|
||||
|
||||
/// Main constructor.
|
||||
CMap_non_basic_iterator(Map& amap, Dart_handle adart):
|
||||
Base(amap, adart,-1)
|
||||
{}
|
||||
};
|
||||
//****************************************************************************
|
||||
template <typename Map_, typename It, typename Const_it,
|
||||
typename Basic_iterator=typename It::Basic_iterator>
|
||||
struct CMap_range
|
||||
{
|
||||
typedef It iterator;
|
||||
typedef Const_it const_iterator;
|
||||
CMap_range(Map_ &amap, typename Map_::Dart_handle adart) :
|
||||
mmap(amap), mdart(adart), msize(0)
|
||||
{}
|
||||
iterator begin() { return iterator(mmap,mdart); }
|
||||
iterator end() { return iterator(mmap,NULL); }
|
||||
const_iterator begin() const { return const_iterator(mmap,mdart); }
|
||||
const_iterator end() const { return const_iterator(mmap,NULL); }
|
||||
typename Map_::size_type size()
|
||||
{
|
||||
if (msize==0)
|
||||
for (const_iterator it=begin(); it!=end(); ++it)
|
||||
++msize;
|
||||
return msize;
|
||||
}
|
||||
bool empty() const
|
||||
{ return mmap.is_empty(); }
|
||||
private:
|
||||
Map_ & mmap;
|
||||
typename Map_::Dart_handle mdart;
|
||||
typename Map_::size_type msize;
|
||||
};
|
||||
//****************************************************************************
|
||||
template <typename Map_, typename It, typename Const_it>
|
||||
struct CMap_range<Map_,It,Const_it,Tag_true>
|
||||
{
|
||||
typedef CMap_range<Map_,It,Const_it,Tag_true> Base_cmap_range;
|
||||
typedef It iterator;
|
||||
typedef Const_it const_iterator;
|
||||
CMap_range(Map_ &amap, typename Map_::Dart_handle adart, int amark=-1):
|
||||
mmap(amap), mdart(adart), msize(0), mmark(amark)
|
||||
{}
|
||||
iterator begin() { return iterator(mmap,mdart,mmark); }
|
||||
iterator end() { return iterator(mmap,NULL,mmark); }
|
||||
const_iterator begin() const { return const_iterator(mmap,mdart,mmark); }
|
||||
const_iterator end() const { return const_iterator(mmap,NULL,mmark); }
|
||||
typename Map_::size_type size()
|
||||
{
|
||||
if (msize==0)
|
||||
for ( CMap_non_basic_iterator<Map_,const_iterator> it(mmap,mdart);
|
||||
it.cont(); ++it )
|
||||
++msize;
|
||||
return msize;
|
||||
}
|
||||
bool empty() const
|
||||
{ return mmap.is_empty(); }
|
||||
private:
|
||||
Map_ & mmap;
|
||||
typename Map_::Dart_handle mdart;
|
||||
typename Map_::size_type msize;
|
||||
int mmark;
|
||||
};
|
||||
//****************************************************************************
|
||||
template <typename Map_, typename Const_it,
|
||||
typename Basic_iterator=typename Const_it::Basic_iterator>
|
||||
struct CMap_const_range
|
||||
{
|
||||
typedef Const_it const_iterator;
|
||||
CMap_const_range(const Map_ &amap, typename Map_::Dart_const_handle adart):
|
||||
mmap(amap), mdart(adart), msize(0)
|
||||
{}
|
||||
const_iterator begin() const { return const_iterator(mmap,mdart); }
|
||||
const_iterator end() const { return const_iterator(mmap,NULL); }
|
||||
typename Map_::size_type size()
|
||||
{
|
||||
if (msize==0)
|
||||
for (const_iterator it=begin(); it!=end(); ++it)
|
||||
++msize;
|
||||
return msize;
|
||||
}
|
||||
bool empty() const
|
||||
{ return mmap.is_empty(); }
|
||||
private:
|
||||
const Map_ & mmap;
|
||||
typename Map_::Dart_const_handle mdart;
|
||||
typename Map_::size_type msize;
|
||||
};
|
||||
//****************************************************************************
|
||||
template <typename Map_, typename Const_it>
|
||||
struct CMap_const_range<Map_,Const_it,Tag_true>
|
||||
{
|
||||
typedef Const_it const_iterator;
|
||||
CMap_const_range(const Map_ &amap, typename Map_::Dart_const_handle adart,
|
||||
int amark=-1):
|
||||
mmap(amap), mdart(adart), msize(0), mmark(amark)
|
||||
{}
|
||||
const_iterator begin() const { return const_iterator(mmap,mdart,mmark); }
|
||||
const_iterator end() const { return const_iterator(mmap,NULL,mmark); }
|
||||
typename Map_::size_type size()
|
||||
{
|
||||
if (msize==0)
|
||||
for ( CMap_non_basic_iterator<Map_,const_iterator> it(mmap,mdart);
|
||||
it.cont(); ++it )
|
||||
++msize;
|
||||
return msize;
|
||||
}
|
||||
bool empty() const
|
||||
{ return mmap.is_empty(); }
|
||||
private:
|
||||
const Map_ & mmap;
|
||||
typename Map_::Dart_const_handle mdart;
|
||||
typename Map_::size_type msize;
|
||||
int mmark;
|
||||
};
|
||||
//****************************************************************************
|
||||
} // namespace CGAL
|
||||
//******************************************************************************
|
||||
#endif // CGAL_COMBINATORIAL_MAP_ITERATORS_BASE_HH
|
||||
//******************************************************************************
|
||||
|
|
@ -156,7 +156,7 @@ namespace CGAL {
|
|||
bool is_removable(const Map& amap, typename Map::Dart_const_handle adart)
|
||||
{
|
||||
CGAL_assertion(adart != NULL);
|
||||
CGAL_assertion(0<=i && i<=Map::dimension);
|
||||
CGAL_static_assertion(0<=i && i<=Map::dimension);
|
||||
|
||||
if ( i==Map::dimension ) return true;
|
||||
if ( i==Map::dimension-1 ) return true;
|
||||
|
|
@ -183,7 +183,7 @@ namespace CGAL {
|
|||
{
|
||||
static size_t run(Map& amap, typename Map::Dart_handle adart)
|
||||
{
|
||||
CGAL_assertion ( 1<=i && i<Map::dimension );
|
||||
CGAL_static_assertion ( 1<=i && i<Map::dimension );
|
||||
CGAL_assertion( (is_removable<Map,i>(amap, adart)) );
|
||||
|
||||
size_t res = 0;
|
||||
|
|
@ -504,7 +504,7 @@ namespace CGAL {
|
|||
InputIterator afirst,
|
||||
InputIterator alast)
|
||||
{
|
||||
CGAL_assertion( Map::dimension>= 3 );
|
||||
CGAL_static_assertion( Map::dimension>= 3 );
|
||||
|
||||
// The path must have at least one dart.
|
||||
if (afirst==alast) return false;
|
||||
|
|
|
|||
|
|
@ -25,15 +25,16 @@
|
|||
namespace CGAL {
|
||||
|
||||
/** @file Dart_const_iterators.h
|
||||
* Definition of dart const iterators. There are 8 iterators:
|
||||
* Definition of dart const iterators. There are 9 iterators:
|
||||
* - CMap_dart_const_iterator_basic_of_orbit<Map,Beta...>
|
||||
* - CMap_dart_const_iterator_basic_of_cell<Map,i,d>
|
||||
* - CMap_dart_const_iterator_basic_of_all<Map>
|
||||
* - CMap_dart_const_iterator_basic_of_involution<Map,i,d>
|
||||
* - CMap_dart_const_iterator_of_involution_inv<Map,i,d>
|
||||
* - CMap_dart_const_iterator_of_orbit<Map,Beta...>
|
||||
* - CMap_dart_const_iterator_of_cell<Map,i,d>
|
||||
* - CMap_dart_const_iterator_basic_of_involution<Map,i,d>
|
||||
* - CMap_dart_const_iterator_of_involution<Map,i,d>
|
||||
* - CMap_dart_const_iterator_basic_of_involution_inv<Map,i,d>
|
||||
* - CMap_dart_const_iterator_of_involution_inv<Map,i,d>
|
||||
*/
|
||||
//****************************************************************************
|
||||
#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
|
||||
|
|
@ -58,6 +59,13 @@ namespace CGAL {
|
|||
int amark):
|
||||
Base(amap,adart,amark)
|
||||
{}
|
||||
/// Constructor from non const version.
|
||||
CMap_dart_const_iterator_basic_of_orbit
|
||||
(const CMap_dart_iterator_basic_of_orbit<Map_,Beta...>& it):
|
||||
Base(*const_cast<const Map_*>(it.get_combinatorial_map()),
|
||||
it.get_first_dart(),
|
||||
it.mmark_number)
|
||||
{}
|
||||
};
|
||||
//****************************************************************************
|
||||
template<typename Map_,unsigned int...Beta>
|
||||
|
|
@ -109,6 +117,14 @@ namespace CGAL {
|
|||
int amark):
|
||||
Base(amap,adart,amark)
|
||||
{}
|
||||
/// Constructor from non const version.
|
||||
CMap_dart_const_iterator_basic_of_orbit
|
||||
(const CMap_dart_iterator_basic_of_orbit<Map_,B1,B2,B3,B4,B5,B6,
|
||||
B7,B8,B9>& it):
|
||||
Base(*const_cast<const Map_*>(it.get_combinatorial_map()),
|
||||
it.get_first_dart(),
|
||||
it.mmark_number)
|
||||
{}
|
||||
};
|
||||
//****************************************************************************
|
||||
template<typename Map_,int B1=-1,int B2=-1,int B3=-1,int B4=-1,int B5=-1,
|
||||
|
|
@ -139,6 +155,33 @@ namespace CGAL {
|
|||
};
|
||||
#endif // CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
|
||||
//****************************************************************************
|
||||
template<typename Map_>
|
||||
class CMap_dart_const_iterator_basic_of_all:
|
||||
public CMap_dart_iterator_basic_of_all<Map_,true>
|
||||
{
|
||||
public:
|
||||
typedef CMap_dart_iterator_basic_of_all<Map_,true> Base;
|
||||
typedef typename Map_::Dart_const_handle Dart_const_handle;
|
||||
|
||||
/* Main constructor. */
|
||||
CMap_dart_const_iterator_basic_of_all(const Map_& amap,
|
||||
Dart_const_handle adart):
|
||||
Base(amap,adart)
|
||||
{}
|
||||
/* Main constructor. */
|
||||
CMap_dart_const_iterator_basic_of_all(const Map_& amap,
|
||||
Dart_const_handle adart,
|
||||
int /*amark*/):
|
||||
Base(amap,adart)
|
||||
{}
|
||||
/// Constructor from non const version.
|
||||
CMap_dart_const_iterator_basic_of_all
|
||||
(const CMap_dart_iterator_basic_of_all<Map_,false>& it):
|
||||
Base(*const_cast<const Map_*>(it.get_combinatorial_map()),
|
||||
it.get_first_dart())
|
||||
{}
|
||||
};
|
||||
//****************************************************************************
|
||||
template<typename Map_,int i,int d=Map_::dimension>
|
||||
class CMap_dart_const_iterator_basic_of_cell:
|
||||
public CMap_dart_iterator_basic_of_cell<Map_,i,d,true>
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -51,7 +51,7 @@ namespace CGAL {
|
|||
typename Map::Dart_const_handle adart1,
|
||||
typename Map::Dart_const_handle adart2)
|
||||
{
|
||||
CGAL_assertion(2<=i && i<=Map::dimension);
|
||||
CGAL_static_assertion(2<=i && i<=Map::dimension);
|
||||
CGAL_assertion(adart1!=NULL && adart2!=NULL);
|
||||
|
||||
if ( !adart1->is_free(i) || !adart2->is_free(i) || adart1==adart2 )
|
||||
|
|
@ -144,7 +144,7 @@ namespace CGAL {
|
|||
static void run(Map& amap,typename Map::Dart_handle adart1,
|
||||
typename Map::Dart_handle adart2)
|
||||
{
|
||||
CGAL_assertion(2<=i && i<=Map::dimension);
|
||||
CGAL_static_assertion(2<=i && i<=Map::dimension);
|
||||
CGAL_assertion( (is_sewable_functor<Map,i>::run(amap,adart1,adart2)) );
|
||||
|
||||
CMap_dart_iterator_of_involution<Map,i> I1(amap, adart1);
|
||||
|
|
@ -205,7 +205,7 @@ namespace CGAL {
|
|||
static void run(Map& amap,typename Map::Dart_handle adart1,
|
||||
typename Map::Dart_handle adart2)
|
||||
{
|
||||
CGAL_assertion(2<=i && i<=Map::dimension);
|
||||
CGAL_static_assertion(2<=i && i<=Map::dimension);
|
||||
CGAL_assertion( (is_sewable_functor<Map,i>::run(amap,adart1,adart2)) );
|
||||
|
||||
CMap_dart_iterator_of_involution<Map,i> I1(amap, adart1);
|
||||
|
|
@ -312,7 +312,7 @@ namespace CGAL {
|
|||
static void run(Map& amap,typename Map::Dart_handle adart)
|
||||
{
|
||||
CGAL_assertion( adart!=NULL && !adart->is_free(i) );
|
||||
CGAL_assertion(2<=i && i<=Map::dimension);
|
||||
CGAL_static_assertion(2<=i && i<=Map::dimension);
|
||||
|
||||
CMap_dart_iterator_of_involution<Map,i> it(amap, adart);
|
||||
while ( it.cont() )
|
||||
|
|
@ -372,7 +372,7 @@ namespace CGAL {
|
|||
struct unsew_functor{
|
||||
static void run(Map& amap,typename Map::Dart_handle adart)
|
||||
{
|
||||
CGAL_assertion(2<=i && i<=Map::dimension);
|
||||
CGAL_static_assertion(2<=i && i<=Map::dimension);
|
||||
CGAL_assertion( adart!=NULL && !adart->is_free(i) );
|
||||
|
||||
std::stack<Couple_dart_and_dim<typename Map::Dart_handle> > todegroup;
|
||||
|
|
@ -478,7 +478,7 @@ namespace CGAL {
|
|||
typename Map::Dart_handle adart2)
|
||||
{
|
||||
CGAL_assertion(adart1 != NULL && adart2 != NULL && adart1!=adart2);
|
||||
CGAL_assertion( i>=2 && i<=Map::dimension );
|
||||
CGAL_static_assertion( i>=2 && i<=Map::dimension );
|
||||
adart1->basic_link_beta(adart2, i);
|
||||
adart2->basic_link_beta(adart1, i);
|
||||
}
|
||||
|
|
@ -514,7 +514,7 @@ namespace CGAL {
|
|||
static void run(Map&,typename Map::Dart_handle adart)
|
||||
{
|
||||
CGAL_assertion(adart != NULL && !adart->is_free(i));
|
||||
CGAL_assertion(2<=i && i<=Map::dimension);
|
||||
CGAL_static_assertion(2<=i && i<=Map::dimension);
|
||||
adart->beta(i)->unlink_beta(i);
|
||||
adart->unlink_beta(i);
|
||||
}
|
||||
|
|
@ -889,7 +889,7 @@ namespace CGAL {
|
|||
typename CMap::Dart_handle adart2)
|
||||
{
|
||||
CGAL_assertion(adart1 != NULL && adart2 != NULL && adart1!=adart2 );
|
||||
CGAL_assertion( 2<=i && i<=CMap::dimension );
|
||||
CGAL_static_assertion( 2<=i && i<=CMap::dimension );
|
||||
adart1->basic_link_beta(adart2, i);
|
||||
adart2->basic_link_beta(adart1, i);
|
||||
CMap::Helper::template Foreach_enabled_attributes
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue