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/Compact_container.h>
|
||||||
#include <CGAL/internal/Combinatorial_map_utility.h>
|
#include <CGAL/internal/Combinatorial_map_utility.h>
|
||||||
#include <CGAL/internal/Combinatorial_map_functors.h>
|
|
||||||
#include <CGAL/internal/Combinatorial_map_sewable.h>
|
#include <CGAL/internal/Combinatorial_map_sewable.h>
|
||||||
|
#include <CGAL/Combinatorial_map_functors.h>
|
||||||
#include <CGAL/Combinatorial_map_min_items.h>
|
#include <CGAL/Combinatorial_map_min_items.h>
|
||||||
#include <CGAL/Dart_const_iterators.h>
|
#include <CGAL/Dart_const_iterators.h>
|
||||||
#include <CGAL/Cell_const_iterators.h>
|
#include <CGAL/Cell_const_iterators.h>
|
||||||
#include <CGAL/Combinatorial_map_basic_operations.h>
|
#include <CGAL/Combinatorial_map_basic_operations.h>
|
||||||
|
#include <CGAL/Combinatorial_map_functors.h>
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
|
|
@ -55,6 +56,7 @@ namespace CGAL {
|
||||||
class Alloc_=CGAL_ALLOCATOR(int) >
|
class Alloc_=CGAL_ALLOCATOR(int) >
|
||||||
class Combinatorial_map_base
|
class Combinatorial_map_base
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
template<class Map, unsigned int i, unsigned int nmi>
|
template<class Map, unsigned int i, unsigned int nmi>
|
||||||
friend struct Remove_cell_functor;
|
friend struct Remove_cell_functor;
|
||||||
|
|
||||||
|
|
@ -87,7 +89,7 @@ namespace CGAL {
|
||||||
typename Map::Dart_handle
|
typename Map::Dart_handle
|
||||||
insert_cell_0_in_cell_2(Map& amap, typename Map::Dart_handle adart);
|
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;
|
friend struct internal::Degroup_one_attribute_of_dart_functor;
|
||||||
|
|
||||||
template<typename CMap, unsigned int i, typename T>
|
template<typename CMap, unsigned int i, typename T>
|
||||||
|
|
@ -101,11 +103,10 @@ namespace CGAL {
|
||||||
|
|
||||||
template <typename CMap, unsigned int i, typename Type_attr>
|
template <typename CMap, unsigned int i, typename Type_attr>
|
||||||
friend struct internal::Degroup_one_attribute_functor;
|
friend struct internal::Degroup_one_attribute_functor;
|
||||||
*/
|
|
||||||
template<typename Map>
|
template<typename Map>
|
||||||
friend struct internal::Test_is_valid_attribute_functor;
|
friend struct internal::Test_is_valid_attribute_functor;
|
||||||
|
|
||||||
|
|
||||||
template<typename Map>
|
template<typename Map>
|
||||||
friend struct internal::Update_dart_of_attribute_functor;
|
friend struct internal::Update_dart_of_attribute_functor;
|
||||||
|
|
||||||
|
|
@ -114,7 +115,7 @@ namespace CGAL {
|
||||||
|
|
||||||
template<typename Map, unsigned int i, typename Enabled>
|
template<typename Map, unsigned int i, typename Enabled>
|
||||||
friend struct internal::Update_dart_of_one_attribute_functor;
|
friend struct internal::Update_dart_of_one_attribute_functor;
|
||||||
|
*/
|
||||||
public:
|
public:
|
||||||
/// Types definition
|
/// Types definition
|
||||||
typedef Combinatorial_map_base<d_, Refs, Items_,Alloc_> Self;
|
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
|
Dart_const_handle beta(Dart_const_handle ADart, Betas... betas) const
|
||||||
{ return internal::Beta_functor<Dart_const_handle, Betas ...>::
|
{ return internal::Beta_functor<Dart_const_handle, Betas ...>::
|
||||||
run(ADart, betas...); }
|
run(ADart, betas...); }
|
||||||
template<typename ... Betas>
|
template<int ... Betas>
|
||||||
Dart_handle beta(Dart_handle ADart) const
|
Dart_handle beta(Dart_handle ADart) const
|
||||||
{ return internal::Beta_functor_static<Dart_handle, Betas ...>::
|
{ return internal::Beta_functor_static<Dart_handle, Betas ...>::
|
||||||
run(ADart); }
|
run(ADart); }
|
||||||
template<typename ... Betas>
|
template<int ... Betas>
|
||||||
Dart_const_handle beta(Dart_const_handle ADart, Betas... betas) const
|
Dart_const_handle beta(Dart_const_handle ADart) const
|
||||||
{ return internal::Beta_functor_static<Dart_const_handle, Betas ...>::
|
{ return internal::Beta_functor_static<Dart_const_handle, Betas ...>::
|
||||||
run(ADart); }
|
run(ADart); }
|
||||||
#else
|
#else
|
||||||
|
|
@ -707,8 +708,8 @@ namespace CGAL {
|
||||||
marks[i] = -1;
|
marks[i] = -1;
|
||||||
|
|
||||||
Helper::template
|
Helper::template
|
||||||
Foreach_enabled_attributes<internal::Reserve_mark_functor<Self> >::
|
Foreach_enabled_attributes<Reserve_mark_functor<Self> >::
|
||||||
run(this,&marks);
|
run(this,&marks);
|
||||||
|
|
||||||
for ( typename Dart_range::const_iterator it(darts().begin()),
|
for ( typename Dart_range::const_iterator it(darts().begin()),
|
||||||
itend(darts().end()); it!=itend; ++it)
|
itend(darts().end()); it!=itend; ++it)
|
||||||
|
|
@ -831,7 +832,7 @@ namespace CGAL {
|
||||||
if ( attribs )
|
if ( attribs )
|
||||||
{
|
{
|
||||||
Helper::template Foreach_enabled_attributes
|
Helper::template Foreach_enabled_attributes
|
||||||
<internal::Display_attribute_functor<Self> >::run(this, it);
|
<Display_attribute_functor<Self> >::run(this, it);
|
||||||
}
|
}
|
||||||
os << std::endl;
|
os << std::endl;
|
||||||
++nb;
|
++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);
|
internal::Set_i_attribute_of_dart_functor<CMap, 0>::run(&amap, d1, ah);
|
||||||
amap.mark(*it, mark);
|
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);
|
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(m);
|
||||||
amap.free_mark(mark);
|
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();
|
int treated = amap.get_new_mark();
|
||||||
|
|
||||||
// Stack of marked darts
|
// Stack of marked darts
|
||||||
std::stack<typename CMap::Dart_handle> tounmark;
|
std::deque<typename CMap::Dart_handle> tounmark;
|
||||||
|
|
||||||
// Now we run through the facet
|
// 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(); )
|
it.cont(); )
|
||||||
{
|
{
|
||||||
cur = it;
|
cur = it;
|
||||||
++it;
|
++it;
|
||||||
amap.mark(cur, treated);
|
amap.mark(cur, treated);
|
||||||
tounmark.push(cur);
|
tounmark.push_back(cur);
|
||||||
|
|
||||||
if (!cur->template is_free<0>())
|
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));
|
(nn1, prev->beta(dim));
|
||||||
|
|
||||||
amap.mark(cur->beta(dim), treated);
|
amap.mark(cur->beta(dim), treated);
|
||||||
tounmark.push(cur->beta(dim));
|
tounmark.push_back(cur->beta(dim));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -189,8 +198,8 @@ insert_cell_0_in_cell_2( CMap& amap, typename CMap::Dart_handle adart,
|
||||||
|
|
||||||
if (n2 != NULL)
|
if (n2 != NULL)
|
||||||
{
|
{
|
||||||
amap.template basic_link_beta_for_involution<2>(first->template beta<0>(),
|
amap.template basic_link_beta_for_involution<2>
|
||||||
n2);
|
(first->template beta<0>(), n2);
|
||||||
for (unsigned int dim=3; dim<=CMap::dimension; ++dim)
|
for (unsigned int dim=3; dim<=CMap::dimension; ++dim)
|
||||||
{
|
{
|
||||||
if ( !adart->is_free(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
|
// Now we unmark all marked darts, and we degroup the new faces with the
|
||||||
// initial one (if 2-attributes are non void).
|
// 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>::
|
internal::Degroup_attribute_functor_run<CMap, 2>::
|
||||||
run(&amap, adart, tounmark.top());
|
run(&amap, adart, *itd);
|
||||||
|
|
||||||
tounmark.pop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CGAL_assertion(amap.is_whole_map_unmarked(treated));
|
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;
|
typename CMap::Dart_handle d2 = NULL;
|
||||||
unsigned int s1 = 0;
|
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)
|
for ( ; it1.cont(); ++it1)
|
||||||
{
|
{
|
||||||
|
|
@ -288,25 +297,27 @@ insert_dangling_cell_1_in_cell_2( CMap& amap,
|
||||||
if ( !it1->is_free(dim) &&
|
if ( !it1->is_free(dim) &&
|
||||||
amap.is_marked(it1->beta(dim), treated) )
|
amap.is_marked(it1->beta(dim), treated) )
|
||||||
{
|
{
|
||||||
amap.basic_link_beta_for_involution(it1->beta(dim)->beta_inv(s1), d1,
|
amap.basic_link_beta_for_involution
|
||||||
dim);
|
(it1->beta(dim)->beta_inv(s1), d1, dim);
|
||||||
amap.basic_link_beta_for_involution
|
amap.basic_link_beta_for_involution
|
||||||
(it1->beta(dim)->beta_inv(s1)->beta(2), d2, dim);
|
(it1->beta(dim)->beta_inv(s1)->beta(2), d2, dim);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
internal::Set_i_attribute_of_dart_functor<CMap, 0>::run(&amap, d1, ah);
|
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 )
|
for ( it1.rewind(); it1.cont(); ++it1 )
|
||||||
{ amap.unmark(it1,treated); }
|
{ amap.mark(it1, treated); }
|
||||||
CGAL_assertion( amap.is_whole_map_unmarked(treated) );
|
|
||||||
|
CGAL_assertion( amap.is_whole_map_marked(treated) );
|
||||||
amap.free_mark(treated);
|
amap.free_mark(treated);
|
||||||
|
|
||||||
typename std::deque<typename CMap::Dart_handle>::iterator it =
|
for ( typename std::deque<typename CMap::Dart_handle>::iterator
|
||||||
to_unmark.begin();
|
it=to_unmark.begin(); it!=to_unmark.end(); ++it)
|
||||||
for (; it != to_unmark.end(); ++it)
|
|
||||||
{ amap.unmark(*it, mark1); }
|
{ amap.unmark(*it, mark1); }
|
||||||
|
|
||||||
CGAL_assertion( amap.is_whole_map_unmarked(mark1) );
|
CGAL_assertion( amap.is_whole_map_unmarked(mark1) );
|
||||||
amap.free_mark(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));
|
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>
|
CMap_dart_iterator_basic_of_involution<CMap,1>
|
||||||
it1 = CMap_dart_iterator_basic_of_involution<CMap,1>(amap, adart1, m1);
|
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>
|
CMap_dart_iterator_basic_of_involution<CMap,1>
|
||||||
it2 = CMap_dart_iterator_basic_of_involution<CMap,1>(amap, adart2, m2);
|
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;
|
std::deque<typename CMap::Dart_handle> to_unmark;
|
||||||
{
|
{
|
||||||
for ( CMap_dart_iterator_basic_of_cell<CMap,0> it(amap,adart1,mark1);
|
for ( CMap_dart_iterator_basic_of_cell<CMap,0> it(amap,adart1,mark1);
|
||||||
it.cont(); ++it )
|
it.cont(); ++it )
|
||||||
{
|
{
|
||||||
to_unmark.push_back(it);
|
to_unmark.push_back(it);
|
||||||
amap.mark(it,mark1);
|
amap.mark(it, mark1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
typename CMap::Dart_handle d1 = NULL;
|
typename CMap::Dart_handle d1=NULL;
|
||||||
typename CMap::Dart_handle d2 = NULL;
|
typename CMap::Dart_handle d2=NULL;
|
||||||
unsigned int s1 = 0;
|
unsigned int s1=0;
|
||||||
|
|
||||||
int treated = amap.get_new_mark();
|
int treated=amap.get_new_mark();
|
||||||
|
|
||||||
for ( ; it1.cont(); ++it1, ++it2)
|
for ( ; it1.cont(); ++it1, ++it2)
|
||||||
{
|
{
|
||||||
|
|
@ -388,14 +400,14 @@ insert_cell_1_in_cell_2(CMap& amap,
|
||||||
|
|
||||||
if ( !it1->is_free(s1) )
|
if ( !it1->is_free(s1) )
|
||||||
{
|
{
|
||||||
if ( s1==0 ) amap.basic_link_beta_1(it1->template beta<0>(), d2);
|
if ( s1==0 ) amap.link_beta_1(it1->template beta<0>(), d2);
|
||||||
else amap.basic_link_beta_0(it1->template beta<1>(), d2);
|
else amap.link_beta_0(it1->template beta<1>(), d2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !it2->is_free(s1) )
|
if ( !it2->is_free(s1) )
|
||||||
{
|
{
|
||||||
if ( s1==0 ) amap.basic_link_beta_1(it2->template beta<0>(), d1);
|
if ( s1==0 ) amap.link_beta_1(it2->template beta<0>(), d1);
|
||||||
else amap.basic_link_beta_0(it2->template beta<1>(), d1);
|
else amap.link_beta_0(it2->template beta<1>(), d1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( s1==0 )
|
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
|
#ifndef CGAL_COMBINATORIAL_MAP_SEWABLE_H
|
||||||
#define 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
|
/* Definition of functor used to test if two darts are i-sewable
|
||||||
* (we use functors as there are different specializations).
|
* (we use functors as there are different specializations).
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -33,25 +33,25 @@
|
||||||
* The class Combinatorial_map_helper<CMap> defines:
|
* The class Combinatorial_map_helper<CMap> defines:
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
namespace CGAL
|
namespace CGAL
|
||||||
{
|
{
|
||||||
namespace internal
|
namespace internal
|
||||||
{
|
{
|
||||||
// There is a problem on windows to handle tuple containing void.
|
// There is a problem on windows to handle tuple containing void.
|
||||||
// To solve this, we transform such a tuple in tuple containing Disabled.
|
// To solve this, we transform such a tuple in tuple containing Disabled.
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct Convert_void
|
struct Convert_void
|
||||||
{ typedef T type; };
|
{ typedef T type; };
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct Convert_void<void>
|
struct Convert_void<void>
|
||||||
{ typedef CGAL::Void type; };
|
{ typedef CGAL::Void type; };
|
||||||
|
|
||||||
#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
|
#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
|
||||||
// Convert a tuple in a same tuple where each void type was replaced into
|
// Convert a tuple in a same tuple where each void type was replaced into
|
||||||
// CGAL::Void.
|
// CGAL::Void.
|
||||||
template<typename ... Items>
|
template<typename ... Items>
|
||||||
struct Convert_tuple_with_void;
|
struct Convert_tuple_with_void;
|
||||||
template<typename ... Items>
|
template<typename ... Items>
|
||||||
struct Convert_tuple_with_void<CGAL::cpp11::tuple<Items...> >
|
struct Convert_tuple_with_void<CGAL::cpp11::tuple<Items...> >
|
||||||
{
|
{
|
||||||
|
|
@ -60,12 +60,12 @@ namespace CGAL
|
||||||
|
|
||||||
// Length of a variadic template
|
// Length of a variadic template
|
||||||
template<typename ... T>
|
template<typename ... T>
|
||||||
struct My_length;
|
struct My_length;
|
||||||
template<typename T1, typename ... T>
|
template<typename T1, typename ... T>
|
||||||
struct My_length<CGAL::cpp11::tuple<T1, T...> >
|
struct My_length<CGAL::cpp11::tuple<T1, T...> >
|
||||||
{
|
{
|
||||||
static const int value = My_length<CGAL::cpp11::tuple<T...> >::value + 1;
|
static const int value = My_length<CGAL::cpp11::tuple<T...> >::value + 1;
|
||||||
};
|
};
|
||||||
template<>
|
template<>
|
||||||
struct My_length<CGAL::cpp11::tuple<> >
|
struct My_length<CGAL::cpp11::tuple<> >
|
||||||
{
|
{
|
||||||
|
|
@ -74,7 +74,7 @@ namespace CGAL
|
||||||
|
|
||||||
//count the number of time a given type is present in a tuple
|
//count the number of time a given type is present in a tuple
|
||||||
template<class Type,class Tuple>
|
template<class Type,class Tuple>
|
||||||
struct Number_of_type_in_tuple;
|
struct Number_of_type_in_tuple;
|
||||||
template<class Type,typename ... Items>
|
template<class Type,typename ... Items>
|
||||||
struct Number_of_type_in_tuple<Type,CGAL::cpp11::tuple<Type,Items...> >{
|
struct Number_of_type_in_tuple<Type,CGAL::cpp11::tuple<Type,Items...> >{
|
||||||
static const int value=Number_of_type_in_tuple
|
static const int value=Number_of_type_in_tuple
|
||||||
|
|
@ -92,7 +92,7 @@ namespace CGAL
|
||||||
|
|
||||||
//count the number of different types from Type is present in a tuple
|
//count the number of different types from Type is present in a tuple
|
||||||
template<class Type, class Tuple>
|
template<class Type, class Tuple>
|
||||||
struct Number_of_different_type_in_tuple;
|
struct Number_of_different_type_in_tuple;
|
||||||
template<class Type, typename Other, typename ... Items>
|
template<class Type, typename Other, typename ... Items>
|
||||||
struct Number_of_different_type_in_tuple<Type,CGAL::cpp11::tuple
|
struct Number_of_different_type_in_tuple<Type,CGAL::cpp11::tuple
|
||||||
<Other, Items...> >
|
<Other, Items...> >
|
||||||
|
|
@ -119,13 +119,13 @@ namespace CGAL
|
||||||
template <class Type,int k,class T,
|
template <class Type,int k,class T,
|
||||||
int dim=CGAL::internal::My_length<T>::value-1>
|
int dim=CGAL::internal::My_length<T>::value-1>
|
||||||
struct Nb_type_in_tuple_up_to_k;
|
struct Nb_type_in_tuple_up_to_k;
|
||||||
|
|
||||||
template <class Type,int dim,int k,class T1,class ... T>
|
template <class Type,int dim,int k,class T1,class ... T>
|
||||||
struct Nb_type_in_tuple_up_to_k<Type,k,CGAL::cpp11::tuple<T1,T...>,dim>
|
struct Nb_type_in_tuple_up_to_k<Type,k,CGAL::cpp11::tuple<T1,T...>,dim>
|
||||||
{
|
{
|
||||||
static const int pos= Nb_type_in_tuple_up_to_k
|
static const int pos= Nb_type_in_tuple_up_to_k
|
||||||
<Type,k,CGAL::cpp11::tuple<T...>,dim>::pos - 1;
|
<Type,k,CGAL::cpp11::tuple<T...>,dim>::pos - 1;
|
||||||
|
|
||||||
static const int value =
|
static const int value =
|
||||||
( pos==k ) ? ( boost::is_same<T1,Type>::value ? 0:-dim-1 )
|
( pos==k ) ? ( boost::is_same<T1,Type>::value ? 0:-dim-1 )
|
||||||
: ( ( pos<k ) ? ( ( boost::is_same<T1,Type>::value ? 1:0 )
|
: ( ( pos<k ) ? ( ( boost::is_same<T1,Type>::value ? 1:0 )
|
||||||
|
|
@ -135,7 +135,7 @@ namespace CGAL
|
||||||
:0
|
:0
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class Type,int dim,int k,class T1>
|
template <class Type,int dim,int k,class T1>
|
||||||
struct Nb_type_in_tuple_up_to_k<Type,k,CGAL::cpp11::tuple<T1>,dim >
|
struct Nb_type_in_tuple_up_to_k<Type,k,CGAL::cpp11::tuple<T1>,dim >
|
||||||
{
|
{
|
||||||
|
|
@ -151,14 +151,14 @@ namespace CGAL
|
||||||
template <class Type, int k,class T,
|
template <class Type, int k,class T,
|
||||||
int dim=CGAL::internal::My_length<T>::value-1>
|
int dim=CGAL::internal::My_length<T>::value-1>
|
||||||
struct Nb_type_different_in_tuple_up_to_k;
|
struct Nb_type_different_in_tuple_up_to_k;
|
||||||
|
|
||||||
template <class Type,int dim,int k,class T1,class ... T>
|
template <class Type,int dim,int k,class T1,class ... T>
|
||||||
struct Nb_type_different_in_tuple_up_to_k<Type,k,
|
struct Nb_type_different_in_tuple_up_to_k<Type,k,
|
||||||
CGAL::cpp11::tuple<T1,T...>,dim>
|
CGAL::cpp11::tuple<T1,T...>,dim>
|
||||||
{
|
{
|
||||||
static const int pos = Nb_type_different_in_tuple_up_to_k
|
static const int pos = Nb_type_different_in_tuple_up_to_k
|
||||||
<Type,k,CGAL::cpp11::tuple<T...>,dim >::pos - 1;
|
<Type,k,CGAL::cpp11::tuple<T...>,dim >::pos - 1;
|
||||||
|
|
||||||
static const int value =
|
static const int value =
|
||||||
( pos==k ) ? ( boost::is_same<T1,Type>::value ? -dim-1 : 0 )
|
( pos==k ) ? ( boost::is_same<T1,Type>::value ? -dim-1 : 0 )
|
||||||
: ( ( pos<k ) ? ( ( boost::is_same<T1,Type>::value ? 0:1 )
|
: ( ( pos<k ) ? ( ( boost::is_same<T1,Type>::value ? 0:1 )
|
||||||
|
|
@ -190,7 +190,7 @@ namespace CGAL
|
||||||
// to build the tuple Attribute_type.
|
// to build the tuple Attribute_type.
|
||||||
template <class Type,class Res, class Tuple=CGAL::cpp11::tuple<> >
|
template <class Type,class Res, class Tuple=CGAL::cpp11::tuple<> >
|
||||||
struct Keep_type_different_of;
|
struct Keep_type_different_of;
|
||||||
|
|
||||||
template < class Type,class ... Res >
|
template < class Type,class ... Res >
|
||||||
struct Keep_type_different_of<Type,CGAL::cpp11::tuple<>,
|
struct Keep_type_different_of<Type,CGAL::cpp11::tuple<>,
|
||||||
CGAL::cpp11::tuple<Res...> >
|
CGAL::cpp11::tuple<Res...> >
|
||||||
|
|
@ -208,7 +208,7 @@ namespace CGAL
|
||||||
};
|
};
|
||||||
|
|
||||||
template < class Type, class Other, class ... T, class ... Res >
|
template < class Type, class Other, class ... T, class ... Res >
|
||||||
struct Keep_type_different_of<Type,CGAL::cpp11::tuple<Other,T...>,
|
struct Keep_type_different_of<Type,CGAL::cpp11::tuple<Other,T...>,
|
||||||
CGAL::cpp11::tuple<Res...> >
|
CGAL::cpp11::tuple<Res...> >
|
||||||
{
|
{
|
||||||
typedef typename Keep_type_different_of
|
typedef typename Keep_type_different_of
|
||||||
|
|
@ -224,7 +224,7 @@ namespace CGAL
|
||||||
// template <int n>
|
// template <int n>
|
||||||
// static void run(){std::cout << n << std::endl;}
|
// static void run(){std::cout << n << std::endl;}
|
||||||
// };
|
// };
|
||||||
//
|
//
|
||||||
// Foreach_static<Functor,5>::run();
|
// Foreach_static<Functor,5>::run();
|
||||||
//
|
//
|
||||||
template <class Functor,int n>
|
template <class Functor,int n>
|
||||||
|
|
@ -235,7 +235,7 @@ namespace CGAL
|
||||||
Foreach_static<Functor,n-1>::run(t...);
|
Foreach_static<Functor,n-1>::run(t...);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class Functor>
|
template <class Functor>
|
||||||
struct Foreach_static<Functor,0>{
|
struct Foreach_static<Functor,0>{
|
||||||
template <class ... T>
|
template <class ... T>
|
||||||
|
|
@ -254,7 +254,7 @@ namespace CGAL
|
||||||
Functor:: template run<n>(t...);
|
Functor:: template run<n>(t...);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class Functor,int n>
|
template <class Functor,int n>
|
||||||
struct Conditionnal_run<Functor,n,Void>
|
struct Conditionnal_run<Functor,n,Void>
|
||||||
{
|
{
|
||||||
|
|
@ -299,7 +299,7 @@ namespace CGAL
|
||||||
//Functor are called from n =0 to k
|
//Functor are called from n =0 to k
|
||||||
template <class Functor,class T,int n=0>
|
template <class Functor,class T,int n=0>
|
||||||
struct Foreach_static_restricted;
|
struct Foreach_static_restricted;
|
||||||
|
|
||||||
template <class Functor,class Head, class ... Items,int n>
|
template <class Functor,class Head, class ... Items,int n>
|
||||||
struct Foreach_static_restricted<Functor,
|
struct Foreach_static_restricted<Functor,
|
||||||
CGAL::cpp11::tuple<Head,Items...>,n>
|
CGAL::cpp11::tuple<Head,Items...>,n>
|
||||||
|
|
@ -311,7 +311,7 @@ namespace CGAL
|
||||||
<Functor,CGAL::cpp11::tuple<Items...>,n+1>::run(t...);
|
<Functor,CGAL::cpp11::tuple<Items...>,n+1>::run(t...);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class Functor,int n>
|
template <class Functor,int n>
|
||||||
struct Foreach_static_restricted<Functor,CGAL::cpp11::tuple<>,n>{
|
struct Foreach_static_restricted<Functor,CGAL::cpp11::tuple<>,n>{
|
||||||
template <class ... T>
|
template <class ... T>
|
||||||
|
|
@ -357,28 +357,28 @@ namespace CGAL
|
||||||
Apply_functor_to_each_tuple_element<Functor,Tuple,pos-1>::run(t);
|
Apply_functor_to_each_tuple_element<Functor,Tuple,pos-1>::run(t);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class Functor,class Tuple>
|
template<class Functor,class Tuple>
|
||||||
struct Apply_functor_to_each_tuple_element<Functor,Tuple,-1>
|
struct Apply_functor_to_each_tuple_element<Functor,Tuple,-1>
|
||||||
{
|
{
|
||||||
static void run(Tuple&){}
|
static void run(Tuple&){}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Clear_functor
|
struct Clear_functor
|
||||||
{
|
{
|
||||||
template<class T>
|
template<class T>
|
||||||
void operator()(T&t)
|
void operator()(T&t)
|
||||||
{ t.clear(); }
|
{ t.clear(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Clear_all
|
struct Clear_all
|
||||||
{
|
{
|
||||||
template<class Tuple>
|
template<class Tuple>
|
||||||
static void run(Tuple& t)
|
static void run(Tuple& t)
|
||||||
{
|
{
|
||||||
Apply_functor_to_each_tuple_element<Clear_functor,Tuple>::run(t);
|
Apply_functor_to_each_tuple_element<Clear_functor,Tuple>::run(t);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Helper class, templated by a given combinatorial map.
|
// Helper class, templated by a given combinatorial map.
|
||||||
template <class CMap>
|
template <class CMap>
|
||||||
|
|
@ -390,7 +390,7 @@ namespace CGAL
|
||||||
typedef typename CMap::Alloc::template rebind<T>::other Attr_allocator;
|
typedef typename CMap::Alloc::template rebind<T>::other Attr_allocator;
|
||||||
typedef CGAL::Compact_container<T,Attr_allocator> type;
|
typedef CGAL::Compact_container<T,Attr_allocator> type;
|
||||||
};
|
};
|
||||||
|
|
||||||
// defines as type Compact_container<T>::iterator
|
// defines as type Compact_container<T>::iterator
|
||||||
template <class T>
|
template <class T>
|
||||||
struct Add_compact_container_iterator{
|
struct Add_compact_container_iterator{
|
||||||
|
|
@ -398,7 +398,7 @@ namespace CGAL
|
||||||
typedef typename CGAL::Compact_container<T,Attr_allocator>::iterator
|
typedef typename CGAL::Compact_container<T,Attr_allocator>::iterator
|
||||||
type;
|
type;
|
||||||
};
|
};
|
||||||
|
|
||||||
// defines as type Compact_container<T>::const_iterator
|
// defines as type Compact_container<T>::const_iterator
|
||||||
template <class T>
|
template <class T>
|
||||||
struct Add_compact_container_const_iterator{
|
struct Add_compact_container_const_iterator{
|
||||||
|
|
@ -419,13 +419,13 @@ namespace CGAL
|
||||||
|
|
||||||
// Number of all attributes
|
// Number of all attributes
|
||||||
/* Does not compile on windows !!
|
/* Does not compile on windows !!
|
||||||
static const unsigned int number_of_attributes =
|
static const unsigned int number_of_attributes =
|
||||||
CGAL::internal::My_length<Attributes>::value; */
|
CGAL::internal::My_length<Attributes>::value; */
|
||||||
|
|
||||||
// Number of enabled attributes
|
// Number of enabled attributes
|
||||||
static const unsigned int nb_attribs =
|
static const unsigned int nb_attribs =
|
||||||
Number_of_different_type_in_tuple<Void,Enabled_attributes>::value;
|
Number_of_different_type_in_tuple<Void,Enabled_attributes>::value;
|
||||||
|
|
||||||
// Given a dimension of the cell, return the index of
|
// Given a dimension of the cell, return the index of
|
||||||
// corresponding attribute
|
// corresponding attribute
|
||||||
template <int d>
|
template <int d>
|
||||||
|
|
@ -440,12 +440,12 @@ namespace CGAL
|
||||||
|
|
||||||
typedef typename Tuple_converter< Add_compact_container_iterator,
|
typedef typename Tuple_converter< Add_compact_container_iterator,
|
||||||
Enabled_attributes >::type
|
Enabled_attributes >::type
|
||||||
Attribute_iterators;
|
Attribute_iterators;
|
||||||
typedef typename Tuple_converter< Add_compact_container_const_iterator,
|
typedef typename Tuple_converter< Add_compact_container_const_iterator,
|
||||||
Enabled_attributes >::type
|
Enabled_attributes >::type
|
||||||
Attribute_const_iterators;
|
Attribute_const_iterators;
|
||||||
|
|
||||||
typedef Attribute_containers Attribute_ranges;
|
typedef Attribute_containers Attribute_ranges;
|
||||||
typedef Attribute_iterators Attribute_handles;
|
typedef Attribute_iterators Attribute_handles;
|
||||||
typedef Attribute_const_iterators Attribute_const_handles;
|
typedef Attribute_const_iterators Attribute_const_handles;
|
||||||
|
|
||||||
|
|
@ -467,7 +467,7 @@ namespace CGAL
|
||||||
typedef typename CGAL::cpp11::tuple_element
|
typedef typename CGAL::cpp11::tuple_element
|
||||||
<Dimension_index<d>::value,Attribute_handles>::type type;
|
<Dimension_index<d>::value,Attribute_handles>::type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<int d>
|
template<int d>
|
||||||
struct Attribute_handle<d, CGAL::Void>
|
struct Attribute_handle<d, CGAL::Void>
|
||||||
{ typedef CGAL::Void* type; };
|
{ typedef CGAL::Void* type; };
|
||||||
|
|
@ -479,7 +479,7 @@ namespace CGAL
|
||||||
typedef typename CGAL::cpp11::tuple_element
|
typedef typename CGAL::cpp11::tuple_element
|
||||||
<Dimension_index<d>::value, Attribute_const_handles>::type type;
|
<Dimension_index<d>::value, Attribute_const_handles>::type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<int d>
|
template<int d>
|
||||||
struct Attribute_const_handle<d, CGAL::Void>
|
struct Attribute_const_handle<d, CGAL::Void>
|
||||||
{ typedef CGAL::Void* type; };
|
{ typedef CGAL::Void* type; };
|
||||||
|
|
@ -491,7 +491,7 @@ namespace CGAL
|
||||||
typedef typename CGAL::cpp11::tuple_element
|
typedef typename CGAL::cpp11::tuple_element
|
||||||
<Dimension_index<d>::value, Attribute_iterators>::type type;
|
<Dimension_index<d>::value, Attribute_iterators>::type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<int d>
|
template<int d>
|
||||||
struct Attribute_iterator<d, CGAL::Void>
|
struct Attribute_iterator<d, CGAL::Void>
|
||||||
{ typedef CGAL::Void* type; };
|
{ typedef CGAL::Void* type; };
|
||||||
|
|
@ -503,7 +503,7 @@ namespace CGAL
|
||||||
typedef typename CGAL::cpp11::tuple_element
|
typedef typename CGAL::cpp11::tuple_element
|
||||||
<Dimension_index<d>::value, Attribute_const_iterators>::type type;
|
<Dimension_index<d>::value, Attribute_const_iterators>::type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<int d>
|
template<int d>
|
||||||
struct Attribute_const_iterator<d, CGAL::Void>
|
struct Attribute_const_iterator<d, CGAL::Void>
|
||||||
{ typedef CGAL::Void* type; };
|
{ typedef CGAL::Void* type; };
|
||||||
|
|
@ -515,7 +515,7 @@ namespace CGAL
|
||||||
typedef typename CGAL::cpp11::tuple_element
|
typedef typename CGAL::cpp11::tuple_element
|
||||||
<Dimension_index<d>::value, Attribute_ranges>::type type;
|
<Dimension_index<d>::value, Attribute_ranges>::type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<int d>
|
template<int d>
|
||||||
struct Attribute_range<d, CGAL::Void>
|
struct Attribute_range<d, CGAL::Void>
|
||||||
{ typedef CGAL::Void type; };
|
{ typedef CGAL::Void type; };
|
||||||
|
|
@ -527,7 +527,7 @@ namespace CGAL
|
||||||
typedef const typename CGAL::cpp11::tuple_element
|
typedef const typename CGAL::cpp11::tuple_element
|
||||||
<Dimension_index<d>::value, Attribute_ranges >::type type;
|
<Dimension_index<d>::value, Attribute_ranges >::type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<int d>
|
template<int d>
|
||||||
struct Attribute_const_range<d, CGAL::Void>
|
struct Attribute_const_range<d, CGAL::Void>
|
||||||
{ typedef CGAL::Void type; };
|
{ typedef CGAL::Void type; };
|
||||||
|
|
@ -539,7 +539,7 @@ namespace CGAL
|
||||||
{
|
{
|
||||||
template <class ...Ts>
|
template <class ...Ts>
|
||||||
static void run(const Ts& ... t)
|
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
|
// To iterate onto each enabled attributes, except j-attributes
|
||||||
template <class Functor, unsigned int j>
|
template <class Functor, unsigned int j>
|
||||||
|
|
@ -547,7 +547,7 @@ namespace CGAL
|
||||||
{
|
{
|
||||||
template <class ...Ts>
|
template <class ...Ts>
|
||||||
static void run(const Ts& ... t)
|
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
|
#else
|
||||||
// This one cannot be moved in Combinatorial_map_utility_novariadic.h
|
// This one cannot be moved in Combinatorial_map_utility_novariadic.h
|
||||||
|
|
@ -557,7 +557,7 @@ namespace CGAL
|
||||||
{
|
{
|
||||||
static void run()
|
static void run()
|
||||||
{Foreach_static_restricted<Functor,Attributes >::run();}
|
{Foreach_static_restricted<Functor,Attributes >::run();}
|
||||||
|
|
||||||
template <class T1>
|
template <class T1>
|
||||||
static void run(const T1& t1)
|
static void run(const T1& t1)
|
||||||
{Foreach_static_restricted<Functor,Attributes >::run(t1);}
|
{Foreach_static_restricted<Functor,Attributes >::run(t1);}
|
||||||
|
|
|
||||||
|
|
@ -168,7 +168,8 @@ void MainWindow::clear_all()
|
||||||
void MainWindow::on_new_volume(Dart_handle adart)
|
void MainWindow::on_new_volume(Dart_handle adart)
|
||||||
{
|
{
|
||||||
assert( adart->attribute<3>()==NULL);
|
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>());
|
update_volume_list_add(adart->attribute<3>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,10 +56,10 @@ namespace CGAL {
|
||||||
typedef Traits_ Traits;
|
typedef Traits_ Traits;
|
||||||
typedef Items_ Items;
|
typedef Items_ Items;
|
||||||
typedef Alloc_ Alloc;
|
typedef Alloc_ Alloc;
|
||||||
|
|
||||||
static const unsigned int ambient_dimension = ambient_dim;
|
static const unsigned int ambient_dimension = ambient_dim;
|
||||||
static const unsigned int dimension = Base::dimension;
|
static const unsigned int dimension = Base::dimension;
|
||||||
|
|
||||||
typedef typename Base::Dart_handle Dart_handle;
|
typedef typename Base::Dart_handle Dart_handle;
|
||||||
typedef typename Base::Dart_const_handle Dart_const_handle;
|
typedef typename Base::Dart_const_handle Dart_const_handle;
|
||||||
typedef typename Base::Helper Helper;
|
typedef typename Base::Helper Helper;
|
||||||
|
|
@ -70,16 +70,16 @@ namespace CGAL {
|
||||||
|
|
||||||
typedef typename Base::Dart_range Dart_range;
|
typedef typename Base::Dart_range Dart_range;
|
||||||
|
|
||||||
typedef typename Helper::template Attribute_type<0>::type
|
typedef typename Helper::template Attribute_type<0>::type
|
||||||
Vertex_attribute;
|
Vertex_attribute;
|
||||||
typedef typename Helper::template Attribute_handle<0>::type
|
typedef typename Helper::template Attribute_handle<0>::type
|
||||||
Vertex_attribute_handle;
|
Vertex_attribute_handle;
|
||||||
typedef typename Helper::template Attribute_const_handle<0>::type
|
typedef typename Helper::template Attribute_const_handle<0>::type
|
||||||
Vertex_attribute_const_handle;
|
Vertex_attribute_const_handle;
|
||||||
|
|
||||||
typedef typename Helper::template Attribute_range<0>::type
|
typedef typename Helper::template Attribute_range<0>::type
|
||||||
Vertex_attribute_range;
|
Vertex_attribute_range;
|
||||||
typedef typename Helper::template Attribute_const_range<0>::type
|
typedef typename Helper::template Attribute_const_range<0>::type
|
||||||
Vertex_attribute_const_range;
|
Vertex_attribute_const_range;
|
||||||
|
|
||||||
/// To use previous definition of create_dart methods.
|
/// To use previous definition of create_dart methods.
|
||||||
|
|
@ -150,7 +150,7 @@ namespace CGAL {
|
||||||
const T5 &t5, const T6 &t6, const T7 &t7, const T8 &t8, const T9 &t9)
|
const T5 &t5, const T6 &t6, const T7 &t7, const T8 &t8, const T9 &t9)
|
||||||
{ return Base::template create_attribute<0>(t1, t2, t3, t4, t5, t6, t7,
|
{ return Base::template create_attribute<0>(t1, t2, t3, t4, t5, t6, t7,
|
||||||
t8, t9); }
|
t8, t9); }
|
||||||
#endif // CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
|
#endif // CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new dart associated with an handle through an attribute.
|
* Create a new dart associated with an handle through an attribute.
|
||||||
|
|
@ -176,12 +176,12 @@ namespace CGAL {
|
||||||
*/
|
*/
|
||||||
void erase_vertex_attribute(Vertex_attribute_handle ahandle)
|
void erase_vertex_attribute(Vertex_attribute_handle ahandle)
|
||||||
{ Base::template erase_attribute<0>(ahandle); }
|
{ Base::template erase_attribute<0>(ahandle); }
|
||||||
|
|
||||||
/** Set the vertex attribute of the given dart.
|
/** Set the vertex attribute of the given dart.
|
||||||
* @param adart a dart.
|
* @param adart a dart.
|
||||||
* @param ah the attribute to set.
|
* @param ah the attribute to set.
|
||||||
*/
|
*/
|
||||||
void set_vertex_attribute_of_dart(Dart_handle adart,
|
void set_vertex_attribute_of_dart(Dart_handle adart,
|
||||||
Vertex_attribute_handle ah)
|
Vertex_attribute_handle ah)
|
||||||
{
|
{
|
||||||
return internal::Set_i_attribute_of_dart_functor<Self, 0>::
|
return internal::Set_i_attribute_of_dart_functor<Self, 0>::
|
||||||
|
|
@ -192,9 +192,9 @@ namespace CGAL {
|
||||||
* @param adart a dart of the vertex.
|
* @param adart a dart of the vertex.
|
||||||
* @param ah the attribute to set.
|
* @param ah the attribute to set.
|
||||||
*/
|
*/
|
||||||
void set_vertex_attribute(Dart_handle adart,
|
void set_vertex_attribute(Dart_handle adart,
|
||||||
Vertex_attribute_handle ah)
|
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.
|
/// @return the Vertex_attribute_range for all vertex_attributes.
|
||||||
Vertex_attribute_range& vertex_attributes()
|
Vertex_attribute_range& vertex_attributes()
|
||||||
|
|
@ -212,7 +212,7 @@ namespace CGAL {
|
||||||
/// @param a dart
|
/// @param a dart
|
||||||
/// @return the vertex_attribute.
|
/// @return the vertex_attribute.
|
||||||
static Vertex_attribute_handle vertex_attribute(Dart_handle adart)
|
static Vertex_attribute_handle vertex_attribute(Dart_handle adart)
|
||||||
{
|
{
|
||||||
CGAL_assertion(adart!=NULL);
|
CGAL_assertion(adart!=NULL);
|
||||||
return adart->template attribute<0>();
|
return adart->template attribute<0>();
|
||||||
}
|
}
|
||||||
|
|
@ -222,7 +222,7 @@ namespace CGAL {
|
||||||
/// @return the vertex_const_attribute.
|
/// @return the vertex_const_attribute.
|
||||||
static Vertex_attribute_const_handle vertex_attribute(Dart_const_handle
|
static Vertex_attribute_const_handle vertex_attribute(Dart_const_handle
|
||||||
adart)
|
adart)
|
||||||
{
|
{
|
||||||
CGAL_assertion(adart!=NULL);
|
CGAL_assertion(adart!=NULL);
|
||||||
return adart->template attribute<0>();
|
return adart->template attribute<0>();
|
||||||
}
|
}
|
||||||
|
|
@ -231,7 +231,7 @@ namespace CGAL {
|
||||||
/// @param a dart
|
/// @param a dart
|
||||||
/// @return the point.
|
/// @return the point.
|
||||||
static Point& point(Dart_handle adart)
|
static Point& point(Dart_handle adart)
|
||||||
{
|
{
|
||||||
CGAL_assertion(adart!=NULL && adart->template attribute<0>()!=NULL );
|
CGAL_assertion(adart!=NULL && adart->template attribute<0>()!=NULL );
|
||||||
return adart->template attribute<0>()->point();
|
return adart->template attribute<0>()->point();
|
||||||
}
|
}
|
||||||
|
|
@ -240,7 +240,7 @@ namespace CGAL {
|
||||||
/// @param a dart
|
/// @param a dart
|
||||||
/// @return the point.
|
/// @return the point.
|
||||||
static const Point& point(Dart_const_handle adart)
|
static const Point& point(Dart_const_handle adart)
|
||||||
{
|
{
|
||||||
CGAL_assertion(adart!=NULL && adart->template attribute<0>()!=NULL );
|
CGAL_assertion(adart!=NULL && adart->template attribute<0>()!=NULL );
|
||||||
return adart->template attribute<0>()->point();
|
return adart->template attribute<0>()->point();
|
||||||
}
|
}
|
||||||
|
|
@ -253,7 +253,7 @@ namespace CGAL {
|
||||||
bool is_valid() const
|
bool is_valid() const
|
||||||
{
|
{
|
||||||
bool valid = Base::is_valid();
|
bool valid = Base::is_valid();
|
||||||
for (typename Dart_range::const_iterator it(this->darts().begin()),
|
for (typename Dart_range::const_iterator it(this->darts().begin()),
|
||||||
itend(this->darts().end()); valid && it != itend; ++it)
|
itend(this->darts().end()); valid && it != itend; ++it)
|
||||||
{
|
{
|
||||||
if ( vertex_attribute(it) == NULL )
|
if ( vertex_attribute(it) == NULL )
|
||||||
|
|
@ -269,17 +269,17 @@ namespace CGAL {
|
||||||
/** test if the two given facets have the same geometry
|
/** test if the two given facets have the same geometry
|
||||||
* @return true iff the two facets have the same geometry.
|
* @return true iff the two facets have the same geometry.
|
||||||
*/
|
*/
|
||||||
bool are_facets_same_geometry(Dart_const_handle d1,
|
bool are_facets_same_geometry(Dart_const_handle d1,
|
||||||
Dart_const_handle d2) const
|
Dart_const_handle d2) const
|
||||||
{
|
{
|
||||||
typename Base::template Dart_of_orbit_range<1>::const_iterator
|
typename Base::template Dart_of_orbit_range<1>::const_iterator
|
||||||
it1(*this,d1);
|
it1(*this,d1);
|
||||||
typename Base::template Dart_of_orbit_range<0>::const_iterator
|
typename Base::template Dart_of_orbit_range<0>::const_iterator
|
||||||
it2(*this,d2);
|
it2(*this,d2);
|
||||||
bool samegeometry = true;
|
bool samegeometry = true;
|
||||||
for ( ; samegeometry && it1.cont() && it2.cont(); ++it1, ++it2)
|
for ( ; samegeometry && it1.cont() && it2.cont(); ++it1, ++it2)
|
||||||
{
|
{
|
||||||
if ( it2->other_extremity()!=NULL &&
|
if ( it2->other_extremity()!=NULL &&
|
||||||
point(it1)!=point(it2->other_extremity()) )
|
point(it1)!=point(it2->other_extremity()) )
|
||||||
samegeometry = false;
|
samegeometry = false;
|
||||||
}
|
}
|
||||||
|
|
@ -299,7 +299,7 @@ namespace CGAL {
|
||||||
|
|
||||||
// First we fill the std::map by one dart per facet, and by using
|
// First we fill the std::map by one dart per facet, and by using
|
||||||
// the minimal point as index.
|
// the minimal point as index.
|
||||||
for (typename Dart_range::iterator it(this->darts().begin()),
|
for (typename Dart_range::iterator it(this->darts().begin()),
|
||||||
itend(this->darts().end()); it!=itend; ++it )
|
itend(this->darts().end()); it!=itend; ++it )
|
||||||
{
|
{
|
||||||
if ( !this->is_marked(it, mymark) && this->is_marked(it, AMark) )
|
if ( !this->is_marked(it, mymark) && this->is_marked(it, AMark) )
|
||||||
|
|
@ -309,7 +309,7 @@ namespace CGAL {
|
||||||
this->mark(it, mymark);
|
this->mark(it, mymark);
|
||||||
typename Base::template
|
typename Base::template
|
||||||
Dart_of_orbit_range<1>::iterator it2(*this,it);
|
Dart_of_orbit_range<1>::iterator it2(*this,it);
|
||||||
++it2;
|
++it2;
|
||||||
for ( ; it2.cont(); ++it2 )
|
for ( ; it2.cont(); ++it2 )
|
||||||
{
|
{
|
||||||
Point cur_point=point(it2);
|
Point cur_point=point(it2);
|
||||||
|
|
@ -331,7 +331,7 @@ namespace CGAL {
|
||||||
typename std::map<Point, std::vector<Dart_handle> >::iterator
|
typename std::map<Point, std::vector<Dart_handle> >::iterator
|
||||||
itmap=one_dart_per_facet.begin(),
|
itmap=one_dart_per_facet.begin(),
|
||||||
itmapend=one_dart_per_facet.end();
|
itmapend=one_dart_per_facet.end();
|
||||||
|
|
||||||
for ( ; itmap!=itmapend; ++itmap )
|
for ( ; itmap!=itmapend; ++itmap )
|
||||||
{
|
{
|
||||||
for ( typename std::vector<Dart_handle>::iterator
|
for ( typename std::vector<Dart_handle>::iterator
|
||||||
|
|
@ -342,7 +342,7 @@ namespace CGAL {
|
||||||
for ( ++it2; it2!= it1end; ++it2 )
|
for ( ++it2; it2!= it1end; ++it2 )
|
||||||
{
|
{
|
||||||
if ( *it1!=*it2 && (*it1)->is_free(3) &&
|
if ( *it1!=*it2 && (*it1)->is_free(3) &&
|
||||||
(*it2)->is_free(3) &&
|
(*it2)->is_free(3) &&
|
||||||
are_facets_same_geometry(*it1,(*it2)->beta(0)) )
|
are_facets_same_geometry(*it1,(*it2)->beta(0)) )
|
||||||
{
|
{
|
||||||
++res;
|
++res;
|
||||||
|
|
@ -379,7 +379,7 @@ namespace CGAL {
|
||||||
Dart_handle d1 = make_edge(*this);
|
Dart_handle d1 = make_edge(*this);
|
||||||
set_vertex_attribute_of_dart(d1,h0);
|
set_vertex_attribute_of_dart(d1,h0);
|
||||||
set_vertex_attribute_of_dart(d1->beta(2),h1);
|
set_vertex_attribute_of_dart(d1->beta(2),h1);
|
||||||
|
|
||||||
return d1;
|
return d1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -405,11 +405,11 @@ namespace CGAL {
|
||||||
Vertex_attribute_handle h2)
|
Vertex_attribute_handle h2)
|
||||||
{
|
{
|
||||||
Dart_handle d1 = make_combinatorial_polygon(*this,3);
|
Dart_handle d1 = make_combinatorial_polygon(*this,3);
|
||||||
|
|
||||||
set_vertex_attribute_of_dart(d1,h0);
|
set_vertex_attribute_of_dart(d1,h0);
|
||||||
set_vertex_attribute_of_dart(d1->beta(1),h1);
|
set_vertex_attribute_of_dart(d1->beta(1),h1);
|
||||||
set_vertex_attribute_of_dart(d1->beta(0),h2);
|
set_vertex_attribute_of_dart(d1->beta(0),h2);
|
||||||
|
|
||||||
return d1;
|
return d1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -446,7 +446,7 @@ namespace CGAL {
|
||||||
set_vertex_attribute_of_dart(d1->beta(1),h1);
|
set_vertex_attribute_of_dart(d1->beta(1),h1);
|
||||||
set_vertex_attribute_of_dart(d1->beta(1)->beta(1),h2);
|
set_vertex_attribute_of_dart(d1->beta(1)->beta(1),h2);
|
||||||
set_vertex_attribute_of_dart(d1->beta(0),h3);
|
set_vertex_attribute_of_dart(d1->beta(0),h3);
|
||||||
|
|
||||||
return d1;
|
return d1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -486,7 +486,7 @@ namespace CGAL {
|
||||||
Dart_handle d2 = make_triangle(h1, h0, h3);
|
Dart_handle d2 = make_triangle(h1, h0, h3);
|
||||||
Dart_handle d3 = make_triangle(h1, h3, h2);
|
Dart_handle d3 = make_triangle(h1, h3, h2);
|
||||||
Dart_handle d4 = make_triangle(h3, h0, h2);
|
Dart_handle d4 = make_triangle(h3, h0, h2);
|
||||||
|
|
||||||
return make_combinatorial_tetrahedron(*this, d1, d2, d3, d4);
|
return make_combinatorial_tetrahedron(*this, d1, d2, d3, d4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -545,7 +545,7 @@ namespace CGAL {
|
||||||
Dart_handle d4 = make_quadrangle(h3, h4, h5, h0);
|
Dart_handle d4 = make_quadrangle(h3, h4, h5, h0);
|
||||||
Dart_handle d5 = make_quadrangle(h0, h1, h2, h3);
|
Dart_handle d5 = make_quadrangle(h0, h1, h2, h3);
|
||||||
Dart_handle d6 = make_quadrangle(h5, h4, h7, h6);
|
Dart_handle d6 = make_quadrangle(h5, h4, h7, h6);
|
||||||
|
|
||||||
return make_combinatorial_hexahedron(*this, d1, d2, d3, d4, d5, d6);
|
return make_combinatorial_hexahedron(*this, d1, d2, d3, d4, d5, d6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -603,11 +603,11 @@ namespace CGAL {
|
||||||
if (i==1)
|
if (i==1)
|
||||||
{
|
{
|
||||||
Dart_const_handle d2=adart->other_extremity();
|
Dart_const_handle d2=adart->other_extremity();
|
||||||
if (d2==NULL) return point(adart);
|
if (d2==NULL) return point(adart);
|
||||||
return typename Traits::Construct_midpoint() (point(adart),
|
return typename Traits::Construct_midpoint() (point(adart),
|
||||||
point(d2));
|
point(d2));
|
||||||
}
|
}
|
||||||
|
|
||||||
// General case, 1<i<=dimension
|
// General case, 1<i<=dimension
|
||||||
Vector vec(typename Traits::Construct_vector()(CGAL::ORIGIN,
|
Vector vec(typename Traits::Construct_vector()(CGAL::ORIGIN,
|
||||||
point(adart)));
|
point(adart)));
|
||||||
|
|
@ -615,7 +615,7 @@ namespace CGAL {
|
||||||
|
|
||||||
// TODO: test if we can optimize by using <Self,0,i,i+1> ?
|
// TODO: test if we can optimize by using <Self,0,i,i+1> ?
|
||||||
CMap_one_dart_per_incident_cell_const_iterator<Self,0,i> it(*this,
|
CMap_one_dart_per_incident_cell_const_iterator<Self,0,i> it(*this,
|
||||||
adart);
|
adart);
|
||||||
for ( ++it; it.cont(); ++it)
|
for ( ++it; it.cont(); ++it)
|
||||||
{
|
{
|
||||||
vec = typename Traits::Construct_sum_of_vectors()
|
vec = typename Traits::Construct_sum_of_vectors()
|
||||||
|
|
@ -633,7 +633,7 @@ namespace CGAL {
|
||||||
* @return a dart handle to the new vertex containing p.
|
* @return a dart handle to the new vertex containing p.
|
||||||
*/
|
*/
|
||||||
Dart_handle insert_point_in_cell_1(Dart_handle dh, const Point& p)
|
Dart_handle insert_point_in_cell_1(Dart_handle dh, const Point& p)
|
||||||
{
|
{
|
||||||
return CGAL::insert_cell_0_in_cell_1(*this, dh,
|
return CGAL::insert_cell_0_in_cell_1(*this, dh,
|
||||||
create_vertex_attribute(p));
|
create_vertex_attribute(p));
|
||||||
}
|
}
|
||||||
|
|
@ -644,7 +644,7 @@ namespace CGAL {
|
||||||
* @return a dart handle to the new vertex containing p.
|
* @return a dart handle to the new vertex containing p.
|
||||||
*/
|
*/
|
||||||
Dart_handle insert_point_in_cell_2(Dart_handle dh, const Point& p)
|
Dart_handle insert_point_in_cell_2(Dart_handle dh, const Point& p)
|
||||||
{
|
{
|
||||||
Vertex_attribute_handle v = create_vertex_attribute(p);
|
Vertex_attribute_handle v = create_vertex_attribute(p);
|
||||||
|
|
||||||
Dart_handle first = CGAL::insert_cell_0_in_cell_2(*this, dh, v);
|
Dart_handle first = CGAL::insert_cell_0_in_cell_2(*this, dh, v);
|
||||||
|
|
@ -669,7 +669,7 @@ namespace CGAL {
|
||||||
if (i==1) return insert_point_in_cell_1(dh, p);
|
if (i==1) return insert_point_in_cell_1(dh, p);
|
||||||
return insert_point_in_cell_2(dh, p);
|
return insert_point_in_cell_2(dh, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Insert a dangling edge in a given facet.
|
/** Insert a dangling edge in a given facet.
|
||||||
* @param dh a dart of the facet (!=NULL).
|
* @param dh a dart of the facet (!=NULL).
|
||||||
* @param p the coordinates of the new vertex.
|
* @param p the coordinates of the new vertex.
|
||||||
|
|
@ -701,8 +701,8 @@ namespace CGAL {
|
||||||
*/
|
*/
|
||||||
Dart_handle dual_points_at_barycenter(Self & alcc, Dart_handle adart=NULL)
|
Dart_handle dual_points_at_barycenter(Self & alcc, Dart_handle adart=NULL)
|
||||||
{
|
{
|
||||||
Dart_handle res = Base::dual(alcc, adart);
|
Dart_handle res = Base::dual(alcc, adart);
|
||||||
|
|
||||||
// Now the lcc alcc is topologically correct, we just need to add
|
// Now the lcc alcc is topologically correct, we just need to add
|
||||||
// its geometry to each vertex (the barycenter of the corresponding
|
// its geometry to each vertex (the barycenter of the corresponding
|
||||||
// dim-cell in the initial map).
|
// dim-cell in the initial map).
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue