Update generalized maps to follow the last modifications of combinatorial maps (nyf).

This commit is contained in:
Guillaume Damiand 2016-01-16 11:51:08 +01:00
parent 515fd7ef8e
commit 96e3ded2a5
5 changed files with 238 additions and 88 deletions

View File

@ -78,12 +78,22 @@ namespace CGAL {
mark_cell<Map,i,dim>(amap, (*this), mmark_number);
}
/// Constructor with a dart in parameter (for end iterator).
GMap_cell_iterator(Map& amap, Dart_handle adart):
Base(amap, adart),
mmark_number(amap.get_new_mark())
{
if (adart!=this->mmap->null_handle)
mark_cell<Map,i,dim>(amap, (*this), mmark_number);
}
/// Destructor.
~GMap_cell_iterator()
{
if (this->mmap->get_number_of_times_mark_reserved(mmark_number)==1)
unmark_treated_darts();
this->mmap->free_mark(mmark_number);
this->mmark_number = Map::INVALID_MARK; // To avoid basic class to try to unmark darts.
}
/// Copy constructor.
@ -93,7 +103,7 @@ namespace CGAL {
{ this->mmap->share_a_mark(mmark_number); }
/// Assignment operator.
Self& operator=(Self& aiterator)
Self& operator=(const Self& aiterator)
{
if (this != &aiterator)
{
@ -134,7 +144,7 @@ namespace CGAL {
private:
/// A mark used to mark treated cells.
int mmark_number;
typename Map::size_type mmark_number;
};
//****************************************************************************
/* Class GMap_one_dart_per_incident_cell_iterator<Map,i,j,dim>: to iterate
@ -191,8 +201,9 @@ namespace CGAL {
GMap_one_dart_per_cell_iterator(Map& amap): Base(amap)
{}
/// Constructor with a dart in parameter (for end iterator).
GMap_one_dart_per_cell_iterator(Map& amap, Dart_handle adart): Base(amap)
{ this->set_current_dart(adart); }
GMap_one_dart_per_cell_iterator(Map& amap, Dart_handle adart):
Base(amap, adart)
{}
};
//****************************************************************************
//****************************************************************************

View File

@ -46,6 +46,7 @@ namespace CGAL {
typedef GMap_dart_iterator_basic_of_orbit_generic<Map_,true,Alpha...> Base;
typedef typename Map_::Dart_const_handle Dart_const_handle;
typedef typename Map_::size_type size_type;
/// Main constructor.
GMap_dart_const_iterator_basic_of_orbit(const Map_& amap,
@ -55,7 +56,7 @@ namespace CGAL {
/// Main constructor.
GMap_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.
@ -104,6 +105,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.
GMap_dart_const_iterator_basic_of_orbit(const Map_& amap,
@ -113,7 +115,7 @@ namespace CGAL {
/// Main constructor.
GMap_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.
@ -161,6 +163,7 @@ namespace CGAL {
public:
typedef GMap_dart_iterator_basic_of_all<Map_,true> Base;
typedef typename Map_::Dart_const_handle Dart_const_handle;
typedef typename Map_::size_type size_type;
/* Main constructor. */
GMap_dart_const_iterator_basic_of_all(const Map_& amap,
@ -170,7 +173,7 @@ namespace CGAL {
/* Main constructor. */
GMap_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.
@ -188,6 +191,7 @@ namespace CGAL {
public:
typedef GMap_dart_iterator_basic_of_cell<Map_,i,d,true> Base;
typedef typename Map_::Dart_const_handle Dart_const_handle;
typedef typename Map_::size_type size_type;
/* Main constructor. */
GMap_dart_const_iterator_basic_of_cell(const Map_& amap,
@ -196,7 +200,8 @@ namespace CGAL {
{}
/* Main constructor. */
GMap_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.
@ -235,6 +240,7 @@ namespace CGAL {
public:
typedef GMap_dart_iterator_basic_of_involution<Map_,i,d,true> Base;
typedef typename Map_::Dart_const_handle Dart_const_handle;
typedef typename Map_::size_type size_type;
/* Main constructor. */
GMap_dart_const_iterator_basic_of_involution(const Map_& amap,
@ -244,7 +250,7 @@ namespace CGAL {
/* Main constructor. */
GMap_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.
@ -262,6 +268,7 @@ namespace CGAL {
public:
typedef GMap_dart_iterator_of_involution<Map_,i,d,true> Base;
typedef typename Map_::Dart_const_handle Dart_const_handle;
typedef typename Map_::size_type size_type;
/* Main constructor. */
GMap_dart_const_iterator_of_involution(const Map_& amap,

View File

@ -148,6 +148,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; ///< True iff this iterator uses mark
@ -159,7 +160,7 @@ namespace CGAL {
/// Main constructor.
GMap_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; ///< True iff this iterator uses mark
@ -203,7 +205,7 @@ namespace CGAL {
/// Main constructor.
GMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart,
int /*amark*/):
size_type /*amark*/):
Base(amap, adart)
{}
@ -246,6 +248,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; ///< True iff this iterator uses mark
typedef Tag_true Basic_iterator; ///< True iff this iterator is basic
@ -261,7 +264,7 @@ namespace CGAL {
/// Main constructor.
GMap_dart_iterator_basic_of_two_alpha(Map& amap, Dart_handle adart,
int /*amark*/):
size_type /*amark*/):
Base(amap, adart),
mcurdart(0)
{}
@ -360,6 +363,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; ///< True iff this iterator uses mark
typedef Tag_true Basic_iterator; ///< True iff this iterator is basic
@ -376,7 +380,7 @@ namespace CGAL {
/// Main constructor.
GMap_dart_iterator_basic_of_two_alpha(Map& amap, Dart_handle adart,
int /*amark*/):
size_type /*amark*/):
Base(amap, adart),
mfirst_dir(true),
mnext_try_first_alpha(true)
@ -517,6 +521,8 @@ namespace CGAL {
typedef typename Base::Dart_handle Dart_handle;
typedef typename Base::Map Map;
typedef typename Map::size_type size_type;
typedef Tag_true Basic_iterator; ///< True iff this iterator is basic
public:
@ -527,7 +533,7 @@ namespace CGAL {
/// Main constructor.
GMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart,
int amark):
size_type amark):
Base(amap, adart, amark)
{}
};
@ -570,7 +576,7 @@ namespace CGAL {
/// Main constructor.
GMap_dart_iterator_basic_of_three_alpha(Map& amap, Dart_handle adart,
int /*amark*/):
size_type /*amark*/):
Base(amap, adart)
{}
};
@ -600,7 +606,7 @@ namespace CGAL {
public:
/// Main constructor.
GMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart,
int amark):
size_type amark):
Base(amap, adart, amark)
{}
};
@ -628,7 +634,7 @@ namespace CGAL {
public:
/// Main constructor.
GMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart,
int amark):
size_type amark):
Base(amap, adart, amark)
{}
};
@ -651,7 +657,7 @@ namespace CGAL {
Base(amap,adart)
{}
/// Main constructor.
GMap_dart_iterator_basic_of_orbit(Map& amap,Dart_handle adart,int amark):
GMap_dart_iterator_basic_of_orbit(Map& amap,Dart_handle adart,size_type amark):
Base(amap,adart,amark)
{}
};
@ -679,7 +685,7 @@ namespace CGAL {
public:
/// Main constructor.
GMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart,
int amark):
size_type amark):
Base(amap, adart, amark)
{}
};
@ -706,7 +712,7 @@ namespace CGAL {
Base(amap,adart)
{}
/// Main constructor.
GMap_dart_iterator_basic_of_orbit(Map& amap,Dart_handle adart,int amark):
GMap_dart_iterator_basic_of_orbit(Map& amap,Dart_handle adart,size_type amark):
Base(amap,adart,amark)
{}
};
@ -734,7 +740,7 @@ namespace CGAL {
/// Main constructor.
GMap_dart_iterator_basic_of_cell(Map& amap,
Dart_handle adart,
int amark):
size_type amark):
Base(amap, adart),
mmark_number(amark)
{
@ -745,7 +751,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<Dart_handle>();
this->mmap->mark(*this, mmark_number);
@ -754,7 +760,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;
@ -775,8 +781,8 @@ namespace CGAL {
else
{
mto_treat.push(this->mmap->alpha(*this, k));
this->mmap->mark(this->mmap->alpha(*this, k), mmark_number);
}
this->mmap->mark(this->mmap->alpha(*this, k), mmark_number);
}
}
@ -807,7 +813,7 @@ namespace CGAL {
std::queue<Dart_handle> mto_treat;
/// Index of the used mark.
int mmark_number;
size_type mmark_number;
};
//****************************************************************************
// Specialization for vertex in 2D
@ -821,6 +827,7 @@ namespace CGAL {
typedef typename Base::Dart_handle Dart_handle;
typedef typename Base::Map Map;
typedef typename Map::size_type size_type;
/// Main constructor.
GMap_dart_iterator_basic_of_cell(Map& amap,
@ -831,7 +838,7 @@ namespace CGAL {
/// Main constructor.
GMap_dart_iterator_basic_of_cell(Map& amap,
Dart_handle adart,
int /*amark*/): Base(amap, adart)
size_type /*amark*/): Base(amap, adart)
{}
};
//****************************************************************************
@ -847,6 +854,7 @@ namespace CGAL {
typedef typename Base::Dart_handle Dart_handle;
typedef typename Base::Map Map;
typedef Tag_true Basic_iterator; ///< True iff this iterator is basic
typedef typename Map::size_type size_type;
/// Main constructor.
GMap_dart_iterator_basic_of_cell(Map& amap,
@ -857,7 +865,7 @@ namespace CGAL {
/// Main constructor.
GMap_dart_iterator_basic_of_cell(Map& amap,
Dart_handle adart,
int /*amark*/): Base(amap, adart)
size_type /*amark*/): Base(amap, adart)
{}
};
//****************************************************************************
@ -873,6 +881,7 @@ namespace CGAL {
typedef typename Base::Dart_handle Dart_handle;
typedef typename Base::Map Map;
typedef Tag_true Basic_iterator; ///< True iff this iterator is basic
typedef typename Map::size_type size_type;
/// Main constructor.
GMap_dart_iterator_basic_of_cell(Map& amap,
@ -883,7 +892,7 @@ namespace CGAL {
/// Main constructor.
GMap_dart_iterator_basic_of_cell(Map& amap,
Dart_handle adart,
int /*amark*/):
size_type /*amark*/):
Base(amap, adart)
{}
};
@ -900,6 +909,7 @@ namespace CGAL {
typedef typename Base::Dart_handle Dart_handle;
typedef typename Base::Map Map;
typedef Tag_true Basic_iterator; ///< True iff this iterator is basic
typedef typename Map::size_type size_type;
/// Main constructor.
/// @TODO specialization of iterator
@ -913,8 +923,7 @@ namespace CGAL {
/// Main constructor.
GMap_dart_iterator_basic_of_cell(Map& amap,
Dart_handle adart,
// @todo remove the third parameter when the specialization will be done
int amark): Base(amap, adart, amark)
size_type amark): Base(amap, adart, amark)
{}
};
//****************************************************************************
@ -930,6 +939,7 @@ namespace CGAL {
typedef typename Base::Dart_handle Dart_handle;
typedef typename Base::Map Map;
typedef Tag_true Basic_iterator; ///< True iff this iterator is basic
typedef typename Map::size_type size_type;
/// Main constructor.
/// @TODO specialization of iterator
@ -943,8 +953,7 @@ namespace CGAL {
/// Main constructor.
GMap_dart_iterator_basic_of_cell(Map& amap,
Dart_handle adart,
// @todo remove the third parameter when the specialization will be done
int amark): Base(amap, adart, amark)
size_type amark): Base(amap, adart, amark)
{}
};
//****************************************************************************
@ -960,6 +969,8 @@ 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; ///< True iff this iterator uses mark
typedef Tag_true Basic_iterator; ///< True iff this iterator is basic
@ -970,7 +981,7 @@ namespace CGAL {
{}
/// Main constructor.
GMap_dart_iterator_basic_of_all(Map& amap, int /*amark*/):
GMap_dart_iterator_basic_of_all(Map& amap, size_type /*amark*/):
Base(amap, amap.darts().begin())
{}
@ -1126,6 +1137,8 @@ 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; ///< True iff this iterator uses mark
typedef Tag_true Basic_iterator; ///< True iff this iterator is basic
@ -1133,7 +1146,7 @@ namespace CGAL {
/// Main constructor.
GMap_dart_iterator_basic_of_involution(Map& amap,
Dart_handle adart,
int amark):
size_type amark):
Base(amap, adart),
mmark_number(amark)
{
@ -1146,7 +1159,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<Dart_handle>();
this->mmap->mark((*this), mmark_number);
@ -1155,7 +1168,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;
@ -1176,8 +1189,8 @@ namespace CGAL {
else
{
mto_treat.push(this->mmap->alpha(*this, k));
this->mmap->mark(this->mmap->alpha(*this, k), mmark_number);
}
this->mmap->mark(this->mmap->alpha(*this, k), mmark_number);
}
}
@ -1197,8 +1210,8 @@ namespace CGAL {
else
{
mto_treat.push(this->mmap->alpha(*this, k));
this->mmap->mark(this->mmap->alpha(*this, k), mmark_number);
}
this->mmap->mark(this->mmap->alpha(*this, k), mmark_number);
}
}
@ -1213,7 +1226,6 @@ namespace CGAL {
else
{
this->mprev_op = OP_END;
this->set_current_dart(this->mmap->null_handle);
}
}
@ -1230,7 +1242,7 @@ namespace CGAL {
std::queue<Dart_handle> mto_treat;
/// Index of the used mark.
int mmark_number;
size_type mmark_number;
};
//****************************************************************************
// 0-involution iterator in combinatorial map of dimension 2.
@ -1245,13 +1257,15 @@ namespace CGAL {
typedef typename Base::Dart_handle Dart_handle;
typedef typename Base::Map Map;
typedef typename Map::size_type size_type;
typedef Tag_true Basic_iterator; ///< True iff this iterator is basic
public:
/// Main constructor.
GMap_dart_iterator_basic_of_involution(Map& amap,
Dart_handle adart,
int /*amark*/):
size_type /*amark*/):
Base(amap, adart)
{}
/// Main constructor.
@ -1262,7 +1276,7 @@ namespace CGAL {
};
//****************************************************************************
// 1-involution iterator in combinatorial map of dimension 2.
// Empty iterator.
// Self iterator.
template<typename Map_,bool Const>
class GMap_dart_iterator_basic_of_involution<Map_,1,2,Const>:
public GMap_dart_iterator_basic_of_orbit_generic<Map_,Const>
@ -1273,13 +1287,15 @@ namespace CGAL {
typedef typename Base::Dart_handle Dart_handle;
typedef typename Base::Map Map;
typedef typename Map::size_type size_type;
typedef Tag_true Basic_iterator; ///< True iff this iterator is basic
public:
/// Main constructor.
GMap_dart_iterator_basic_of_involution(Map& amap,
Dart_handle adart,
int /*amark*/):
size_type /*amark*/):
Base(amap, adart)
{}
/// Main constructor.
@ -1301,13 +1317,15 @@ namespace CGAL {
typedef typename Base::Dart_handle Dart_handle;
typedef typename Base::Map Map;
typedef typename Map::size_type size_type;
typedef Tag_true Basic_iterator; ///< True iff this iterator is basic
public:
/// Main constructor.
GMap_dart_iterator_basic_of_involution(Map& amap,
Dart_handle adart,
int /*amark*/):
size_type /*amark*/):
Base(amap, adart)
{}
/// Main constructor.
@ -1318,7 +1336,7 @@ namespace CGAL {
};
//****************************************************************************
// 0-involution iterator in combinatorial map of dimension 3.
// Alpha2 o Alpha3 iterator.
// Alpha2, Alpha3 iterator.
template<typename Map_,bool Const>
class GMap_dart_iterator_basic_of_involution<Map_,0,3,Const>:
public GMap_dart_iterator_basic_of_orbit_generic<Map_,Const,2,3>
@ -1329,13 +1347,15 @@ namespace CGAL {
typedef typename Base::Dart_handle Dart_handle;
typedef typename Base::Map Map;
typedef typename Map::size_type size_type;
typedef Tag_true Basic_iterator; ///< True iff this iterator is basic
public:
/// Main constructor.
GMap_dart_iterator_basic_of_involution(Map& amap,
Dart_handle adart,
int /*amark*/):
size_type /*amark*/):
Base(amap, adart)
{}
/// Main constructor.
@ -1357,13 +1377,15 @@ namespace CGAL {
typedef typename Base::Dart_handle Dart_handle;
typedef typename Base::Map Map;
typedef typename Map::size_type size_type;
typedef Tag_true Basic_iterator; ///< True iff this iterator is basic
public:
/// Main constructor.
GMap_dart_iterator_basic_of_involution(Map& amap,
Dart_handle adart,
int /*amark*/):
size_type /*amark*/):
Base(amap, adart)
{}
/// Main constructor.
@ -1385,13 +1407,15 @@ namespace CGAL {
typedef typename Base::Dart_handle Dart_handle;
typedef typename Base::Map Map;
typedef typename Map::size_type size_type;
typedef Tag_true Basic_iterator; ///< True iff this iterator is basic
public:
/// Main constructor.
GMap_dart_iterator_basic_of_involution(Map& amap,
Dart_handle adart,
int /* amark*/):
size_type /* amark*/):
Base(amap, adart)
{}
/// Main constructor.
@ -1401,8 +1425,8 @@ namespace CGAL {
{}
};
//****************************************************************************
// 1-involution iterator in combinatorial map of dimension 3.
// Alpha0 o Alpha1 iterator.
// 3-involution iterator in combinatorial map of dimension 3.
// Alpha0, Alpha1 iterator.
template<typename Map_,bool Const>
class GMap_dart_iterator_basic_of_involution<Map_,3,3,Const>:
public GMap_dart_iterator_basic_of_orbit_generic<Map_,Const,0,1>
@ -1413,13 +1437,15 @@ namespace CGAL {
typedef typename Base::Dart_handle Dart_handle;
typedef typename Base::Map Map;
typedef typename Map::size_type size_type;
typedef Tag_true Basic_iterator; ///< True iff this iterator is basic
public:
/// Main constructor.
GMap_dart_iterator_basic_of_involution(Map& amap,
Dart_handle adart,
int /*amark*/):
size_type /*amark*/):
Base(amap, adart)
{}
/// Main constructor.

View File

@ -96,8 +96,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<typename CMap::Dart_handle> to_erase;
@ -112,10 +112,13 @@ namespace CGAL
++res;
}
// We group the two (i+1)-cells incident if they exist.
if ( dg1!=amap.null_handle )
CGAL::internal::Group_attribute_functor_run<CMap, i+1>::
run(&amap, dg1, dg2);
if (amap.are_attributes_automatically_managed())
{
// We group the two (i+1)-cells incident if they exist.
if ( dg1!=amap.null_handle )
CGAL::internal::Group_attribute_functor_run<CMap, i+1>::
run(&amap, dg1, dg2);
}
// During the operation, we store in modified_darts the darts modified
// to test after the loop the non void attributes that are split.
@ -152,11 +155,14 @@ namespace CGAL
}
}
// We test the split of all the incident cells for all the non
// void attributes.
CMap::Helper::template Foreach_enabled_attributes_except
<CGAL::internal::Test_split_attribute_functor<CMap,i>, i>::
run(&amap, modified_darts, mark_modified_darts);
if (amap.are_attributes_automatically_managed())
{
// We test the split of all the incident cells for all the non
// void attributes.
CMap::Helper::template Foreach_enabled_attributes_except
<CGAL::internal::Test_split_attribute_functor<CMap,i>, i>::
run(&amap, modified_darts, mark_modified_darts);
}
// We remove all the darts of the i-cell.
for ( it=to_erase.begin(); it!=to_erase.end(); ++it )
@ -196,7 +202,7 @@ namespace CGAL
{
static size_t run(Gmap& amap, typename Gmap::Dart_handle adart)
{
int mark = amap.get_new_mark();
typename CMap::size_type mark = amap.get_new_mark();
std::deque<typename Gmap::Dart_handle> to_erase;
size_t res = 0;
@ -219,16 +225,22 @@ namespace CGAL
if ( !amap.template is_free<Gmap::dimension>(*it) &&
!amap.is_marked(amap.template alpha<Gmap::dimension>(*it), mark) )
{
modified_darts.push_back(amap.template alpha<Gmap::dimension>(*it));
if (amap.are_attributes_automatically_managed())
{
modified_darts.push_back(amap.template beta<CMap::dimension>(*it));
}
amap.template unlink_alpha<Gmap::dimension>(*it);
}
}
// We test the split of all the incident cells for all the non
// void attributes.
Gmap::Helper::template Foreach_enabled_attributes_except
<CGAL::internal::Test_split_attribute_functor<Gmap,i>,
Gmap::dimension>::run(&amap, modified_darts);
if (amap.are_attributes_automatically_managed())
{
// We test the split of all the incident cells for all the non
// void attributes.
Gmap::Helper::template Foreach_enabled_attributes_except
<CGAL::internal::Test_split_attribute_functor<Gmap,i>,
Gmap::dimension>::run(&amap, modified_darts);
}
// We remove all the darts of the d-cell.
for ( it = to_erase.begin(); it != to_erase.end(); ++it )
@ -322,8 +334,8 @@ namespace CGAL
typename Gmap::Dart_handle d1, d2;
typename Gmap::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();
// First we store and mark all the darts of the i-cell to contract.
std::deque<typename Gmap::Dart_handle> to_erase;
@ -337,10 +349,13 @@ namespace CGAL
++res;
}
// We group the two (i-1)-cells incident if they exist.
if ( dg1!=amap.null_handle )
CGAL::internal::Group_attribute_functor_run<Gmap,i-1>::
run(&amap, dg1, dg2);
if ( amap.are_attributes_automatically_managed() )
{
// We group the two (i-1)-cells incident if they exist.
if ( dg1!=amap.null_handle )
CGAL::internal::Group_attribute_functor_run<Gmap,i-1>::
run(&amap, dg1, dg2);
}
// During the operation, we store in modified_darts the darts modified
// to test after the loop the non void attributes that are split.
@ -374,11 +389,14 @@ namespace CGAL
}
}
// We test the split of all the incident cells for all the non
// void attributes.
Gmap::Helper::template Foreach_enabled_attributes_except
<CGAL::internal::Test_split_attribute_functor<Gmap,i>, i>::
run(&amap, modified_darts, mark_modified_darts);
if ( amap.are_attributes_automatically_managed() )
{
// We test the split of all the incident cells for all the non
// void attributes.
Gmap::Helper::template Foreach_enabled_attributes_except
<CGAL::internal::Test_split_attribute_functor<Gmap,i>, i>::
run(&amap, modified_darts, mark_modified_darts);
}
// We remove all the darts of the i-cell.
for ( it=to_erase.begin(); it!=to_erase.end(); ++it )

View File

@ -91,6 +91,15 @@ struct Group_attribute_functor_of_dart_run
else amap->template set_dart_attribute<i>(dh2, a1);
}
};
// Specialization for void attributes.
template<typename CMap, unsigned int i, unsigned int j>
struct Group_attribute_functor_of_dart_run<CMap, i, j, CGAL::Void>
{
static void run(CMap*,
typename CMap::Dart_handle,
typename CMap::Dart_handle)
{}
};
// Specialization for i=j. Do nothing as j is the dimension to not consider.
template<typename CMap, unsigned int i, typename T>
struct Group_attribute_functor_of_dart_run<CMap,i,i,T>
@ -274,7 +283,7 @@ void test_split_attribute_functor_one_dart
( CMap* amap, typename CMap::Dart_handle adart,
CGAL::Unique_hash_map<typename CMap::template Attribute_handle<i>::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
@ -332,7 +341,7 @@ struct Test_split_attribute_functor_run
static void run( CMap* amap,
const std::deque<typename CMap::Dart_handle>
&modified_darts,
int mark_modified_darts=-1)
typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK)
{
CGAL_static_assertion( i<=CMap::dimension );
CGAL_assertion( i!=j );
@ -348,7 +357,7 @@ struct Test_split_attribute_functor_run
CGAL::Unique_hash_map<Attribute_handle_i, unsigned int,
typename CMap::Hash_function> 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<typename CMap::Dart_handle>::const_iterator
it=modified_darts.begin();
for ( ; it!=modified_darts.end(); ++it )
@ -361,13 +370,72 @@ 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) )
CGAL::mark_cell<CMap, i>(*amap, *it, mark);
}
CGAL_assertion( amap->is_whole_map_marked(mark) );
amap->free_mark(mark);
}
static void run( CMap* amap,
const std::deque<typename CMap::Dart_handle>
&modified_darts,
const std::deque<typename CMap::Dart_handle>
&modified_darts2,
typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK)
{
CGAL_static_assertion( i<=CMap::dimension );
CGAL_assertion( i!=j );
CGAL_assertion( amap!=NULL );
CGAL_static_assertion_msg(CMap::Helper::template
Dimension_index<i>::value>=0,
"Test_split_attribute_functor_run<i> but "
"i-attributes are disabled");
typedef typename CMap::template Attribute_handle<i>::type
Attribute_handle_i;
CGAL::Unique_hash_map<Attribute_handle_i, unsigned int,
typename CMap::Hash_function> found_attributes;
typename CMap::size_type mark = amap->get_new_mark(); // to mark incident cells.
typename std::deque<typename CMap::Dart_handle>::const_iterator
it=modified_darts.begin();
for ( ; it!=modified_darts.end(); ++it )
{
CGAL::internal::test_split_attribute_functor_one_dart<CMap,i>
(amap, *it, found_attributes, mark);
}
typename std::deque<typename CMap::Dart_handle>::const_iterator
it2=modified_darts2.begin();
for ( ; it2!=modified_darts2.end(); ++it2 )
{
CGAL::internal::test_split_attribute_functor_one_dart<CMap,i>
(amap, *it2, found_attributes, mark);
}
// Now we unmark all the marked darts.
amap->negate_mark(mark);
for ( it=modified_darts.begin(); it!=modified_darts.end(); ++it )
{
if ( mark_modified_darts!=CMap::INVALID_MARK )
amap->unmark(*it, mark_modified_darts);
if ( !amap->is_marked(*it, mark) )
CGAL::mark_cell<CMap, i>(*amap, *it, mark);
}
for ( it2=modified_darts2.begin(); it2!=modified_darts2.end(); ++it2 )
{
if ( mark_modified_darts!=CMap::INVALID_MARK )
amap->unmark(*it2, mark_modified_darts);
if ( !amap->is_marked(*it2, mark) )
CGAL::mark_cell<CMap, i>(*amap, *it2, mark);
}
CGAL_assertion( amap->is_whole_map_marked(mark) );
amap->free_mark(mark);
}
@ -377,7 +445,10 @@ template<typename CMap, unsigned int i, unsigned int j>
struct Test_split_attribute_functor_run<CMap, i, j, CGAL::Void>
{
static void run( CMap*, const std::deque<typename CMap::Dart_handle>&,
int=-1)
typename CMap::size_type=CMap::INVALID_MARK)
{}
static void run( CMap*, const std::deque<typename CMap::Dart_handle>&,
const std::deque<typename CMap::Dart_handle>&, typename CMap::size_type=CMap::INVALID_MARK)
{}
};
// Specialization for i=j.
@ -385,7 +456,10 @@ template<typename CMap, unsigned int i, typename T>
struct Test_split_attribute_functor_run<CMap, i, i, T>
{
static void run( CMap*, const std::deque<typename CMap::Dart_handle>&,
int=-1)
typename CMap::size_type=CMap::INVALID_MARK)
{}
static void run( CMap*, const std::deque<typename CMap::Dart_handle>&,
const std::deque<typename CMap::Dart_handle>&, typename CMap::size_type=CMap::INVALID_MARK)
{}
};
// Specialization for i=1 and j=0 (edge attributes are not modified
@ -394,7 +468,10 @@ template<typename CMap, typename T>
struct Test_split_attribute_functor_run<CMap, 1, 0, T>
{
static void run( CMap*, const std::deque<typename CMap::Dart_handle>&,
int=-1)
typename CMap::size_type=CMap::INVALID_MARK)
{}
static void run( CMap*, const std::deque<typename CMap::Dart_handle>&,
const std::deque<typename CMap::Dart_handle>&, typename CMap::size_type=CMap::INVALID_MARK)
{}
};
// ************************************************************************
@ -413,11 +490,22 @@ struct Test_split_attribute_functor
static void run( CMap* amap,
const std::deque<typename CMap::Dart_handle>
&modified_darts,
int mark_modified_darts=-1)
typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK)
{
CGAL::internal::Test_split_attribute_functor_run<CMap, i, j>::
run(amap, modified_darts, mark_modified_darts);
}
template <unsigned int i>
static void run( CMap* amap,
const std::deque<typename CMap::Dart_handle>
&modified_darts,
const std::deque<typename CMap::Dart_handle>
&modified_darts2,
typename CMap::size_type mark_modified_darts=CMap::INVALID_MARK)
{
CGAL::internal::Test_split_attribute_functor_run<CMap, i, j>::
run(amap, modified_darts, modified_darts2, mark_modified_darts);
}
};
// ************************************************************************
} // namespace internal