mirror of https://github.com/CGAL/cgal
Start some cleanup in group/degroup methods.
This commit is contained in:
parent
6a06c5b0f4
commit
0558f60b09
|
|
@ -85,8 +85,8 @@ namespace CGAL {
|
|||
typename Map::Dart_handle
|
||||
insert_cell_0_in_cell_2(Map& amap, typename Map::Dart_handle adart);
|
||||
|
||||
template<typename CMap, unsigned int i, typename Type_attr, typename Range>
|
||||
friend struct internal::Degroup_one_attribute_of_dart_functor;
|
||||
/*template<typename CMap, unsigned int i, typename Type_attr, typename Range>
|
||||
friend struct internal::Degroup_one_attribute_of_dart_functor;*/
|
||||
|
||||
template <typename CMap, unsigned int i, typename Type_attr>
|
||||
friend struct internal::Degroup_one_attribute_functor;
|
||||
|
|
@ -94,7 +94,7 @@ namespace CGAL {
|
|||
template<typename Map>
|
||||
friend struct internal::Test_is_valid_attribute_functor;
|
||||
|
||||
template<typename CMap, unsigned int i>
|
||||
template<typename CMap, unsigned int i, typename T>
|
||||
friend struct internal::Group_attribute_functor_of_dart_run;
|
||||
|
||||
template<typename Map,unsigned int i>
|
||||
|
|
@ -2077,6 +2077,48 @@ namespace CGAL {
|
|||
<internal::Update_dart_of_attribute_functor<Self> >::run(this,ah,amark);
|
||||
}
|
||||
|
||||
/** Group the i-cell-attributes of the two given darts, if required.
|
||||
* If the two i-cell-attributes of \em adart1 and \em adart2 are different,
|
||||
* we set the i-cell-attribute of adart2 onto the attribute of adart1.
|
||||
* @param adart1 the first dart.
|
||||
* @param adart2 the second dart.
|
||||
* @return true iff the two attributes are merged.
|
||||
*/
|
||||
template<unsigned int i>
|
||||
bool group_enabled_attribute_of_dart( Dart_handle dh1, Dart_handle dh2)
|
||||
{
|
||||
}
|
||||
|
||||
/** Degroup the i-cell attribute of the two given darts, if required.
|
||||
* We create a new attribute and link dart2 onto this new attribute.
|
||||
* The new attribute is initialized by copying the old one.
|
||||
* @param adart1 the first dart.
|
||||
* @param adart2 the second dart.
|
||||
* @return true iff the attribute is split.
|
||||
*/
|
||||
template<unsigned int i>
|
||||
bool degroup_enabled_attribute_of_dart( Dart_handle dh1, Dart_handle dh2)
|
||||
{
|
||||
CGAL_static_assertion(i<=dimension);
|
||||
CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
|
||||
"group_enabled_attribute_of_dart<i> but "
|
||||
"i-attributes are disabled");
|
||||
CGAL_assertion( dh1!=NULL && dh2!=NULL );
|
||||
CGAL_assertion( dh1!=null_dart_handle && dh2!=null_dart_handle );
|
||||
|
||||
typename Attribute_handle<i>::type a1=dh1->template attribute<i>();
|
||||
typename Attribute_handle<i>::type a2=dh2->template attribute<i>();
|
||||
|
||||
// If the two attributes are different, nothing to do.
|
||||
if ( a1==NULL || a1 != a2 ) return false;
|
||||
|
||||
a2 = create_attribute<i>(*a1);
|
||||
|
||||
// We set the attribute of dh2 to a2.
|
||||
set_attribute_of_dart<i>(dh2, a2);
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Group the i cell-attributes of two darts.
|
||||
* If the two i cell-attribute of \em adart1 and \em adart2 are different,
|
||||
* we set the i cell-attribute of each dart belonging to the i-cell orbit
|
||||
|
|
@ -2120,7 +2162,55 @@ namespace CGAL {
|
|||
set_attribute<i>(toSet, a1);
|
||||
}
|
||||
|
||||
/** Group all the attributes of adart1 and adart2. If both dart have a
|
||||
/** Degroup the i-cell attribute of the two given darts, if required.
|
||||
* If the two darts are incident to the same attribute and do not belong to
|
||||
* the same i-cell, we create a new attibute and link each dart
|
||||
* belonging to the i-cell of adart2 onto this new attribute.
|
||||
* The new attribute is initialized by copying the old one then by using
|
||||
* the functor On_split from the original attribute.
|
||||
* @param adart1 the first dart.
|
||||
* @param adart2 the second dart.
|
||||
* @return true iff the attribute is split.
|
||||
*/
|
||||
template<unsigned int i, class Type_attr>
|
||||
bool degroup_enabled_attribute(Dart_handle adart1, Dart_handle adart2)
|
||||
{
|
||||
CGAL_static_assertion(i<=dimension);
|
||||
CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
|
||||
"degroup_enabled_attribute<i> but "
|
||||
"i-attributes are disabled");
|
||||
CGAL_assertion(adart1 != NULL && adart2 != NULL);
|
||||
CGAL_assertion(adart1 != null_dart_handle && adart2 != null_dart_handle);
|
||||
|
||||
typename Attribute_handle<i>::type a1=adart1->template attribute<i>();
|
||||
typename Attribute_handle<i>::type a2=NULL;
|
||||
|
||||
// If the two attributes are not equal, nothing to do.
|
||||
if ( a1 != adart2->template attribute<i>() || a1 == NULL) return false;
|
||||
|
||||
// TODO improve this step: use basic iterator to iterate through cell<i>(adart2)
|
||||
// If the two darts belong to the same cell, nothing to do.
|
||||
if ( belong_to_same_cell<Self,i,dimension>(*this, adart1, adart2) )
|
||||
return false;
|
||||
|
||||
// Here we create a new attribute
|
||||
a2 = create_attribute<i>(*a1);
|
||||
|
||||
// We call the on_split functor
|
||||
internal::Apply_cell_functor<Type_attr,
|
||||
typename Type_attr::On_split>::run(*a1,*a2);
|
||||
|
||||
// We set the dart of the cell a1 onto adart1.
|
||||
a1->set_dart(adart1);
|
||||
|
||||
// and reuse the basic iterator here to unmark.
|
||||
// And we set all the dart of the cell of adart2 to v1.
|
||||
set_attribute<i>(adart2, a2);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Group all the attributes of adart1 and adart2. If both dart have a
|
||||
* i-attribute, the attribute associated to adart1 is kept.
|
||||
* @param adart1 the first dart.
|
||||
* @param adart1 the second dart.
|
||||
|
|
@ -2132,32 +2222,6 @@ namespace CGAL {
|
|||
typename Attribute_type<i>::type>::run(this,adart1,adart2);
|
||||
}
|
||||
|
||||
/** Group the i cell-attributes of two darts.
|
||||
* If the two i cell-attribute of \em adart1 and \em adart2 are different,
|
||||
* we set the i cell-attribute of adart2 onto the attribute of adart1.
|
||||
* @param adart1 the first dart.
|
||||
* @param adart2 the second dart.
|
||||
*/
|
||||
template<unsigned int i, class Type_attr>
|
||||
void group_enabled_attribute_of_dart( Dart_handle dh1, Dart_handle dh2)
|
||||
{
|
||||
CGAL_static_assertion(i<=dimension);
|
||||
CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
|
||||
"group_enabled_attribute_of_dart<i> but "
|
||||
"i-attributes are disabled");
|
||||
CGAL_assertion( dh1!=NULL && dh2!=NULL );
|
||||
CGAL_assertion( dh1!=null_dart_handle && dh2!=null_dart_handle );
|
||||
|
||||
typename Attribute_handle<i>::type a1=dh1->template attribute<i>();
|
||||
typename Attribute_handle<i>::type a2=dh2->template attribute<i>();
|
||||
|
||||
// If the two attributes are equal, nothing to do.
|
||||
if ( a1 == a2 ) return;
|
||||
|
||||
if ( a1==NULL ) set_attribute_of_dart<i>(dh1, a2);
|
||||
else set_attribute_of_dart<i>(dh2, a1);
|
||||
}
|
||||
|
||||
/** Group all the dart attributes of adart1 and adart2, except the
|
||||
* adim-cell attribute.
|
||||
* @param adart1 the first dart.
|
||||
|
|
@ -2183,58 +2247,12 @@ namespace CGAL {
|
|||
*/
|
||||
void group_all_attributes_except(Dart_handle adart1, Dart_handle adart2,
|
||||
int adim)
|
||||
{
|
||||
{
|
||||
CGAL_assertion( adim==-1 || (1<=adim && (unsigned int)adim<=dimension) );
|
||||
Helper::template Foreach_enabled_attributes
|
||||
<internal::Group_attribute_functor<Self> >::
|
||||
run(this,adart1,adart2,adim);
|
||||
}
|
||||
|
||||
/** Degroup the i-cell attribute of the two given darts, if required.
|
||||
* If the two darts are incident to the same attribute and do not belong to
|
||||
* the same i-cell, we create a new attibute and link each dart
|
||||
* belonging to the i-cell of adart2 onto this new attribute.
|
||||
* The new attribute is initialized by copying the old one then by using
|
||||
* the functor On_split from the original attribute.
|
||||
* @param adart1 the first dart.
|
||||
* @param adart2 the second dart.
|
||||
* @return true iff the attribute is split.
|
||||
*/
|
||||
template<unsigned int i, class Type_attr>
|
||||
bool degroup_enabled_attribute(Dart_handle adart1, Dart_handle adart2)
|
||||
{
|
||||
CGAL_static_assertion(i<=dimension);
|
||||
CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
|
||||
"degroup_enabled_attribute<i> but "
|
||||
"i-attributes are disabled");
|
||||
CGAL_assertion(adart1 != NULL && adart2 != NULL);
|
||||
CGAL_assertion(adart1 != null_dart_handle && adart2 != null_dart_handle);
|
||||
|
||||
typename Attribute_handle<i>::type a1=adart1->template attribute<i>();
|
||||
typename Attribute_handle<i>::type a2=NULL;
|
||||
|
||||
// If the two attributes are not equal, nothing to do.
|
||||
if ( a1 != adart2->template attribute<i>() || a1 == NULL) return false;
|
||||
|
||||
// If the two darts belong to the same cell, nothing to do.
|
||||
if ( belong_to_same_cell<Self,i,dimension>(*this, adart1, adart2) )
|
||||
return false;
|
||||
|
||||
// Here we create a new attribute
|
||||
a2 = create_attribute<i>(*a1);
|
||||
|
||||
// We call the on_split functor
|
||||
internal::Apply_cell_functor<Type_attr,
|
||||
typename Type_attr::On_split>::run(*a1,*a2);
|
||||
|
||||
// We set the dart of the cell a1 onto adart1.
|
||||
a1->set_dart(adart1);
|
||||
|
||||
// And we set all the dart of the cell of adart2 to v1.
|
||||
set_attribute<i>(adart2, a2);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template<unsigned int i>
|
||||
bool degroup_attribute(Dart_handle adart1, Dart_handle adart2)
|
||||
|
|
@ -2265,51 +2283,12 @@ namespace CGAL {
|
|||
void degroup_all_attributes(Dart_handle adart1, Dart_handle adart2)
|
||||
{ degroup_all_attributes_except(adart1, adart2, -1); }
|
||||
|
||||
/** Degroup the i-cell attribute of the two given darts, if required.
|
||||
* We create a new attibute and link dart2 onto this new attribute.
|
||||
* The new attribute is initialized by copying the old one then by using
|
||||
* the functor On_split from the original attribute.
|
||||
* @param adart1 the first dart.
|
||||
* @param adart2 the second dart.
|
||||
* @return true iff the attribute is split.
|
||||
*/
|
||||
template<unsigned int i, class Type_attr, typename Range>
|
||||
bool degroup_enabled_attribute_of_dart( Dart_handle dh1, Dart_handle dh2)
|
||||
{
|
||||
CGAL_static_assertion(i<=dimension);
|
||||
CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
|
||||
"group_enabled_attribute_of_dart<i> but "
|
||||
"i-attributes are disabled");
|
||||
CGAL_assertion( dh1!=NULL && dh2!=NULL );
|
||||
CGAL_assertion( dh1!=null_dart_handle && dh2!=null_dart_handle );
|
||||
|
||||
typename Attribute_handle<i>::type a1=dh1->template attribute<i>();
|
||||
typename Attribute_handle<i>::type a2=dh2->template attribute<i>();
|
||||
|
||||
// If the two attributes are equal, nothing to do.
|
||||
if ( a1==NULL || a1 != a2 ) return false;
|
||||
|
||||
a2 = create_attribute<i>(*a1);
|
||||
|
||||
// We call the on_split functor
|
||||
// internal::Apply_cell_functor<Type_attr,
|
||||
// typename Type_attr::On_split>::run(*a1,*a2);
|
||||
|
||||
// We set the attribute of dh2 to a2.
|
||||
for (typename Range::iterator it=Range(*this,dh2).begin(),
|
||||
itend=Range(*this,dh2).end(); it!=itend; ++it)
|
||||
{
|
||||
set_attribute_of_dart<i>(it, a2);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template<unsigned int i,typename Range>
|
||||
/* template<unsigned int i>
|
||||
bool degroup_attribute_of_dart(Dart_handle adart1, Dart_handle adart2)
|
||||
{
|
||||
return internal::Degroup_one_attribute_of_dart_functor<Self,i,
|
||||
typename Attribute_type<i>::type, Range>::run(this,adart1,adart2);
|
||||
}
|
||||
return internal::Degroup_one_attribute_of_dart_functor<Self,i>::
|
||||
run(this,adart1,adart2);
|
||||
}*/
|
||||
|
||||
/** Test the validity of a i-cell-attribute.
|
||||
* ie all the darts belonging to a i-cell are linked to the same attribute.
|
||||
|
|
@ -2408,11 +2387,11 @@ namespace CGAL {
|
|||
"set_attribute_of_dart<i> but "
|
||||
"i-attributes are disabled");
|
||||
CGAL_assertion( adart!=NULL && adart!=null_dart_handle && ah!=NULL );
|
||||
if ( adart->template attribute<i>()==ah ) return;
|
||||
CGAL_assertion( adart->template attribute<i>()!=ah );
|
||||
|
||||
decrease_attribute_ref_counting<i>(adart);
|
||||
|
||||
adart->template set_attribute<i>(ah);
|
||||
// TODO remove the set_dart ?
|
||||
ah->set_dart(adart);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -73,12 +73,20 @@ namespace CGAL {
|
|||
|
||||
if ( cur!=first )
|
||||
{
|
||||
if ( amap.template degroup_attribute_of_dart<2,
|
||||
typename Map::template Dart_of_involution_range<1> >
|
||||
(first, cur) )
|
||||
if ( amap.template degroup_attribute_of_dart<2>(first, cur) )
|
||||
{
|
||||
// TODO Functor takiing a range, an attrib_handle, and that set
|
||||
// all the darts of the range to this handle
|
||||
for (typename Map::template Dart_of_involution_range<1>::iterator
|
||||
it=template darts_of_involution<1>(dh2).begin(),
|
||||
itend=template darts_of_involution<1>(dh2).end(); it!=itend;
|
||||
++it)
|
||||
{
|
||||
}
|
||||
tosplit.push(internal::Couple_dart_and_dim
|
||||
<typename Map::Dart_handle>
|
||||
(first,cur,2));
|
||||
}
|
||||
}
|
||||
|
||||
if (!cur->is_free(0))
|
||||
|
|
@ -1134,6 +1142,7 @@ namespace CGAL {
|
|||
}
|
||||
|
||||
amap.template basic_link_beta<1>(*it, d1);
|
||||
// TODO remove this group, and use link_beta instead ?
|
||||
amap.group_all_dart_attributes_except(*it, d1, 1);
|
||||
|
||||
amap.mark(*it, mark);
|
||||
|
|
|
|||
|
|
@ -26,13 +26,127 @@
|
|||
#include <stack>
|
||||
#include <set>
|
||||
|
||||
/* Definition of functors used to manage attributes (we need functors as
|
||||
* attributes are stored in tuple, thus all the access must be done at
|
||||
* compiling time.
|
||||
*
|
||||
* Group_attribute_functor_of_dart<CMap> to group the <i>-attributes of two
|
||||
* given darts (except for adim).
|
||||
* Group_attribute_functor_of_dart_run<CMap,i> same than
|
||||
* Group_attribute_functor_of_dart<CMap>::run<i>, with i template argument
|
||||
* given in the struct to enable specialization.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
namespace CGAL {
|
||||
namespace internal {
|
||||
|
||||
/** @file Combinatorial_map_functors.h
|
||||
* Definition of functors used for dD Combinatorial map.
|
||||
*/
|
||||
/** @file Combinatorial_map_functors.h
|
||||
* Definition of functors used for dD Combinatorial map.
|
||||
*/
|
||||
|
||||
// **************************************************************************
|
||||
/// Functor used for link_beta to update the attributes of
|
||||
/// adart2 on the attributes of this dart.
|
||||
template<typename CMap, unsigned int i, typename T=
|
||||
typename CMap::Helper::template Attribute_handle<i>::type>
|
||||
struct Group_attribute_functor_of_dart_run
|
||||
{
|
||||
static void run(CMap* amap,
|
||||
typename CMap::Dart_handle dh1,
|
||||
typename CMap::Dart_handle dh2)
|
||||
{
|
||||
CGAL_static_assertion(i<=CMap::dimension);
|
||||
CGAL_static_assertion_msg(CMap::Helper::template
|
||||
Dimension_index<i>::value>=0,
|
||||
"Group_attribute_functor_of_dart_run<i> but "
|
||||
"i-attributes are disabled");
|
||||
CGAL_assertion( dh1!=NULL && dh2!=NULL );
|
||||
CGAL_assertion( dh1!=CMap::null_dart_handle &&
|
||||
dh2!=CMap::null_dart_handle );
|
||||
|
||||
T a1=dh1->template attribute<i>();
|
||||
T a2=dh2->template attribute<i>();
|
||||
|
||||
// If the two attributes are equal, nothing to do.
|
||||
if ( a1 == a2 ) return false;
|
||||
|
||||
if ( a1==NULL ) amap->set_attribute_of_dart<i>(dh1, a2);
|
||||
else amap->set_attribute_of_dart<i>(dh2, a1);
|
||||
}
|
||||
};
|
||||
template<typename CMap, typename T>
|
||||
struct Group_attribute_functor_of_dart_run<CMap, 0, T>
|
||||
{
|
||||
static void run(CMap* amap,
|
||||
typename CMap::Dart_handle dh1,
|
||||
typename CMap::Dart_handle dh2,
|
||||
int adim)
|
||||
{
|
||||
CGAL_assertion( adim==-1 ||
|
||||
(0<=adim && (unsigned int)adim<=CMap::dimension) );
|
||||
// todo ASSERT (1<=adim && ...) ???
|
||||
if ( adim!=0 )
|
||||
{
|
||||
typename CMap::Dart_handle od = dh1->other_extremity();
|
||||
if ( od!=NULL )
|
||||
{
|
||||
typename CMap::Helper::template Attribute_handle<0>::type
|
||||
a1=od->template attribute<0>();
|
||||
if ( a1!=NULL && a1!=dh2->template attribute<0>() )
|
||||
amap->template set_attribute_of_dart<0>(dh2, a1);
|
||||
}
|
||||
}
|
||||
|
||||
if ( adim!=1 )
|
||||
{
|
||||
typename CMap::Dart_handle od = dh2->other_extremity();
|
||||
if ( od!=NULL && dh1->template attribute<0>()==NULL )
|
||||
{
|
||||
typename CMap::Helper::template Attribute_handle<0>::type
|
||||
a2=od->template attribute<0>();
|
||||
if ( a2!=NULL )
|
||||
amap->template set_attribute_of_dart<0>(dh1, a2);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
template<typename CMap, unsigned int i>
|
||||
struct Group_attribute_functor_of_dart_run<CMap,i,Void>
|
||||
{
|
||||
static void run(CMap*,
|
||||
typename CMap::Dart_handle,
|
||||
typename CMap::Dart_handle,
|
||||
int)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/// Functor used for link_beta to update the attributes of
|
||||
/// adart2 on the attributes of this dart, except for adim-attributes.
|
||||
/// We define run<i> to allows to use this functor with
|
||||
/// Foreach_enabled_attributes.
|
||||
template<typename CMap>
|
||||
struct Group_attribute_functor_of_dart
|
||||
{
|
||||
template <unsigned int i>
|
||||
static void run(CMap* amap,
|
||||
typename CMap::Dart_handle adart1,
|
||||
typename CMap::Dart_handle adart2, int adim)
|
||||
{
|
||||
CGAL_assertion( adim==-1 ||
|
||||
(0<=adim && (unsigned int)adim<=CMap::dimension) );
|
||||
Group_attribute_functor_of_dart_run<CMap,i>::
|
||||
run(amap,adart1,adart2,adim);
|
||||
}
|
||||
};
|
||||
|
||||
// **************************************************************************
|
||||
|
||||
|
||||
////////////////////////////////////
|
||||
template<typename Dart_handle>
|
||||
struct Couple_dart_and_dim
|
||||
{
|
||||
|
|
@ -43,6 +157,7 @@ namespace CGAL {
|
|||
int dim;
|
||||
};
|
||||
|
||||
|
||||
// Functor used to group one attribute of two given darts
|
||||
template <typename CMap, unsigned int i, typename Type_attr>
|
||||
struct Group_one_attribute_functor
|
||||
|
|
@ -90,7 +205,7 @@ namespace CGAL {
|
|||
{ return false; }
|
||||
};
|
||||
|
||||
// Functor used to degroup one attribute of one dart
|
||||
/* // Functor used to degroup one attribute of one dart
|
||||
template <typename CMap, unsigned int i, typename Type_attr, typename Range>
|
||||
struct Degroup_one_attribute_of_dart_functor
|
||||
{
|
||||
|
|
@ -112,7 +227,7 @@ namespace CGAL {
|
|||
typename CMap::Dart_handle,
|
||||
typename CMap::Dart_handle)
|
||||
{ return false; }
|
||||
};
|
||||
};*/
|
||||
|
||||
/// Functor used to call decrease_attribute_ref_counting<i>
|
||||
/// on each i-cell attribute enabled
|
||||
|
|
@ -330,78 +445,6 @@ namespace CGAL {
|
|||
{}
|
||||
};
|
||||
|
||||
/// Functor used for link_beta to update the attributes of
|
||||
/// adart2 on the attributes of this dart, except for adimension-attributes.
|
||||
template<typename CMap, unsigned int i>
|
||||
struct Group_attribute_functor_of_dart_run
|
||||
{
|
||||
static void run(CMap* amap,
|
||||
typename CMap::Dart_handle dh1,
|
||||
typename CMap::Dart_handle dh2,
|
||||
int adim)
|
||||
{
|
||||
CGAL_assertion( adim==-1 ||
|
||||
(0<=adim && (unsigned int)adim<=CMap::dimension) );
|
||||
if ( adim!=i )
|
||||
{
|
||||
amap->template group_enabled_attribute_of_dart
|
||||
<i, typename CMap::Helper::template Attribute_type<i>::type>
|
||||
(dh1, dh2);
|
||||
}
|
||||
}
|
||||
};
|
||||
template<typename CMap>
|
||||
struct Group_attribute_functor_of_dart_run<CMap, 0>
|
||||
{
|
||||
static void run(CMap* amap,
|
||||
typename CMap::Dart_handle dh1,
|
||||
typename CMap::Dart_handle dh2,
|
||||
int adim)
|
||||
{
|
||||
CGAL_assertion( adim==-1 ||
|
||||
(0<=adim && (unsigned int)adim<=CMap::dimension) );
|
||||
// todo ASSERT (1<=adim && ...) ???
|
||||
if ( adim!=0 )
|
||||
{
|
||||
typename CMap::Dart_handle od = dh1->other_extremity();
|
||||
if ( od!=NULL )
|
||||
{
|
||||
typename CMap::Helper::template Attribute_handle<0>::type
|
||||
a1=od->template attribute<0>();
|
||||
if ( a1!=NULL && a1!=dh2->template attribute<0>() )
|
||||
amap->template set_attribute_of_dart<0>(dh2, a1);
|
||||
}
|
||||
}
|
||||
|
||||
if ( adim!=1 )
|
||||
{
|
||||
typename CMap::Dart_handle od = dh2->other_extremity();
|
||||
if ( od!=NULL && dh1->template attribute<0>()==NULL )
|
||||
{
|
||||
typename CMap::Helper::template Attribute_handle<0>::type
|
||||
a2=od->template attribute<0>();
|
||||
if ( a2!=NULL )
|
||||
amap->template set_attribute_of_dart<0>(dh1, a2);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<typename CMap>
|
||||
struct Group_attribute_functor_of_dart
|
||||
{
|
||||
template <unsigned int i>
|
||||
static void run(CMap* amap,
|
||||
typename CMap::Dart_handle adart1,
|
||||
typename CMap::Dart_handle adart2, int adim)
|
||||
{
|
||||
CGAL_assertion( adim==-1 ||
|
||||
(0<=adim && (unsigned int)adim<=CMap::dimension) );
|
||||
Group_attribute_functor_of_dart_run<CMap,i>::
|
||||
run(amap,adart1,adart2,adim);
|
||||
}
|
||||
};
|
||||
|
||||
// Functor used to call the On_split functor between the two given darts.
|
||||
template<typename Map,unsigned int i,
|
||||
typename Enabled=
|
||||
|
|
|
|||
|
|
@ -255,6 +255,30 @@ namespace CGAL
|
|||
static void run(T...){}
|
||||
};
|
||||
|
||||
//Helper function that is calling
|
||||
//Functor if TAG is different from Void and n!=j
|
||||
template <class Functor,int n,int j,class Type>
|
||||
struct Conditionnal_run_except{
|
||||
template <class ... T>
|
||||
static void run(const T& ... t){
|
||||
Functor:: template run<n>(t...);
|
||||
}
|
||||
};
|
||||
|
||||
template <class Functor,int n,int j>
|
||||
struct Conditionnal_run<Functor,n,j,Void>
|
||||
{
|
||||
template <class ... T>
|
||||
static void run(T...){}
|
||||
};
|
||||
|
||||
template <class Functor,int n>
|
||||
struct Conditionnal_run<Functor,n,n,Void>
|
||||
{
|
||||
template <class ... T>
|
||||
static void run(T...){}
|
||||
};
|
||||
|
||||
//Same as Foreach_static excepted that Functor
|
||||
//is called for case k only if the k'th type in the tuple
|
||||
//is different from Void. Note that to the converse of Foreach_static
|
||||
|
|
@ -279,6 +303,31 @@ namespace CGAL
|
|||
template <class ... T>
|
||||
static void run(const T& ... ){}
|
||||
};
|
||||
|
||||
//Same as Foreach_static_restricted excepted that Functor
|
||||
//is called for case k only if the k'th type in the tuple
|
||||
//is different from Void and k!=j.
|
||||
template <class Functor,int j,class T,int n=0>
|
||||
struct Foreach_static_restricted_except;
|
||||
|
||||
template <class Functor,int j,class Head, class ... Items,int n>
|
||||
struct Foreach_static_restricted_except<Functor, j,
|
||||
CGAL::cpp11::tuple<Head,Items...>,n>
|
||||
{
|
||||
template <class ... T>
|
||||
static void run(const T& ... t){
|
||||
Conditionnal_run_except<Functor,n,j,Head>::run(t...);
|
||||
Foreach_static_restricted_except
|
||||
<Functor,j,CGAL::cpp11::tuple<Items...>,n+1>::run(t...);
|
||||
}
|
||||
};
|
||||
|
||||
template <class Functor,int j,int n>
|
||||
struct Foreach_static_restricted_except<Functor,j,CGAL::cpp11::tuple<>,n>
|
||||
{
|
||||
template <class ... T>
|
||||
static void run(const T& ... ){}
|
||||
};
|
||||
#else
|
||||
// Definitions of structs are moved to another file.
|
||||
#include <CGAL/internal/Combinatorial_map_utility_novariadic.h>
|
||||
|
|
|
|||
Loading…
Reference in New Issue