mirror of https://github.com/CGAL/cgal
Cont degroup/group and operations
This commit is contained in:
parent
599d700c65
commit
550518a13f
|
|
@ -1693,6 +1693,7 @@ namespace CGAL {
|
|||
int m=get_new_mark();
|
||||
std::deque<Dart_handle> dartv;
|
||||
std::deque<Dart_handle> modified_darts;
|
||||
std::deque<Dart_handle> modified_darts2;
|
||||
|
||||
for ( CMap_dart_iterator_basic_of_cell<Self,0> it(*this, adart, m);
|
||||
it.cont(); ++it)
|
||||
|
|
@ -1707,12 +1708,12 @@ namespace CGAL {
|
|||
if ( is_marked(it, m) )
|
||||
{
|
||||
modified_darts.push_back(it);
|
||||
modified_darts.push_back(it->template beta<0>());
|
||||
modified_darts2.push_back(it->template beta<0>());
|
||||
unlink_beta_0(it);
|
||||
}
|
||||
else
|
||||
{
|
||||
modified_darts.push_back(it);
|
||||
modified_darts2.push_back(it);
|
||||
modified_darts.push_back(it->template beta<1>());
|
||||
unlink_beta_1(it);
|
||||
}
|
||||
|
|
@ -1725,12 +1726,11 @@ namespace CGAL {
|
|||
CGAL_assertion( is_whole_map_unmarked(m) );
|
||||
free_mark(m);
|
||||
|
||||
// TODO pass the mark m to know which dart is modified by b0 of b1
|
||||
// We test the split of all the incident cells for all the non
|
||||
// void attributes.
|
||||
Helper::template Foreach_enabled_attributes_except
|
||||
<internal::Test_split_attribute_functor<Self,0>, 1>::
|
||||
run(this, &modified_darts);
|
||||
run(this, modified_darts, modified_darts2);
|
||||
}
|
||||
|
||||
/** Unsew by beta1 the given dart plus all the required darts
|
||||
|
|
@ -1748,6 +1748,7 @@ namespace CGAL {
|
|||
int m = get_new_mark();
|
||||
std::deque<Dart_handle> dartv;
|
||||
std::deque<Dart_handle> modified_darts;
|
||||
std::deque<Dart_handle> modified_darts2;
|
||||
|
||||
for ( CMap_dart_iterator_basic_of_cell<Self,0> it(*this,adart,m);
|
||||
it.cont(); ++it)
|
||||
|
|
@ -1761,14 +1762,14 @@ namespace CGAL {
|
|||
{
|
||||
if ( is_marked(it, m) )
|
||||
{
|
||||
modified_darts.push_back(it);
|
||||
modified_darts2.push_back(it);
|
||||
modified_darts.push_back(it->template beta<1>());
|
||||
unlink_beta_1(it);
|
||||
}
|
||||
else
|
||||
{
|
||||
modified_darts.push_back(it);
|
||||
modified_darts.push_back(it->template beta<0>());
|
||||
modified_darts2.push_back(it->template beta<0>());
|
||||
unlink_beta_0(it);
|
||||
}
|
||||
}
|
||||
|
|
@ -1784,7 +1785,7 @@ namespace CGAL {
|
|||
// void attributes.
|
||||
Helper::template Foreach_enabled_attributes_except
|
||||
<internal::Test_split_attribute_functor<Self,1>, 1>::
|
||||
run(this, &modified_darts);
|
||||
run(this, modified_darts, modified_darts2);
|
||||
}
|
||||
|
||||
/** Unsew by betai the given dart plus all the required darts
|
||||
|
|
@ -1816,7 +1817,7 @@ namespace CGAL {
|
|||
// void attributes.
|
||||
Helper::template Foreach_enabled_attributes_except
|
||||
<internal::Test_split_attribute_functor<Self,i>, i>::
|
||||
run(this, &modified_darts);
|
||||
run(this, modified_darts);
|
||||
}
|
||||
|
||||
/** Unsew by betai the given dart plus all the required darts
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ insert_cell_0_in_cell_1(CMap& amap, typename CMap::Dart_handle adart)
|
|||
}
|
||||
}
|
||||
|
||||
amap.template link_beta_1(*it, d1);
|
||||
amap.link_beta_1(*it, d1);
|
||||
// TODO remove this group, and use link_beta instead ?
|
||||
//amap.group_all_dart_attributes_except(*it, d1, 1);
|
||||
|
||||
|
|
|
|||
|
|
@ -104,13 +104,14 @@ namespace CGAL {
|
|||
// the operation.
|
||||
typename std::deque<typename CMap::Dart_handle>::iterator it =
|
||||
to_erase.begin();
|
||||
//TODO remove ? or be sure that this is required
|
||||
for (; it != to_erase.end(); ++it)
|
||||
amap.update_dart_of_all_attributes(*it, mark);
|
||||
|
||||
std::deque<typename CMap::Dart_handle> modified_darts;
|
||||
|
||||
// For each dart of the i-cell, we modify i-links of neighbors.
|
||||
for ( it=to_erase.begin(); it != to_erase.end(); ++it)
|
||||
for ( it=to_erase.begin(); it!=to_erase.end(); ++it )
|
||||
{
|
||||
d1=(*it)->template beta<iinv>();
|
||||
while ( d1!=CMap::null_dart_handle && amap.is_marked(d1, mark) )
|
||||
|
|
@ -141,6 +142,7 @@ namespace CGAL {
|
|||
amap.mark(d2, mark_modified_darts);
|
||||
modified_darts.push_back(d1);
|
||||
modified_darts.push_back(d2);
|
||||
// TODO push only one out of two dart ?
|
||||
/*if ( i==1 )
|
||||
{
|
||||
d2->basic_link_beta(d1, 0);
|
||||
|
|
@ -150,9 +152,9 @@ namespace CGAL {
|
|||
}
|
||||
else
|
||||
{
|
||||
if ( !d1->is_free(i) )
|
||||
if ( !d1->template is_free<i>() )
|
||||
{
|
||||
d1->unlink_beta(i);
|
||||
d1->template unlink_beta<i>();
|
||||
CGAL_assertion( !amap.is_marked(d1, mark_modified_darts) );
|
||||
amap.mark(d1, mark_modified_darts);
|
||||
modified_darts.push_back(d1);
|
||||
|
|
@ -161,9 +163,9 @@ namespace CGAL {
|
|||
}
|
||||
else if ( d2!=CMap::null_dart_handle )
|
||||
{
|
||||
if ( !d2->is_free(iinv) )
|
||||
if ( !d2->template is_free<iinv>() )
|
||||
{
|
||||
d2->unlink_beta(iinv);
|
||||
d2->template unlink_beta<iinv>();
|
||||
CGAL_assertion( !amap.is_marked(d2, mark_modified_darts) );
|
||||
amap.mark(d2, mark_modified_darts);
|
||||
modified_darts.push_back(d2);
|
||||
|
|
@ -171,12 +173,13 @@ namespace CGAL {
|
|||
}
|
||||
}
|
||||
}
|
||||
if ( (*it)->is_free(i+1) && !(*it)->is_free(i) )
|
||||
if ( (*it)->template is_free<i+1>() &&
|
||||
!(*it)->template is_free<i>() )
|
||||
{
|
||||
d1 = (*it)->beta(i);
|
||||
if ( !d1->is_free(iinv) )
|
||||
d1 = (*it)->template beta<i>();
|
||||
if ( !d1->template is_free<iinv>() )
|
||||
{
|
||||
d1->unlink_beta(iinv);
|
||||
d1->template unlink_beta<iinv>();
|
||||
CGAL_assertion( !amap.is_marked(d1, mark_modified_darts) );
|
||||
amap.mark(d1, mark_modified_darts);
|
||||
modified_darts.push_back(d1);
|
||||
|
|
@ -188,7 +191,7 @@ namespace CGAL {
|
|||
// void attributes.
|
||||
CMap::Helper::template Foreach_enabled_attributes_except
|
||||
<internal::Test_split_attribute_functor<CMap,i>, i>::
|
||||
run(&amap, &modified_darts, mark_modified_darts);
|
||||
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 )
|
||||
|
|
@ -233,18 +236,6 @@ namespace CGAL {
|
|||
|
||||
std::deque<typename CMap::Dart_handle> modified_darts;
|
||||
|
||||
/* int mark_for_incident_cells[CMap::Helper::nb_attribs];
|
||||
std::deque<std::deque<typename CMap::Dart_handle> >
|
||||
incident_cells[CMap::Helper::nb_attribs];
|
||||
|
||||
// Marks used to mark all the incident cells.
|
||||
for (int j=0; j<CMap::Helper::nb_attribs; ++j)
|
||||
{
|
||||
mark_for_incident_cells[j] = amap.get_new_mark();
|
||||
CGAL_assertion( mark_for_incident_cells[j]!=-1 );
|
||||
}
|
||||
*/
|
||||
|
||||
// 1) We mark all the darts of the d-cell.
|
||||
for (CMap_dart_iterator_basic_of_cell<CMap,CMap::dimension>
|
||||
it(amap,adart,mark); it.cont(); ++it)
|
||||
|
|
@ -257,29 +248,13 @@ namespace CGAL {
|
|||
typename std::deque<typename CMap::Dart_handle>::iterator
|
||||
it = to_erase.begin();
|
||||
|
||||
// 2) We store all the incident cells that can be split by the operation,
|
||||
// and we update the dart of the cells incident to the remove volume.
|
||||
/* for ( ; it != to_erase.end(); ++it )
|
||||
{
|
||||
if ( !(*it)->is_free(CMap::dimension) )
|
||||
{
|
||||
CMap::Helper::template Foreach_enabled_attributes
|
||||
<internal::Store_incident_cells<CMap,i> >::
|
||||
run(&amap, *it, mark, &mark_for_incident_cells[0],
|
||||
&incident_cells[0]);
|
||||
}
|
||||
amap.update_dart_of_all_attributes(*it, mark);
|
||||
}*/
|
||||
|
||||
|
||||
// 3) We unlink all the darts of the volume for beta-d.
|
||||
for ( it = to_erase.begin(); it != to_erase.end(); ++it )
|
||||
{
|
||||
if ( !(*it)->is_free(CMap::dimension) &&
|
||||
!amap.is_marked((*it)->beta(CMap::dimension), mark) )
|
||||
if ( !(*it)->template is_free<CMap::dimension>() &&
|
||||
!amap.is_marked((*it)->template beta<CMap::dimension>(), mark) )
|
||||
{
|
||||
modified_darts.push_back((*it)->beta(CMap::dimension));
|
||||
//(*it)->beta(CMap::dimension)->unlink_beta(CMap::dimension);
|
||||
modified_darts.push_back((*it)->template beta<CMap::dimension>());
|
||||
amap.template unlink_beta_for_involution<CMap::dimension>(*it);
|
||||
}
|
||||
}
|
||||
|
|
@ -288,10 +263,7 @@ namespace CGAL {
|
|||
// void attributes.
|
||||
CMap::Helper::template Foreach_enabled_attributes_except
|
||||
<internal::Test_split_attribute_functor<CMap,i>,
|
||||
CMap::dimension>::
|
||||
run(&amap, &modified_darts, -1); //, modified_darts2);
|
||||
//&mark_for_incident_cells[0],
|
||||
//&incident_cells[0]);
|
||||
CMap::dimension>::run(&amap, modified_darts);
|
||||
|
||||
// 5) We remove all the darts of the d-cell.
|
||||
for ( it = to_erase.begin(); it != to_erase.end(); ++it )
|
||||
|
|
@ -300,14 +272,6 @@ namespace CGAL {
|
|||
CGAL_assertion( amap.is_whole_map_unmarked(mark) );
|
||||
amap.free_mark(mark);
|
||||
|
||||
// We free the marks.
|
||||
/* for (int j=0; j<CMap::Helper::nb_attribs; ++j)
|
||||
{
|
||||
CGAL_assertion( amap.is_whole_map_marked
|
||||
(mark_for_incident_cells [j]) );
|
||||
amap.free_mark( mark_for_incident_cells [j] );
|
||||
}*/
|
||||
|
||||
CGAL_expensive_postcondition( amap.is_valid() );
|
||||
assert( amap.is_valid() ); // TO REMOVE
|
||||
|
||||
|
|
@ -338,26 +302,15 @@ namespace CGAL {
|
|||
std::deque<typename CMap::Dart_handle> to_erase;
|
||||
|
||||
std::deque<typename CMap::Dart_handle> modified_darts;
|
||||
|
||||
/* int mark_for_incident_cells[CMap::Helper::nb_attribs];
|
||||
std::deque<std::deque<typename CMap::Dart_handle> >
|
||||
incident_cells[CMap::Helper::nb_attribs];
|
||||
|
||||
// Marks used to mark all the incident cells.
|
||||
for (int j=0; j<CMap::Helper::nb_attribs; ++j)
|
||||
{
|
||||
mark_for_incident_cells [j] = amap.get_new_mark();
|
||||
CGAL_assertion( mark_for_incident_cells [j]!=-1 );
|
||||
}
|
||||
*/
|
||||
std::deque<typename CMap::Dart_handle> modified_darts2;
|
||||
|
||||
// First we store and mark all the darts of the 0-cell to remove.
|
||||
for ( CMap_dart_iterator_basic_of_cell<CMap,0> it(amap,adart,mark);
|
||||
it.cont(); ++it )
|
||||
{
|
||||
to_erase.push_back(it);
|
||||
if ( !it->is_free(0) && dg1==NULL )
|
||||
{ dg1=it; dg2=it->beta(0); }
|
||||
if ( !it->template is_free<0>() && dg1==NULL )
|
||||
{ dg1=it; dg2=it->template beta<0>(); }
|
||||
amap.mark(it, mark);
|
||||
++res;
|
||||
}
|
||||
|
|
@ -366,39 +319,6 @@ namespace CGAL {
|
|||
// the operation.
|
||||
typename std::deque<typename CMap::Dart_handle>::iterator it =
|
||||
to_erase.begin();
|
||||
/* for (; it != to_erase.end(); ++it)
|
||||
{
|
||||
if ( !(*it)->is_free(0) )
|
||||
{
|
||||
if ( !(*it)->is_free(1) && (*it)->beta(0)!=(*it) )
|
||||
{
|
||||
if ( dg1==NULL ) { dg1=(*it)->beta(0); dg2=(*it)->beta(1); }
|
||||
CMap::Helper::template Foreach_enabled_attributes
|
||||
<internal::Store_incident_cells<CMap,0> >::
|
||||
run(&amap, *it, mark, &mark_for_incident_cells[0],
|
||||
&incident_cells[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
CMap::Helper::template Foreach_enabled_attributes
|
||||
<internal::Store_incident_cells<CMap,0> >::
|
||||
run(&amap, *it, mark, &mark_for_incident_cells[0],
|
||||
&incident_cells[0]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !(*it)->is_free(1) )
|
||||
{
|
||||
CMap::Helper::template Foreach_enabled_attributes
|
||||
<internal::Store_incident_cells<CMap,0> >::
|
||||
run(&amap, (*it)->beta(1), mark, &mark_for_incident_cells[0],
|
||||
&incident_cells[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
for (; it != to_erase.end(); ++it)
|
||||
amap.update_dart_of_all_attributes(*it, mark);
|
||||
|
||||
|
|
@ -410,18 +330,21 @@ namespace CGAL {
|
|||
// For each dart of the vertex, we modify 0 and 1-links of neighbors.
|
||||
for ( it=to_erase.begin(); it != to_erase.end(); ++it)
|
||||
{
|
||||
if ( !(*it)->is_free(0) )
|
||||
if ( !(*it)->template is_free<0>() )
|
||||
{
|
||||
if ( !(*it)->is_free(1) && (*it)->beta(0)!=(*it) )
|
||||
if ( !(*it)->template is_free<1>() &&
|
||||
(*it)->template beta<0>()!=(*it) )
|
||||
{
|
||||
amap.template basic_link_beta<1>((*it)->beta(0), (*it)->beta(1));
|
||||
modified_darts.push_back((*it)->beta(0));
|
||||
modified_darts.push_back((*it)->beta(1));
|
||||
amap.basic_link_beta_1((*it)->template beta<0>(),
|
||||
(*it)->template beta<1>());
|
||||
modified_darts.push_back((*it)->template beta<0>());
|
||||
modified_darts2.push_back((*it)->template beta<1>());
|
||||
// TODO push only one out of two dart ?
|
||||
}
|
||||
else
|
||||
{
|
||||
(*it)->beta(0)->unlink_beta(1);
|
||||
modified_darts.push_back((*it)->beta(0));
|
||||
(*it)->template beta<0>()->template unlink_beta<1>();
|
||||
modified_darts.push_back((*it)->template beta<0>());
|
||||
}
|
||||
|
||||
for ( unsigned int j=2; j<=CMap::dimension; ++j )
|
||||
|
|
@ -430,17 +353,18 @@ namespace CGAL {
|
|||
{
|
||||
// TODO push these darts in modified_darts ?
|
||||
// not sure this is required
|
||||
amap.basic_link_beta((*it)->beta(0), (*it)->beta(j), j);
|
||||
amap.basic_link_beta((*it)->template beta<0>(),
|
||||
(*it)->beta(j), j);
|
||||
//((*it)->beta(0))->basic_link_beta((*it)->beta(j),j);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !(*it)->is_free(1) )
|
||||
if ( !(*it)->template is_free<1>() )
|
||||
{
|
||||
(*it)->beta(1)->unlink_beta(0);
|
||||
modified_darts.push_back((*it)->beta(1));
|
||||
(*it)->template beta<1>()->template unlink_beta<0>();
|
||||
modified_darts2.push_back((*it)->template beta<1>());
|
||||
}
|
||||
|
||||
for ( unsigned int j=2; j<=CMap::dimension; ++j )
|
||||
|
|
@ -459,11 +383,8 @@ namespace CGAL {
|
|||
// void attributes.
|
||||
CMap::Helper::template Foreach_enabled_attributes_except
|
||||
<internal::Test_split_attribute_functor<CMap,0>, 1>::
|
||||
// <internal::Test_split_with_deque<CMap,0> >::
|
||||
run(&amap,
|
||||
&modified_darts, -1); //mark_modified_darts);
|
||||
//&mark_for_incident_cells[0],
|
||||
//&incident_cells[0]);
|
||||
modified_darts, modified_darts2);
|
||||
|
||||
// We remove all the darts of the i-cell.
|
||||
for ( it=to_erase.begin(); it!=to_erase.end(); ++it )
|
||||
|
|
@ -472,15 +393,6 @@ namespace CGAL {
|
|||
CGAL_assertion( amap.is_whole_map_unmarked(mark) );
|
||||
amap.free_mark(mark);
|
||||
|
||||
// We free the marks.
|
||||
/* for (int j=0; j<CMap::Helper::nb_attribs; ++j)
|
||||
{
|
||||
CGAL_assertion( amap.is_whole_map_marked
|
||||
(mark_for_incident_cells [j]) );
|
||||
amap.free_mark( mark_for_incident_cells [j] );
|
||||
}
|
||||
*/
|
||||
|
||||
CGAL_expensive_postcondition( amap.is_valid() );
|
||||
assert( amap.is_valid() ); // TO REMOVEE
|
||||
|
||||
|
|
@ -555,8 +467,8 @@ namespace CGAL {
|
|||
it.cont(); ++it )
|
||||
{
|
||||
to_erase.push_back(it);
|
||||
if ( !it->is_free(i-1) && dg1==NULL )
|
||||
{ dg1=it; dg2=it->beta(i-1); }
|
||||
if ( !it->template is_free<i-1>() && dg1==NULL )
|
||||
{ dg1=it; dg2=it->template beta<i-1>(); }
|
||||
amap.mark(it, mark);
|
||||
++res;
|
||||
}
|
||||
|
|
@ -577,20 +489,21 @@ namespace CGAL {
|
|||
// For each dart of the i-cell, we modify i-links of neighbors.
|
||||
for ( it=to_erase.begin(); it!=to_erase.end(); ++it )
|
||||
{
|
||||
d1 = (*it)->beta(i);
|
||||
d1 = (*it)->template beta<i>();
|
||||
while ( d1!=CMap::null_dart_handle && amap.is_marked(d1, mark) )
|
||||
{
|
||||
d1 = d1->beta(imuinv)->beta(i);
|
||||
if (d1 == (*it)->beta(i)) d1 = CMap::null_dart_handle;
|
||||
d1 = d1->template beta<imuinv>()->template beta<i>();
|
||||
if (d1 == (*it)->template beta<i>()) d1 = CMap::null_dart_handle;
|
||||
}
|
||||
|
||||
if ( !amap.is_marked(d1, mark_modified_darts) )
|
||||
{
|
||||
d2 = (*it)->beta(i-1)->beta(i);
|
||||
d2 = (*it)->template beta<i-1>()->template beta<i>();
|
||||
while ( d2!=CMap::null_dart_handle && amap.is_marked(d2, mark) )
|
||||
{
|
||||
d2 = d2->beta(i-1)->beta(i);
|
||||
if ( d2==(*it)->beta(i-1)->beta(i) ) d2=CMap::null_dart_handle;
|
||||
d2 = d2->template beta<i-1>()->template beta<i>();
|
||||
if ( d2==(*it)->template beta<i-1>()->template beta<i>() )
|
||||
d2=CMap::null_dart_handle;
|
||||
}
|
||||
|
||||
if ( !amap.is_marked(d2, mark_modified_darts) )
|
||||
|
|
@ -599,15 +512,16 @@ namespace CGAL {
|
|||
{
|
||||
if (d2 != CMap::null_dart_handle && d1!=d2 )
|
||||
{
|
||||
amap.template basic_link_beta<i>(d1, d2);
|
||||
amap.template basic_link_beta_for_involution<i>(d1, d2);
|
||||
amap.mark(d1, mark_modified_darts);
|
||||
amap.mark(d2, mark_modified_darts);
|
||||
modified_darts.push_back(d1);
|
||||
modified_darts.push_back(d2);
|
||||
// TODO push only one out of two dart ?
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !d1->is_free(i) )
|
||||
if ( !d1->template is_free<i>() )
|
||||
{
|
||||
d1->unlink_beta(i);
|
||||
CGAL_assertion( !amap.is_marked(d1, mark_modified_darts) );
|
||||
|
|
@ -645,7 +559,7 @@ namespace CGAL {
|
|||
// void attributes.
|
||||
CMap::Helper::template Foreach_enabled_attributes_except
|
||||
<internal::Test_split_attribute_functor<CMap,i>, i>::
|
||||
run(&amap, &modified_darts, mark_modified_darts);
|
||||
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 )
|
||||
|
|
@ -697,6 +611,7 @@ namespace CGAL {
|
|||
std::deque<typename CMap::Dart_handle> to_erase;
|
||||
|
||||
std::deque<typename CMap::Dart_handle> modified_darts;
|
||||
std::deque<typename CMap::Dart_handle> modified_darts2;
|
||||
|
||||
// First we store and mark all the darts of the 1-cell to contract.
|
||||
for ( CMap_dart_iterator_basic_of_cell<CMap,1> it(amap,adart,mark);
|
||||
|
|
@ -731,15 +646,16 @@ namespace CGAL {
|
|||
{
|
||||
/* modified_darts.push_back((*it)->beta(0));
|
||||
if ( (*it)->beta(0)!=(*it)->beta(1) )*/
|
||||
modified_darts.push_back((*it)->beta(1));
|
||||
amap.template basic_link_beta<1>((*it)->beta(0), (*it)->beta(1));
|
||||
modified_darts2.push_back((*it)->template beta<1>());
|
||||
amap.basic_link_beta_1((*it)->template beta<0>(),
|
||||
(*it)->template beta<1>());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO todegroup.push(Dart_pair((*it)->beta(0), *it));
|
||||
modified_darts.push_back((*it)->beta(0));
|
||||
(*it)->beta(0)->unlink_beta(1);
|
||||
modified_darts.push_back((*it)->template beta<0>());
|
||||
(*it)->template beta<0>()->template unlink_beta<1>();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -747,8 +663,8 @@ namespace CGAL {
|
|||
if ( !(*it)->is_free(1) )
|
||||
{
|
||||
// TODO todegroup.push(Dart_pair((*it)->beta(1), *it));
|
||||
modified_darts.push_back((*it)->beta(1));
|
||||
(*it)->beta(1)->unlink_beta(0);
|
||||
modified_darts2.push_back((*it)->template beta<1>());
|
||||
(*it)->template beta<1>()->template unlink_beta<0>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -757,11 +673,7 @@ namespace CGAL {
|
|||
// void attributes.
|
||||
CMap::Helper::template Foreach_enabled_attributes_except
|
||||
<internal::Test_split_attribute_functor<CMap,1>, 1>::
|
||||
// <internal::Test_split_with_deque<CMap,0> >::
|
||||
run(&amap,
|
||||
&modified_darts, -1); //mark_modified_darts);
|
||||
//&mark_for_incident_cells[0],
|
||||
//&incident_cells[0]);
|
||||
run(&amap, modified_darts, modified_darts2);
|
||||
|
||||
// 6) We remove all the darts of the cell.
|
||||
for (it = to_erase.begin(); it != to_erase.end(); ++it)
|
||||
|
|
|
|||
|
|
@ -428,6 +428,16 @@ namespace CGAL
|
|||
typename CMap::Dart_handle)
|
||||
{}
|
||||
};
|
||||
// Specialization for i=1 and j=0. Do nothing as edges attributes are not
|
||||
// modify when we modify beta_0.
|
||||
template<typename CMap, typename T>
|
||||
struct Group_attribute_functor_of_dart_run<CMap,1,0,T>
|
||||
{
|
||||
static void run(CMap*,
|
||||
typename CMap::Dart_handle,
|
||||
typename CMap::Dart_handle)
|
||||
{}
|
||||
};
|
||||
// **************************************************************************
|
||||
/// Functor used for link_beta to update the attributes of
|
||||
/// adart2 on the attributes of this dart, except for j-attributes.
|
||||
|
|
@ -660,6 +670,16 @@ namespace CGAL
|
|||
typename CMap::Dart_handle)
|
||||
{}
|
||||
};
|
||||
// Specialization for i=1 and j=0. Do nothing as edges attributes are not
|
||||
// modify when we modify beta_0.
|
||||
template<typename CMap, typename T>
|
||||
struct Group_attribute_functor_run<CMap,1,0,T>
|
||||
{
|
||||
static void run(CMap*,
|
||||
typename CMap::Dart_handle,
|
||||
typename CMap::Dart_handle)
|
||||
{}
|
||||
};
|
||||
// **************************************************************************
|
||||
/// Functor used for sew to update the attributes of
|
||||
/// adart2 on the attributes of this dart, except for j-attributes.
|
||||
|
|
@ -804,24 +824,18 @@ namespace CGAL
|
|||
{}
|
||||
};
|
||||
// **************************************************************************
|
||||
/// Functor used by Test_split_attribute_functor_run to process one dart.
|
||||
template<typename CMap>
|
||||
struct Test_split_attribute_functor_one_dart
|
||||
{
|
||||
typedef typename CMap::Dart_handle Dart_handle;
|
||||
|
||||
// Function used by Test_split_attribute_functor_run to process one dart.
|
||||
// Test the split of the i-cell containing the given dart adart.
|
||||
// When we process a dart, we search in the Unique_hash_map if its
|
||||
// i-attribute was already found. If yes, it means that we already
|
||||
// found an i-cell with this attribute, thus this attribute is split.
|
||||
// We mark (with mark) all the darts of the i-cell containing adart to
|
||||
// process them exactly once.
|
||||
template<unsigned int i>
|
||||
static void run( CMap* amap,
|
||||
Dart_handle adart,
|
||||
Unique_hash_map<typename CMap::Helper::template
|
||||
Attribute_handle<i>::type, int> & found_attributes,
|
||||
int mark )
|
||||
template<typename CMap, unsigned int i>
|
||||
void test_split_attribute_functor_one_dart
|
||||
( CMap* amap, typename CMap::Dart_handle adart,
|
||||
Unique_hash_map<typename CMap::Helper::template Attribute_handle<i>::type,
|
||||
unsigned int> & found_attributes, int mark )
|
||||
{
|
||||
CGAL_assertion( amap!=NULL );
|
||||
CGAL_assertion( adart!=NULL );
|
||||
|
|
@ -830,6 +844,7 @@ namespace CGAL
|
|||
"Test_split_attribute_functor_one_dart<i> but "
|
||||
"i-attributes are disabled");
|
||||
|
||||
typedef typename CMap::Dart_handle Dart_handle;
|
||||
typedef typename CMap::Helper::template Attribute_handle<i>::type
|
||||
Attribute_handle_i;
|
||||
|
||||
|
|
@ -867,22 +882,20 @@ namespace CGAL
|
|||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
// **************************************************************************
|
||||
/// Functor used for unsew to test if i-attributes are split after an
|
||||
/// operation, except for j-attributes.
|
||||
/// (j is the dimension of the beta modified for darts in modified_darts,
|
||||
/// if j==0 modified_darts_2 are the darts modified for beta_1).
|
||||
/// if j==0 modified_darts2 are the darts modified for beta_1).
|
||||
template<typename CMap, unsigned int i, unsigned int j=CMap::dimension+1,
|
||||
typename T=
|
||||
typename CMap::Helper::template Attribute_type<i>::type>
|
||||
struct Test_split_attribute_functor_run
|
||||
{
|
||||
// modified_darts is the set of modified darts for beta_j
|
||||
static void run( CMap* amap,
|
||||
std::deque<typename CMap::Dart_handle>
|
||||
*modified_darts,
|
||||
std::deque<typename CMap::Dart_handle>
|
||||
*/*modified_darts2*/,
|
||||
const std::deque<typename CMap::Dart_handle>
|
||||
&modified_darts,
|
||||
int mark_modified_darts=-1)
|
||||
{
|
||||
CGAL_static_assertion( 1<=i && i<=CMap::dimension );
|
||||
|
|
@ -899,23 +912,86 @@ namespace CGAL
|
|||
Unique_hash_map<Attribute_handle_i, unsigned int> found_attributes;
|
||||
|
||||
int mark = amap->get_new_mark(); // to mark incident cells.
|
||||
typename std::deque<typename CMap::Dart_handle>::iterator
|
||||
it=modified_darts->begin();
|
||||
for ( ; it!=modified_darts->end(); ++it )
|
||||
typename std::deque<typename CMap::Dart_handle>::const_iterator
|
||||
it=modified_darts.begin();
|
||||
for ( ; it!=modified_darts.end(); ++it )
|
||||
{
|
||||
Test_split_attribute_functor_one_dart<CMap>::
|
||||
run<i>(amap, *it, found_attributes, mark);
|
||||
test_split_attribute_functor_one_dart<CMap,i>
|
||||
(amap, *it, found_attributes, mark);
|
||||
}
|
||||
|
||||
// Now we unmark all the marked darts.
|
||||
amap->negate_mark(mark);
|
||||
for ( it=modified_darts->begin(); it!=modified_darts->end(); ++it )
|
||||
for ( it=modified_darts.begin(); it!=modified_darts.end(); ++it )
|
||||
{
|
||||
if ( mark_modified_darts!=-1 )
|
||||
amap->unmark(*it, mark_modified_darts);
|
||||
|
||||
if ( !amap->is_marked(*it, mark) )
|
||||
mark_cell<i>(*amap, *it, mark);
|
||||
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,
|
||||
int mark_modified_darts=-1)
|
||||
{
|
||||
// Normalement on utilise la version avec modified_darts2
|
||||
// que dans le cas j=0
|
||||
CGAL_assertion(false);
|
||||
// TODO remove cette function run
|
||||
|
||||
CGAL_static_assertion( 1<=i && 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::Helper::template Attribute_handle<i>::type
|
||||
Attribute_handle_i;
|
||||
|
||||
Unique_hash_map<Attribute_handle_i, unsigned int> found_attributes;
|
||||
|
||||
int 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 )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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!=-1 )
|
||||
amap->unmark(*it, mark_modified_darts);
|
||||
|
||||
if ( !amap->is_marked(*it, mark) )
|
||||
mark_cell<CMap, i>(*amap, *it, mark);
|
||||
}
|
||||
for ( it2=modified_darts2.begin(); it2!=modified_darts2.end(); ++it2 )
|
||||
{
|
||||
if ( mark_modified_darts!=-1 )
|
||||
amap->unmark(*it2, mark_modified_darts);
|
||||
|
||||
if ( !amap->is_marked(*it2, mark) )
|
||||
mark_cell<CMap, i>(*amap, *it2, mark);
|
||||
}
|
||||
|
||||
CGAL_assertion( amap->is_whole_map_marked(mark) );
|
||||
|
|
@ -927,10 +1003,8 @@ namespace CGAL
|
|||
struct Test_split_attribute_functor_run<CMap, 0, j, T>
|
||||
{
|
||||
static void run( CMap* amap,
|
||||
std::deque<typename CMap::Dart_handle>
|
||||
*modified_darts,
|
||||
std::deque<typename CMap::Dart_handle>
|
||||
*/*modified_darts2*/,
|
||||
const std::deque<typename CMap::Dart_handle>
|
||||
&modified_darts,
|
||||
int mark_modified_darts=-1)
|
||||
{
|
||||
CGAL_assertion( j!=0 && j!=1 );
|
||||
|
|
@ -947,32 +1021,113 @@ namespace CGAL
|
|||
typename CMap::Dart_handle od=NULL;
|
||||
|
||||
int mark = amap->get_new_mark(); // to mark incident cells.
|
||||
typename std::deque<typename CMap::Dart_handle>::iterator
|
||||
it=modified_darts->begin();
|
||||
for ( ; it!=modified_darts->end(); ++it )
|
||||
typename std::deque<typename CMap::Dart_handle>::const_iterator
|
||||
it=modified_darts.begin();
|
||||
for ( ; it!=modified_darts.end(); ++it )
|
||||
{
|
||||
Test_split_attribute_functor_one_dart<CMap>::
|
||||
run<0>(amap, *it, found_attributes, mark);
|
||||
test_split_attribute_functor_one_dart<CMap,0>
|
||||
(amap, *it, found_attributes, mark);
|
||||
|
||||
od=(*it)->other_extremity();
|
||||
if ( od!=NULL )
|
||||
Test_split_attribute_functor_one_dart<CMap>::
|
||||
run<0>(amap, od, found_attributes, mark);
|
||||
test_split_attribute_functor_one_dart<CMap,0>
|
||||
(amap, od, found_attributes, mark);
|
||||
}
|
||||
|
||||
// Now we unmark all the marked darts.
|
||||
amap->negate_mark(mark);
|
||||
for ( it=modified_darts->begin(); it!=modified_darts->end(); ++it )
|
||||
for ( it=modified_darts.begin(); it!=modified_darts.end(); ++it )
|
||||
{
|
||||
if ( mark_modified_darts!=-1 )
|
||||
amap->unmark(*it, mark_modified_darts);
|
||||
|
||||
if ( !amap->is_marked(*it, mark) )
|
||||
mark_cell<0>(*amap, *it, mark);
|
||||
mark_cell<CMap, 0>(*amap, *it, mark);
|
||||
|
||||
od=(*it)->other_extremity();
|
||||
if ( od!=NULL && !amap->is_marked(od, mark) )
|
||||
mark_cell<0>(*amap, od, mark);
|
||||
mark_cell<CMap, 0>(*amap, od, 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,
|
||||
int mark_modified_darts=-1)
|
||||
{
|
||||
// Normalement on utilise la version avec modified_darts2
|
||||
// que dans le cas j=0
|
||||
CGAL_assertion(false);
|
||||
// TODO remove cette function run
|
||||
|
||||
CGAL_assertion( j!=0 && j!=1 );
|
||||
CGAL_assertion( amap!=NULL );
|
||||
CGAL_static_assertion_msg(CMap::Helper::template
|
||||
Dimension_index<0>::value>=0,
|
||||
"Test_split_attribute_functor_run<0> but "
|
||||
"0-attributes are disabled");
|
||||
|
||||
typedef typename CMap::Helper::template Attribute_handle<0>::type
|
||||
Attribute_handle_0;
|
||||
|
||||
Unique_hash_map<Attribute_handle_0, unsigned int> found_attributes;
|
||||
typename CMap::Dart_handle od=NULL;
|
||||
|
||||
int 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 )
|
||||
{
|
||||
test_split_attribute_functor_one_dart<CMap,0>
|
||||
(amap, *it, found_attributes, mark);
|
||||
|
||||
od=(*it)->other_extremity();
|
||||
if ( od!=NULL )
|
||||
test_split_attribute_functor_one_dart<CMap,0>
|
||||
(amap, od, found_attributes, mark);
|
||||
}
|
||||
typename std::deque<typename CMap::Dart_handle>::const_iterator
|
||||
it2=modified_darts2.begin();
|
||||
for ( ; it2!=modified_darts2.end(); ++it2 )
|
||||
{
|
||||
test_split_attribute_functor_one_dart<CMap,0>
|
||||
(amap, *it2, found_attributes, mark);
|
||||
|
||||
od=(*it2)->other_extremity();
|
||||
if ( od!=NULL )
|
||||
test_split_attribute_functor_one_dart<CMap,0>
|
||||
(amap, od, 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!=-1 )
|
||||
amap->unmark(*it, mark_modified_darts);
|
||||
|
||||
if ( !amap->is_marked(*it, mark) )
|
||||
mark_cell<CMap, 0>(*amap, *it, mark);
|
||||
|
||||
od=(*it)->other_extremity();
|
||||
if ( od!=NULL && !amap->is_marked(od, mark) )
|
||||
mark_cell<CMap, 0>(*amap, od, mark);
|
||||
}
|
||||
for ( it2=modified_darts2.begin(); it2!=modified_darts2.end(); ++it2 )
|
||||
{
|
||||
if ( mark_modified_darts!=-1 )
|
||||
amap->unmark(*it2, mark_modified_darts);
|
||||
|
||||
if ( !amap->is_marked(*it2, mark) )
|
||||
mark_cell<CMap, 0>(*amap, *it2, mark);
|
||||
|
||||
od=(*it2)->other_extremity();
|
||||
if ( od!=NULL && !amap->is_marked(od, mark) )
|
||||
mark_cell<CMap, 0>(*amap, od, mark);
|
||||
}
|
||||
|
||||
CGAL_assertion( amap->is_whole_map_marked(mark) );
|
||||
|
|
@ -983,18 +1138,115 @@ namespace CGAL
|
|||
template<typename CMap, typename T>
|
||||
struct Test_split_attribute_functor_run<CMap, 0, 0, T>
|
||||
{
|
||||
};
|
||||
// Specialization for i=1 and j=0.
|
||||
template<typename CMap, typename T>
|
||||
struct Test_split_attribute_functor_run<CMap, 1, 0, T>
|
||||
static void run( CMap* amap,
|
||||
const std::deque<typename CMap::Dart_handle>
|
||||
&modified_darts,
|
||||
const std::deque<typename CMap::Dart_handle>
|
||||
&modified_darts2,
|
||||
int mark_modified_darts=-1)
|
||||
{
|
||||
// No sense as we use always <0,0> ?
|
||||
CGAL_assertion( amap!=NULL );
|
||||
CGAL_static_assertion_msg(CMap::Helper::template
|
||||
Dimension_index<0>::value>=0,
|
||||
"Test_split_attribute_functor_run<0> but "
|
||||
"0-attributes are disabled");
|
||||
|
||||
typedef typename CMap::Helper::template Attribute_handle<0>::type
|
||||
Attribute_handle_0;
|
||||
|
||||
Unique_hash_map<Attribute_handle_0, unsigned int> found_attributes;
|
||||
typename CMap::Dart_handle od=NULL;
|
||||
|
||||
int 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 )
|
||||
{
|
||||
test_split_attribute_functor_one_dart<CMap,0>
|
||||
(amap, *it, found_attributes, mark);
|
||||
}
|
||||
typename std::deque<typename CMap::Dart_handle>::const_iterator
|
||||
it2=modified_darts2.begin();
|
||||
for ( ; it2!=modified_darts2.end(); ++it2 )
|
||||
{
|
||||
od=(*it2)->other_extremity();
|
||||
if ( od!=NULL )
|
||||
test_split_attribute_functor_one_dart<CMap,0>
|
||||
(amap, od, 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!=-1 )
|
||||
amap->unmark(*it, mark_modified_darts);
|
||||
|
||||
if ( !amap->is_marked(*it, mark) )
|
||||
mark_cell<CMap, 0>(*amap, *it, mark);
|
||||
}
|
||||
for ( it2=modified_darts2.begin(); it2!=modified_darts2.end(); ++it2 )
|
||||
{
|
||||
if ( mark_modified_darts!=-1 )
|
||||
amap->unmark(*it2, mark_modified_darts);
|
||||
|
||||
od=(*it2)->other_extremity();
|
||||
if ( od!=NULL && !amap->is_marked(od, mark) )
|
||||
mark_cell<CMap, 0>(*amap, od, mark);
|
||||
}
|
||||
|
||||
CGAL_assertion( amap->is_whole_map_marked(mark) );
|
||||
amap->free_mark(mark);
|
||||
}
|
||||
};
|
||||
// Specialization for i=0 and j=1.
|
||||
// Equivalent to i=0 and j=0.
|
||||
template<typename CMap, typename T>
|
||||
struct Test_split_attribute_functor_run<CMap, 0, 1, T>
|
||||
{
|
||||
static void run( CMap*, const std::deque<typename CMap::Dart_handle>&,
|
||||
int=-1)
|
||||
{ CGAL_assertion(false); }
|
||||
static void run( CMap*, const std::deque<typename CMap::Dart_handle>&,
|
||||
const std::deque<typename CMap::Dart_handle>&, int=-1)
|
||||
{ CGAL_assertion(false); }
|
||||
};
|
||||
// Specialization for void attributes.
|
||||
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)
|
||||
{}
|
||||
static void run( CMap*, const std::deque<typename CMap::Dart_handle>&,
|
||||
const std::deque<typename CMap::Dart_handle>&, int=-1)
|
||||
{}
|
||||
};
|
||||
// Specialization for i=j.
|
||||
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)
|
||||
{}
|
||||
static void run( CMap*, const std::deque<typename CMap::Dart_handle>&,
|
||||
const std::deque<typename CMap::Dart_handle>&, int=-1)
|
||||
{}
|
||||
};
|
||||
// Specialization for i=1 and j=0 (edge attributes are not modified
|
||||
// when we modify beta_0).
|
||||
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)
|
||||
{}
|
||||
static void run( CMap*, const std::deque<typename CMap::Dart_handle>&,
|
||||
const std::deque<typename CMap::Dart_handle>&, int=-1)
|
||||
{}
|
||||
};
|
||||
// **************************************************************************
|
||||
|
||||
/// Functor used for unsew to test if i-attributes are split after an
|
||||
/// operation, except for j-attributes.
|
||||
/// We define run<i> to allows to use this functor with
|
||||
|
|
@ -1002,116 +1254,33 @@ namespace CGAL
|
|||
template<typename CMap, unsigned int j=CMap::dimension+1>
|
||||
struct Test_split_attribute_functor
|
||||
{
|
||||
typedef typename CMap::Dart_handle Dart_handle;
|
||||
|
||||
// Test the split of the i-cell containing dart adart.
|
||||
template<unsigned int i>
|
||||
static void test_one_dart( CMap* amap,
|
||||
Dart_handle adart,
|
||||
Unique_hash_map<typename CMap::Helper::template
|
||||
Attribute_handle<i>::type, int> &
|
||||
found_attributes, int mark )
|
||||
{
|
||||
typedef typename CMap::Helper::template Attribute_handle<i>::type
|
||||
Attribute_handle_i;
|
||||
|
||||
if ( adart->template attribute<i>()!=NULL &&
|
||||
!amap->is_marked(adart, mark) )
|
||||
{
|
||||
Attribute_handle_i a1 = adart->template attribute<i>();
|
||||
if ( found_attributes.is_defined(a1) )
|
||||
{ // Here the attribute was already present in the hash_map
|
||||
Attribute_handle_i a2 = amap->template create_attribute<i>(*a1);
|
||||
|
||||
for ( CMap_dart_iterator_basic_of_cell<CMap, i>
|
||||
itj(*amap, adart, mark); itj.cont(); ++itj )
|
||||
{
|
||||
amap->template set_attribute_of_dart<i>(itj, a2);
|
||||
amap->mark(itj, mark);
|
||||
}
|
||||
a2->set_dart(adart);
|
||||
Call_split_functor<CMap, i>::run(a1, a2);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Here the attribute was not in the hash_map.
|
||||
found_attributes[a1]=1;
|
||||
a1->set_dart(adart);
|
||||
|
||||
for ( CMap_dart_iterator_basic_of_cell<CMap, i>
|
||||
itj(*amap, adart, mark); itj.cont(); ++itj )
|
||||
{
|
||||
CGAL_assertion( itj->template attribute<i>()==a1 );
|
||||
amap->mark(itj, mark);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Test the split of i-attributes, for all modified darts given in
|
||||
// modified_darts, and marked with mark_modified_darts.
|
||||
// For each split attribute, create a new i-attribute, associate
|
||||
// it with the new i-cell and call onsplit functors.
|
||||
template <unsigned int i>
|
||||
static void run( CMap* amap,
|
||||
std::deque<typename CMap::Dart_handle>
|
||||
*modified_darts,
|
||||
const std::deque<typename CMap::Dart_handle>
|
||||
&modified_darts,
|
||||
int mark_modified_darts=-1)
|
||||
{
|
||||
CGAL_assertion( i!=j );
|
||||
CGAL_assertion( amap!=NULL );
|
||||
|
||||
typedef typename CMap::Helper::template Attribute_handle<i>::type
|
||||
Attribute_handle_i;
|
||||
|
||||
Unique_hash_map<Attribute_handle_i, unsigned int> found_attributes;
|
||||
|
||||
int mark = amap->get_new_mark(); // to mark incident cells.
|
||||
for ( typename std::deque<Dart_handle>::iterator
|
||||
it=modified_darts->begin(); it!=modified_darts->end(); ++it )
|
||||
{
|
||||
test_one_dart<i>(amap, *it, found_attributes, mark);
|
||||
|
||||
if ( /*j!=1 &&*/ i==0 ) // TODO Here we test too many cases, but more works to do
|
||||
{
|
||||
typename CMap::Dart_handle od = (*it)->other_extremity();
|
||||
if ( od!=NULL )
|
||||
test_one_dart<i>(amap, od, found_attributes, mark);
|
||||
Test_split_attribute_functor_run<CMap, i, j>::run(amap, modified_darts,
|
||||
mark_modified_darts);
|
||||
}
|
||||
}
|
||||
|
||||
// Now we unmark all the marked darts.
|
||||
amap->negate_mark(mark);
|
||||
for ( typename std::deque<Dart_handle>::iterator
|
||||
it=modified_darts->begin(); it!=modified_darts->end(); ++it )
|
||||
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,
|
||||
int mark_modified_darts=-1)
|
||||
{
|
||||
if ( mark_modified_darts!=-1 )
|
||||
amap->unmark(*it, mark_modified_darts);
|
||||
|
||||
if ( !amap->is_marked(*it, mark) )
|
||||
for ( CMap_dart_iterator_basic_of_cell<CMap,i>
|
||||
itj(*amap, *it, mark); itj.cont(); ++itj )
|
||||
{
|
||||
amap->mark(itj, mark);
|
||||
}
|
||||
|
||||
if ( /*j!=1 &&*/ i==0 )
|
||||
{
|
||||
Dart_handle od = (*it)->other_extremity();
|
||||
if ( od!=NULL && !amap->is_marked(od, mark) )
|
||||
for ( CMap_dart_iterator_basic_of_cell<CMap,i>
|
||||
itj(*amap, od, mark); itj.cont(); ++itj )
|
||||
{
|
||||
amap->mark(itj, mark);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CGAL_assertion( amap->is_whole_map_marked(mark) );
|
||||
amap->free_mark(mark);
|
||||
Test_split_attribute_functor_run<CMap, i, j>::run(amap, modified_darts,
|
||||
modified_darts2,
|
||||
mark_modified_darts);
|
||||
}
|
||||
};
|
||||
|
||||
// **************************************************************************
|
||||
} // namespace internal
|
||||
} // namespace CGAL
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue