mirror of https://github.com/CGAL/cgal
* Re-add set_attribute method in CMap class (was removed by error).
* Make functors Is_removable_functor and Is_contractible_functor to avoid a warning.
This commit is contained in:
parent
450a07786b
commit
481908df1f
|
|
@ -985,6 +985,20 @@ namespace CGAL {
|
||||||
(mattribute_containers).size();
|
(mattribute_containers).size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Set the i th attribute of all the darts of a given i-cell.
|
||||||
|
* @param adart a dart of the i-cell.
|
||||||
|
* @param ah the vertex to set.
|
||||||
|
*/
|
||||||
|
template<unsigned int i>
|
||||||
|
void set_attribute(Dart_handle adart,
|
||||||
|
typename Attribute_handle<i>::type ah)
|
||||||
|
{
|
||||||
|
CGAL_static_assertion(i<=dimension);
|
||||||
|
CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
|
||||||
|
"set_attribute<i> but i-attributes are disabled");
|
||||||
|
Set_i_attribute_functor<Self,i>::run(this, adart, ah);
|
||||||
|
}
|
||||||
|
|
||||||
/// @return a Attributes_range<i> (range through all the
|
/// @return a Attributes_range<i> (range through all the
|
||||||
/// attributes<i> of the map).
|
/// attributes<i> of the map).
|
||||||
template<unsigned int i>
|
template<unsigned int i>
|
||||||
|
|
|
||||||
|
|
@ -126,10 +126,6 @@ insert_cell_0_in_cell_2( CMap& amap, typename CMap::Dart_handle adart,
|
||||||
while ( !first->template is_free<0>() && first->template beta<0>()!=adart )
|
while ( !first->template is_free<0>() && first->template beta<0>()!=adart )
|
||||||
first = first->template beta<0>();
|
first = first->template beta<0>();
|
||||||
|
|
||||||
// Stack of couple of dart and dimension for which
|
|
||||||
// we must call on_split functor
|
|
||||||
std::deque<typename CMap::Dart_handle> modified_darts;
|
|
||||||
|
|
||||||
// Mark used to mark darts already treated.
|
// Mark used to mark darts already treated.
|
||||||
int treated = amap.get_new_mark();
|
int treated = amap.get_new_mark();
|
||||||
|
|
||||||
|
|
@ -203,7 +199,6 @@ insert_cell_0_in_cell_2( CMap& amap, typename CMap::Dart_handle adart,
|
||||||
(nn1, prev->beta(dim));
|
(nn1, prev->beta(dim));
|
||||||
|
|
||||||
amap.mark(cur->beta(dim), treated);
|
amap.mark(cur->beta(dim), treated);
|
||||||
tounmark.push_back(cur->beta(dim));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -240,7 +235,11 @@ insert_cell_0_in_cell_2( CMap& amap, typename CMap::Dart_handle adart,
|
||||||
itd=tounmark.begin(); itd!=tounmark.end(); ++itd )
|
itd=tounmark.begin(); itd!=tounmark.end(); ++itd )
|
||||||
{
|
{
|
||||||
amap.unmark(*itd, treated);
|
amap.unmark(*itd, treated);
|
||||||
|
for (unsigned int dim=3; dim<=CMap::dimension; ++dim)
|
||||||
|
{
|
||||||
|
if ( !(*itd)->is_free(dim) )
|
||||||
|
amap.unmark((*itd)->beta(dim), treated);
|
||||||
|
}
|
||||||
if ( *itd!=adart )
|
if ( *itd!=adart )
|
||||||
CGAL::internal::Degroup_attribute_functor_run<CMap, 2>::
|
CGAL::internal::Degroup_attribute_functor_run<CMap, 2>::
|
||||||
run(&amap, adart, *itd);
|
run(&amap, adart, *itd);
|
||||||
|
|
@ -300,9 +299,9 @@ insert_dangling_cell_1_in_cell_2( CMap& amap,
|
||||||
if ( !it1->is_free(s1) )
|
if ( !it1->is_free(s1) )
|
||||||
{
|
{
|
||||||
if ( s1==0 )
|
if ( s1==0 )
|
||||||
amap.template link_beta_1(it1->template beta<0>(), d2);
|
amap.link_beta_1(it1->template beta<0>(), d2);
|
||||||
else
|
else
|
||||||
amap.template link_beta_0(it1->template beta<1>(), d2);
|
amap.link_beta_0(it1->template beta<1>(), d2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s1==0)
|
if (s1==0)
|
||||||
|
|
|
||||||
|
|
@ -37,15 +37,11 @@ namespace CGAL
|
||||||
* @param adart a dart of the i-cell.
|
* @param adart a dart of the i-cell.
|
||||||
* @return true iff the i-cell can be removed.
|
* @return true iff the i-cell can be removed.
|
||||||
*/
|
*/
|
||||||
template < class CMap, unsigned int i >
|
template <class CMap, unsigned int i, unsigned int nmi=CMap::dimension-i>
|
||||||
bool is_removable(const CMap& amap, typename CMap::Dart_const_handle adart)
|
struct Is_removable_functor
|
||||||
|
{
|
||||||
|
static bool run(const CMap& amap, typename CMap::Dart_const_handle adart)
|
||||||
{
|
{
|
||||||
CGAL_assertion( adart!=NULL );
|
|
||||||
CGAL_static_assertion( 0<=i && i<=CMap::dimension );
|
|
||||||
|
|
||||||
if ( i==CMap::dimension ) return true;
|
|
||||||
if ( i==CMap::dimension-1 ) return true;
|
|
||||||
|
|
||||||
// TODO? Optimisation for dim-2, and to not test all the darts of the cell?
|
// TODO? Optimisation for dim-2, and to not test all the darts of the cell?
|
||||||
bool res = true;
|
bool res = true;
|
||||||
for ( CGAL::CMap_dart_const_iterator_of_cell<CMap,i> it(amap, adart);
|
for ( CGAL::CMap_dart_const_iterator_of_cell<CMap,i> it(amap, adart);
|
||||||
|
|
@ -57,6 +53,30 @@ namespace CGAL
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
// Specialization for i=CMap::dimension
|
||||||
|
template <class CMap, unsigned int i>
|
||||||
|
struct Is_removable_functor<CMap, i, 0>
|
||||||
|
{
|
||||||
|
static bool run(const CMap&, typename CMap::Dart_const_handle)
|
||||||
|
{ return true; }
|
||||||
|
};
|
||||||
|
// Specialization for i=CMap::dimension-1
|
||||||
|
template <class CMap, unsigned int i>
|
||||||
|
struct Is_removable_functor<CMap, i, 1>
|
||||||
|
{
|
||||||
|
static bool run(const CMap&, typename CMap::Dart_const_handle)
|
||||||
|
{ return true; }
|
||||||
|
};
|
||||||
|
/** Test if an i-cell can be removed.
|
||||||
|
* An i-cell can be removed if i==CMap::dimension or i==CMap::dimension-1,
|
||||||
|
* or if there are at most two (i+1)-cell incident to it.
|
||||||
|
* @param adart a dart of the i-cell.
|
||||||
|
* @return true iff the i-cell can be removed.
|
||||||
|
*/
|
||||||
|
template < class CMap, unsigned int i >
|
||||||
|
bool is_removable(const CMap& amap, typename CMap::Dart_const_handle adart)
|
||||||
|
{ return CGAL::Is_removable_functor<CMap, i>::run(amap,adart); }
|
||||||
|
|
||||||
/** Remove an i-cell, 0<i<dimension, and merge eventually both incident
|
/** Remove an i-cell, 0<i<dimension, and merge eventually both incident
|
||||||
* (i+1)-cells.
|
* (i+1)-cells.
|
||||||
|
|
@ -431,15 +451,11 @@ namespace CGAL
|
||||||
* @param adart a dart of the i-cell.
|
* @param adart a dart of the i-cell.
|
||||||
* @return true iff the i-cell can be contracted.
|
* @return true iff the i-cell can be contracted.
|
||||||
*/
|
*/
|
||||||
template < class CMap, unsigned int i >
|
template <class CMap, unsigned int i>
|
||||||
bool is_contractible(const CMap& amap, typename CMap::Dart_const_handle adart)
|
struct Is_contractible_functor
|
||||||
|
{
|
||||||
|
static bool run(const CMap& amap, typename CMap::Dart_const_handle adart)
|
||||||
{
|
{
|
||||||
CGAL_assertion(adart != NULL);
|
|
||||||
CGAL_static_assertion(0<=i && i<=CMap::dimension);
|
|
||||||
|
|
||||||
if ( i==0 ) return false;
|
|
||||||
if ( i==1 ) return true;
|
|
||||||
|
|
||||||
// TODO ? Optimisation possible to not test all the darts of the cell ?
|
// TODO ? Optimisation possible to not test all the darts of the cell ?
|
||||||
bool res = true;
|
bool res = true;
|
||||||
for ( CGAL::CMap_dart_const_iterator_of_cell<CMap,i> it(amap, adart);
|
for ( CGAL::CMap_dart_const_iterator_of_cell<CMap,i> it(amap, adart);
|
||||||
|
|
@ -451,6 +467,30 @@ namespace CGAL
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
// Specialization for i=0
|
||||||
|
template <class CMap>
|
||||||
|
struct Is_contractible_functor<CMap, 0>
|
||||||
|
{
|
||||||
|
static bool run(const CMap&, typename CMap::Dart_const_handle)
|
||||||
|
{ return false; }
|
||||||
|
};
|
||||||
|
// Specialization for i=1
|
||||||
|
template <class CMap>
|
||||||
|
struct Is_contractible_functor<CMap, 1>
|
||||||
|
{
|
||||||
|
static bool run(const CMap&, typename CMap::Dart_const_handle)
|
||||||
|
{ return true; }
|
||||||
|
};
|
||||||
|
/** Test if an i-cell can be contracted.
|
||||||
|
* An i-cell can be contracted if i==1
|
||||||
|
* or if there are at most two (i-1)-cell incident to it.
|
||||||
|
* @param adart a dart of the i-cell.
|
||||||
|
* @return true iff the i-cell can be contracted.
|
||||||
|
*/
|
||||||
|
template < class CMap, unsigned int i >
|
||||||
|
bool is_contractible(const CMap& amap, typename CMap::Dart_const_handle adart)
|
||||||
|
{ return CGAL::Is_contractible_functor<CMap, i>::run(amap,adart); }
|
||||||
|
|
||||||
/** Contract an i-cell, 1<i<=dimension, and merge eventually both incident
|
/** Contract an i-cell, 1<i<=dimension, and merge eventually both incident
|
||||||
* (i-1)-cells.
|
* (i-1)-cells.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue