Work to be able to use LCC with GMap as underlying DS (nyf)

This commit is contained in:
Guillaume Damiand 2016-06-17 10:45:25 +02:00
parent 258b8af5a7
commit 0e80ecf8c0
11 changed files with 575 additions and 28 deletions

View File

@ -774,6 +774,32 @@ namespace CGAL {
{ return beta<B2, B3, B4, B5, B6, B7, B8, B9>(beta<B1>(ADart)); }
#endif
// Generic function to iterate on CMap or GMap in a generic way
bool exist_previous_dart_in_face(Dart_const_handle ADart) const
{ return !is_free<0>(ADart); }
bool exist_next_dart_in_face(Dart_const_handle ADart) const
{ return !is_free<1>(ADart); }
template<unsigned int dim>
bool exist_opposite_dart(Dart_const_handle ADart) const
{ return !is_free<dim>(ADart); }
Dart_handle get_previous_dart_in_face(Dart_handle ADart)
{ return beta<0>(ADart); }
Dart_const_handle get_previous_dart_in_face(Dart_const_handle ADart) const
{ return beta<0>(ADart); }
Dart_handle get_next_dart_in_face(Dart_handle ADart)
{ return beta<1>(ADart); }
Dart_const_handle get_next_dart_in_face(Dart_const_handle ADart) const
{ return beta<1>(ADart); }
template<unsigned int dim>
Dart_handle get_opposite_dart(Dart_handle ADart)
{ return beta<dim>(ADart); }
template<unsigned int dim>
Dart_const_handle get_opposite_dart(Dart_const_handle ADart) const
{ return beta<dim>(ADart); }
/** Count the number of used marks.
* @return the number of used marks.
*/
@ -786,7 +812,6 @@ namespace CGAL {
bool is_reserved(size_type amark) const
{
CGAL_assertion(amark<NB_MARKS);
return (mnb_times_reserved_marks[amark]!=0);
}
@ -797,7 +822,6 @@ namespace CGAL {
size_type number_of_marked_darts(size_type amark) const
{
CGAL_assertion( is_reserved(amark) );
return mnb_marked_darts[amark];
}
@ -859,7 +883,6 @@ namespace CGAL {
void share_a_mark(size_type amark) const
{
CGAL_assertion( is_reserved(amark) );
++mnb_times_reserved_marks[amark];
}
@ -869,7 +892,6 @@ namespace CGAL {
size_type get_number_of_times_mark_reserved(size_type amark) const
{
CGAL_assertion( amark<NB_MARKS );
return mnb_times_reserved_marks[amark];
}
@ -4341,7 +4363,7 @@ namespace CGAL {
(beta(it1, dim, CGAL_BETAINV(s1), 2), d2, dim);
}
}
if (are_attributes_automatically_managed() && update_attributes)
if (are_attributes_automatically_managed() && update_attributes && ah!=NULL)
{
internal::Set_i_attribute_of_dart_functor<Self, 0>::run(this, d1, ah);
}

View File

@ -20,7 +20,7 @@
#ifndef CGAL_GMAP_CELL_ITERATORS_H
#define CGAL_GMAP_CELL_ITERATORS_H 1
#include <CGAL/Dart_iterators.h>
#include <CGAL/GMap_dart_iterators.h>
#include <CGAL/Cell_iterators.h>
// TODO do all the orbit iterator of any orbit ?
@ -32,8 +32,126 @@ namespace CGAL {
* - GMap_cell_iterator<Map,i,dim>: one dart per each i-cell
* - GMap_one_dart_per_incident_cell_iterator<Map,Ite,i,dim>
* - GMap_one_dart_per_cell_iterator<Map,Ite,i,dim>
* - one specialisation of the CMap_cell_iterator for the
* GMap_dart_iterator_basic_of_all iterator
*/
//****************************************************************************
/* Class CMap_cell_iterator<Map,GMap_dart_iterator_basic_of_all<Map>,
i,dim,Tag_false>: specialization to iterate onto
* all the cells of the gmap.
*/
template <typename Map_,unsigned int i,unsigned int dim,bool Const>
class CMap_cell_iterator<Map_,GMap_dart_iterator_basic_of_all<Map_,Const>,
i,dim,Const,Tag_false>:
public GMap_dart_iterator_basic_of_all<Map_,Const>
{
public:
typedef GMap_dart_iterator_basic_of_all<Map_,Const> Base;
typedef CMap_cell_iterator<Map_,Base,i,dim,Const,Tag_false> Self;
typedef typename Base::Dart_handle Dart_handle;
typedef typename Base::Map Map;
protected:
/// Unmark all the marked darts during the iterator.
void unmark_treated_darts()
{
if (this->mmap->is_whole_map_unmarked(mmark_number)) return;
this->mmap->negate_mark(mmark_number);
if (this->mmap->is_whole_map_unmarked(mmark_number)) return;
Base::rewind();
mark_cell<Map,i,dim>(*this->mmap, (*this),
mmark_number);
while (this->mmap->number_of_unmarked_darts(mmark_number) > 0)
this->operator++();
this->mmap->negate_mark(mmark_number);
CGAL_assertion(this->mmap->is_whole_map_unmarked(mmark_number));
}
public:
/// Main constructor.
CMap_cell_iterator(Map& amap):
Base(amap),
mmark_number(amap.get_new_mark())
{
CGAL_static_assertion( (boost::is_same<typename Base::Basic_iterator,
Tag_true>::value) );
CGAL_assertion(amap.is_whole_map_unmarked(mmark_number));
mark_cell<Map,i,dim>(amap, (*this), mmark_number);
}
/// Constructor with a dart in parameter (for end iterator).
CMap_cell_iterator(Map& amap, Dart_handle adart):
Base(amap, adart),
mmark_number(amap.get_new_mark())
{
if (adart!=this->mmap->null_handle)
mark_cell<Map,i,dim>(amap, (*this), mmark_number);
}
/// Destructor.
~CMap_cell_iterator()
{
if (this->mmap->get_number_of_times_mark_reserved(mmark_number)==1)
unmark_treated_darts();
this->mmap->free_mark(mmark_number);
this->mmark_number = Map::INVALID_MARK; // To avoid basic class to try to unmark darts.
}
/// Copy constructor.
CMap_cell_iterator(const Self& aiterator):
Base(aiterator),
mmark_number(aiterator.mmark_number)
{ this->mmap->share_a_mark(mmark_number); }
/// Assignment operator.
Self& operator=(const Self& aiterator)
{
if (this != &aiterator)
{
Base::operator=(aiterator);
mmark_number = aiterator.mmark_number;
this->mmap->share_a_mark(mmark_number);
}
return *this;
}
/// Rewind of the iterator to its beginning.
void rewind()
{
unmark_treated_darts();
Base::rewind();
mark_cell<Map,i,dim>(*this->mmap, (*this), mmark_number);
}
/// Postfix ++ operator.
Self operator++(int)
{ Self res=*this; operator ++(); return res; }
/// Prefix ++ operator.
Self& operator++()
{
CGAL_assertion(this->cont());
do
{
Base::operator++();
}
while (this->cont() &&
this->mmap->is_marked((*this), mmark_number));
if (this->cont())
mark_cell<Map,i,dim>(*this->mmap, (*this), mmark_number);
return *this;
}
private:
/// A mark used to mark treated cells.
typename Map::size_type mmark_number;
};
//****************************************************************************
/* Class GMap_cell_iterator<Map,i,dim,Tag_false>: to iterate onto
* all the cells of the gmap.
@ -178,7 +296,7 @@ namespace CGAL {
};
//****************************************************************************
/* Class GMap_one_dart_per_cell_iterator<Map,i,dim>: to iterate onto the
* i-cells incident of the map (one dart by each i-cell).
* i-cells of the map (one dart by each i-cell).
*/
template <typename Map_,unsigned int i,unsigned int dim=Map_::dimension,
bool Const=false>

View File

@ -57,6 +57,9 @@ struct GMap_dart
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;

View File

@ -994,6 +994,16 @@ namespace CGAL {
Base(amap, amap.darts().begin())
{}
/// Constructor with a dart in parameter (for end iterator).
GMap_dart_iterator_basic_of_all(Map& amap, Dart_handle adart):
Base(amap, adart)
{}
/// Constructor with a dart in parameter (for end iterator).
GMap_dart_iterator_basic_of_all(Map& amap, Dart_handle adart,
size_type /*amark*/):
Base(amap, adart)
{}
/// Prefix ++ operator.
Self& operator++()
{

View File

@ -42,6 +42,11 @@
#include <CGAL/config.h>
#if defined( __INTEL_COMPILER )
// Workarounf for warning in function basic_link_beta_0
#pragma warning disable 1017
#endif
namespace CGAL {
/** @file Generalized_map.h
@ -720,6 +725,32 @@ namespace CGAL {
{ return alpha<B2, B3, B4, B5, B6, B7, B8, B9>(alpha<B1>(ADart)); }
#endif
// Generic function to iterate on CMap or GMap in a generic way
bool exist_previous_dart_in_face(Dart_const_handle ADart) const
{ return !is_free<0>(ADart) && !is_free<1>(alpha<0>(ADart)); }
bool exist_next_dart_in_face(Dart_const_handle ADart) const
{ return !is_free<1>(ADart) && !is_free<0>(alpha<1>(ADart)); }
template<unsigned int dim>
bool exist_opposite_dart(Dart_const_handle ADart) const
{ return !is_free<dim>(ADart) && !is_free<0>(alpha<dim>(ADart)); }
Dart_handle get_previous_dart_in_face(Dart_handle ADart)
{ return alpha<1, 0>(ADart); }
Dart_const_handle get_previous_dart_in_face(Dart_const_handle ADart) const
{ return alpha<1, 0>(ADart); }
Dart_handle get_next_dart_in_face(Dart_handle ADart)
{ return alpha<0, 1>(ADart); }
Dart_const_handle get_next_dart_in_face(Dart_const_handle ADart) const
{ return alpha<0, 1>(ADart); }
template<unsigned int dim>
Dart_handle get_opposite_dart(Dart_handle ADart)
{ return alpha<0, dim>(ADart); }
template<unsigned int dim>
Dart_const_handle get_opposite_dart(Dart_const_handle ADart) const
{ return alpha<0, dim>(ADart); }
/** Count the number of used marks.
* @return the number of used marks.
*/
@ -2895,7 +2926,7 @@ namespace CGAL {
{
Dart_handle d1 = create_dart();
Dart_handle d2 = create_dart();
basic_link_alpha(d1, d2, 0);
basic_link_alpha<0>(d1, d2);
return d1;
}
@ -3368,7 +3399,9 @@ namespace CGAL {
insert_cell_1_in_cell_2(GMap& amap,
typename GMap::Dart_handle adart1,
typename GMap::Dart_handle adart2,
bool update_attributes=true)
bool update_attributes=true,
typename Attribute_handle<0>::type
ah=null_handle)
{
if ( adart2!=amap.null_handle)
{
@ -3417,6 +3450,11 @@ namespace CGAL {
amap.template link_alpha<1>(it2, d2);
++it2;
}
if (are_attributes_automatically_managed() && update_attributes && ah!=NULL)
{
internal::Set_i_attribute_of_dart_functor<Self, 0>::run(this, d1, ah);
}
}
if (amap.are_attributes_automatically_managed() && update_attributes)
@ -3455,9 +3493,20 @@ namespace CGAL {
CGAL_assertion( amap.is_valid() );
#endif
return amap.template alpha<1>(adart1);
return amap.template alpha<1,0>(adart1);
}
/** Insert a dangling edge in a 2-cell between given by a dart.
* @param adart1 a first dart of the facet (!=NULL && !=null_dart_handle).
* @param update_attributes a boolean to update the enabled attributes
* @return a dart of the new edge, not incident to the vertex of adart1.
*/
Dart_handle insert_dangling_cell_1_in_cell_2( Dart_handle adart1,
typename Attribute_handle<0>::type
ah=null_handle,
bool update_attributes=true )
{ return insert_cell_1_in_cell_2(adart1, NULL, update_attributes, ah); }
/** Test if a 2-cell can be inserted onto a given 3-cell along
* a path of edges.
* @param amap the used generalized map.

View File

@ -0,0 +1,233 @@
// 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_SAVE_LOAD_H
#define CGAL_GENERALIZED_MAP_SAVE_LOAD_H
#include <boost/foreach.hpp>
#include <boost/property_tree/xml_parser.hpp>
#include <boost/property_tree/ptree.hpp>
#include <boost/lexical_cast.hpp>
#include <CGAL/Generalized_map.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Cell_attribute_with_point.h>
#include <CGAL/Combinatorial_map_save_load.h>
#include <algorithm>
#include <map>
#include <vector>
#include <cstdlib>
#include <iostream>
#include <typeinfo>
/* We reuse the following functions from Combinatorial_map_save_load.h:
* write_cmap_dart_node
* write_cmap_attribute_node
* My_functor_cmap_save_one_attrib
* My_functor_cmap_save_attrib
* cmap_save_attributes
*
* read_cmap_dart_node
* read_cmap_attribute_node
* My_functor_cmap_load_one_attrib
* My_functor_cmap_load_attrib
* cmap_load_attributes
*/
namespace CGAL {
typedef Exact_predicates_inexact_constructions_kernel::Point_3 RPoint_3;
typedef Exact_predicates_exact_constructions_kernel::Point_3 EPoint_3;
// Tags used in xml tree:
// For darts:
// <darts>
// <d> // new dart
// <a i="0"> neighbor dart index for alpha0 </b>
// ...
// <v> value of dart (optional) </v>
// </d>
// ...
// </darts>
// For attributes:
// <attributes>
// <dimension index="1"> // new type of non void attribute
// <type>type of the info associated</type>
// <a> // new attribute
// <d> dart index </d>
// <v> value of attribute </v>
// </a>
// ...
// </attributes>
template < class GMap >
boost::property_tree::ptree gmap_save_darts
(const GMap& amap, std::map<typename GMap::Dart_const_handle, typename GMap::size_type>& myDarts)
{
CGAL_assertion( myDarts.empty() );
// First we numbered each dart by using the std::map.
typename GMap::Dart_range::const_iterator it(amap.darts().begin());
for(typename GMap::size_type num=1; num<=amap.number_of_darts();
++num, ++it)
{
myDarts[it] = num;
}
// make a tree
using boost::property_tree::ptree;
ptree pt;
// Now we save each dart, and its neighbors.
it=amap.darts().begin();
for(typename GMap::size_type num=0; num<amap.number_of_darts(); ++num, ++it)
{
// make a dart node
ptree & ndart = pt.add("d", "");
// the beta, only for non free sews
for(unsigned int dim=0; dim<=amap.dimension; dim++)
{
if(!amap.is_free(it, dim))
{
ptree & currentNext = ndart.add("b", myDarts[amap.alpha(it, dim)]);
currentNext.put("<xmlattr>.i", dim);
}
}
// update property node to add a value node (if user defined its own
// function)
write_cmap_dart_node(ndart, it);
}
return pt;
}
template < class GMap >
bool save_generalized_map(const GMap& amap, std::ostream & output)
{
using boost::property_tree::ptree;
ptree data;
// map dart => number
std::map<typename GMap::Dart_const_handle, typename GMap::size_type> myDarts;
// Get darts
ptree pt_darts;
pt_darts = gmap_save_darts(amap, myDarts);
data.add_child("data.darts",pt_darts);
// Get attributes
ptree pt_attr;
pt_attr = cmap_save_attributes(amap, myDarts);
data.add_child("data.attributes", pt_attr);
// save data in output
write_xml(output, data);
return true;
}
template < class GMap >
bool save_generalized_map(const GMap& amap, const char* filename)
{
std::ofstream output(filename);
if (!output) return false;
return save_generalized_map(amap, output);
}
template < class GMap >
bool gmap_load_darts(boost::property_tree::ptree &pt, GMap& amap,
std::vector<typename GMap::Dart_handle>& myDarts)
{
// use a boost::property_tree
using boost::property_tree::ptree;
// make darts
BOOST_FOREACH( const ptree::value_type &v, pt.get_child("data.darts") )
{
if( v.first == "d" )
myDarts.push_back(amap.create_dart());
}
// update beta links
unsigned int index;
unsigned int currentDartInt = 0;
unsigned int nextDartInt;
BOOST_FOREACH( const ptree::value_type &v, pt.get_child("data.darts") )
{
if( v.first == "d" )
{
BOOST_FOREACH( const ptree::value_type &v2, v.second )
{
if (v2.first == "b")
{
index = v2.second.get("<xmlattr>.i", 0);
nextDartInt = boost::lexical_cast< int >(v2.second.data())-1;
if ( index<=amap.dimension )
{
// A->B
amap.basic_link_alpha(myDarts[currentDartInt],
myDarts[nextDartInt],
index);
//B->A
amap.basic_link_alpha(myDarts[nextDartInt],
myDarts[currentDartInt],
index);
}
}
else if (v2.first=="v")
read_cmap_dart_node(v2,myDarts[currentDartInt]);
}
}
++currentDartInt;
}
return true;
}
template < class GMap >
bool load_generalized_map(std::ifstream & input, GMap& amap)
{
using boost::property_tree::ptree;
ptree pt;
read_xml(input, pt);
std::vector<typename GMap::Dart_handle> myDarts;
gmap_load_darts(pt,amap,myDarts);
cmap_load_attributes(pt,amap,myDarts);
return true;
}
template < class GMap >
bool load_generalized_map(const char* filename, GMap& amap)
{
std::ifstream input(filename);
if (!input) return false;
return load_generalized_map(input, amap);
}
} // namespace CGAL
#endif // CGAL_GENERALIZED_MAP_SAVE_LOAD_H //
// EOF //

View File

@ -279,7 +279,7 @@ struct GMap_degroup_attribute_functor_run<CMap, i, i, T>
// We mark (with mark) all the darts of the i-cell containing adart to
// process them exactly once.
template<typename CMap, unsigned int i>
void test_split_attribute_functor_one_dart
void GMap_test_split_attribute_functor_one_dart
( CMap* amap, typename CMap::Dart_handle adart,
CGAL::Unique_hash_map<typename CMap::template Attribute_handle<i>::type,
unsigned int, typename CMap::Hash_function> &
@ -362,7 +362,7 @@ struct GMap_test_split_attribute_functor_run
it=modified_darts.begin();
for ( ; it!=modified_darts.end(); ++it )
{
CGAL::internal::test_split_attribute_functor_one_dart<CMap,i>
CGAL::internal::GMap_test_split_attribute_functor_one_dart<CMap,i>
(amap, *it, found_attributes, mark);
}
@ -406,14 +406,14 @@ struct GMap_test_split_attribute_functor_run
it=modified_darts.begin();
for ( ; it!=modified_darts.end(); ++it )
{
CGAL::internal::test_split_attribute_functor_one_dart<CMap,i>
CGAL::internal::GMap_test_split_attribute_functor_one_dart<CMap,i>
(amap, *it, found_attributes, mark);
}
typename std::deque<typename CMap::Dart_handle>::const_iterator
it2=modified_darts2.begin();
for ( ; it2!=modified_darts2.end(); ++it2 )
{
CGAL::internal::test_split_attribute_functor_one_dart<CMap,i>
CGAL::internal::GMap_test_split_attribute_functor_one_dart<CMap,i>
(amap, *it2, found_attributes, mark);
}

View File

@ -50,6 +50,8 @@ if ( CGAL_FOUND )
${MAP_VIEWER_LIBRARIES})
# qt5_use_modules(voronoi_3 ${MAP_VIEWER_MODULES})
create_single_source_cgal_program( "gmap_linear_cell_complex_3.cpp" )
else()
message(STATUS "This program requires the CGAL library, "

View File

@ -27,6 +27,9 @@
#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
@ -110,8 +113,6 @@ namespace CGAL {
/// To use previous definition of create_dart methods.
using Base::create_dart;
using Base::beta;
using Base::is_free;
using Base::attribute;
using Base::null_handle;
using Base::point_of_vertex_attribute;
@ -457,8 +458,9 @@ namespace CGAL {
typename std::vector<Dart_handle>::iterator it2=it1;
for ( ++it2; it2!= it1end; ++it2 )
{
if ( *it1!=*it2 && is_free(*it1, 3) &&
is_free(*it2, 3) &&
if ( *it1!=*it2 &&
!this->template exist_opposite_dart<3>(*it1) &&
!this->template exist_opposite_dart<3>(*it2) &&
are_facets_same_geometry(*it1,beta(*it2, 0)) )
{
++res;
@ -494,7 +496,7 @@ namespace CGAL {
{
Dart_handle d1 = this->make_edge();
set_vertex_attribute_of_dart(d1,h0);
set_vertex_attribute_of_dart(beta(d1, 2),h1);
set_vertex_attribute_of_dart(this->other_extremity(d1),h1);
return d1;
}
@ -523,8 +525,8 @@ namespace CGAL {
Dart_handle d1 = this->make_combinatorial_polygon(3);
set_vertex_attribute_of_dart(d1,h0);
set_vertex_attribute_of_dart(beta(d1, 1),h1);
set_vertex_attribute_of_dart(beta(d1, 0),h2);
set_vertex_attribute_of_dart(this->get_next_dart_in_face(d1),h1);
set_vertex_attribute_of_dart(this->get_previous_dart_in_face(d1),h2);
return d1;
}
@ -559,9 +561,10 @@ namespace CGAL {
Dart_handle d1 = this->make_combinatorial_polygon(4);
set_vertex_attribute_of_dart(d1,h0);
set_vertex_attribute_of_dart(beta(d1, 1),h1);
set_vertex_attribute_of_dart(beta(d1, 1, 1),h2);
set_vertex_attribute_of_dart(beta(d1, 0),h3);
set_vertex_attribute_of_dart(this->get_next_dart_in_face(d1),h1);
set_vertex_attribute_of_dart(this->get_next_dart_in_face
(this->get_next_dart_in_face(d1)), h2);
set_vertex_attribute_of_dart(this->get_previous_dart_in_face(d1),h3);
return d1;
}
@ -838,7 +841,7 @@ namespace CGAL {
// Linear_cell_complex using compact container with handle.
// No difference with class Linear_cell_complex_base except the default
// template parameters for Refs class.
// 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_min_items<d_>,
@ -923,6 +926,93 @@ namespace CGAL {
};
// 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_ = GMap_linear_cell_complex_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 GMap_linear_cell_complex: public Linear_cell_complex_base<d_,
ambient_dim, Traits_, Items_, Alloc_, CMap,
GMap_linear_cell_complex<d_, ambient_dim,
Traits_, Items_, Alloc_, CMap, Storage_>,
Storage_>
{
public:
typedef GMap_linear_cell_complex<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;
GMap_linear_cell_complex() : 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.
*/
GMap_linear_cell_complex(const Self & alcc) : Base()
{ Base::template copy<Self>(alcc); }
template < class LCC2 >
GMap_linear_cell_complex(const LCC2& alcc)
{ Base::template copy<LCC2>(alcc);}
template < class LCC2, typename Converters >
GMap_linear_cell_complex(const LCC2& alcc, Converters& converters)
{ Base::template copy<LCC2, Converters>(alcc, converters);}
template < class LCC2, typename Converters, typename Pointconverter >
GMap_linear_cell_complex(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

@ -21,6 +21,7 @@
#define CGAL_LINEAR_CELL_COMPLEX_MIN_ITEMS_H 1
#include <CGAL/Dart.h>
#include <CGAL/GMap_dart.h>
#include <CGAL/Cell_attribute_with_point.h>
namespace CGAL {
@ -32,7 +33,7 @@ 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 darts.
*/
template <unsigned int d>
struct Linear_cell_complex_min_items
@ -43,7 +44,26 @@ namespace CGAL {
{
typedef CGAL::Dart<d, LCC> Dart;
typedef Cell_attribute_with_point<LCC> Vertex_attrib;
typedef Cell_attribute_with_point<LCC> Vertex_attrib;
typedef CGAL::cpp11::tuple<Vertex_attrib> Attributes;
};
};
/** 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 GMap_linear_cell_complex_min_items
{
/// Dart_wrapper defines the type of darts used.
template <class LCC>
struct Dart_wrapper
{
typedef CGAL::GMap_dart<d, LCC> Dart;
typedef Cell_attribute_with_point<LCC> Vertex_attrib;
typedef CGAL::cpp11::tuple<Vertex_attrib> Attributes;
};
};

View File

@ -38,7 +38,7 @@ namespace CGAL {
// Copy of Combinatorial_map_storage_1 and add new types related
// to geometry (not possible to inherith because we use Self type
// as template parameter of Dart_wrapper. If we inherit, Self is not
// the correct type.)
// the correct type).
template<unsigned int d_, unsigned int ambient_dim,
class Traits_, class Items_, class Alloc_ >
class Linear_cell_complex_storage_1