mirror of https://github.com/CGAL/cgal
cont...
This commit is contained in:
parent
173f8bc073
commit
6035180c7a
|
|
@ -22,12 +22,13 @@
|
|||
|
||||
#include <CGAL/Compact_container.h>
|
||||
#include <CGAL/internal/Combinatorial_map_utility.h>
|
||||
#include <CGAL/internal/Combinatorial_map_functors.h>
|
||||
#include <CGAL/internal/Combinatorial_map_sewable.h>
|
||||
#include <CGAL/Combinatorial_map_functors.h>
|
||||
#include <CGAL/Combinatorial_map_min_items.h>
|
||||
#include <CGAL/Dart_const_iterators.h>
|
||||
#include <CGAL/Cell_const_iterators.h>
|
||||
#include <CGAL/Combinatorial_map_basic_operations.h>
|
||||
#include <CGAL/Combinatorial_map_functors.h>
|
||||
#include <bitset>
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
|
|
@ -55,6 +56,7 @@ namespace CGAL {
|
|||
class Alloc_=CGAL_ALLOCATOR(int) >
|
||||
class Combinatorial_map_base
|
||||
{
|
||||
/*
|
||||
template<class Map, unsigned int i, unsigned int nmi>
|
||||
friend struct Remove_cell_functor;
|
||||
|
||||
|
|
@ -87,7 +89,7 @@ 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>
|
||||
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 T>
|
||||
|
|
@ -101,11 +103,10 @@ namespace CGAL {
|
|||
|
||||
template <typename CMap, unsigned int i, typename Type_attr>
|
||||
friend struct internal::Degroup_one_attribute_functor;
|
||||
*/
|
||||
|
||||
template<typename Map>
|
||||
friend struct internal::Test_is_valid_attribute_functor;
|
||||
|
||||
|
||||
template<typename Map>
|
||||
friend struct internal::Update_dart_of_attribute_functor;
|
||||
|
||||
|
|
@ -114,7 +115,7 @@ namespace CGAL {
|
|||
|
||||
template<typename Map, unsigned int i, typename Enabled>
|
||||
friend struct internal::Update_dart_of_one_attribute_functor;
|
||||
|
||||
*/
|
||||
public:
|
||||
/// Types definition
|
||||
typedef Combinatorial_map_base<d_, Refs, Items_,Alloc_> Self;
|
||||
|
|
@ -328,12 +329,12 @@ namespace CGAL {
|
|||
Dart_const_handle beta(Dart_const_handle ADart, Betas... betas) const
|
||||
{ return internal::Beta_functor<Dart_const_handle, Betas ...>::
|
||||
run(ADart, betas...); }
|
||||
template<typename ... Betas>
|
||||
template<int ... Betas>
|
||||
Dart_handle beta(Dart_handle ADart) const
|
||||
{ return internal::Beta_functor_static<Dart_handle, Betas ...>::
|
||||
run(ADart); }
|
||||
template<typename ... Betas>
|
||||
Dart_const_handle beta(Dart_const_handle ADart, Betas... betas) const
|
||||
template<int ... Betas>
|
||||
Dart_const_handle beta(Dart_const_handle ADart) const
|
||||
{ return internal::Beta_functor_static<Dart_const_handle, Betas ...>::
|
||||
run(ADart); }
|
||||
#else
|
||||
|
|
@ -707,7 +708,7 @@ namespace CGAL {
|
|||
marks[i] = -1;
|
||||
|
||||
Helper::template
|
||||
Foreach_enabled_attributes<internal::Reserve_mark_functor<Self> >::
|
||||
Foreach_enabled_attributes<Reserve_mark_functor<Self> >::
|
||||
run(this,&marks);
|
||||
|
||||
for ( typename Dart_range::const_iterator it(darts().begin()),
|
||||
|
|
@ -831,7 +832,7 @@ namespace CGAL {
|
|||
if ( attribs )
|
||||
{
|
||||
Helper::template Foreach_enabled_attributes
|
||||
<internal::Display_attribute_functor<Self> >::run(this, it);
|
||||
<Display_attribute_functor<Self> >::run(this, it);
|
||||
}
|
||||
os << std::endl;
|
||||
++nb;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,433 @@
|
|||
// Copyright (c) 2010-2011 CNRS and LIRIS' Establishments (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; either version 3 of the License,
|
||||
// or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
// Author(s) : Guillaume Damiand <guillaume.damiand@liris.cnrs.fr>
|
||||
//
|
||||
#ifndef CGAL_COMBINATORIAL_MAP_FUNCTORS_H
|
||||
#define CGAL_COMBINATORIAL_MAP_FUNCTORS_H
|
||||
|
||||
#include <CGAL/Dart_const_iterators.h>
|
||||
#include <CGAL/Cell_const_iterators.h>
|
||||
#include <CGAL/Combinatorial_map_basic_operations.h>
|
||||
#include <vector>
|
||||
|
||||
/* 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). Some of these functors are used with
|
||||
* Foreach_enabled_attributes to iterate through all the non void attribs.
|
||||
* Functors allowing to group/ungroup attributes are defined in
|
||||
* Combinatorial_map_group_functors.h (included at the end of this file)
|
||||
*
|
||||
* Reserve_mark_functor<CMap> to reserve one mark for each non void attribute.
|
||||
*
|
||||
* Set_i_attribute_functor<CMap, i> to set the i-attribute of a given
|
||||
* i-cell.
|
||||
*
|
||||
* internal::Call_split_functor<CMap,i> to call the OnSplit functors on two
|
||||
* given i-attributes.
|
||||
*
|
||||
* internal::Call_merge_functor<CMap,i> to call the OnMerge functors on two
|
||||
* given i-attributes.
|
||||
*
|
||||
* internal::Test_is_valid_attribute_functor<CMap> to test if a given i-cell is
|
||||
* valid (all its darts are linked to the same attribute, no other dart is
|
||||
* linked with this attribute).
|
||||
*
|
||||
* internal::Count_cell_functor<CMap> to count the nuber of i-cells.
|
||||
*
|
||||
* internal::Count_bytes_one_attribute_functor<CMap> to count the memory
|
||||
* occupied by i-attributes.
|
||||
*
|
||||
* internal::Decrease_attribute_functor<CMap> to decrease by one the ref
|
||||
* counting of a given i-attribute.
|
||||
*
|
||||
* internal::Beta_functor<Dart, i...> to call several beta on the given dart.
|
||||
* Indices are given as parameter of the run function.
|
||||
*
|
||||
* internal::Beta_functor_static<Dart, i...> to call several beta on the given
|
||||
* dart. Indices are given as template arguments.
|
||||
*
|
||||
* internal::Set_i_attribute_of_dart_functor<CMap, i> to set the i-attribute
|
||||
* of a given dart.
|
||||
*/
|
||||
|
||||
namespace CGAL
|
||||
{
|
||||
/** @file Combinatorial_map_functors.h
|
||||
* Definition of functors used for dD Combinatorial map.
|
||||
*/
|
||||
// **************************************************************************
|
||||
/// Functor used to reserve one mark for each enabled attribute.
|
||||
template<typename CMap>
|
||||
struct Reserve_mark_functor
|
||||
{
|
||||
template <unsigned int i>
|
||||
static void run(const CMap* amap, std::vector<int>* marks)
|
||||
{ (*marks)[i] = amap->get_new_mark(); }
|
||||
};
|
||||
// **************************************************************************
|
||||
/// Functor used to display the address of the i-cell attribute
|
||||
template<typename CMap>
|
||||
struct Display_attribute_functor
|
||||
{
|
||||
template <unsigned int i>
|
||||
static void run(const CMap* amap,
|
||||
typename CMap::Dart_const_handle adart)
|
||||
{
|
||||
if ( adart->template attribute<i>()==NULL )
|
||||
std::cout<<"NULL";
|
||||
else
|
||||
std::cout<<&*(adart->template attribute<i>());
|
||||
}
|
||||
};
|
||||
// **************************************************************************
|
||||
namespace internal
|
||||
{
|
||||
// Functor which call Functor::operator() on the two given cell_attributes
|
||||
template<typename Cell_attribute, typename Functor>
|
||||
struct Apply_cell_functor
|
||||
{
|
||||
static void run(Cell_attribute& acell1, Cell_attribute& acell2)
|
||||
{
|
||||
Functor() (acell1,acell2);
|
||||
}
|
||||
};
|
||||
//...except for Null_functor.
|
||||
template<typename Cell_attribute>
|
||||
struct Apply_cell_functor<Cell_attribute,Null_functor>
|
||||
{
|
||||
static void run(Cell_attribute&, Cell_attribute&)
|
||||
{}
|
||||
};
|
||||
// **************************************************************************
|
||||
// Functor used to call the On_split functor between the two given darts.
|
||||
template<typename CMap, unsigned int i,
|
||||
typename Enabled=typename CMap::Helper::
|
||||
#ifndef CGAL_CFG_TEMPLATE_IN_DEFAULT_PARAMETER_BUG
|
||||
template
|
||||
#endif
|
||||
Attribute_type<i>::type>
|
||||
struct Call_split_functor
|
||||
{
|
||||
static void run(typename CMap::Dart_handle adart1,
|
||||
typename CMap::Dart_handle adart2)
|
||||
{
|
||||
Apply_cell_functor
|
||||
<typename CMap::Helper::template Attribute_type<i>::type,
|
||||
typename CMap::Helper::
|
||||
template Attribute_type<i>::type::On_split>::
|
||||
run(*(adart1->template attribute<i>()),
|
||||
*(adart2->template attribute<i>()));
|
||||
}
|
||||
static void
|
||||
run(typename CMap::Helper::template Attribute_handle<i>::type a1,
|
||||
typename CMap::Helper::template Attribute_handle<i>::type a2)
|
||||
{
|
||||
Apply_cell_functor
|
||||
<typename CMap::Helper::template Attribute_type<i>::type,
|
||||
typename CMap::Helper::
|
||||
template Attribute_type<i>::type::On_split>::
|
||||
run(*a1, *a2);
|
||||
}
|
||||
};
|
||||
// Specialization for disabled attributes.
|
||||
template<typename CMap,unsigned int i>
|
||||
struct Call_split_functor<CMap,i,CGAL::Void>
|
||||
{
|
||||
static void run(typename CMap::Dart_handle,
|
||||
typename CMap::Dart_handle)
|
||||
{}
|
||||
};
|
||||
// **************************************************************************
|
||||
// Functor used to call the On_merge functor between the two given darts.
|
||||
template<typename CMap,unsigned int i,
|
||||
typename Enabled=typename CMap::Helper::
|
||||
#ifndef CGAL_CFG_TEMPLATE_IN_DEFAULT_PARAMETER_BUG
|
||||
template
|
||||
#endif
|
||||
Attribute_type<i>::type>
|
||||
struct Call_merge_functor
|
||||
{
|
||||
static void run(typename CMap::Dart_handle adart1,
|
||||
typename CMap::Dart_handle adart2)
|
||||
{
|
||||
Apply_cell_functor
|
||||
<typename CMap::Helper::template Attribute_type<i>::type,
|
||||
typename CMap::Helper::template Attribute_type<i>::type::On_merge>::
|
||||
run(*(adart1->template attribute<i>()),
|
||||
*(adart2->template attribute<i>()));
|
||||
}
|
||||
static void
|
||||
run(typename CMap::Helper::template Attribute_handle<i>::type a1,
|
||||
typename CMap::Helper::template Attribute_handle<i>::type a2)
|
||||
{
|
||||
Apply_cell_functor
|
||||
<typename CMap::Helper::template Attribute_type<i>::type,
|
||||
typename CMap::Helper::template Attribute_type<i>::type::On_merge>::
|
||||
run(*a1, *a2);
|
||||
}
|
||||
};
|
||||
// Specialization for disabled attributes.
|
||||
template<typename CMap,unsigned int i>
|
||||
struct Call_merge_functor<CMap,i,CGAL::Void>
|
||||
{
|
||||
static void run(typename CMap::Dart_handle,
|
||||
typename CMap::Dart_handle)
|
||||
{}
|
||||
};
|
||||
// **************************************************************************
|
||||
/// Functor used to test if a cell is valid
|
||||
template<typename CMap>
|
||||
struct Test_is_valid_attribute_functor
|
||||
{
|
||||
template <unsigned int i>
|
||||
static void run(const CMap* amap,
|
||||
typename CMap::Dart_const_handle adart,
|
||||
std::vector<int>* marks, bool *ares)
|
||||
{
|
||||
if (!amap->template is_valid_attribute<i>(adart,(*marks)[i]) )
|
||||
{
|
||||
(*ares)=false;
|
||||
std::cerr << "CMap not valid: a "<<i<<"-cell is not correctly "
|
||||
"associated with an attribute for " << &(*adart)<< std::endl;
|
||||
}
|
||||
}
|
||||
};
|
||||
// **************************************************************************
|
||||
/// Functor for counting i-cell
|
||||
template<typename CMap>
|
||||
struct Count_cell_functor
|
||||
{
|
||||
template <unsigned int i>
|
||||
static void run( const CMap* amap,
|
||||
typename CMap::Dart_const_handle adart,
|
||||
std::vector<int>* amarks,
|
||||
std::vector<unsigned int>* ares )
|
||||
{
|
||||
if ( (*amarks)[i]!=-1 && !amap->is_marked(adart, (*amarks)[i]) )
|
||||
{
|
||||
++ (*ares)[i];
|
||||
mark_cell<CMap,i>(*amap, adart, (*amarks)[i]);
|
||||
}
|
||||
}
|
||||
};
|
||||
// **************************************************************************
|
||||
/// Functor for counting the memory occupation of attributes
|
||||
/// Be careful not reentrant !!! TODO a Foreach_enabled_attributes
|
||||
/// taking an instance of a functor as argument allowing to compute
|
||||
/// and return values.
|
||||
template<typename CMap>
|
||||
struct Count_bytes_one_attribute_functor
|
||||
{
|
||||
template <unsigned int i>
|
||||
static void run( const CMap* amap )
|
||||
{
|
||||
res += amap->template attributes<i>().capacity()*
|
||||
sizeof(typename CMap::template Attribute_type<i>::type);
|
||||
}
|
||||
|
||||
static typename CMap::size_type res;
|
||||
};
|
||||
template<typename CMap>
|
||||
typename CMap::size_type Count_bytes_one_attribute_functor<CMap>::res = 0;
|
||||
|
||||
template<typename CMap>
|
||||
struct Count_bytes_all_attributes_functor
|
||||
{
|
||||
static typename CMap::size_type run( const CMap& amap )
|
||||
{
|
||||
Count_bytes_one_attribute_functor<CMap>::res = 0;
|
||||
CMap::Helper::template Foreach_enabled_attributes
|
||||
<Count_bytes_one_attribute_functor<CMap> >::run(&amap);
|
||||
return Count_bytes_one_attribute_functor<CMap>::res;
|
||||
}
|
||||
};
|
||||
// **************************************************************************
|
||||
/// Decrease the cell attribute reference counting of the given dart.
|
||||
/// The attribute is removed if there is no more darts linked with it.
|
||||
template<typename CMap, unsigned int i, typename T=
|
||||
typename CMap::Helper::template Attribute_type<i>::type>
|
||||
struct Decrease_attribute_functor_run
|
||||
{
|
||||
static void run(CMap* amap, typename CMap::Dart_handle adart)
|
||||
{
|
||||
if ( adart->template attribute<i>()!=NULL )
|
||||
{
|
||||
adart->template attribute<i>()->dec_nb_refs();
|
||||
if ( adart->template attribute<i>()->get_nb_refs()==0 )
|
||||
amap->template erase_attribute<i>(adart->template attribute<i>());
|
||||
}
|
||||
}
|
||||
};
|
||||
/// Specialization for void attributes.
|
||||
template<typename CMap, unsigned int i>
|
||||
struct Decrease_attribute_functor_run<CMap,i,CGAL::Void>
|
||||
{
|
||||
static void run(CMap*, typename CMap::Dart_handle)
|
||||
{}
|
||||
};
|
||||
// **************************************************************************
|
||||
/// Functor used to call decrease_attribute_ref_counting<i>
|
||||
/// on each i-cell attribute enabled
|
||||
template<typename CMap>
|
||||
struct Decrease_attribute_functor
|
||||
{
|
||||
template <unsigned int i>
|
||||
static void run(CMap* amap, typename CMap::Dart_handle adart)
|
||||
{ Decrease_attribute_functor_run<CMap,i>::run(amap, adart); }
|
||||
};
|
||||
// **************************************************************************
|
||||
/// Functor used to set the i-attribute of a given dart.
|
||||
template<typename CMap, unsigned int i, typename T=
|
||||
typename CMap::Helper::template Attribute_type<i>::type>
|
||||
struct Set_i_attribute_of_dart_functor
|
||||
{
|
||||
static void run( CMap* amap, typename CMap::Dart_handle dh,
|
||||
typename CMap::Helper::template Attribute_handle<i>::type
|
||||
ah )
|
||||
{
|
||||
CGAL_static_assertion(i<=CMap::dimension);
|
||||
CGAL_assertion( dh!=NULL && dh!=CMap::null_dart_handle );
|
||||
|
||||
if ( dh->template attribute<i>()==ah ) return;
|
||||
|
||||
Decrease_attribute_functor_run<CMap, i>::run(amap, dh);
|
||||
dh->template set_attribute<i>(ah);
|
||||
}
|
||||
};
|
||||
/// Specialization for void attributes.
|
||||
template<typename CMap, unsigned int i>
|
||||
struct Set_i_attribute_of_dart_functor<CMap,i,CGAL::Void>
|
||||
{
|
||||
static void run( CMap*, typename CMap::Dart_handle,
|
||||
typename CMap::Helper::template Attribute_handle<i>::type)
|
||||
{}
|
||||
};
|
||||
// **************************************************************************
|
||||
// Beta functor, used to combine several beta.
|
||||
#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
|
||||
template<typename Dart_handle, typename ... Betas>
|
||||
struct Beta_functor;
|
||||
template<typename Dart_handle, typename ... Betas>
|
||||
struct Beta_functor<Dart_handle, int, Betas...>
|
||||
{
|
||||
static Dart_handle run(Dart_handle ADart, int B, Betas... betas)
|
||||
{ return Beta_functor<Dart_handle, Betas...>::run(ADart->beta(B),
|
||||
betas...); }
|
||||
};
|
||||
template<typename Dart_handle>
|
||||
struct Beta_functor<Dart_handle, int>
|
||||
{
|
||||
static Dart_handle run(Dart_handle ADart, int B)
|
||||
{
|
||||
CGAL_assertion( ADart!=NULL );
|
||||
return ADart->beta(B);
|
||||
}
|
||||
};
|
||||
// **************************************************************************
|
||||
template<typename Dart_handle, int ... Betas>
|
||||
struct Beta_functor_static;
|
||||
template<typename Dart_handle, int B, int ... Betas>
|
||||
struct Beta_functor_static<Dart_handle, B, Betas...>
|
||||
{
|
||||
static Dart_handle run(Dart_handle ADart)
|
||||
{ return Beta_functor_static<Dart_handle, Betas...>::
|
||||
run(ADart->template beta<B>()); }
|
||||
};
|
||||
template<typename Dart_handle, int B>
|
||||
struct Beta_functor_static<Dart_handle, B>
|
||||
{
|
||||
static Dart_handle run(Dart_handle ADart)
|
||||
{
|
||||
CGAL_assertion( ADart!=NULL );
|
||||
return ADart->template beta<B>();
|
||||
}
|
||||
};
|
||||
#endif //CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
|
||||
// **************************************************************************
|
||||
/// Functor used to call update_dart_of_attribute<i>
|
||||
/// on each i-cell attribute enabled
|
||||
// TODO REMOVE ?
|
||||
template<typename CMap>
|
||||
struct Update_dart_of_attribute_functor
|
||||
{
|
||||
template <unsigned int i>
|
||||
static void run(CMap* amap, typename CMap::Dart_handle ah, int amark)
|
||||
{ amap->template update_dart_of_attribute<i>(ah,amark); }
|
||||
};
|
||||
|
||||
template<typename CMap, unsigned int i, typename Enabled=
|
||||
typename CMap::Helper::
|
||||
#ifndef CGAL_CFG_TEMPLATE_IN_DEFAULT_PARAMETER_BUG
|
||||
template
|
||||
#endif
|
||||
Attribute_type<i>::type>
|
||||
struct Update_dart_of_one_attribute_functor
|
||||
{
|
||||
static void run(CMap* amap, typename CMap::Dart_handle ah, int amark)
|
||||
{ amap->template update_dart_of_attribute<i>(ah,amark); }
|
||||
};
|
||||
template<typename CMap, unsigned int i>
|
||||
struct Update_dart_of_one_attribute_functor<CMap, i, CGAL::Void>
|
||||
{
|
||||
static void run(CMap*, typename CMap::Dart_handle, int)
|
||||
{}
|
||||
};
|
||||
// **************************************************************************
|
||||
} // namespace internal
|
||||
// **************************************************************************
|
||||
/// Functor used to set the i-attribute of a given i-cell.
|
||||
/// We can use any range as Range type, by default we use
|
||||
/// Dart_of_cell_range<i>
|
||||
template<typename CMap, unsigned int i,
|
||||
typename Range=typename CMap::template Dart_of_cell_range<i>,
|
||||
typename T=typename CMap::Helper::template Attribute_type<i>::type>
|
||||
struct Set_i_attribute_functor
|
||||
{
|
||||
static void run( CMap* amap, typename CMap::Dart_handle dh,
|
||||
typename CMap::Helper::template Attribute_handle<i>::type
|
||||
ah )
|
||||
{
|
||||
CGAL_static_assertion(i<=CMap::dimension);
|
||||
CGAL_assertion( dh!=NULL && dh!=CMap::null_dart_handle && ah!=NULL );
|
||||
|
||||
for ( typename Range::iterator it(*amap, dh); it.cont(); ++it)
|
||||
{
|
||||
if ( it->template attribute<i>()!=ah )
|
||||
{
|
||||
internal::Decrease_attribute_functor_run<CMap, i>::run(amap, it);
|
||||
it->template set_attribute<i>(ah);
|
||||
}
|
||||
}
|
||||
ah->set_dart(dh);
|
||||
}
|
||||
};
|
||||
/// Specialization for void attributes.
|
||||
template<typename CMap, unsigned int i>
|
||||
struct Set_i_attribute_functor<CMap,i,CGAL::Void>
|
||||
{
|
||||
static void run( CMap*, typename CMap::Dart_handle,
|
||||
typename CMap::Helper::template Attribute_handle<i>::type)
|
||||
{}
|
||||
};
|
||||
// **************************************************************************
|
||||
} // namespace CGAL
|
||||
|
||||
#include <CGAL/internal/Combinatorial_map_group_functors.h>
|
||||
|
||||
#endif // CGAL_COMBINATORIAL_MAP_FUNCTORS_H //
|
||||
// EOF //
|
||||
|
|
@ -50,7 +50,13 @@ insert_cell_0_in_cell_1( CMap& amap, typename CMap::Dart_handle adart,
|
|||
}
|
||||
}
|
||||
|
||||
amap.link_beta_1(*it, d1);
|
||||
amap.basic_link_beta_1(*it, d1);
|
||||
|
||||
// We copy all the attributes except for dim=0
|
||||
CMap::Helper::template Foreach_enabled_attributes_except
|
||||
<internal::Group_attribute_functor_of_dart<CMap>, 0>::
|
||||
run(&amap,*it,d1);
|
||||
// We initialise the 0-atttrib to ah
|
||||
internal::Set_i_attribute_of_dart_functor<CMap, 0>::run(&amap, d1, ah);
|
||||
amap.mark(*it, mark);
|
||||
}
|
||||
|
|
@ -61,6 +67,9 @@ insert_cell_0_in_cell_1( CMap& amap, typename CMap::Dart_handle adart,
|
|||
amap.unmark(*it, mark);
|
||||
}
|
||||
|
||||
CGAL_assertion(amap.is_whole_map_unmarked(m));
|
||||
CGAL_assertion(amap.is_whole_map_unmarked(mark));
|
||||
|
||||
amap.free_mark(m);
|
||||
amap.free_mark(mark);
|
||||
|
||||
|
|
@ -102,16 +111,16 @@ insert_cell_0_in_cell_2( CMap& amap, typename CMap::Dart_handle adart,
|
|||
int treated = amap.get_new_mark();
|
||||
|
||||
// Stack of marked darts
|
||||
std::stack<typename CMap::Dart_handle> tounmark;
|
||||
std::deque<typename CMap::Dart_handle> tounmark;
|
||||
|
||||
// Now we run through the facet
|
||||
for ( CGAL::CMap_dart_iterator_basic_of_orbit<CMap,1> it(amap, first);
|
||||
for ( CGAL::CMap_dart_iterator_basic_of_orbit<CMap, 1> it(amap, first);
|
||||
it.cont(); )
|
||||
{
|
||||
cur = it;
|
||||
++it;
|
||||
amap.mark(cur, treated);
|
||||
tounmark.push(cur);
|
||||
tounmark.push_back(cur);
|
||||
|
||||
if (!cur->template is_free<0>())
|
||||
{
|
||||
|
|
@ -170,7 +179,7 @@ insert_cell_0_in_cell_2( CMap& amap, typename CMap::Dart_handle adart,
|
|||
(nn1, prev->beta(dim));
|
||||
|
||||
amap.mark(cur->beta(dim), treated);
|
||||
tounmark.push(cur->beta(dim));
|
||||
tounmark.push_back(cur->beta(dim));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -189,8 +198,8 @@ insert_cell_0_in_cell_2( CMap& amap, typename CMap::Dart_handle adart,
|
|||
|
||||
if (n2 != NULL)
|
||||
{
|
||||
amap.template basic_link_beta_for_involution<2>(first->template beta<0>(),
|
||||
n2);
|
||||
amap.template basic_link_beta_for_involution<2>
|
||||
(first->template beta<0>(), n2);
|
||||
for (unsigned int dim=3; dim<=CMap::dimension; ++dim)
|
||||
{
|
||||
if ( !adart->is_free(dim) )
|
||||
|
|
@ -203,15 +212,14 @@ insert_cell_0_in_cell_2( CMap& amap, typename CMap::Dart_handle adart,
|
|||
|
||||
// Now we unmark all marked darts, and we degroup the new faces with the
|
||||
// initial one (if 2-attributes are non void).
|
||||
while ( !tounmark.empty() )
|
||||
for ( typename std::deque<typename CMap::Dart_handle>::iterator
|
||||
itd=tounmark.begin(); itd!=tounmark.end(); ++itd )
|
||||
{
|
||||
amap.unmark(tounmark.top(), treated);
|
||||
amap.unmark(*itd, treated);
|
||||
|
||||
if ( tounmark.top()!=adart )
|
||||
if ( *itd!=adart )
|
||||
internal::Degroup_attribute_functor_run<CMap, 2>::
|
||||
run(&amap, adart, tounmark.top());
|
||||
|
||||
tounmark.pop();
|
||||
run(&amap, adart, *itd);
|
||||
}
|
||||
|
||||
CGAL_assertion(amap.is_whole_map_unmarked(treated));
|
||||
|
|
@ -250,9 +258,10 @@ insert_dangling_cell_1_in_cell_2( CMap& amap,
|
|||
typename CMap::Dart_handle d2 = NULL;
|
||||
unsigned int s1 = 0;
|
||||
|
||||
int treated = amap.get_new_mark();
|
||||
int treated=amap.get_new_mark();
|
||||
|
||||
CGAL::CMap_dart_iterator_of_involution<CMap,1> it1(amap, adart1);
|
||||
CGAL::CMap_dart_iterator_basic_of_involution<CMap,1>
|
||||
it1(amap, adart1, treated);
|
||||
|
||||
for ( ; it1.cont(); ++it1)
|
||||
{
|
||||
|
|
@ -288,25 +297,27 @@ insert_dangling_cell_1_in_cell_2( CMap& amap,
|
|||
if ( !it1->is_free(dim) &&
|
||||
amap.is_marked(it1->beta(dim), treated) )
|
||||
{
|
||||
amap.basic_link_beta_for_involution(it1->beta(dim)->beta_inv(s1), d1,
|
||||
dim);
|
||||
amap.basic_link_beta_for_involution
|
||||
(it1->beta(dim)->beta_inv(s1), d1, dim);
|
||||
amap.basic_link_beta_for_involution
|
||||
(it1->beta(dim)->beta_inv(s1)->beta(2), d2, dim);
|
||||
}
|
||||
}
|
||||
internal::Set_i_attribute_of_dart_functor<CMap, 0>::run(&amap, d1, ah);
|
||||
amap.mark(it1,treated);
|
||||
amap.mark(it1, treated);
|
||||
}
|
||||
|
||||
amap.negate_mark(treated);
|
||||
for ( it1.rewind(); it1.cont(); ++it1 )
|
||||
{ amap.unmark(it1,treated); }
|
||||
CGAL_assertion( amap.is_whole_map_unmarked(treated) );
|
||||
{ amap.mark(it1, treated); }
|
||||
|
||||
CGAL_assertion( amap.is_whole_map_marked(treated) );
|
||||
amap.free_mark(treated);
|
||||
|
||||
typename std::deque<typename CMap::Dart_handle>::iterator it =
|
||||
to_unmark.begin();
|
||||
for (; it != to_unmark.end(); ++it)
|
||||
for ( typename std::deque<typename CMap::Dart_handle>::iterator
|
||||
it=to_unmark.begin(); it!=to_unmark.end(); ++it)
|
||||
{ amap.unmark(*it, mark1); }
|
||||
|
||||
CGAL_assertion( amap.is_whole_map_unmarked(mark1) );
|
||||
amap.free_mark(mark1);
|
||||
|
||||
|
|
@ -353,29 +364,30 @@ insert_cell_1_in_cell_2(CMap& amap,
|
|||
|
||||
CGAL_assertion(is_insertable_cell_1_in_cell_2<CMap>(amap, adart1, adart2));
|
||||
|
||||
int m1 = amap.get_new_mark();
|
||||
int m1=amap.get_new_mark();
|
||||
CMap_dart_iterator_basic_of_involution<CMap,1>
|
||||
it1 = CMap_dart_iterator_basic_of_involution<CMap,1>(amap, adart1, m1);
|
||||
int m2 = amap.get_new_mark();
|
||||
|
||||
int m2=amap.get_new_mark();
|
||||
CMap_dart_iterator_basic_of_involution<CMap,1>
|
||||
it2 = CMap_dart_iterator_basic_of_involution<CMap,1>(amap, adart2, m2);
|
||||
|
||||
int mark1 = amap.get_new_mark();
|
||||
int mark1=amap.get_new_mark();
|
||||
std::deque<typename CMap::Dart_handle> to_unmark;
|
||||
{
|
||||
for ( CMap_dart_iterator_basic_of_cell<CMap,0> it(amap,adart1,mark1);
|
||||
it.cont(); ++it )
|
||||
{
|
||||
to_unmark.push_back(it);
|
||||
amap.mark(it,mark1);
|
||||
amap.mark(it, mark1);
|
||||
}
|
||||
}
|
||||
|
||||
typename CMap::Dart_handle d1 = NULL;
|
||||
typename CMap::Dart_handle d2 = NULL;
|
||||
unsigned int s1 = 0;
|
||||
typename CMap::Dart_handle d1=NULL;
|
||||
typename CMap::Dart_handle d2=NULL;
|
||||
unsigned int s1=0;
|
||||
|
||||
int treated = amap.get_new_mark();
|
||||
int treated=amap.get_new_mark();
|
||||
|
||||
for ( ; it1.cont(); ++it1, ++it2)
|
||||
{
|
||||
|
|
@ -388,14 +400,14 @@ insert_cell_1_in_cell_2(CMap& amap,
|
|||
|
||||
if ( !it1->is_free(s1) )
|
||||
{
|
||||
if ( s1==0 ) amap.basic_link_beta_1(it1->template beta<0>(), d2);
|
||||
else amap.basic_link_beta_0(it1->template beta<1>(), d2);
|
||||
if ( s1==0 ) amap.link_beta_1(it1->template beta<0>(), d2);
|
||||
else amap.link_beta_0(it1->template beta<1>(), d2);
|
||||
}
|
||||
|
||||
if ( !it2->is_free(s1) )
|
||||
{
|
||||
if ( s1==0 ) amap.basic_link_beta_1(it2->template beta<0>(), d1);
|
||||
else amap.basic_link_beta_0(it2->template beta<1>(), d1);
|
||||
if ( s1==0 ) amap.link_beta_1(it2->template beta<0>(), d1);
|
||||
else amap.link_beta_0(it2->template beta<1>(), d1);
|
||||
}
|
||||
|
||||
if ( s1==0 )
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -20,6 +20,8 @@
|
|||
#ifndef CGAL_COMBINATORIAL_MAP_SEWABLE_H
|
||||
#define CGAL_COMBINATORIAL_MAP_SEWABLE_H
|
||||
|
||||
#include <CGAL/Dart_const_iterators.h>
|
||||
|
||||
/* Definition of functor used to test if two darts are i-sewable
|
||||
* (we use functors as there are different specializations).
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -539,7 +539,7 @@ namespace CGAL
|
|||
{
|
||||
template <class ...Ts>
|
||||
static void run(const Ts& ... t)
|
||||
{ Foreach_static_restricted<Functor,Attributes >::run(t...); }
|
||||
{ Foreach_static_restricted<Functor, Attributes>::run(t...); }
|
||||
};
|
||||
// To iterate onto each enabled attributes, except j-attributes
|
||||
template <class Functor, unsigned int j>
|
||||
|
|
@ -547,7 +547,7 @@ namespace CGAL
|
|||
{
|
||||
template <class ...Ts>
|
||||
static void run(const Ts& ... t)
|
||||
{ Foreach_static_restricted_except<Functor,Attributes,j>::run(t...); }
|
||||
{ Foreach_static_restricted_except<Functor, j, Attributes>::run(t...); }
|
||||
};
|
||||
#else
|
||||
// This one cannot be moved in Combinatorial_map_utility_novariadic.h
|
||||
|
|
|
|||
|
|
@ -168,7 +168,8 @@ void MainWindow::clear_all()
|
|||
void MainWindow::on_new_volume(Dart_handle adart)
|
||||
{
|
||||
assert( adart->attribute<3>()==NULL);
|
||||
scene.lcc->set_attribute<3>(adart,scene.lcc->create_attribute<3>());
|
||||
CGAL::Set_i_attribute_functor<LCC, 3>::
|
||||
run(scene.lcc, adart, scene.lcc->create_attribute<3>());
|
||||
update_volume_list_add(adart->attribute<3>());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ namespace CGAL {
|
|||
*/
|
||||
void set_vertex_attribute(Dart_handle adart,
|
||||
Vertex_attribute_handle ah)
|
||||
{ return internal::Set_i_attribute_functor<Self, 0>::run(this, adart,ah); }
|
||||
{ return Set_i_attribute_functor<Self, 0>::run(this, adart,ah); }
|
||||
|
||||
/// @return the Vertex_attribute_range for all vertex_attributes.
|
||||
Vertex_attribute_range& vertex_attributes()
|
||||
|
|
|
|||
Loading…
Reference in New Issue