Factorize dart between CMap and GMap.

Now we use the same class in both packages.
TODO: modify the doc accordingly.
This commit is contained in:
Guillaume Damiand 2016-10-13 14:23:00 -04:00
parent 2a89580128
commit 4624a0b97b
37 changed files with 908 additions and 756 deletions

View File

@ -9,7 +9,7 @@ struct Myitem
template<class CMap>
struct Dart_wrapper
{
typedef CGAL::Dart<3, CMap> Dart;
typedef void Dart_info;
typedef CGAL::Cell_attribute<CMap, double> Face_attribute; // A weight
typedef CGAL::cpp11::tuple<void,void,Face_attribute> Attributes;
};

View File

@ -26,8 +26,8 @@ struct Myitem
template<class CMap>
struct Dart_wrapper
{
typedef CGAL::Dart<3, CMap> Dart;
typedef CGAL::Cell_attribute<CMap, int, CGAL::Tag_true,
typedef void Dart_info;
typedef CGAL::Cell_attribute<CGAL::Generic_map, int, CGAL::Tag_true,
Sum_functor, Divide_by_two_functor> Facet_attribute;
typedef CGAL::cpp11::tuple<void,void,Facet_attribute> Attributes;
};

View File

@ -68,30 +68,21 @@ namespace CGAL {
class Cell_attribute_without_info<Refs, Tag_false,
OnMerge, OnSplit>
{
template < unsigned int, class, class, class, class >
friend class Combinatorial_map_base;
template<unsigned int, class, class>
friend class Combinatorial_map_storage_1;
template < unsigned int, class, class, class, class >
friend class Generalized_map_base;
template<unsigned int, class, class>
friend class Generalized_map_storage_1;
template <unsigned int, typename>
friend struct Dart;
template<unsigned int, unsigned int, class, class, class>
friend class Linear_cell_complex_storage_1;
template <unsigned int, typename>
friend struct GMap_dart;
template<unsigned int, unsigned int, class, class, class>
friend class GMap_linear_cell_complex_storage_1;
template <class, class, class, class>
friend class Compact_container;
template<typename, unsigned int, typename>
friend struct internal::Decrease_attribute_functor_run;
template <typename, typename>
friend struct internal::Reverse_orientation_of_map_functor;
template <typename, typename>
friend struct internal::Reverse_orientation_of_connected_component_functor;
public:
typedef Tag_false Supports_cell_dart;
@ -180,30 +171,21 @@ namespace CGAL {
class Cell_attribute_without_info<Refs, Tag_true,
OnMerge, OnSplit>
{
template < unsigned int, class, class, class, class >
friend class Combinatorial_map_base;
template<unsigned int, class, class>
friend class Combinatorial_map_storage_1;
template < unsigned int, class, class, class, class >
friend class Generalized_map_base;
template<unsigned int, class, class>
friend class Generalized_map_storage_1;
template <unsigned int, typename>
friend struct Dart;
template<unsigned int, unsigned int, class, class, class>
friend class Linear_cell_complex_storage_1;
template <unsigned int, typename>
friend struct GMap_dart;
template<unsigned int, unsigned int, class, class, class>
friend class GMap_linear_cell_complex_storage_1;
template <class, class, class, class>
friend class Compact_container;
template<typename, unsigned int, typename>
friend struct internal::Decrease_attribute_functor_run;
template <typename, typename>
friend struct internal::Reverse_orientation_of_map_functor;
template <typename, typename>
friend struct internal::Reverse_orientation_of_connected_component_functor;
public:
typedef Tag_true Supports_cell_dart;
@ -295,14 +277,20 @@ namespace CGAL {
/// Specialization when Info==void.
template <class Refs, class Tag_,
class OnMerge, class OnSplit>
class Cell_attribute<Refs, void, Tag_, OnSplit, OnMerge> :
public Cell_attribute_without_info<Refs, Tag_, OnSplit, OnMerge>
class Cell_attribute<Refs, void, Tag_, OnMerge, OnSplit> :
public Cell_attribute_without_info<Refs, Tag_, OnMerge, OnSplit>
{
template < unsigned int, class, class, class, class >
friend class Combinatorial_map_base;
template<unsigned int, class, class>
friend class Combinatorial_map_storage_1;
template < unsigned int, class, class, class, class >
friend class Generalized_map_base;
template<unsigned int, class, class>
friend class Generalized_map_storage_1;
template<unsigned int, unsigned int, class, class, class>
friend class Linear_cell_complex_storage_1;
template<unsigned int, unsigned int, class, class, class>
friend class GMap_linear_cell_complex_storage_1;
template <class, class, class, class>
friend class Compact_container;
@ -316,6 +304,10 @@ namespace CGAL {
typedef OnSplit On_split;
typedef void Info;
template<typename T>
struct rebind
{ typedef Cell_attribute<T, void, Tag_, OnMerge, OnSplit> type; };
// protected:
/// Default contructor.
Cell_attribute()
@ -330,11 +322,17 @@ namespace CGAL {
public Cell_attribute_without_info<Refs, Tag_, OnMerge, OnSplit>,
public Info_for_cell_attribute<Info_>
{
template < unsigned int, class, class, class, class >
friend class Combinatorial_map_base;
template<unsigned int, class, class>
friend class Combinatorial_map_storage_1;
template < unsigned int, class, class, class, class >
friend class Generalized_map_base;
template<unsigned int, class, class>
friend class Generalized_map_storage_1;
template<unsigned int, unsigned int, class, class, class>
friend class Linear_cell_complex_storage_1;
template<unsigned int, unsigned int, class, class, class>
friend class GMap_linear_cell_complex_storage_1;
template <class, class, class, class>
friend class Compact_container;
@ -350,6 +348,10 @@ namespace CGAL {
typedef OnSplit On_split;
typedef Info_ Info;
template<typename T>
struct rebind
{ typedef Cell_attribute<T, Info_, Tag_, OnMerge, OnSplit> type; };
bool operator==(const Self& other) const
{ return this->info()==other.info(); }

View File

@ -26,7 +26,13 @@
#include <CGAL/internal/Combinatorial_map_copy_functors.h>
#include <CGAL/internal/Combinatorial_map_sewable.h>
#include <CGAL/Combinatorial_map_functors.h>
#ifdef CGAL_CMAP_DEPRECATED
#include <CGAL/Combinatorial_map_min_items.h>
#else
#include <CGAL/Generic_map_min_items.h>
#endif
#include <CGAL/Dart_const_iterators.h>
#include <CGAL/Cell_const_iterators.h>
#include <CGAL/Combinatorial_map_basic_operations.h>
@ -65,7 +71,11 @@ namespace CGAL {
* the beta links, and to manage enabled attributes.
*/
template < unsigned int d_, class Refs,
#ifdef CGAL_CMAP_DEPRECATED
class Items_=Combinatorial_map_min_items<d_>,
#else
class Items_=Generic_map_min_items,
#endif
class Alloc_=CGAL_ALLOCATOR(int),
class Storage_= Combinatorial_map_storage_1<d_, Items_, Alloc_> >
class Combinatorial_map_base: public Storage_
@ -95,12 +105,10 @@ namespace CGAL {
typedef Storage_ Storage;
typedef Storage Base;
typedef Combinatorial_map_base<d_, Refs, Items_, Alloc_, Storage_ > Self;
typedef typename Base::Dart Dart;
typedef typename Base::Dart_handle Dart_handle;
typedef typename Base::Dart_const_handle Dart_const_handle;
typedef typename Base::Dart_container Dart_container;
typedef typename Base::Dart_wrapper Dart_wrapper;
typedef typename Base::size_type size_type;
typedef typename Base::Helper Helper;
typedef typename Base::Attributes Attributes;
@ -129,7 +137,6 @@ namespace CGAL {
using Base::dart_unlink_beta;
using Base::attribute;
using Base::mattribute_containers;
using Base::get_attribute;
using Base::dart_of_attribute;
using Base::set_dart_of_attribute;
using Base::info_of_attribute;
@ -167,8 +174,10 @@ namespace CGAL {
*/
Combinatorial_map_base()
{
#ifdef CGAL_CMAP_DEPRECATED
CGAL_static_assertion_msg(Dart::dimension==dimension,
"Dimension of dart different from dimension of map");
#endif
CGAL_static_assertion_msg(Helper::nb_attribs<=dimension+1,
"Too many attributes in the tuple Attributes_enabled");
@ -591,11 +600,10 @@ namespace CGAL {
if ( this->template attribute<i>(dh)!=null_handle )
{
this->template get_attribute<i>(this->template attribute<i>(dh)).
dec_nb_refs();
this->template dec_attribute_ref_counting<i>(this->template attribute<i>(dh));
if ( this->are_attributes_automatically_managed() &&
this->template get_attribute<i>(this->template attribute<i>(dh)).
get_nb_refs()==0 )
this->template get_attribute_ref_counting<i>
(this->template attribute<i>(dh))==0 )
this->template erase_attribute<i>(this->template attribute<i>(dh));
}
@ -604,7 +612,7 @@ namespace CGAL {
if ( ah!=null_handle )
{
this->template set_dart_of_attribute<i>(ah, dh);
this->template get_attribute<i>(ah).inc_nb_refs();
this->template inc_attribute_ref_counting<i>(ah);
}
}
@ -916,7 +924,6 @@ namespace CGAL {
*/
bool is_marked(Dart_const_handle adart, size_type amark) const
{
// CGAL_assertion( adart != null_dart_handle );
CGAL_assertion( is_reserved(amark) );
return get_dart_mark(adart, amark)!=mmask_marks[amark];
@ -1369,7 +1376,7 @@ namespace CGAL {
(mattribute_containers).emplace(args...);
// Reinitialize the ref counting of the new attribute. This is normally
// not required except if create_attribute is used as "copy contructor".
this->template get_attribute<i>(res).mrefcounting = 0;
this->template init_attribute_ref_counting<i>(res);
return res;
}
#else
@ -1391,7 +1398,7 @@ namespace CGAL {
typename Attribute_handle<i>::type res=
CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
(mattribute_containers).emplace(t1);
this->template get_attribute<i>(res).mrefcounting = 0;
this->template init_attribute_ref_counting<i>(res);
return res;
}
template<unsigned int i, typename T1, typename T2>
@ -2237,7 +2244,7 @@ namespace CGAL {
void topo_unsew_0(Dart_handle adart)
{
CGAL_assertion( !this->template is_free<0>(adart) );
topo_unsew_1( adart->template beta<0>() );
topo_unsew_1(this->template beta<0>(adart) );
}
/** Topological unsew by betai the given dart plus all the required darts
@ -4805,7 +4812,11 @@ namespace CGAL {
};
template < unsigned int d_,
#ifdef CGAL_CMAP_DEPRECATED
class Items_=Combinatorial_map_min_items<d_>,
#else
class Items_=Generic_map_min_items,
#endif
class Alloc_=CGAL_ALLOCATOR(int),
class Storage_= Combinatorial_map_storage_1<d_, Items_, Alloc_> >
class Combinatorial_map :

View File

@ -20,7 +20,7 @@
#ifndef CGAL_COMBINATORIAL_MAP_MIN_ITEMS_H
#define CGAL_COMBINATORIAL_MAP_MIN_ITEMS_H 1
#include <CGAL/Combinatorial_map_dart.h>
#include <CGAL/Dart.h>
namespace CGAL {
@ -32,6 +32,7 @@ namespace CGAL {
* Combinatorial_map_min_items defines what is the minimal item
* class for a d-map It provides definitions for darts without attribute.
*/
#ifdef CGAL_CMAP_DEPRECATED
template <unsigned int d>
struct Combinatorial_map_min_items
{
@ -39,10 +40,11 @@ namespace CGAL {
template < class Refs >
struct Dart_wrapper
{
typedef CGAL::Combinatorial_map_dart< d, Refs > Dart;
typedef CGAL::Dart< d, Refs > Dart;
typedef CGAL::cpp11::tuple<> Attributes;
};
};
#endif
} // namespace CGAL

View File

@ -577,16 +577,16 @@ namespace CGAL {
{
if( v2.first == "p" )
{
if (myDarts[id_dart_cellule]->
template attribute<i>()==NULL )
if (amap->template attribute<i>
(myDarts[id_dart_cellule])==NULL )
amap->template set_attribute<i>
(myDarts[id_dart_cellule],
amap->template create_attribute<i>());
read_cmap_attribute_node
(v2,
myDarts[id_dart_cellule]->
template attribute<i>()->point());
(amap->template attribute<i>
(myDarts[id_dart_cellule])->point()));
}
}
}
@ -638,15 +638,14 @@ namespace CGAL {
{
if( v2.first == "v" )
{
if (myDarts[id_dart_cellule]->
template attribute<i>()==NULL )
if (amap->template attribute<i>
(myDarts[id_dart_cellule])==NULL)
amap->template set_attribute<i>
(myDarts[id_dart_cellule],
amap->template create_attribute<i>());
read_cmap_attribute_node
(v2,
myDarts[id_dart_cellule]->
template attribute<i>()->info());
amap->template info<i>(myDarts[id_dart_cellule]));
}
}
}

View File

@ -24,6 +24,7 @@
#include <CGAL/Compact_container.h>
#include <bitset>
#include <CGAL/Dart.h>
#include <boost/config.hpp>
#if (BOOST_GCC >= 40900)
@ -61,10 +62,17 @@ namespace CGAL {
typedef internal::Combinatorial_map_helper<Self> Helper;
typedef typename Items_::template Dart_wrapper<Self> Dart_wrapper;
#ifdef CGAL_CMAP_DEPRECATED
typedef typename Dart_wrapper::Dart Dart;
#else
// TODO Define by default Dart_info to void if it does not exist in Dart_wrapper
typedef typename Dart_wrapper::Dart_info Dart_info;
typedef CGAL::Dart<d_, Self, Dart_info> Dart;
#endif
typedef typename Alloc_::template rebind<Dart>::other Dart_allocator;
typedef Compact_container<Dart,Dart_allocator> Dart_container;
typedef Compact_container<Dart, Dart_allocator> Dart_container;
typedef typename Dart_container::iterator Dart_handle;
typedef typename Dart_container::const_iterator Dart_const_handle;
@ -127,13 +135,13 @@ namespace CGAL {
{
CGAL_assertion( dh!=NULL );
CGAL_assertion(i <= dimension);
return dh->mbeta[i]==null_dart_handle;
return dh->mf[i]==null_dart_handle;
}
bool is_free(Dart_const_handle dh, unsigned int i) const
{
CGAL_assertion( dh!=NULL );
CGAL_assertion(i <= dimension);
return dh->mbeta[i]==null_dart_handle;
return dh->mf[i]==null_dart_handle;
}
/// Set simultaneously all the marks of this dart to a given value.
@ -174,24 +182,24 @@ namespace CGAL {
Dart_handle get_beta(Dart_handle ADart, int B1)
{
CGAL_assertion(ADart!=NULL && B1>=0 && B1<=(int)dimension);
return ADart->mbeta[B1];
return ADart->mf[B1];
}
Dart_const_handle get_beta(Dart_const_handle ADart, int B1) const
{
CGAL_assertion(ADart!=NULL && B1>=0 && B1<=(int)dimension);
return ADart->mbeta[B1];
return ADart->mf[B1];
}
template<int B1>
Dart_handle get_beta(Dart_handle ADart)
{
CGAL_assertion(ADart!=NULL && B1>=0 && B1<=(int)dimension);
return ADart->mbeta[B1];
return ADart->mf[B1];
}
template<int B1>
Dart_const_handle get_beta(Dart_const_handle ADart) const
{
CGAL_assertion(ADart!=NULL && B1>=0 && B1<=(int)dimension);
return ADart->mbeta[B1];
return ADart->mf[B1];
}
// return a handle on the i-attribute
@ -213,6 +221,55 @@ namespace CGAL {
(ADart->mattribute_handles);
}
// Copy a given attribute
template<unsigned int i>
typename Attribute_handle<i>::type copy_attribute
(typename Attribute_const_handle<i>::type ah)
{
CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
"copy_attribute<i> called but i-attributes are disabled.");
typename Attribute_handle<i>::type res=
CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
(mattribute_containers).emplace(*ah);
this->template init_attribute_ref_counting<i>(res);
return res;
}
// Test if a given attribute is valid
template<unsigned int i>
bool is_valid_attribute(typename Attribute_const_handle<i>::type ah) const
{
CGAL_assertion( ah!=NULL );
return ah->is_valid();
}
// accessors and modifiers to the attribute ref counting given its handle
template<unsigned int i>
std::size_t get_attribute_ref_counting
(typename Attribute_const_handle<i>::type ah) const
{
CGAL_assertion( ah!=NULL );
return ah->get_nb_refs();
}
template<unsigned int i>
void init_attribute_ref_counting(typename Attribute_handle<i>::type ah)
{
CGAL_assertion( ah!=NULL );
ah->mrefcounting=0;
}
template<unsigned int i>
void inc_attribute_ref_counting(typename Attribute_handle<i>::type ah)
{
CGAL_assertion( ah!=NULL );
ah->inc_nb_refs();
}
template<unsigned int i>
void dec_attribute_ref_counting(typename Attribute_handle<i>::type ah)
{
CGAL_assertion( ah!=NULL );
ah->dec_nb_refs();
}
// get the attribute given its handle
template<unsigned int i>
typename Attribute_type<i>::type&
@ -229,17 +286,6 @@ namespace CGAL {
return *ah;
}
Dart & get_dart(Dart_handle ah)
{
CGAL_assertion( ah!=NULL );
return *ah;
}
const Dart & get_dart(Dart_const_handle ah) const
{
CGAL_assertion( ah!=NULL );
return *ah;
}
// Get the dart of the given attribute
template<unsigned int i>
Dart_handle dart_of_attribute(typename Attribute_handle<i>::type ah)
@ -264,6 +310,14 @@ namespace CGAL {
ah->set_dart(adart);
}
#ifndef CGAL_CMAP_DEPRECATED
// Get the information associated with a given dart
typename Dart::Info& info(Dart_handle adart)
{ return adart->info(); }
const typename Dart::Info& info(Dart_const_handle adart) const
{ return adart->info(); }
#endif
// Get the info of the given attribute
template<unsigned int i>
typename Attribute_type<i>::type::Info &
@ -313,6 +367,7 @@ namespace CGAL {
return dart_of_attribute<i>(attribute<i>(adart));
}
// Debug function // TODO UPDATE WHEN INDEX IS ADDED IN COMPACT CONTAINER
void display_dart(Dart_const_handle ADart) const
{ std::cout<<&*ADart; }
@ -341,14 +396,14 @@ namespace CGAL {
CGAL_assertion(i <= dimension);
CGAL_assertion(adart!=NULL && adart2!=NULL);
CGAL_assertion(adart!=null_dart_handle);
adart->mbeta[i] = adart2;
adart->mf[i] = adart2;
}
void dart_link_beta(Dart_handle adart, Dart_handle adart2, unsigned int i)
{
CGAL_assertion(i <= dimension);
CGAL_assertion(adart!=NULL && adart2!=NULL);
CGAL_assertion(adart!=null_dart_handle);
adart->mbeta[i] = adart2;
adart->mf[i] = adart2;
}
/** Unlink a dart for a given dimension.
@ -359,12 +414,12 @@ namespace CGAL {
void dart_unlink_beta(Dart_handle adart)
{
CGAL_assertion(adart!=NULL && i <= dimension);
adart->mbeta[i] = null_dart_handle;
adart->mf[i] = null_dart_handle;
}
void dart_unlink_beta(Dart_handle adart, unsigned int i)
{
CGAL_assertion(adart!=NULL && i <= dimension);
adart->mbeta[i] = null_dart_handle;
adart->mf[i] = null_dart_handle;
}
public:
@ -375,7 +430,7 @@ namespace CGAL {
/// Dart container.
Dart_container mdarts;
/// Container for the null_dart_handle, static data member.
/// Container for the null_dart_handle.
Dart_container mnull_dart_container;
/// Tuple of attributes containers

View File

@ -17,8 +17,8 @@
//
// Author(s) : Guillaume Damiand <guillaume.damiand@liris.cnrs.fr>
//
#ifndef CGAL_COMBINATORIAL_MAP_DART_H
#define CGAL_COMBINATORIAL_MAP_DART_H 1
#ifndef CGAL_DART_H
#define CGAL_DART_H 1
#include <CGAL/Compact_container.h>
#include <CGAL/assertions.h>
@ -27,69 +27,42 @@
namespace CGAL {
/** @file Combinatorial_map_dart.h
/** @file Dart.h
* Definition of nD dart.
*/
namespace internal {
template <typename Map,unsigned int i>
struct basic_link_beta_functor;
template <typename CMap,unsigned int i>
struct link_beta_functor;
}
#define CGAL_BETAINV(i) (i>1?i:(i==1?0:1))
/** Definition of nD dart.
* The Combinatorial_map_dart class describes an nD dart (basic element of a
* combinatorial map). A dart is composed with handle towards its neighbors,
/** Definition of nD dart without information.
* The_dart class describes an nD dart (basic element of a combinatorial or generalized map).
* A dart is composed with handle towards its neighbors,
* a bitset containing Boolean marks, and handle towards enabled attributes.
* n is the dimension of the space (2 for 2D, 3 for 3D...)
* Refs the ref class
*/
template <unsigned int d, typename Refs>
struct Combinatorial_map_dart
struct Dart_without_info
{
template < unsigned int, class, class, class, class >
friend class Combinatorial_map_base;
public:
template<unsigned int, class, class>
friend class Combinatorial_map_storage_1;
template<unsigned int, class, class>
friend class Combinatorial_map_storage_2;
friend class Generalized_map_storage_1;
template<unsigned int, unsigned int, class, class, class>
friend class Linear_cell_complex_storage_1;
template<unsigned int, unsigned int, class, class, class>
friend class Linear_cell_complex_storage_2;
friend class GMap_linear_cell_complex_storage_1;
template <class, class, class, class>
friend class Compact_container;
template<class, unsigned int, unsigned int>
friend struct Remove_cell_functor;
template<class, unsigned int>
friend struct Contract_cell_functor;
template <typename,unsigned int>
friend struct internal::link_beta_functor;
template <typename, typename>
friend struct internal::Reverse_orientation_of_map_functor;
template <typename, typename>
friend struct internal::Reverse_orientation_of_connected_component_functor;
public:
typedef Combinatorial_map_dart<d,Refs> Self;
typedef Dart_without_info<d,Refs> Self;
typedef typename Refs::Dart_handle Dart_handle;
typedef typename Refs::size_type size_type;
typedef typename Refs::Dart_const_handle Dart_const_handle;
typedef typename Refs::Helper Helper;
/// Typedef for attributes
template<int i>
struct Attribute_handle: public Refs::template Attribute_handle<i>
@ -105,64 +78,26 @@ namespace CGAL {
/// The dimension of the combinatorial map.
static const unsigned int dimension = d;
/** Return the beta of this dart for a given dimension.
* @param i the dimension.
* @return beta(\em i).
*/
template<unsigned int i>
Dart_handle beta()
{
CGAL_assertion(i <= dimension);
return mbeta[i];
}
Dart_handle beta(unsigned int i)
{
CGAL_assertion(i <= dimension);
return mbeta[i];
}
template<unsigned int i>
Dart_const_handle beta() const
{
CGAL_assertion(i <= dimension);
return mbeta[i];
}
Dart_const_handle beta(unsigned int i) const
{
CGAL_assertion(i <= dimension);
return mbeta[i];
}
void * for_compact_container() const
{ return mf[0].for_compact_container(); }
void * & for_compact_container()
{ return mf[0].for_compact_container(); }
/** Return the beta inverse of this dart for a given dimension.
* @param i the dimension.
* @return beta^{-1}(\em i).
protected:
/** Default constructor: no real initialisation,
* because this is done in the combinatorial map class.
*/
template<unsigned int i>
Dart_handle beta_inv()
{ return beta<CGAL_BETAINV(i)>(); }
Dart_handle beta_inv(unsigned int i)
{ return beta(CGAL_BETAINV(i)); }
template<unsigned int i>
Dart_const_handle beta_inv() const
{ return beta<CGAL_BETAINV(i)>(); }
Dart_const_handle beta_inv(unsigned int i) const
{ return beta(CGAL_BETAINV(i)); }
Dart_without_info()
{}
/// @return a handle on the i-attribute
template<int i>
typename Attribute_handle<i>::type attribute()
/** Copy constructor:
* @param adart a dart.
*/
Dart_without_info(const Dart_without_info& adart) : mmarks(adart.mmarks),
mattribute_handles(adart.mattribute_handles)
{
CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
"attribute<i> called but i-attributes are disabled.");
return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
(mattribute_handles);
}
template<int i>
typename Attribute_const_handle<i>::type attribute() const
{
CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
"attribute<i> called but i-attributes are disabled.");
return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
(mattribute_handles);
for (unsigned int i = 0; i <= dimension; ++i)
mf[i] = adart.mf[i];
}
/** Return the mark value of a given mark number.
@ -205,32 +140,27 @@ namespace CGAL {
void set_marks(const std::bitset<NB_MARKS>& amarks) const
{ mmarks = amarks; }
protected:
/** Default constructor: no real initialisation,
* because this is done in the combinatorial map class.
*/
Combinatorial_map_dart()
{}
/** Copy constructor:
* @param adart a dart.
*/
Combinatorial_map_dart(const Combinatorial_map_dart& adart) : mmarks(adart.mmarks),
mattribute_handles(adart.mattribute_handles)
/// @return a handle on the i-attribute
template<int i>
typename Attribute_handle<i>::type attribute()
{
for (unsigned int i = 0; i <= dimension; ++i)
mbeta[i] = adart.mbeta[i];
CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
"attribute<i> called but i-attributes are disabled.");
return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
(mattribute_handles);
}
template<int i>
typename Attribute_const_handle<i>::type attribute() const
{
CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
"attribute<i> called but i-attributes are disabled.");
return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
(mattribute_handles);
}
public:
void * for_compact_container() const
{ return mbeta[0].for_compact_container(); }
void * & for_compact_container()
{ return mbeta[0].for_compact_container(); }
protected:
/// Beta for each dimension +1 (from 0 to dimension).
Dart_handle mbeta[dimension+1];
/// Neighboors for each dimension +1 (from 0 to dimension).
Dart_handle mf[dimension+1];
/// Values of Boolean marks.
mutable std::bitset<NB_MARKS> mmarks;
@ -239,12 +169,173 @@ namespace CGAL {
typename Helper::Attribute_handles mattribute_handles;
};
/// Old name, kept for backward compatibility
#ifdef CGAL_CMAP_DEPRECATED
/* namespace internal {
template <typename Map,unsigned int i>
struct basic_link_beta_functor;
template <typename CMap,unsigned int i>
struct link_beta_functor;
} */
#define CGAL_BETAINV(i) (i>1?i:(i==1?0:1))
/** Definition of nD dart for combinatorial map. Add functions beta and attributes which
* are now deprecated.
*/
template <unsigned int d, typename Refs>
struct CGAL_DEPRECATED Dart : public Combinatorial_map_dart<d, Refs>
{};
struct Dart : public Dart_without_info<d, Refs>
{
template<unsigned int, class, class>
friend class Combinatorial_map_storage_1;
template<unsigned int, class, class>
friend class Generalized_map_storage_1;
template<unsigned int, unsigned int, class, class, class>
friend class Linear_cell_complex_storage_1;
template<unsigned int, unsigned int, class, class, class>
friend class GMap_linear_cell_complex_storage_1;
template <class, class, class, class>
friend class Compact_container;
typedef Dart_without_info<d, Refs> Base;
using Base::dimension;
using Base::mf;
using Base::mattribute_handles;
typedef typename Base::Dart_handle Dart_handle;
typedef typename Base::Dart_const_handle Dart_const_handle;
typedef typename Base::Helper Helper;
/// Typedef for attributes
template<int i>
struct Attribute_handle: public Refs::template Attribute_handle<i>
{};
template<int i>
struct Attribute_const_handle:
public Refs::template Attribute_const_handle<i>
{};
public:
/** Return the beta of this dart for a given dimension.
* @param i the dimension.
* @return beta(\em i).
*/
template<unsigned int i>
Dart_handle beta()
{
CGAL_assertion(i <= dimension);
return mf[i];
}
Dart_handle beta(unsigned int i)
{
CGAL_assertion(i <= dimension);
return mf[i];
}
template<unsigned int i>
Dart_const_handle beta() const
{
CGAL_assertion(i <= dimension);
return mf[i];
}
Dart_const_handle beta(unsigned int i) const
{
CGAL_assertion(i <= dimension);
return mf[i];
}
/** Return the beta inverse of this dart for a given dimension.
* @param i the dimension.
* @return beta^{-1}(\em i).
*/
template<unsigned int i>
Dart_handle beta_inv()
{ return beta<CGAL_BETAINV(i)>(); }
Dart_handle beta_inv(unsigned int i)
{ return beta(CGAL_BETAINV(i)); }
template<unsigned int i>
Dart_const_handle beta_inv() const
{ return beta<CGAL_BETAINV(i)>(); }
Dart_const_handle beta_inv(unsigned int i) const
{ return beta(CGAL_BETAINV(i)); }
/// @return a handle on the i-attribute
template<int i>
typename Attribute_handle<i>::type attribute()
{
CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
"attribute<i> called but i-attributes are disabled.");
return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
(mattribute_handles);
}
template<int i>
typename Attribute_const_handle<i>::type attribute() const
{
CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
"attribute<i> called but i-attributes are disabled.");
return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
(mattribute_handles);
}
};
#else // CGAL_CMAP_DEPRECATED
// Dart definition with an info;
// (there is a specialization below when Info_==void)
template <unsigned int d, typename Refs, typename Info_=void>
struct Dart : public Dart_without_info<d, Refs>
{
public:
template<unsigned int, class, class>
friend class Combinatorial_map_storage_1;
template<unsigned int, class, class>
friend class Generalized_map_storage_1;
template<unsigned int, unsigned int, class, class, class>
friend class Linear_cell_complex_storage_1;
template<unsigned int, unsigned int, class, class, class>
friend class GMap_linear_cell_complex_storage_1;
template <class, class, class, class>
friend class Compact_container;
typedef Dart<d, Refs, Info_> Self;
typedef Info_ Info;
protected:
/** Default constructor: no real initialisation,
* because this is done in the combinatorial or generalized map class.
*/
Dart()
{}
Dart(const Info_& info) : minfo(info)
{}
Info_& info()
{ return minfo; }
const Info_& info() const
{ return minfo; }
protected:
Info minfo;
};
// Specialization of Dart class when info==void
template <unsigned int d, typename Refs>
struct Dart<d, Refs, void> : public Dart_without_info<d, Refs>
{
public:
typedef CGAL::Void Info;
};
#endif // CGAL_CMAP_DEPRECATED
} // namespace CGAL
#endif // CGAL_COMBINATORIAL_MAP_DART_H //
#endif // CGAL_DART_H //
// EOF //

View File

@ -666,7 +666,7 @@ namespace CGAL {
else
{
if ( !mfirst_border )
this->set_current_dart(mit->beta(delta));
this->set_current_dart(this->mmap->beta(mit, delta));
else
this->set_current_dart(mit);
}

View File

@ -17,34 +17,33 @@
//
// Author(s) : Guillaume Damiand <guillaume.damiand@liris.cnrs.fr>
//
#ifndef CGAL_GENERALIZED_MAP_MIN_ITEMS_H
#define CGAL_GENERALIZED_MAP_MIN_ITEMS_H 1
#include <CGAL/Generalized_map_dart.h>
#ifndef CGAL_GENERIC_MAP_MIN_ITEMS_H
#define CGAL_GENERIC_MAP_MIN_ITEMS_H 1
namespace CGAL {
/** @file Generalized_map_min_items.h
* Definition of min item class for dD generalized map.
*/
/** @file Generic_map_min_items.h
* Definition of min item class for dD generic map.
*/
/** Minimal items for dD generalized map.
* Generalized_map_min_items defines what is the minimal item
* class for a d-gmap It provides definitions for darts without attribute.
*/
template <unsigned int d>
struct Generalized_map_min_items
{
/// Dart_wrapper defines the type of darts used, and enabled attributes.
template < class Refs >
struct Dart_wrapper
{
typedef CGAL::Generalized_map_dart< d, Refs > Dart;
typedef CGAL::cpp11::tuple<> Attributes;
};
};
/** Minimal items for dD generic map.
* Generic_map_min_items defines what is the minimal item class for a generic map.
* No information associated with darts, no enabled attribute.
*/
#ifndef CGAL_CMAP_DEPRECATED
struct Generic_map_min_items
{
template < class Refs >
struct Dart_wrapper
{
typedef void Dart_info;
typedef CGAL::cpp11::tuple<> Attributes;
};
};
#endif
} // namespace CGAL
#endif // CGAL_GENERALIZED_MAP_MIN_ITEMS_H //
#endif // CGAL_GENERIC_MAP_MIN_ITEMS_H
// EOF //

View File

@ -63,7 +63,7 @@ struct Create_attribute_if_same_info_cmap<Map1, Map2, i, Info, Info>
run(Map2& map2, const Info& info)
{ typename Map2::template Attribute_handle<i>::type
res = map2.template create_attribute<i>();
map2.template get_attribute<i>(res).info()=info;
map2.template info_of_attribute<i>(res)=info;
return res;
}
};
@ -369,7 +369,7 @@ struct Cast_converter_cmap_attributes
CGAL_assertion( map2.template attribute<i>(dh2)==Map2::null_handle );
typename Map2::template Attribute_handle<i>::type
res = map2.template create_attribute<i>();
map2.template get_attribute<i>(res).info() =
map2.template info_of_attribute<i>(res) =
(typename Map2::template Attribute_type<i>::type::Info)
map1.template info<i>(dh1);
return res;
@ -405,7 +405,7 @@ struct Default_converter_cmap_0attributes_with_point
internal::Set_point_if_possible_cmap
<typename Map1::template Attribute_type<0>::type::Point,
typename Map2::template Attribute_type<0>::type::Point>::
run(map1.point(dh1), map2.template get_attribute<0>(res).point());
run(map1.point(dh1), map2.point_of_vertex_attribute(res));
return res;
}
};

View File

@ -503,11 +503,10 @@ struct Degroup_nonvoid_attribute_functor_run
// As we split, we set the dart of the first attribute to adart1 for which
// we are sure it belongs to the first i-cell.
amap->template get_attribute<i>(a1).set_dart(adart1);
amap->template set_dart_of_attribute<i>(a1, adart1);
typename CMap::template Attribute_handle<i>::type
a2 = amap->template
create_attribute<i>(amap->template get_attribute<i>(a1));
a2 = amap->template copy_attribute<i>(a1);
amap->template set_attribute<i>(adart2, a2);
CGAL::internal::Call_split_functor<CMap, i>::run(amap, a1, a2);

View File

@ -256,17 +256,17 @@ struct Test_is_valid_attribute_functor
if ( a!=amap->null_handle )
{
if ( amap->template get_attribute<i>(a).get_nb_refs()!=nb )
if ( amap->template get_attribute_ref_counting<i>(a)!=nb )
{
std::cout<<"ERROR: the number of reference of an "<<i
<<"-attribute is not correct. Count: "<<nb
<<" != Store in the attribute: "
<<amap->template get_attribute<i>(a).get_nb_refs()
<<amap->template get_attribute_ref_counting<i>(a)
<<" for dart ";
amap->display_dart(adart); std::cout<<std::endl;
valid=false;
}
if ( !amap->template get_attribute<i>(a).is_valid() )
if ( !amap->template is_valid_attribute<i>(a) )
{
std::cout<<"ERROR: the dart associated with an "<<i
<<"-attribute is NULL for dart ";
@ -339,10 +339,10 @@ struct Correct_invalid_attributes_functor
// If the i-cell has less darts than the ref counter of the i-attribute,
// the i-attribute is shared by different cells => we duplicate it.
if ( nb!=amap->template get_attribute<i>(a).get_nb_refs() )
if ( nb!=amap->template get_attribute_ref_counting<i>(a) )
{
typename CMap::template Attribute_handle<i>::type
a2=amap->template create_attribute<i>(amap->template get_attribute<i>(a));
a2=amap->template copy_attribute<i>(a);
amap->template set_attribute<i>(adart, a2);
}
}
@ -433,12 +433,11 @@ struct Decrease_attribute_functor_run
{
if ( amap->template attribute<i>(adart)!=CMap::null_handle )
{
amap->template get_attribute<i>(amap->template attribute<i>(adart)).
dec_nb_refs();
if ( amap->are_attributes_automatically_managed() &&
amap->template get_attribute<i>(amap->template attribute<i>(adart)).
get_nb_refs()==0 )
amap->template erase_attribute<i>(amap->template attribute<i>(adart));
amap.template dec_attribute_ref_counting<i>(amap.template attribute<i>(adart));
if ( amap.are_attributes_automatically_managed() &&
amap.template get_attribute_ref_counting<i>
(amap.template attribute<i>(adart))==0 )
amap.template erase_attribute<i>(amap.template attribute<i>(adart));
}
}
};
@ -740,7 +739,7 @@ struct Reverse_orientation_of_map_functor
amap->beta(first_dart_in_cell,1);
typename CMap::Helper::template Attribute_handle<0>::type
attribute_for_first_dart=amap->template attribute<0>(current_dart_in_cell);
amap->template get_attribute<0>(attribute_for_first_dart).inc_nb_refs();
amap->template inc_attribute_ref_counting<0>(attribute_for_first_dart);
do {
amap->mark(current_dart_in_cell, mark);
typename CMap::Dart_handle previous_dart_in_cell=
@ -764,7 +763,7 @@ struct Reverse_orientation_of_map_functor
amap->beta(current_dart_in_cell,1);
CGAL::internal::Set_i_attribute_of_dart_functor<CMap, 0>::
run(amap, current_dart_in_cell, attribute_for_first_dart);
amap->template get_attribute<0>(attribute_for_first_dart).dec_nb_refs();
amap->template dec_attribute_ref_counting<0>(attribute_for_first_dart);
amap->template dart_link_beta<1>(current_dart_in_cell, previous_dart_in_cell);
amap->template dart_link_beta<0>(current_dart_in_cell, next_dart_in_cell);
}
@ -831,7 +830,7 @@ struct Reverse_orientation_of_connected_component_functor
amap->beta(first_dart_in_cell,1);
typename CMap::Helper::template Attribute_handle<0>::type
attribute_for_first_dart=amap->template attribute<0>(current_dart_in_cell);
amap->template get_attribute<0>(attribute_for_first_dart).inc_nb_refs();
amap->template inc_attribute_ref_counting<0>(attribute_for_first_dart);
do {
amap->mark(current_dart_in_cell, mark);
typename CMap::Dart_handle previous_dart_in_cell=
@ -855,7 +854,7 @@ struct Reverse_orientation_of_connected_component_functor
amap->beta(current_dart_in_cell,1);
CGAL::internal::Set_i_attribute_of_dart_functor<CMap, 0>::
run(amap, current_dart_in_cell, attribute_for_first_dart);
amap->template get_attribute<0>(attribute_for_first_dart).dec_nb_refs();
amap->template dec_attribute_ref_counting<0>(attribute_for_first_dart);
amap->template dart_link_beta<1>(current_dart_in_cell, previous_dart_in_cell);
amap->template dart_link_beta<0>(current_dart_in_cell, next_dart_in_cell);
}

View File

@ -36,28 +36,45 @@
*/
namespace CGAL
{
struct Generic_map
{
typedef CGAL::Void Dart;
typedef CGAL::Void Dart_handle;
typedef CGAL::Void Dart_const_handle;
typedef CGAL::Void Alloc;
};
namespace internal
{
// There is a problem on windows to handle tuple containing void.
// To solve this, we transform such a tuple in tuple containing Disabled.
template<typename T>
template<typename T, typename Refs>
struct Convert_void
{ typedef T type; };
{ typedef typename T::template rebind<Refs>::type type; };
template<>
struct Convert_void<void>
template<typename Refs>
struct Convert_void<void, Refs>
{ typedef CGAL::Void type; };
#if ! defined(CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES) && \
// Struct to rebind an attribute with the given refs class, if it is
// not void
template<typename T, typename Refs>
struct Rebind_attr
{ typedef typename T::template rebind<Refs>::type type; };
template<typename Refs>
struct Rebind_attr<CGAL::Void, Refs>
{ typedef CGAL::Void type; };
#if ! defined(CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES) && \
! defined(CGAL_CFG_NO_CPP0X_TUPLE)
// Convert a tuple in a same tuple where each void type was replaced into
// CGAL::Void.
template<typename ... Items>
template<class CMap, typename ... Items>
struct Convert_tuple_with_void;
template<typename ... Items>
struct Convert_tuple_with_void<CGAL::cpp11::tuple<Items...> >
template<class CMap, typename ... Items>
struct Convert_tuple_with_void<CMap, CGAL::cpp11::tuple<Items...> >
{
typedef CGAL::cpp11::tuple<typename Convert_void<Items>::type... > type;
typedef CGAL::cpp11::tuple<typename Convert_void<Items, CMap>::type... > type;
};
// Length of a variadic template
@ -390,14 +407,14 @@ namespace CGAL
template <class T>
struct Add_compact_container{
typedef typename CMap::Alloc::template rebind<T>::other Attr_allocator;
typedef typename CMap::template Container_for_attributes<T> type;
typedef typename CMap::template Container_for_attributes<typename T::template rebind<CMap>::type > type;
};
// defines as type Compact_container<T>::iterator
template <class T>
struct Add_compact_container_iterator{
typedef typename CMap::Alloc::template rebind<T>::other Attr_allocator;
typedef typename CMap::template Container_for_attributes<T>::iterator
typedef typename CMap::template Container_for_attributes<typename T::template rebind<CMap>::type >::iterator
iterator_type;
// TODO case when there is no Use_index typedef in CMap
@ -410,7 +427,7 @@ namespace CGAL
template <class T>
struct Add_compact_container_const_iterator{
typedef typename CMap::Alloc::template rebind<T>::other Attr_allocator;
typedef typename CMap::template Container_for_attributes<T>::
typedef typename CMap::template Container_for_attributes<typename T::template rebind<CMap>::type >::
const_iterator iterator_type;
typedef typename boost::mpl::if_
@ -420,7 +437,7 @@ namespace CGAL
// All the attributes (with CGAL::Void)
typedef typename CGAL::internal::Convert_tuple_with_void
<typename CMap::Attributes>::type Attributes;
<CMap, typename CMap::Attributes>::type Attributes;
// defines as type Cell_attribute_binary_functor<T>
template <class T>
@ -476,7 +493,7 @@ namespace CGAL
template<int d, int in_tuple=(d<CGAL::internal::My_length
<Attributes>::value)>
struct Attribute_type
{ typedef typename CGAL::cpp11::tuple_element<d,Attributes>::type type; };
{ typedef typename Rebind_attr<typename CGAL::cpp11::tuple_element<d,Attributes>::type, CMap>::type type; };
template<int d>
struct Attribute_type<d,0>

View File

@ -14,7 +14,7 @@ struct Map_2_dart_items
template < class Refs >
struct Dart_wrapper
{
typedef CGAL::Dart< 2, Refs > Dart;
typedef void Dart_info;
typedef CGAL::Cell_attribute< Refs, int, CGAL::Tag_true > Int_attrib;
typedef CGAL::Cell_attribute< Refs, double, CGAL::Tag_true > Double_attrib;
@ -29,7 +29,7 @@ struct Map_2_dart_max_items_3
template < class Refs >
struct Dart_wrapper
{
typedef CGAL::Dart< 2, Refs > Dart;
typedef int Dart_info;
typedef CGAL::Cell_attribute< Refs, int, CGAL::Tag_true > Int_attrib;
typedef CGAL::Cell_attribute< Refs, double, CGAL::Tag_true > Double_attrib;
@ -45,7 +45,7 @@ struct Map_3_dart_items_3
template < class Refs >
struct Dart_wrapper
{
typedef CGAL::Dart< 3, Refs > Dart;
typedef void Dart_info;
typedef CGAL::Cell_attribute< Refs, int, CGAL::Tag_true > Int_attrib;
typedef CGAL::Cell_attribute< Refs, double, CGAL::Tag_true > Double_attrib;
@ -61,7 +61,7 @@ struct Map_3_dart_max_items_3
template < class Refs >
struct Dart_wrapper
{
typedef CGAL::Dart< 3, Refs > Dart;
typedef int* Dart_info;
typedef CGAL::Cell_attribute< Refs, int, CGAL::Tag_true > Int_attrib;
typedef CGAL::Cell_attribute< Refs, double, CGAL::Tag_true > Double_attrib;
@ -78,7 +78,7 @@ public:
template < class Refs >
struct Dart_wrapper
{
typedef CGAL::Dart< 3, Refs > Dart;
typedef Map_3_dart_max_items_3 Dart_info;
typedef CGAL::Cell_attribute< Refs, int > Int_attrib;
@ -91,7 +91,7 @@ struct Map_dart_items_4
template < class Refs >
struct Dart_wrapper
{
typedef CGAL::Dart< 4, Refs > Dart;
typedef void Dart_info;
typedef CGAL::Cell_attribute< Refs, int > Int_attrib;
typedef CGAL::Cell_attribute< Refs, double > Double_attrib;
@ -107,7 +107,7 @@ struct Map_dart_max_items_4
template < class Refs >
struct Dart_wrapper
{
typedef CGAL::Dart< 4, Refs > Dart;
typedef char Dart_info;
typedef CGAL::Cell_attribute< Refs, int > Int_attrib;
typedef CGAL::Cell_attribute< Refs, double > Double_attrib;
@ -119,7 +119,7 @@ struct Map_dart_max_items_4
};
// void, void, void
typedef CGAL::Combinatorial_map<2, CGAL::Combinatorial_map_min_items<2> > Map1;
typedef CGAL::Combinatorial_map<2, CGAL::Generic_map_min_items > Map1;
// double, void, double
typedef CGAL::Combinatorial_map<2, Map_2_dart_items > Map2;
@ -128,7 +128,7 @@ typedef CGAL::Combinatorial_map<2, Map_2_dart_items > Map2;
typedef CGAL::Combinatorial_map<2, Map_2_dart_max_items_3> Map3;
// void, void, void, void
typedef CGAL::Combinatorial_map<3, CGAL::Combinatorial_map_min_items<3> > Map4;
typedef CGAL::Combinatorial_map<3, CGAL::Generic_map_min_items > Map4;
// double, void, int, double
typedef CGAL::Combinatorial_map<3, Map_3_dart_items_3> Map5;
@ -155,7 +155,7 @@ struct CreateAttributes
for(typename Map::Dart_range::iterator it=map.darts().begin(),
itend=map.darts().end(); it!=itend; ++it)
{
if ( it->template attribute<i>()==map.null_handle )
if ( map.template attribute<i>(it)==map.null_handle )
map.template set_attribute<i>
(it, map.template create_attribute<i>(++nb));
}
@ -182,7 +182,7 @@ struct DisplayAttribs
itend=amap.template attributes<i>().end();
it!=itend; ++it )
{
std::cout<<amap.template get_attribute<i>(it).info()<<"; ";
std::cout<<amap.template info<i>(it)<<"; ";
}
std::cout<<std::endl;
}

View File

@ -3,13 +3,25 @@
#ifndef CGAL_NO_DEPRECATED_CODE
#define CGAL_NO_DEPRECATION_WARNINGS 1
#define CGAL_CMAP_DEPRECATED 1
#include <CGAL/Combinatorial_map.h>
#include <CGAL/Combinatorial_map_constructors.h>
#include <CGAL/Combinatorial_map_operations.h>
#include <CGAL/Cell_attribute.h>
typedef CGAL::Combinatorial_map<3> CMap;
struct My_items
{
/// Dart_wrapper defines the type of darts used, and enabled attributes.
template < class Refs >
struct Dart_wrapper
{
typedef CGAL::Dart< 3, Refs > Dart;
typedef CGAL::cpp11::tuple<> Attributes;
};
};
typedef CGAL::Combinatorial_map<3, My_items> CMap;
bool test()
{

View File

@ -11,7 +11,7 @@ struct Map_2_dart_items
template < class Refs >
struct Dart_wrapper
{
typedef CGAL::Dart< 2, Refs > Dart;
typedef void Dart_info;
typedef CGAL::Cell_attribute< Refs, int, CGAL::Tag_true > Int_attrib;
typedef CGAL::Cell_attribute< Refs, double, CGAL::Tag_true > Double_attrib;
@ -26,7 +26,7 @@ struct Map_2_dart_max_items_3
template < class Refs >
struct Dart_wrapper
{
typedef CGAL::Dart< 2, Refs > Dart;
typedef int Dart_info;
typedef CGAL::Cell_attribute< Refs, int, CGAL::Tag_true > Int_attrib;
typedef CGAL::Cell_attribute< Refs, double, CGAL::Tag_true > Double_attrib;
@ -42,7 +42,7 @@ struct Map_3_dart_items_3
template < class Refs >
struct Dart_wrapper
{
typedef CGAL::Dart< 3, Refs > Dart;
typedef void Dart_info;
typedef CGAL::Cell_attribute< Refs, int, CGAL::Tag_true > Int_attrib;
typedef CGAL::Cell_attribute< Refs, double, CGAL::Tag_true > Double_attrib;
@ -58,7 +58,7 @@ struct Map_3_dart_max_items_3
template < class Refs >
struct Dart_wrapper
{
typedef CGAL::Dart< 3, Refs > Dart;
typedef double Dart_info;
typedef CGAL::Cell_attribute< Refs, int, CGAL::Tag_true > Int_attrib;
typedef CGAL::Cell_attribute< Refs, double, CGAL::Tag_true > Double_attrib;
@ -75,7 +75,7 @@ public:
template < class Refs >
struct Dart_wrapper
{
typedef CGAL::Dart< 3, Refs > Dart;
typedef Map_3_dart_max_items_3 Dart_info;
typedef CGAL::Cell_attribute< Refs, int > Int_attrib;
@ -88,7 +88,7 @@ struct Map_dart_items_4
template < class Refs >
struct Dart_wrapper
{
typedef CGAL::Dart< 4, Refs > Dart;
typedef void Dart_info;
typedef CGAL::Cell_attribute< Refs, int > Int_attrib;
typedef CGAL::Cell_attribute< Refs, double > Double_attrib;
@ -104,7 +104,7 @@ struct Map_dart_max_items_4
template < class Refs >
struct Dart_wrapper
{
typedef CGAL::Dart< 4, Refs > Dart;
typedef char* Dart_info;
typedef CGAL::Cell_attribute< Refs, int > Int_attrib;
typedef CGAL::Cell_attribute< Refs, double > Double_attrib;
@ -115,13 +115,13 @@ struct Map_dart_max_items_4
};
};
typedef CGAL::Combinatorial_map<2, CGAL::Combinatorial_map_min_items<2> > Map1;
typedef CGAL::Combinatorial_map<2, CGAL::Generic_map_min_items > Map1;
typedef CGAL::Combinatorial_map<2, Map_2_dart_items > Map2;
typedef CGAL::Combinatorial_map<2, Map_2_dart_max_items_3> Map3;
typedef CGAL::Combinatorial_map<3, CGAL::Combinatorial_map_min_items<3> > Map4;
typedef CGAL::Combinatorial_map<3, CGAL::Generic_map_min_items > Map4;
typedef CGAL::Combinatorial_map<3, Map_3_dart_items_3> Map5;

View File

@ -9,7 +9,7 @@ struct Myitem
template<class GMap>
struct Dart_wrapper
{
typedef CGAL::GMap_dart<3, GMap> Dart;
typedef void Dart_info;
typedef CGAL::Cell_attribute<GMap, double> Face_attribute; // A weight
typedef CGAL::cpp11::tuple<void,void,Face_attribute> Attributes;
};

View File

@ -25,7 +25,7 @@ struct Myitem
template<class GMap>
struct Dart_wrapper
{
typedef CGAL::GMap_dart<3, GMap> Dart;
typedef void Dart_info;
typedef CGAL::Cell_attribute<GMap, int, CGAL::Tag_true,
Sum_functor, Divide_by_two_functor>
Facet_attribute;
@ -49,7 +49,7 @@ int main()
it=gm.darts().begin(), itend=gm.darts().end();
it!=itend; ++it)
{
if ( it->attribute<2>()==NULL )
if ( gm.attribute<2>(it)==NULL )
gm.set_attribute<2>(it, gm.create_attribute<2>());
}
@ -57,13 +57,13 @@ int main()
for (GMap_3::One_dart_per_incident_cell_range<2, 3>::iterator
it=gm.one_dart_per_incident_cell<2,3>(dh1).begin(),
itend=gm.one_dart_per_incident_cell<2,3>(dh1).end(); it!=itend; ++it)
{ it->attribute<2>()->info()=7; }
{ gm.info<2>(it)=7; }
// 3) Set the color of all facets of the second cube to 19
for (GMap_3::One_dart_per_incident_cell_range<2, 3>::iterator it=
gm.one_dart_per_incident_cell<2,3>(dh2).begin(),
itend=gm.one_dart_per_incident_cell<2,3>(dh2).end(); it!=itend; ++it)
{ it->attribute<2>()->info()=13; }
{ gm.info<2>(it)=13; }
// 4) 3-Sew the two cubes along one facet
gm.sew<3>(dh1, dh2);

View File

@ -27,7 +27,7 @@
#include <CGAL/internal/Generalized_map_internal_functors.h>
#include <CGAL/internal/Generalized_map_sewable.h>
#include <CGAL/Combinatorial_map_functors.h>
#include <CGAL/Generalized_map_min_items.h>
#include <CGAL/Generic_map_min_items.h>
#include <CGAL/GMap_dart_const_iterators.h>
#include <CGAL/GMap_cell_const_iterators.h>
#include <CGAL/Combinatorial_map_basic_operations.h>
@ -59,7 +59,7 @@ namespace CGAL {
* the alpha links, and to manage enabled attributes.
*/
template < unsigned int d_, class Refs,
class Items_=Generalized_map_min_items<d_>,
class Items_=CGAL::Generic_map_min_items,
class Alloc_=CGAL_ALLOCATOR(int),
class Storage_= Generalized_map_storage_1<d_, Items_, Alloc_> >
class Generalized_map_base: public Storage_
@ -88,7 +88,6 @@ namespace CGAL {
typedef typename Base::Dart_handle Dart_handle;
typedef typename Base::Dart_const_handle Dart_const_handle;
typedef typename Base::Dart_container Dart_container;
typedef typename Base::Dart_wrapper Dart_wrapper;
typedef typename Base::size_type size_type;
typedef typename Base::Helper Helper;
typedef typename Base::Attributes Attributes;
@ -116,7 +115,6 @@ namespace CGAL {
using Base::dart_unlink_alpha;
using Base::attribute;
using Base::mattribute_containers;
using Base::get_attribute;
using Base::dart_of_attribute;
using Base::set_dart_of_attribute;
using Base::info_of_attribute;
@ -154,9 +152,6 @@ namespace CGAL {
*/
Generalized_map_base()
{
CGAL_static_assertion_msg(Dart::dimension==dimension,
"Dimension of dart different from dimension of map");
CGAL_static_assertion_msg(Helper::nb_attribs<=dimension+1,
"Too many attributes in the tuple Attributes_enabled");
this->init_storage();
@ -543,10 +538,9 @@ namespace CGAL {
if ( this->template attribute<i>(dh)!=null_handle )
{
this->template get_attribute<i>(this->template attribute<i>(dh)).
dec_nb_refs();
if ( this->template get_attribute<i>(this->template attribute<i>(dh)).
get_nb_refs()==0 )
this->template dec_attribute_ref_counting<i>(this->template attribute<i>(dh));
if ( this->template get_attribute_ref_counting<i>
(this->template attribute<i>(dh))==0 )
this->template erase_attribute<i>(this->template attribute<i>(dh));
}
@ -555,7 +549,7 @@ namespace CGAL {
if ( ah!=null_handle )
{
this->template set_dart_of_attribute<i>(ah, dh);
this->template get_attribute<i>(ah).inc_nb_refs();
this->template inc_attribute_ref_counting<i>(ah);
}
}
@ -1251,7 +1245,7 @@ namespace CGAL {
(mattribute_containers).emplace(args...);
// Reinitialize the ref counting of the new attribute. This is normally
// not required except if create_attribute is used as "copy contructor".
this->template get_attribute<i>(res).mrefcounting = 0;
this->template init_attribute_ref_counting<i>(res);
return res;
}
#else
@ -1273,7 +1267,7 @@ namespace CGAL {
typename Attribute_handle<i>::type res=
CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
(mattribute_containers).emplace(t1);
this->template get_attribute<i>(res).mrefcounting = 0;
this->template init_attribute_ref_counting<i>(res);
return res;
}
template<unsigned int i, typename T1, typename T2>
@ -3874,7 +3868,7 @@ namespace CGAL {
};
template < unsigned int d_,
class Items_=Generalized_map_min_items<d_>,
class Items_=Generic_map_min_items,
class Alloc_=CGAL_ALLOCATOR(int),
class Storage_= Generalized_map_storage_1<d_, Items_, Alloc_> >
class Generalized_map :

View File

@ -1,217 +0,0 @@
// Copyright (c) 2016 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_GENERALIZED_MAP_DART_H
#define CGAL_GENERALIZED_MAP_DART_H 1
#include <CGAL/Compact_container.h>
#include <CGAL/assertions.h>
#include <bitset>
namespace CGAL {
/** @file Generalized_map_dart.h
* Definition of nD dart for generalized maps.
*/
namespace internal {
template <typename Map,unsigned int i>
struct basic_link_alpha_functor;
template <typename CMap,unsigned int i>
struct link_alpha_functor;
}
/** Definition of nD dart.
* The Generalized_map_dart class describes an nD dart (basic element of a
* generalized map). A dart is composed with handle towards its neighbors,
* a bitset containing Boolean marks, and handle towards enabled attributes.
* n is the dimension of the space (2 for 2D, 3 for 3D...)
* Refs the ref class
*/
template <unsigned int d, typename Refs>
struct Generalized_map_dart
{
template < unsigned int, class, class, class, class >
friend class Generalized_map_base;
template < unsigned int, class, class >
friend class Generalized_map_storage_1;
template < unsigned int, class, class >
friend class Generalized_map_storage_2;
template < unsigned int, unsigned int, class, class, class >
friend class GMap_linear_cell_complex_storage_1;
template <class, class, class, class>
friend class Compact_container;
template<class, unsigned int, unsigned int>
friend struct Remove_cell_functor;
template<class, unsigned int>
friend struct Contract_cell_functor;
template <typename, unsigned int>
friend struct internal::link_alpha_functor;
public:
typedef Generalized_map_dart<d,Refs> Self;
typedef typename Refs::Dart_handle Dart_handle;
typedef typename Refs::size_type size_type;
typedef typename Refs::Dart_const_handle Dart_const_handle;
typedef typename Refs::Helper Helper;
/// Typedef for attributes
template<int i>
struct Attribute_handle: public Refs::template Attribute_handle<i>
{};
template<int i>
struct Attribute_const_handle: public Refs::template Attribute_const_handle<i>
{};
/// The number of used marks.
static const size_type NB_MARKS = Refs::NB_MARKS;
/// The dimension of the generalized map.
static const unsigned int dimension = d;
/** Return the alpha of this dart for a given dimension.
* @return alpha(\em i).
*/
template<unsigned int i>
Dart_handle alpha()
{
CGAL_assertion(i <= dimension);
return malpha[i];
}
template<unsigned int i>
Dart_const_handle alpha() const
{
CGAL_assertion(i <= dimension);
return malpha[i];
}
Dart_handle alpha(unsigned int i)
{
CGAL_assertion(i <= dimension);
return malpha[i];
}
Dart_const_handle alpha(unsigned int i) const
{
CGAL_assertion(i <= dimension);
return malpha[i];
}
/// @return a handle on the i-attribute
template<int i>
typename Attribute_handle<i>::type attribute()
{
CGAL_static_assertion_msg( Helper::template Dimension_index<i>::value>=0,
"attribute<i> but i-attributes are disabled.");
return CGAL::cpp0x::get<Helper::template Dimension_index<i>::value>
(mattribute_handles);
}
template<int i>
typename Attribute_const_handle<i>::type attribute() const
{
CGAL_static_assertion_msg( Helper::template Dimension_index<i>::value>=0,
"attribute<i> but i-attributes are disabled.");
return CGAL::cpp0x::get<Helper::template Dimension_index<i>::value>
(mattribute_handles);
}
/** Return the mark value of a given mark number.
* @param amark the mark number.
* @return the value for this number.
*/
bool get_mark(size_type amark) const
{
CGAL_assertion(amark>=0 && amark<NB_MARKS);
return mmarks[amark];
}
/** Set the mark of a given mark number to a given value.
* @param amark the mark number.
* @param AValue the value.
*/
void set_mark(size_type amark, bool avalue) const
{
CGAL_assertion(amark>=0 && amark<NB_MARKS);
mmarks.set(amark, avalue);
}
/** Flip the mark of a given mark number.
* @param amark the mark number.
*/
void flip_mark(size_type amark) const
{
CGAL_assertion(amark>=0 && amark<NB_MARKS);
mmarks.flip(amark);
}
/** Return all the marks of this dart.
* @return the marks.
*/
std::bitset<NB_MARKS> get_marks() const
{ return mmarks; }
/** Set simultaneously all the marks of this dart to a given value.
* @param amarks the value of the marks.
*/
void set_marks(const std::bitset<NB_MARKS>& amarks) const
{ mmarks = amarks; }
protected:
/** Default constructor: no real initialisation,
* because this is done in the generalized map class.
*/
Generalized_map_dart()
{}
/** Copy constructor:
* @param adart a dart.
*/
Generalized_map_dart(const Generalized_map_dart& adart) :
mmarks(adart.mmarks),
mattribute_handles(adart.mattribute_handles)
{
for (unsigned int i = 0; i <= dimension; ++i)
malpha[i] = adart.malpha[i];
}
public:
void * for_compact_container() const
{ return malpha[0].for_compact_container(); }
void * & for_compact_container()
{ return malpha[0].for_compact_container(); }
protected:
/// Alpha for each dimension +1 (from 0 to dimension).
Dart_handle malpha[dimension+1];
/// Values of Boolean marks.
mutable std::bitset<NB_MARKS> mmarks;
/// Attributes enabled
typename Helper::Attribute_handles mattribute_handles;
};
} // namespace CGAL
#endif // CGAL_GENERALIZED_MAP_DART_H //
// EOF //

View File

@ -39,10 +39,14 @@ namespace CGAL {
typedef internal::Combinatorial_map_helper<Self> Helper;
typedef typename Items_::template Dart_wrapper<Self> Dart_wrapper;
typedef typename Dart_wrapper::Dart Dart;
// TODO Define by default Dart_info to void if it does not exist in Dart_wrapper
typedef typename Dart_wrapper::Dart_info Dart_info;
typedef CGAL::Dart<d_, Self, Dart_info> Dart;
typedef typename Alloc_::template rebind<Dart>::other Dart_allocator;
typedef Compact_container<Dart,Dart_allocator> Dart_container;
typedef Compact_container<Dart, Dart_allocator> Dart_container;
typedef typename Dart_container::iterator Dart_handle;
typedef typename Dart_container::const_iterator Dart_const_handle;
@ -102,13 +106,13 @@ namespace CGAL {
{
CGAL_assertion( dh!=NULL );
CGAL_assertion(i <= dimension);
return dh->malpha[i]==dh;
return dh->mf[i]==dh;
}
bool is_free(Dart_const_handle dh, unsigned int i) const
{
CGAL_assertion( dh!=NULL );
CGAL_assertion(i <= dimension);
return dh->malpha[i]==dh;
return dh->mf[i]==dh;
}
/// Set simultaneously all the marks of this dart to a given value.
@ -149,24 +153,24 @@ namespace CGAL {
Dart_handle get_alpha(Dart_handle ADart, int B1)
{
CGAL_assertion(ADart!=NULL && B1>=0 && B1<=(int)dimension);
return ADart->malpha[B1];
return ADart->mf[B1];
}
Dart_const_handle get_alpha(Dart_const_handle ADart, int B1) const
{
CGAL_assertion(ADart!=NULL && B1>=0 && B1<=(int)dimension);
return ADart->malpha[B1];
return ADart->mf[B1];
}
template<int B1>
Dart_handle get_alpha(Dart_handle ADart)
{
CGAL_assertion(ADart!=NULL && B1>=0 && B1<=(int)dimension);
return ADart->malpha[B1];
return ADart->mf[B1];
}
template<int B1>
Dart_const_handle get_alpha(Dart_const_handle ADart) const
{
CGAL_assertion(ADart!=NULL && B1>=0 && B1<=(int)dimension);
return ADart->malpha[B1];
return ADart->mf[B1];
}
// return a handle on the i-attribute
@ -188,6 +192,55 @@ namespace CGAL {
(ADart->mattribute_handles);
}
// Copy a given attribute
template<unsigned int i>
typename Attribute_handle<i>::type copy_attribute
(typename Attribute_const_handle<i>::type ah)
{
CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
"copy_attribute<i> called but i-attributes are disabled.");
typename Attribute_handle<i>::type res=
CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
(mattribute_containers).emplace(*ah);
this->template init_attribute_ref_counting<i>(res);
return res;
}
// Test if a given attribute is valid
template<unsigned int i>
bool is_valid_attribute(typename Attribute_const_handle<i>::type ah) const
{
CGAL_assertion( ah!=NULL );
return ah->is_valid();
}
// accessors and modifiers to the attribute ref counting given its handle
template<unsigned int i>
std::size_t get_attribute_ref_counting
(typename Attribute_const_handle<i>::type ah) const
{
CGAL_assertion( ah!=NULL );
return ah->get_nb_refs();
}
template<unsigned int i>
void init_attribute_ref_counting(typename Attribute_handle<i>::type ah)
{
CGAL_assertion( ah!=NULL );
ah->mrefcounting=0;
}
template<unsigned int i>
void inc_attribute_ref_counting(typename Attribute_handle<i>::type ah)
{
CGAL_assertion( ah!=NULL );
ah->inc_nb_refs();
}
template<unsigned int i>
void dec_attribute_ref_counting(typename Attribute_handle<i>::type ah)
{
CGAL_assertion( ah!=NULL );
ah->dec_nb_refs();
}
// get the attribute given its handle
template<unsigned int i>
typename Attribute_type<i>::type&
@ -204,17 +257,6 @@ namespace CGAL {
return *ah;
}
Dart & get_dart(Dart_handle ah)
{
CGAL_assertion( ah!=NULL );
return *ah;
}
const Dart & get_dart(Dart_const_handle ah) const
{
CGAL_assertion( ah!=NULL );
return *ah;
}
// Get the dart of the given attribute
template<unsigned int i>
Dart_handle dart_of_attribute(typename Attribute_handle<i>::type ah)
@ -239,6 +281,12 @@ namespace CGAL {
ah->set_dart(adart);
}
// Get the information associated with a given dart
typename Dart::Info& info(Dart_handle adart)
{ return adart->info(); }
const typename Dart::Info& info(Dart_const_handle adart) const
{ return adart->info(); }
// Get the info of the given attribute
template<unsigned int i>
typename Attribute_type<i>::type::Info &
@ -288,6 +336,7 @@ namespace CGAL {
return dart_of_attribute<i>(attribute<i>(adart));
}
// Debug function // TODO UPDATE WHEN INDEX IS ADDED IN COMPACT CONTAINER
void display_dart(Dart_const_handle ADart) const
{ std::cout<<&*ADart; }
@ -315,13 +364,13 @@ namespace CGAL {
{
CGAL_assertion(i <= dimension);
CGAL_assertion(adart!=NULL && adart2!=NULL);
adart->malpha[i] = adart2;
adart->mf[i] = adart2;
}
void dart_link_alpha(Dart_handle adart, Dart_handle adart2, unsigned int i)
{
CGAL_assertion(i <= dimension);
CGAL_assertion(adart!=NULL && adart2!=NULL);
adart->malpha[i] = adart2;
adart->mf[i] = adart2;
}
/** Unlink a dart for a given dimension.
@ -332,12 +381,12 @@ namespace CGAL {
void dart_unlink_alpha(Dart_handle adart)
{
CGAL_assertion(adart!=NULL && i <= dimension);
adart->malpha[i] = adart;
adart->mf[i] = adart;
}
void dart_unlink_alpha(Dart_handle adart, unsigned int i)
{
CGAL_assertion(adart!=NULL && i <= dimension);
adart->malpha[i] = adart;
adart->mf[i] = adart;
}
protected:

View File

@ -242,11 +242,10 @@ struct GMap_degroup_attribute_functor_run
// As we split, we set the dart of the first attribute to adart1 for which
// we are sure it belongs to the first i-cell.
amap->template get_attribute<i>(a1).set_dart(adart1);
amap->template set_dart_of_attribute<i>(a1, adart1);
typename CMap::template Attribute_handle<i>::type
a2 = amap->template
create_attribute<i>(amap->template get_attribute<i>(a1));
a2 = amap->template copy_attribute<i>(a1);
amap->template set_attribute<i>(adart2, a2);
CGAL::internal::Call_split_functor<CMap, i>::run(amap, a1, a2);
@ -448,7 +447,8 @@ struct GMap_test_split_attribute_functor_run<CMap, i, j, CGAL::Void>
typename CMap::size_type=CMap::INVALID_MARK)
{}
static void run( CMap*, const std::deque<typename CMap::Dart_handle>&,
const std::deque<typename CMap::Dart_handle>&, typename CMap::size_type=CMap::INVALID_MARK)
const std::deque<typename CMap::Dart_handle>&,
typename CMap::size_type=CMap::INVALID_MARK)
{}
};
// Specialization for i=j.
@ -459,7 +459,8 @@ struct GMap_test_split_attribute_functor_run<CMap, i, i, T>
typename CMap::size_type=CMap::INVALID_MARK)
{}
static void run( CMap*, const std::deque<typename CMap::Dart_handle>&,
const std::deque<typename CMap::Dart_handle>&, typename CMap::size_type=CMap::INVALID_MARK)
const std::deque<typename CMap::Dart_handle>&,
typename CMap::size_type=CMap::INVALID_MARK)
{}
};
// Specialization for i=1 and j=0 (edge attributes are not modified
@ -471,7 +472,8 @@ struct GMap_test_split_attribute_functor_run<CMap, 1, 0, T>
typename CMap::size_type=CMap::INVALID_MARK)
{}
static void run( CMap*, const std::deque<typename CMap::Dart_handle>&,
const std::deque<typename CMap::Dart_handle>&, typename CMap::size_type=CMap::INVALID_MARK)
const std::deque<typename CMap::Dart_handle>&,
typename CMap::size_type=CMap::INVALID_MARK)
{}
};
// ************************************************************************

View File

@ -26,7 +26,7 @@ struct Myitems_2
template <class GMAP>
struct Dart_wrapper
{
typedef CGAL::Generalized_map_dart<2, GMAP> Dart;
typedef void Dart_info;
typedef CGAL::Cell_attribute<GMAP,int,CGAL::Tag_true,Sum_functor,
Divide_by_two_functor> myattrib;
@ -40,7 +40,7 @@ struct Myitems_2c
template <class GMAP>
struct Dart_wrapper
{
typedef CGAL::Generalized_map_dart<2, GMAP> Dart;
typedef int Dart_info;
typedef CGAL::Cell_attribute<GMAP,int,CGAL::Tag_false,Sum_functor,
Divide_by_two_functor> myattrib;
@ -53,7 +53,7 @@ struct Myitems_3
template <class GMAP>
struct Dart_wrapper
{
typedef CGAL::Generalized_map_dart<3, GMAP> Dart;
typedef double* Dart_info;
typedef CGAL::Cell_attribute<GMAP,int,CGAL::Tag_true,Sum_functor,
Divide_by_two_functor> myattrib;
@ -67,7 +67,7 @@ struct Myitems_3c
template <class GMAP>
struct Dart_wrapper
{
typedef CGAL::Generalized_map_dart<3, GMAP> Dart;
typedef void Dart_info;
typedef CGAL::Cell_attribute<GMAP,int,CGAL::Tag_false,Sum_functor,
Divide_by_two_functor> myattrib;
@ -81,7 +81,7 @@ struct Myitems_4
template <class GMAP>
struct Dart_wrapper
{
typedef CGAL::Generalized_map_dart<4, GMAP> Dart;
typedef double Dart_info;
typedef CGAL::Cell_attribute<GMAP,int,CGAL::Tag_true,Sum_functor,
Divide_by_two_functor> myattrib;
@ -95,7 +95,7 @@ struct Myitems_4c
template <class GMAP>
struct Dart_wrapper
{
typedef CGAL::Generalized_map_dart<4, GMAP> Dart;
typedef char* Dart_info;
typedef CGAL::Cell_attribute<GMAP,int,CGAL::Tag_false,Sum_functor,
Divide_by_two_functor> myattrib;

View File

@ -173,7 +173,7 @@ bool import_from_moka(LCC& lcc, const char* filename)
}
}
if ( gdarts[i].dh->attribute<3>() == NULL )
if ( lcc.template attribute<3>(gdarts[i].dh) == NULL )
{
lcc.template set_attribute<3>(gdarts[i].dh, lcc.template create_attribute<3>());
}

View File

@ -153,7 +153,7 @@ public:
template < class Refs >
struct Dart_wrapper
{
typedef CGAL::Combinatorial_map_dart<3, Refs > Dart;
typedef void Dart_info;
typedef CGAL::Cell_attribute_with_point< Refs > Vertex_attrib;
typedef CGAL::Cell_attribute< Refs, Volume_info> Volume_attrib;

View File

@ -1,4 +1,4 @@
#include <CGAL/Linear_cell_complex.h>
#include <CGAL/Linear_cell_complex_for_generalized_map.h>
#include <CGAL/Linear_cell_complex_operations.h>
#include <iostream>
#include <algorithm>

View File

@ -15,7 +15,7 @@ struct Myitem
template<class Refs>
struct Dart_wrapper
{
typedef CGAL::Combinatorial_map_dart<3, Refs > Dart;
typedef void Dart_info;
typedef CGAL::Cell_attribute_with_point< Refs, int, CGAL::Tag_true,
Average_functor >

View File

@ -1,4 +1,4 @@
#include <CGAL/Linear_cell_complex.h>
#include <CGAL/Linear_cell_complex_for_generalized_map.h>
#include <CGAL/Linear_cell_complex_constructors.h>
#include <iostream>
#include <vector>

View File

@ -63,9 +63,9 @@ namespace CGAL {
Functor_on_merge_, Functor_on_split_>,
public Point_for_cell<typename LCC::Point>
{
template < unsigned int, class, class, class, class >
/* template < unsigned int, class, class, class, class >
friend class Combinatorial_map_base;
*/
template <class, class, class, class>
friend class Compact_container;
@ -118,9 +118,9 @@ namespace CGAL {
public Cell_attribute<LCC, void, Tag, Functor_on_merge_, Functor_on_split_>,
public Point_for_cell<typename LCC::Point>
{
template < unsigned int, class, class, class, class >
/* template < unsigned int, class, class, class, class >
friend class Combinatorial_map_base;
*/
template <class, class, class, class>
friend class Compact_container;

View File

@ -55,10 +55,14 @@ namespace CGAL {
typedef internal::Combinatorial_map_helper<Self> Helper;
typedef typename Items_::template Dart_wrapper<Self> Dart_wrapper;
typedef typename Dart_wrapper::Dart Dart;
// TODO Define by default Dart_info to void if it does not exist in Dart_wrapper
typedef typename Dart_wrapper::Dart_info Dart_info;
typedef CGAL::Dart<d_, Self, Dart_info> Dart;
typedef typename Alloc_::template rebind<Dart>::other Dart_allocator;
typedef Compact_container<Dart,Dart_allocator> Dart_container;
typedef Compact_container<Dart, Dart_allocator> Dart_container;
typedef typename Dart_container::iterator Dart_handle;
typedef typename Dart_container::const_iterator Dart_const_handle;
@ -127,13 +131,13 @@ namespace CGAL {
{
CGAL_assertion( dh!=NULL );
CGAL_assertion(i <= dimension);
return dh->malpha[i]==dh;
return dh->mf[i]==dh;
}
bool is_free(Dart_const_handle dh, unsigned int i) const
{
CGAL_assertion( dh!=NULL );
CGAL_assertion(i <= dimension);
return dh->malpha[i]==dh;
return dh->mf[i]==dh;
}
/// Set simultaneously all the marks of this dart to a given value.
@ -174,24 +178,24 @@ namespace CGAL {
Dart_handle get_alpha(Dart_handle ADart, int B1)
{
CGAL_assertion(ADart!=NULL && B1>=0 && B1<=(int)dimension);
return ADart->malpha[B1];
return ADart->mf[B1];
}
Dart_const_handle get_alpha(Dart_const_handle ADart, int B1) const
{
CGAL_assertion(ADart!=NULL && B1>=0 && B1<=(int)dimension);
return ADart->malpha[B1];
return ADart->mf[B1];
}
template<int B1>
Dart_handle get_alpha(Dart_handle ADart)
{
CGAL_assertion(ADart!=NULL && B1>=0 && B1<=(int)dimension);
return ADart->malpha[B1];
return ADart->mf[B1];
}
template<int B1>
Dart_const_handle get_alpha(Dart_const_handle ADart) const
{
CGAL_assertion(ADart!=NULL && B1>=0 && B1<=(int)dimension);
return ADart->malpha[B1];
return ADart->mf[B1];
}
// return a handle on the i-attribute
@ -213,6 +217,55 @@ namespace CGAL {
(ADart->mattribute_handles);
}
// Copy a given attribute
template<unsigned int i>
typename Attribute_handle<i>::type copy_attribute
(typename Attribute_const_handle<i>::type ah)
{
CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
"copy_attribute<i> called but i-attributes are disabled.");
typename Attribute_handle<i>::type res=
CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
(mattribute_containers).emplace(*ah);
this->template init_attribute_ref_counting<i>(res);
return res;
}
// Test if a given attribute is valid
template<unsigned int i>
bool is_valid_attribute(typename Attribute_const_handle<i>::type ah) const
{
CGAL_assertion( ah!=NULL );
return ah->is_valid();
}
// accessors and modifiers to the attribute ref counting given its handle
template<unsigned int i>
std::size_t get_attribute_ref_counting
(typename Attribute_const_handle<i>::type ah) const
{
CGAL_assertion( ah!=NULL );
return ah->get_nb_refs();
}
template<unsigned int i>
void init_attribute_ref_counting(typename Attribute_handle<i>::type ah)
{
CGAL_assertion( ah!=NULL );
ah->mrefcounting=0;
}
template<unsigned int i>
void inc_attribute_ref_counting(typename Attribute_handle<i>::type ah)
{
CGAL_assertion( ah!=NULL );
ah->inc_nb_refs();
}
template<unsigned int i>
void dec_attribute_ref_counting(typename Attribute_handle<i>::type ah)
{
CGAL_assertion( ah!=NULL );
ah->dec_nb_refs();
}
// get the attribute given its handle
template<unsigned int i>
typename Attribute_type<i>::type&
@ -229,17 +282,6 @@ namespace CGAL {
return *ah;
}
Dart & get_dart(Dart_handle ah)
{
CGAL_assertion( ah!=NULL );
return *ah;
}
const Dart & get_dart(Dart_const_handle ah) const
{
CGAL_assertion( ah!=NULL );
return *ah;
}
// Get the dart of the given attribute
template<unsigned int i>
Dart_handle dart_of_attribute(typename Attribute_handle<i>::type ah)
@ -264,6 +306,12 @@ namespace CGAL {
ah->set_dart(adart);
}
// Get the information associated with a given dart
typename Dart::Info& info(Dart_handle adart)
{ return adart->info(); }
const typename Dart::Info& info(Dart_const_handle adart) const
{ return adart->info(); }
// Get the info of the given attribute
template<unsigned int i>
typename Attribute_type<i>::type::Info &
@ -327,6 +375,7 @@ namespace CGAL {
return get_attribute<0>(vh).point();
}
// Debug function // TODO UPDATE WHEN INDEX IS ADDED IN COMPACT CONTAINER
void display_dart(Dart_const_handle ADart) const
{ std::cout<<&*ADart; }
@ -354,13 +403,13 @@ namespace CGAL {
{
CGAL_assertion(i <= dimension);
CGAL_assertion(adart!=NULL && adart2!=NULL);
adart->malpha[i] = adart2;
adart->mf[i] = adart2;
}
void dart_link_alpha(Dart_handle adart, Dart_handle adart2, unsigned int i)
{
CGAL_assertion(i <= dimension);
CGAL_assertion(adart!=NULL && adart2!=NULL);
adart->malpha[i] = adart2;
adart->mf[i] = adart2;
}
/** Unlink a dart for a given dimension.
@ -371,12 +420,12 @@ namespace CGAL {
void dart_unlink_alpha(Dart_handle adart)
{
CGAL_assertion(adart!=NULL && i <= dimension);
adart->malpha[i] = adart;
adart->mf[i] = adart;
}
void dart_unlink_alpha(Dart_handle adart, unsigned int i)
{
CGAL_assertion(adart!=NULL && i <= dimension);
adart->malpha[i] = adart;
adart->mf[i] = adart;
}
protected:

View File

@ -27,9 +27,6 @@
#include <CGAL/Linear_cell_complex_traits.h>
#include <CGAL/Linear_cell_complex_storages.h>
#include <CGAL/Generalized_map.h>
#include <CGAL/GMap_linear_cell_complex_storages.h>
namespace CGAL {
/** @file Linear_cell_complex.h
@ -791,7 +788,11 @@ namespace CGAL {
// template parameters for Refs class which is a combinatorial map.
template < unsigned int d_, unsigned int ambient_dim = d_,
class Traits_ = Linear_cell_complex_traits<ambient_dim>,
class Items_ = Linear_cell_complex_for_combinatorial_map_min_items<d_>,
#ifdef CGAL_CMAP_DEPRECATED
class Items_ = Linear_cell_complex_min_items<d_>,
#else
class Items_ = Linear_cell_complex_min_items,
#endif
class Alloc_ = CGAL_ALLOCATOR(int),
template<unsigned int,class,class,class,class>
class CMap = Combinatorial_map_base,
@ -878,7 +879,11 @@ namespace CGAL {
template < unsigned int d_, unsigned int ambient_dim = d_,
class Traits_ = Linear_cell_complex_traits<ambient_dim>,
class Items_ = Linear_cell_complex_for_combinatorial_map_min_items<d_>,
#ifdef CGAL_CMAP_DEPRECATED
class Items_ = Linear_cell_complex_min_items<d_>,
#else
class Items_ = Linear_cell_complex_min_items,
#endif
class Alloc_ = CGAL_ALLOCATOR(int),
template<unsigned int,class,class,class,class>
class CMap = Combinatorial_map_base,
@ -890,96 +895,6 @@ namespace CGAL {
Alloc_, CMap, Storage_>
{};
// GMap_linear_cell_complex using compact container with handle.
// No difference with class Linear_cell_complex_base except the default
// template parameters for Refs class which is a generalized map.
template < unsigned int d_, unsigned int ambient_dim = d_,
class Traits_ = Linear_cell_complex_traits<ambient_dim>,
class Items_ = Linear_cell_complex_for_generalized_map_min_items<d_>,
class Alloc_ = CGAL_ALLOCATOR(int),
template<unsigned int,class,class,class,class>
class CMap = Generalized_map_base,
class Storage_ = GMap_linear_cell_complex_storage_1<d_, ambient_dim,
Traits_, Items_,
Alloc_> >
class Linear_cell_complex_for_generalized_map:
public Linear_cell_complex_base<d_, ambient_dim, Traits_,
Items_, Alloc_, CMap,
Linear_cell_complex_for_generalized_map
<d_, ambient_dim,
Traits_, Items_,
Alloc_, CMap, Storage_>,
Storage_>
{
public:
typedef Linear_cell_complex_for_generalized_map<d_, ambient_dim,
Traits_, Items_, Alloc_, CMap, Storage_> Self;
typedef Linear_cell_complex_base<d_, ambient_dim,
Traits_, Items_, Alloc_, CMap, Self, Storage_> Base;
typedef Traits_ Traits;
typedef Items_ Items;
typedef Alloc_ Alloc;
static const unsigned int ambient_dimension = Base::ambient_dimension;
static const unsigned int dimension = Base::dimension;
typedef typename Base::Dart_handle Dart_handle;
typedef typename Base::Dart_const_handle Dart_const_handle;
typedef typename Base::Helper Helper;
typedef typename Base::Point Point;
typedef typename Base::Vector Vector;
typedef typename Base::FT FT;
typedef typename Base::Dart_range Dart_range;
typedef typename Base::template Attribute_type<0>::type Vertex_attribute;
typedef typename Base::template Attribute_handle<0>::type
Vertex_attribute_handle;
typedef typename Base::template Attribute_const_handle<0>::type
Vertex_attribute_const_handle;
typedef typename Base::template Attribute_range<0>::type
Vertex_attribute_range;
typedef typename Base::template Attribute_const_range<0>::type
Vertex_attribute_const_range;
typedef typename Base::size_type size_type;
typedef typename Base::Use_index Use_index;
typedef typename Base::Storage Storage;
typedef typename Base::Exception_no_more_available_mark
Exception_no_more_available_mark;
Linear_cell_complex_for_generalized_map() : Base()
{}
/** Copy the given linear cell complex into *this.
* Note that both LCC can have different dimensions and/or non void attributes.
* @param alcc the linear cell complex to copy.
* @post *this is valid.
*/
Linear_cell_complex_for_generalized_map(const Self & alcc) : Base()
{ Base::template copy<Self>(alcc); }
template < class LCC2 >
Linear_cell_complex_for_generalized_map(const LCC2& alcc)
{ Base::template copy<LCC2>(alcc);}
template < class LCC2, typename Converters >
Linear_cell_complex_for_generalized_map(const LCC2& alcc, Converters& converters)
{ Base::template copy<LCC2, Converters>(alcc, converters);}
template < class LCC2, typename Converters, typename Pointconverter >
Linear_cell_complex_for_generalized_map(const LCC2& alcc, Converters& converters,
const Pointconverter& pointconverter)
{ Base::template copy<LCC2, Converters, Pointconverter>
(alcc, converters, pointconverter);}
};
} // namespace CGAL
#endif // CGAL_LINEAR_CELL_COMPLEX_H //

View File

@ -0,0 +1,127 @@
// Copyright (c) 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_LINEAR_CELL_COMPLEX_FOR_GENERALIZED_MAP_H
#define CGAL_LINEAR_CELL_COMPLEX_FOR_GENERALIZED_MAP_H 1
#include <CGAL/Linear_cell_complex.h>
#include <CGAL/Generalized_map.h>
#include <CGAL/GMap_linear_cell_complex_storages.h>
namespace CGAL {
/** @file Linear_cell_complex_for_generalized_map.h
* Definition of a linear cell complex based on generalized map, having points
* associated to all vertices.
*/
// GMap_linear_cell_complex using compact container with handle.
// No difference with class Linear_cell_complex_base except the default
// template parameters for Refs class which is a generalized map.
template < unsigned int d_, unsigned int ambient_dim = d_,
class Traits_ = Linear_cell_complex_traits<ambient_dim>,
class Items_ = Linear_cell_complex_min_items,
class Alloc_ = CGAL_ALLOCATOR(int),
template<unsigned int,class,class,class,class>
class CMap = Generalized_map_base,
class Storage_ = GMap_linear_cell_complex_storage_1<d_, ambient_dim,
Traits_, Items_,
Alloc_> >
class Linear_cell_complex_for_generalized_map:
public Linear_cell_complex_base<d_, ambient_dim, Traits_,
Items_, Alloc_, CMap,
Linear_cell_complex_for_generalized_map
<d_, ambient_dim,
Traits_, Items_,
Alloc_, CMap, Storage_>,
Storage_>
{
public:
typedef Linear_cell_complex_for_generalized_map<d_, ambient_dim,
Traits_, Items_, Alloc_, CMap, Storage_> Self;
typedef Linear_cell_complex_base<d_, ambient_dim,
Traits_, Items_, Alloc_, CMap, Self, Storage_> Base;
typedef Traits_ Traits;
typedef Items_ Items;
typedef Alloc_ Alloc;
static const unsigned int ambient_dimension = Base::ambient_dimension;
static const unsigned int dimension = Base::dimension;
typedef typename Base::Dart_handle Dart_handle;
typedef typename Base::Dart_const_handle Dart_const_handle;
typedef typename Base::Helper Helper;
typedef typename Base::Point Point;
typedef typename Base::Vector Vector;
typedef typename Base::FT FT;
typedef typename Base::Dart_range Dart_range;
typedef typename Base::template Attribute_type<0>::type Vertex_attribute;
typedef typename Base::template Attribute_handle<0>::type
Vertex_attribute_handle;
typedef typename Base::template Attribute_const_handle<0>::type
Vertex_attribute_const_handle;
typedef typename Base::template Attribute_range<0>::type
Vertex_attribute_range;
typedef typename Base::template Attribute_const_range<0>::type
Vertex_attribute_const_range;
typedef typename Base::size_type size_type;
typedef typename Base::Use_index Use_index;
typedef typename Base::Storage Storage;
typedef typename Base::Exception_no_more_available_mark
Exception_no_more_available_mark;
Linear_cell_complex_for_generalized_map() : Base()
{}
/** Copy the given linear cell complex into *this.
* Note that both LCC can have different dimensions and/or non void attributes.
* @param alcc the linear cell complex to copy.
* @post *this is valid.
*/
Linear_cell_complex_for_generalized_map(const Self & alcc) : Base()
{ Base::template copy<Self>(alcc); }
template < class LCC2 >
Linear_cell_complex_for_generalized_map(const LCC2& alcc)
{ Base::template copy<LCC2>(alcc);}
template < class LCC2, typename Converters >
Linear_cell_complex_for_generalized_map(const LCC2& alcc, Converters& converters)
{ Base::template copy<LCC2, Converters>(alcc, converters);}
template < class LCC2, typename Converters, typename Pointconverter >
Linear_cell_complex_for_generalized_map(const LCC2& alcc, Converters& converters,
const Pointconverter& pointconverter)
{ Base::template copy<LCC2, Converters, Pointconverter>
(alcc, converters, pointconverter);}
};
} // namespace CGAL
#endif // CGAL_LINEAR_CELL_COMPLEX_FOR_GENERALIZED_MAP_H //
// EOF //

View File

@ -20,8 +20,10 @@
#ifndef CGAL_LINEAR_CELL_COMPLEX_MIN_ITEMS_H
#define CGAL_LINEAR_CELL_COMPLEX_MIN_ITEMS_H 1
#include <CGAL/Combinatorial_map_dart.h>
#include <CGAL/Generalized_map_dart.h>
#ifdef CGAL_CMAP_DEPRECATED
#include <CGAL/Dart.h>
#endif
#include <CGAL/Cell_attribute_with_point.h>
namespace CGAL {
@ -33,45 +35,36 @@ namespace CGAL {
/** Minimal items for linear cell complexes.
* Linear_cell_complex_min_items defines what is the item class
* for a linear cell complex. It provides definitions for attributes
* associated to vertices (containing points), and darts.
* associated to vertices (containing points), and information associated with darts.
*/
#ifdef CGAL_CMAP_DEPRECATED
template <unsigned int d>
struct Linear_cell_complex_for_combinatorial_map_min_items
struct Linear_cell_complex_min_items
{
/// Dart_wrapper defines the type of darts used.
template <class LCC>
struct Dart_wrapper
{
typedef CGAL::Combinatorial_map_dart<d, LCC> Dart;
typedef CGAL::Dart<d, LCC> Dart;
typedef CGAL::Cell_attribute_with_point<LCC> Vertex_attrib;
typedef CGAL::cpp11::tuple<Vertex_attrib> Attributes;
};
};
/// Old name, kept for backward compatibility
template <unsigned int d>
struct CGAL_DEPRECATED Linear_cell_complex_min_items :
public Linear_cell_complex_for_combinatorial_map_min_items<d>
{};
/** Minimal items for linear cell complexes for GMaps.
* Linear_cell_complex_min_items defines what is the item class
* for a linear cell complex. It provides definitions for attributes
* associated to vertices (containing points), and darts.
*/
template <unsigned int d>
struct Linear_cell_complex_for_generalized_map_min_items
#else
struct Linear_cell_complex_min_items
{
/// Dart_wrapper defines the type of darts used.
template <class LCC>
struct Dart_wrapper
{
typedef CGAL::Generalized_map_dart<d, LCC> Dart;
typedef void Dart_info;
typedef CGAL::Cell_attribute_with_point<LCC> Vertex_attrib;
typedef CGAL::cpp11::tuple<Vertex_attrib> Attributes;
};
};
#endif
} // namespace CGAL

View File

@ -55,10 +55,17 @@ namespace CGAL {
typedef internal::Combinatorial_map_helper<Self> Helper;
typedef typename Items_::template Dart_wrapper<Self> Dart_wrapper;
#ifdef CGAL_CMAP_DEPRECATED
typedef typename Dart_wrapper::Dart Dart;
#else
// TODO Define by default Dart_info to void if it does not exist in Dart_wrapper
typedef typename Dart_wrapper::Dart_info Dart_info;
typedef CGAL::Dart<d_, Self, Dart_info> Dart;
#endif
typedef typename Alloc_::template rebind<Dart>::other Dart_allocator;
typedef Compact_container<Dart,Dart_allocator> Dart_container;
typedef Compact_container<Dart, Dart_allocator> Dart_container;
typedef typename Dart_container::iterator Dart_handle;
typedef typename Dart_container::const_iterator Dart_const_handle;
@ -130,13 +137,13 @@ namespace CGAL {
{
CGAL_assertion( dh!=NULL );
CGAL_assertion(i <= dimension);
return dh->mbeta[i]==null_dart_handle;
return dh->mf[i]==null_dart_handle;
}
bool is_free(Dart_const_handle dh, unsigned int i) const
{
CGAL_assertion( dh!=NULL );
CGAL_assertion(i <= dimension);
return dh->mbeta[i]==null_dart_handle;
return dh->mf[i]==null_dart_handle;
}
/// Set simultaneously all the marks of this dart to a given value.
@ -177,24 +184,24 @@ namespace CGAL {
Dart_handle get_beta(Dart_handle ADart, int B1)
{
CGAL_assertion(ADart!=NULL && B1>=0 && B1<=(int)dimension);
return ADart->mbeta[B1];
return ADart->mf[B1];
}
Dart_const_handle get_beta(Dart_const_handle ADart, int B1) const
{
CGAL_assertion(ADart!=NULL && B1>=0 && B1<=(int)dimension);
return ADart->mbeta[B1];
return ADart->mf[B1];
}
template<int B1>
Dart_handle get_beta(Dart_handle ADart)
{
CGAL_assertion(ADart!=NULL && B1>=0 && B1<=(int)dimension);
return ADart->mbeta[B1];
return ADart->mf[B1];
}
template<int B1>
Dart_const_handle get_beta(Dart_const_handle ADart) const
{
CGAL_assertion(ADart!=NULL && B1>=0 && B1<=(int)dimension);
return ADart->mbeta[B1];
return ADart->mf[B1];
}
// return a handle on the i-attribute
@ -216,6 +223,55 @@ namespace CGAL {
(ADart->mattribute_handles);
}
// Copy a given attribute
template<unsigned int i>
typename Attribute_handle<i>::type copy_attribute
(typename Attribute_const_handle<i>::type ah)
{
CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
"copy_attribute<i> called but i-attributes are disabled.");
typename Attribute_handle<i>::type res=
CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
(mattribute_containers).emplace(*ah);
this->template init_attribute_ref_counting<i>(res);
return res;
}
// Test if a given attribute is valid
template<unsigned int i>
bool is_valid_attribute(typename Attribute_const_handle<i>::type ah) const
{
CGAL_assertion( ah!=NULL );
return ah->is_valid();
}
// accessors and modifiers to the attribute ref counting given its handle
template<unsigned int i>
std::size_t get_attribute_ref_counting
(typename Attribute_const_handle<i>::type ah) const
{
CGAL_assertion( ah!=NULL );
return ah->get_nb_refs();
}
template<unsigned int i>
void init_attribute_ref_counting(typename Attribute_handle<i>::type ah)
{
CGAL_assertion( ah!=NULL );
ah->mrefcounting=0;
}
template<unsigned int i>
void inc_attribute_ref_counting(typename Attribute_handle<i>::type ah)
{
CGAL_assertion( ah!=NULL );
ah->inc_nb_refs();
}
template<unsigned int i>
void dec_attribute_ref_counting(typename Attribute_handle<i>::type ah)
{
CGAL_assertion( ah!=NULL );
ah->dec_nb_refs();
}
// get the attribute given its handle
template<unsigned int i>
typename Attribute_type<i>::type&
@ -232,17 +288,6 @@ namespace CGAL {
return *ah;
}
Dart & get_dart(Dart_handle ah)
{
CGAL_assertion( ah!=NULL );
return *ah;
}
const Dart & get_dart(Dart_const_handle ah) const
{
CGAL_assertion( ah!=NULL );
return *ah;
}
// Get the dart of the given attribute
template<unsigned int i>
Dart_handle dart_of_attribute(typename Attribute_handle<i>::type ah)
@ -267,6 +312,14 @@ namespace CGAL {
ah->set_dart(adart);
}
#ifndef CGAL_CMAP_DEPRECATED
// Get the information associated with a given dart
typename Dart::Info& info(Dart_handle adart)
{ return adart->info(); }
const typename Dart::Info& info(Dart_const_handle adart) const
{ return adart->info(); }
#endif
// Get the info of the given attribute
template<unsigned int i>
typename Attribute_type<i>::type::Info &
@ -330,6 +383,7 @@ namespace CGAL {
return get_attribute<0>(vh).point();
}
// Debug function // TODO UPDATE WHEN INDEX IS ADDED IN COMPACT CONTAINER
void display_dart(Dart_const_handle ADart) const
{ std::cout<<&*ADart; }
@ -358,14 +412,14 @@ namespace CGAL {
CGAL_assertion(i <= dimension);
CGAL_assertion(adart!=NULL && adart2!=NULL);
CGAL_assertion(adart!=null_dart_handle);
adart->mbeta[i] = adart2;
adart->mf[i] = adart2;
}
void dart_link_beta(Dart_handle adart, Dart_handle adart2, unsigned int i)
{
CGAL_assertion(i <= dimension);
CGAL_assertion(adart!=NULL && adart2!=NULL);
CGAL_assertion(adart!=null_dart_handle);
adart->mbeta[i] = adart2;
adart->mf[i] = adart2;
}
/** Unlink a dart for a given dimension.
@ -376,12 +430,12 @@ namespace CGAL {
void dart_unlink_beta(Dart_handle adart)
{
CGAL_assertion(adart!=NULL && i <= dimension);
adart->mbeta[i] = null_dart_handle;
adart->mf[i] = null_dart_handle;
}
void dart_unlink_beta(Dart_handle adart, unsigned int i)
{
CGAL_assertion(adart!=NULL && i <= dimension);
adart->mbeta[i] = null_dart_handle;
adart->mf[i] = null_dart_handle;
}
public:
@ -392,7 +446,7 @@ namespace CGAL {
/// Dart container.
Dart_container mdarts;
/// Container for the null_dart_handle, static data member.
/// Container for the null_dart_handle.
Dart_container mnull_dart_container;
/// Tuple of attributes containers
@ -400,12 +454,12 @@ namespace CGAL {
};
/// null_handle
template <unsigned int d_, unsigned int ambient_dim,
template<unsigned int d_, unsigned int ambient_dim,
class Traits_, class Items_, class Alloc_ >
const typename Linear_cell_complex_storage_1<d_, ambient_dim, Traits_,
Items_, Alloc_>::Null_handle_type
Linear_cell_complex_storage_1<d_, ambient_dim, Traits_,
Items_, Alloc_>::null_handle = NULL;
Items_, Alloc_>::Null_handle_type
Linear_cell_complex_storage_1<d_, ambient_dim, Traits_, Items_, Alloc_>::
null_handle = NULL;
} // namespace CGAL

View File

@ -14,7 +14,7 @@ struct Map_2_dart_items
template < class Refs >
struct Dart_wrapper
{
typedef CGAL::Combinatorial_map_dart< 2, Refs > Dart;
typedef void Dart_info;
typedef CGAL::Cell_attribute< Refs, int > Int_attrib;
typedef CGAL::Cell_attribute< Refs, double > Double_attrib;
@ -30,7 +30,7 @@ struct Map_2_dart_max_items_3
template < class Refs >
struct Dart_wrapper
{
typedef CGAL::Combinatorial_map_dart< 2, Refs > Dart;
typedef double Dart_info;
typedef CGAL::Cell_attribute_with_point< Refs, int > Int_attrib_wp;
typedef CGAL::Cell_attribute< Refs, int > Int_attrib;
@ -47,7 +47,7 @@ struct Map_3_dart_items_3
template < class Refs >
struct Dart_wrapper
{
typedef CGAL::Combinatorial_map_dart< 3, Refs > Dart;
typedef char Dart_info;
typedef CGAL::Cell_attribute< Refs, int > Int_attrib;
typedef CGAL::Cell_attribute< Refs, double > Double_attrib;
@ -64,7 +64,7 @@ struct Map_3_dart_max_items_3
template < class Refs >
struct Dart_wrapper
{
typedef CGAL::Combinatorial_map_dart< 3, Refs > Dart;
typedef char* Dart_info;
typedef CGAL::Cell_attribute_with_point< Refs, int > Int_attrib_wp;
typedef CGAL::Cell_attribute< Refs, int > Int_attrib;
@ -82,7 +82,7 @@ public:
template < class Refs >
struct Dart_wrapper
{
typedef CGAL::Combinatorial_map_dart< 3, Refs > Dart;
typedef int* Dart_info;
typedef CGAL::Cell_attribute_with_point< Refs, int > Int_attrib_wp;
typedef CGAL::Cell_attribute< Refs, int > Int_attrib;
@ -96,7 +96,7 @@ struct Map_dart_items_4
template < class Refs >
struct Dart_wrapper
{
typedef CGAL::Combinatorial_map_dart< 4, Refs > Dart;
typedef Another_map_3_dart_items_3 Dart_info;
typedef CGAL::Cell_attribute_with_point< Refs, int > Int_attrib_wp;
typedef CGAL::Cell_attribute< Refs, int > Int_attrib;
@ -113,7 +113,7 @@ struct Map_dart_max_items_4
template < class Refs >
struct Dart_wrapper
{
typedef CGAL::Combinatorial_map_dart< 4, Refs > Dart;
typedef double Dart_info;
typedef CGAL::Cell_attribute_with_point< Refs, int > Int_attrib_wp;
typedef CGAL::Cell_attribute< Refs, int > Int_attrib;
@ -134,7 +134,7 @@ typedef CGAL::Linear_cell_complex_traits
typedef CGAL::Linear_cell_complex_traits<4> Traits4_a;
// Point_3, void, void
typedef CGAL::Linear_cell_complex_for_combinatorial_map<2,3, Traits3_a, CGAL::Linear_cell_complex_for_combinatorial_map_min_items<2> > Map1;
typedef CGAL::Linear_cell_complex_for_combinatorial_map<2,3, Traits3_a, CGAL::Linear_cell_complex_min_items > Map1;
// Point_3+double, void, double
typedef CGAL::Linear_cell_complex_for_combinatorial_map<2,3, Traits3_a, Map_2_dart_items > Map2;
@ -143,7 +143,7 @@ typedef CGAL::Linear_cell_complex_for_combinatorial_map<2,3, Traits3_a, Map_2_da
typedef CGAL::Linear_cell_complex_for_combinatorial_map<2,3, Traits3_b, Map_2_dart_max_items_3> Map3;
// Point_3, void, void, void
typedef CGAL::Linear_cell_complex_for_combinatorial_map<3,3, Traits3_a, CGAL::Linear_cell_complex_for_combinatorial_map_min_items<3> > Map4;
typedef CGAL::Linear_cell_complex_for_combinatorial_map<3,3, Traits3_a, CGAL::Linear_cell_complex_min_items > Map4;
// Point_3+double, void, int, double
typedef CGAL::Linear_cell_complex_for_combinatorial_map<3,3, Traits3_a, Map_3_dart_items_3> Map5;

View File

@ -23,7 +23,7 @@ struct Myitems_2
template <class LCC>
struct Dart_wrapper
{
typedef CGAL::Combinatorial_map_dart<2, LCC> Dart;
typedef int Dart_info;
typedef CGAL::Cell_attribute_with_point<LCC,int,CGAL::Tag_true,Sum_functor,
Divide_by_two_functor> myattrib;
@ -37,7 +37,7 @@ struct Myitems_2c
template <class LCC>
struct Dart_wrapper
{
typedef CGAL::Combinatorial_map_dart<2, LCC> Dart;
typedef double Dart_info;
typedef CGAL::Cell_attribute_with_point<LCC,int,CGAL::Tag_false,Sum_functor,
Divide_by_two_functor> myattrib;
@ -50,7 +50,7 @@ struct Myitems_3
template <class LCC>
struct Dart_wrapper
{
typedef CGAL::Combinatorial_map_dart<3, LCC> Dart;
typedef void Dart_info;
typedef CGAL::Cell_attribute_with_point<LCC,int,CGAL::Tag_true,Sum_functor,
Divide_by_two_functor> myattrib;
@ -64,7 +64,7 @@ struct Myitems_3c
template <class LCC>
struct Dart_wrapper
{
typedef CGAL::Combinatorial_map_dart<3, LCC> Dart;
typedef char* Dart_info;
typedef CGAL::Cell_attribute_with_point<LCC,int,CGAL::Tag_false,Sum_functor,
Divide_by_two_functor> myattrib;
@ -78,7 +78,7 @@ struct Myitems_4
template <class LCC>
struct Dart_wrapper
{
typedef CGAL::Combinatorial_map_dart<4, LCC> Dart;
typedef Myitems_3c Dart_info;
typedef CGAL::Cell_attribute_with_point<LCC,int,CGAL::Tag_true,Sum_functor,
Divide_by_two_functor> myattrib;
@ -92,7 +92,7 @@ struct Myitems_4c
template <class LCC>
struct Dart_wrapper
{
typedef CGAL::Combinatorial_map_dart<4, LCC> Dart;
typedef void Dart_info;
typedef CGAL::Cell_attribute_with_point<LCC,int,CGAL::Tag_false,Sum_functor,
Divide_by_two_functor> myattrib;