Add forward declaration files for CMap, GMap, LCC, Polygonal_schema. Improve copy methods for CMap and GMap to deal with const and non const cases.

This commit is contained in:
Guillaume Damiand 2020-03-27 18:35:15 +01:00
parent 2fd672f852
commit 0308d1a1bb
14 changed files with 526 additions and 254 deletions

View File

@ -14,6 +14,8 @@
#include <CGAL/disable_warnings.h>
#include <CGAL/Combinatorial_map_fwd.h>
#include <CGAL/internal/Combinatorial_map_internal_functors.h>
#include <CGAL/internal/Combinatorial_map_utility.h>
#include <CGAL/internal/Combinatorial_map_group_functors.h>
@ -80,14 +82,8 @@ namespace CGAL {
* mainly to create darts, to use marks onto these darts, to get and set
* the beta links, and to manage enabled attributes.
*/
template < unsigned int d_, class Refs,
#if defined(CGAL_CMAP_DART_DEPRECATED) && !defined(CGAL_NO_DEPRECATED_CODE)
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_> >
template < unsigned int d_, class Refs_, class Items_,
class Alloc_, class Storage_ >
class Combinatorial_map_base: public Storage_
{
template<typename CMap,unsigned int i,typename Enabled>
@ -114,9 +110,10 @@ namespace CGAL {
typedef Combinatorial_map_tag Combinatorial_data_structure;
/// Types definition
typedef Storage_ Storage;
typedef Storage Base;
typedef Combinatorial_map_base<d_, Refs, Items_, Alloc_, Storage_ > Self;
typedef Storage_ Storage;
typedef Storage Base;
typedef Combinatorial_map_base<d_, Refs_, Items_, Alloc_, Storage_ > Self;
typedef Refs_ Refs;
typedef typename Base::Dart Dart;
typedef typename Base::Dart_handle Dart_handle;
typedef typename Base::Dart_const_handle Dart_const_handle;
@ -211,28 +208,24 @@ namespace CGAL {
CGAL_assertion(number_of_darts()==0);
}
/** Copy the given combinatorial map 'amap' into *this.
* Note that both CMap can have different dimensions and/or non void attributes.
* Here CMap2 is necessarily non const; while Dart_handle_2 can be a const or non const handle.
* This is the "generic" method, called by the different variants below.
* @param amap the combinatorial map to copy.
* @post *this is valid.
*/
template <unsigned int d2, typename Refs2, typename Items2, typename Alloc2,
typename Storage2,
template <typename CMap2, typename Dart_handle_2,
typename Converters, typename DartInfoConverter,
typename PointConverter>
void copy(Combinatorial_map_base<d2, Refs2, Items2, Alloc2, Storage2>& amap,
const Converters& converters,
const DartInfoConverter& dartinfoconverter,
const PointConverter& pointconverter,
boost::unordered_map
<typename Combinatorial_map_base<d2, Refs2, Items2, Alloc2, Storage2>::
Dart_handle, Dart_handle>* origin_to_copy,
boost::unordered_map
<Dart_handle, typename Combinatorial_map_base<d2, Refs2, Items2,
Alloc2, Storage2>::Dart_handle>* copy_to_origin)
void generic_copy(CMap2& amap,
const Converters& converters,
const DartInfoConverter& dartinfoconverter,
const PointConverter& pointconverter,
boost::unordered_map<Dart_handle_2, Dart_handle>* origin_to_copy=nullptr,
boost::unordered_map<Dart_handle, Dart_handle_2>* copy_to_origin=nullptr)
{
typedef Combinatorial_map_base<d2, Refs2, Items2, Alloc2, Storage2> CMap2;
this->clear();
this->mnb_used_marks = amap.mnb_used_marks;
@ -254,15 +247,13 @@ namespace CGAL {
// Create an mapping between darts of the two maps (originals->copies).
// (here we cannot use CGAL::Unique_hash_map because it does not provide
// iterators...
boost::unordered_map<typename CMap2::Dart_handle, Dart_handle>
local_dartmap;
if (origin_to_copy==NULL) // Used local_dartmap if user does not provides its own unordered_map
boost::unordered_map<Dart_handle_2, Dart_handle> local_dartmap;
if (origin_to_copy==NULL) // Use local_dartmap if user does not provides its own unordered_map
{ origin_to_copy=&local_dartmap; }
Dart_handle new_dart;
for (typename CMap2::Dart_range::iterator
it=amap.darts().begin(), itend=amap.darts().end();
it!=itend; ++it)
for (typename CMap2::Dart_range::iterator it=amap.darts().begin(),
itend=amap.darts().end(); it!=itend; ++it)
{
new_dart=mdarts.emplace();
init_dart(new_dart, amap.get_marks(it));
@ -270,15 +261,16 @@ namespace CGAL {
(*origin_to_copy)[it]=new_dart;
if (copy_to_origin!=NULL) { (*copy_to_origin)[new_dart]=it; }
internal::Copy_dart_info_functor<Refs2, Refs, DartInfoConverter>::run
(static_cast<const Refs2&>(amap), static_cast<Refs&>(*this),
internal::Copy_dart_info_functor
<typename CMap2::Refs, Refs, DartInfoConverter>::run
(static_cast<typename CMap2::Refs&>(amap), static_cast<Refs&>(*this),
it, new_dart, dartinfoconverter);
}
unsigned int min_dim=(dimension<amap.dimension?dimension:amap.dimension);
typename boost::unordered_map<typename CMap2::Dart_handle,Dart_handle>
::iterator dartmap_iter, dartmap_iter_end=origin_to_copy->end();
typename boost::unordered_map<Dart_handle_2,Dart_handle>::iterator
dartmap_iter, dartmap_iter_end=origin_to_copy->end();
for (dartmap_iter=origin_to_copy->begin(); dartmap_iter!=dartmap_iter_end;
++dartmap_iter)
{
@ -298,9 +290,9 @@ namespace CGAL {
++dartmap_iter)
{
Helper::template Foreach_enabled_attributes
< internal::Copy_attributes_functor <Refs2, Refs, Converters,
PointConverter> >::
run(static_cast<const Refs2&>(amap), static_cast<Refs&>(*this),
< internal::Copy_attributes_functor<typename CMap2::Refs, Refs,
Converters, PointConverter> >::
run(static_cast<const typename CMap2::Refs&>(amap), static_cast<Refs&>(*this),
dartmap_iter->first, dartmap_iter->second,
converters, pointconverter);
}
@ -308,61 +300,124 @@ namespace CGAL {
CGAL_assertion (is_valid());
}
template <unsigned int d2, typename Refs2, typename Items2, typename Alloc2,
typename Storage2>
void copy(Combinatorial_map_base<d2, Refs2, Items2, Alloc2, Storage2>& amap,
boost::unordered_map
<typename Combinatorial_map_base<d2, Refs2, Items2, Alloc2,
Storage2>::Dart_handle, Dart_handle>* origin_to_copy,
boost::unordered_map
<Dart_handle, typename Combinatorial_map_base<d2, Refs2, Items2,
Alloc2, Storage2>::Dart_handle>* copy_to_origin)
{
CGAL::cpp11::tuple<> converters;
Default_converter_dart_info<Refs2, Refs> dartinfoconverter;
Default_converter_cmap_0attributes_with_point<Refs2, Refs> pointconverter;
copy(amap, converters, dartinfoconverter, pointconverter,
origin_to_copy, copy_to_origin);
}
template <unsigned int d2, typename Refs2, typename Items2, typename Alloc2,
typename Storage2, typename Converters>
void copy(Combinatorial_map_base<d2, Refs2, Items2,
Alloc2, Storage2>& amap,
// (1a) copy(amap, converters, dartinfoconverter, pointconverter)
template<typename CMap2, typename Converters, typename DartInfoConverter,
typename PointConverter>
void copy(CMap2& amap,
const Converters& converters,
const DartInfoConverter& dartinfoconverter,
const PointConverter& pointconverter,
boost::unordered_map
<typename Combinatorial_map_base<d2, Refs2, Items2, Alloc2,
Storage2>::Dart_handle, Dart_handle>* origin_to_copy,
<typename CMap2::Dart_handle, Dart_handle>* origin_to_copy=nullptr,
boost::unordered_map
<Dart_handle, typename Combinatorial_map_base<d2, Refs2, Items2,
Alloc2, Storage2>::Dart_handle>* copy_to_origin)
<Dart_handle, typename CMap2::Dart_handle>* copy_to_origin=nullptr)
{
Default_converter_cmap_0attributes_with_point<Refs2, Refs> pointconverter;
Default_converter_dart_info<Refs2, Refs> dartinfoconverter;
copy(amap, converters, dartinfoconverter, pointconverter,
generic_copy<CMap2, typename CMap2::Dart_handle, Converters,
DartInfoConverter, PointConverter>
(amap, converters, dartinfoconverter, pointconverter,
origin_to_copy, copy_to_origin);
}
template <unsigned int d2, typename Refs2, typename Items2, typename Alloc2,
typename Storage2,
typename Converters, typename DartInfoConverter>
void copy(Combinatorial_map_base<d2, Refs2, Items2,
Alloc2, Storage2>& amap,
// (1b) copy(const amap, converters, dartinfoconverter, pointconverter)
template<typename CMap2, typename Converters, typename DartInfoConverter,
typename PointConverter>
void copy(const CMap2& amap,
const Converters& converters,
const DartInfoConverter& dartinfoconverter,
const PointConverter& pointconverter,
boost::unordered_map
<typename CMap2::Dart_const_handle, Dart_handle>* origin_to_copy=nullptr,
boost::unordered_map
<Dart_handle, typename CMap2::Dart_const_handle>* copy_to_origin=nullptr)
{
generic_copy<CMap2, typename CMap2::Dart_const_handle, Converters,
DartInfoConverter, PointConverter>
(const_cast<CMap2&>(amap), converters, dartinfoconverter,
pointconverter, origin_to_copy, copy_to_origin);
}
// (2a) copy(amap, converters, dartinfoconverter)
template<typename CMap2, typename Converters, typename DartInfoConverter>
void copy(CMap2& amap,
const Converters& converters,
const DartInfoConverter& dartinfoconverter,
boost::unordered_map
<typename Combinatorial_map_base<d2, Refs2, Items2, Alloc2,
Storage2>::Dart_handle, Dart_handle>* origin_to_copy,
<typename CMap2::Dart_handle, Dart_handle>* origin_to_copy=nullptr,
boost::unordered_map
<Dart_handle, typename Combinatorial_map_base<d2, Refs2, Items2,
Alloc2, Storage2>::Dart_handle>* copy_to_origin)
<Dart_handle, typename CMap2::Dart_handle>* copy_to_origin=nullptr)
{
Default_converter_cmap_0attributes_with_point<Refs2, Refs> pointconverter;
Default_converter_cmap_0attributes_with_point<typename CMap2::Refs, Refs>
pointconverter;
copy(amap, converters, dartinfoconverter, pointconverter,
origin_to_copy, copy_to_origin);
}
// (2b) copy(const amap, converters, dartinfoconverter)
template <typename CMap2, typename Converters, typename DartInfoConverter>
void copy(const CMap2& amap,
const Converters& converters,
const DartInfoConverter& dartinfoconverter,
boost::unordered_map
<typename CMap2::Dart_const_handle, Dart_handle>* origin_to_copy=nullptr,
boost::unordered_map
<Dart_handle, typename CMap2::Dart_const_handle>* copy_to_origin=nullptr)
{
Default_converter_cmap_0attributes_with_point<typename CMap2::Refs, Refs>
pointconverter;
copy(amap, converters, dartinfoconverter, pointconverter,
origin_to_copy, copy_to_origin);
}
// (3a) copy(amap, converters)
template<typename CMap2, typename Converters>
void copy(CMap2& amap,
const Converters& converters,
boost::unordered_map
<typename CMap2::Dart_handle, Dart_handle>* origin_to_copy=nullptr,
boost::unordered_map
<Dart_handle, typename CMap2::Dart_handle>* copy_to_origin=nullptr)
{
Default_converter_dart_info<typename CMap2::Refs, Refs> dartinfoconverter;
copy(amap, converters, dartinfoconverter, origin_to_copy, copy_to_origin);
}
// (3b) copy(const amap, converters)
template <typename CMap2, typename Converters>
void copy(const CMap2& amap,
const Converters& converters,
boost::unordered_map
<typename CMap2::Dart_const_handle, Dart_handle>* origin_to_copy=nullptr,
boost::unordered_map
<Dart_handle, typename CMap2::Dart_const_handle>* copy_to_origin=nullptr)
{
Default_converter_dart_info<typename CMap2::Refs, Refs> dartinfoconverter;
copy(amap, converters, dartinfoconverter, origin_to_copy, copy_to_origin);
}
// (4a) copy(amap)
template<typename CMap2>
void copy(CMap2& amap,
boost::unordered_map
<typename CMap2::Dart_handle, Dart_handle>* origin_to_copy=nullptr,
boost::unordered_map
<Dart_handle, typename CMap2::Dart_handle>* copy_to_origin=nullptr)
{
CGAL::cpp11::tuple<> converters;
copy(amap, converters, origin_to_copy, copy_to_origin);
}
// (4b) copy(const amap)
template <typename CMap2>
void copy(const CMap2& amap,
boost::unordered_map
<typename CMap2::Dart_const_handle, Dart_handle>* origin_to_copy=nullptr,
boost::unordered_map
<Dart_handle, typename CMap2::Dart_const_handle>* copy_to_origin=nullptr)
{
CGAL::cpp11::tuple<> converters;
copy(amap, converters, origin_to_copy, copy_to_origin);
}
// Copy constructor from a map having exactly the same type.
Combinatorial_map_base (const Self & amap)
{ copy(amap); }
@ -4648,14 +4703,7 @@ namespace CGAL {
typename Helper::Merge_functors m_onmerge_functors;
};
template < unsigned int d_,
#if defined(CGAL_CMAP_DART_DEPRECATED) && !defined(CGAL_NO_DEPRECATED_CODE)
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_> >
template < unsigned int d_, class Items_, class Alloc_, class Storage_ >
class Combinatorial_map :
public Combinatorial_map_base<d_,
Combinatorial_map<d_,Items_,Alloc_, Storage_>,

View File

@ -0,0 +1,51 @@
// Copyright (c) 2010-2011 CNRS and LIRIS' Establishments (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org)
//
// $URL$
// $Id$
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
//
// Author(s) : Guillaume Damiand <guillaume.damiand@liris.cnrs.fr>
//
#ifndef COMBINATORIAL_MAP_FWD_H
#define COMBINATORIAL_MAP_FWD_H 1
#include <CGAL/memory.h>
namespace CGAL {
#if defined(CGAL_CMAP_DART_DEPRECATED) && !defined(CGAL_NO_DEPRECATED_CODE)
template <unsigned int d>
struct Combinatorial_map_min_items;
#else
struct Generic_map_min_items;
#endif
template<unsigned int d_, class Items_, class Alloc_ >
class Combinatorial_map_storage_1;
template < unsigned int d_, class Refs_,
#if defined(CGAL_CMAP_DART_DEPRECATED) && !defined(CGAL_NO_DEPRECATED_CODE)
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;
template < unsigned int d_,
#if defined(CGAL_CMAP_DART_DEPRECATED) && !defined(CGAL_NO_DEPRECATED_CODE)
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;
} // CGAL
#endif // COMBINATORIAL_MAP_FWD_H

View File

@ -17,54 +17,14 @@
#include <CGAL/internal/Combinatorial_map_internal_functors.h>
#include <CGAL/Polyhedron_3_fwd.h>
#include <CGAL/Surface_mesh/Surface_mesh_fwd.h>
#include <CGAL/Combinatorial_map_fwd.h>
#include <CGAL/Generalized_map_fwd.h>
#include <CGAL/Linear_cell_complex_fwd.h>
#include <CGAL/Polygonal_schema_fwd.h>
#include <bitset>
namespace CGAL
{
// Forward declarations of all classes model of Face_graph
template <unsigned int d, typename Refs, typename Items, typename Alloc,
typename Storage>
class Combinatorial_map_base;
template <unsigned int d, typename Refs, typename Items, typename Alloc,
typename Storage>
class Generalized_map_base;
template <unsigned int d, unsigned int d2, typename Traits, typename Items,
typename Alloc,
template<unsigned int,class,class,class,class>
class Map, typename Refs, typename Storage>
class Linear_cell_complex_base;
template <unsigned int d, typename Items, typename Alloc,
typename Storage>
class Combinatorial_map;
template <unsigned int d, typename Items, typename Alloc,
typename Storage>
class Generalized_map;
template <unsigned int d, unsigned int d2, typename Traits, typename Items,
typename Alloc,
template<unsigned int,class,class,class,class>
class Map, typename Storage>
class Linear_cell_complex_for_combinatorial_map;
template <unsigned int d, unsigned int d2, typename Traits, typename Items,
typename Alloc,
template<unsigned int,class,class,class,class>
class Map, typename Storage>
class Linear_cell_complex_for_generalized_map;
namespace Surface_mesh_topology
{
template <typename Items, typename Alloc, typename Storage>
class Polygonal_schema_with_combinatorial_map;
template <typename Items, typename Alloc, typename Storage>
class Polygonal_schema_with_generalized_map;
}
////////////////////////////////////////////////////////////////////////////////
/** Class Face_graph_wrapper: to wrap any model of FaceGraph into a
* Combinatorial map. For now, only for const models, i.e. does not support
@ -77,6 +37,7 @@ public:
typedef HEG_ HEG;
typedef Face_graph_wrapper<HEG> Self;
typedef std::size_t size_type;
typedef Self Refs;
struct Dart_container
{

View File

@ -12,6 +12,7 @@
#ifndef CGAL_GENERALIZED_MAP_H
#define CGAL_GENERALIZED_MAP_H 1
#include <CGAL/Generalized_map_fwd.h>
#include <CGAL/internal/Combinatorial_map_utility.h>
#include <CGAL/internal/Generalized_map_group_functors.h>
#include <CGAL/internal/Combinatorial_map_copy_functors.h>
@ -58,10 +59,7 @@ namespace CGAL {
* mainly to create darts, to use marks onto these darts, to get and set
* the alpha links, and to manage enabled attributes.
*/
template < unsigned int d_, class Refs,
class Items_=Generic_map_min_items,
class Alloc_=CGAL_ALLOCATOR(int),
class Storage_= Generalized_map_storage_1<d_, Items_, Alloc_> >
template<unsigned int d_, class Refs_, class Items_, class Alloc_, class Storage_>
class Generalized_map_base: public Storage_
{
template<typename Gmap,unsigned int i,typename Enabled>
@ -84,9 +82,10 @@ namespace CGAL {
typedef Generalized_map_tag Combinatorial_data_structure;
/// Types definition
typedef Storage_ Storage;
typedef Storage Base;
typedef Generalized_map_base<d_, Refs, Items_, Alloc_, Storage_ > Self;
typedef Storage_ Storage;
typedef Storage Base;
typedef Generalized_map_base<d_, Refs_, Items_, Alloc_, Storage_ > Self;
typedef Refs_ Refs;
typedef typename Base::Dart Dart;
typedef typename Base::Dart_handle Dart_handle;
@ -178,25 +177,21 @@ namespace CGAL {
/** Copy the given generalized map into *this.
* Note that both Gmap can have different dimensions and/or non void attributes.
* Here CMap2 is necessarily non const; while Dart_handle_2 can be a const or non const handle.
* This is the "generic" method, called by the different variants below.
* @param amap the generalized map to copy.
* @post *this is valid.
*/
template <unsigned int d2, typename Refs2, typename Items2, typename Alloc2,
typename Storage2,
typename Converters, typename DartInfoConverter,
template <typename GMap2, typename Dart_handle_2,
typename Converters, typename DartInfoConverter,
typename PointConverter>
void copy(Generalized_map_base<d2, Refs2, Items2, Alloc2, Storage2>& amap,
const Converters& converters,
const DartInfoConverter& dartinfoconverter,
const PointConverter& pointconverter,
boost::unordered_map
<typename Generalized_map_base<d2, Refs2, Items2, Alloc2, Storage2>::
Dart_handle, Dart_handle>* origin_to_copy,
boost::unordered_map
<Dart_handle, typename Generalized_map_base<d2, Refs2, Items2,
Alloc2, Storage2>::Dart_handle>* copy_to_origin)
void generic_copy(GMap2& amap,
const Converters& converters,
const DartInfoConverter& dartinfoconverter,
const PointConverter& pointconverter,
boost::unordered_map<Dart_handle_2, Dart_handle>* origin_to_copy=nullptr,
boost::unordered_map<Dart_handle, Dart_handle_2>* copy_to_origin=nullptr)
{
typedef Generalized_map_base<d2, Refs2, Items2, Alloc2, Storage2> GMap2;
this->clear();
this->mnb_used_marks = amap.mnb_used_marks;
@ -216,15 +211,13 @@ namespace CGAL {
// Create an mapping between darts of the two maps (originals->copies).
// (here we cannot use CGAL::Unique_hash_map because it does not provide
// iterators...
boost::unordered_map<typename GMap2::Dart_handle, Dart_handle>
local_dartmap;
if (origin_to_copy==NULL) // Used local_dartmap if user does not provides its own unordered_map
boost::unordered_map<Dart_handle_2, Dart_handle> local_dartmap;
if (origin_to_copy==NULL) // Use local_dartmap if user does not provides its own unordered_map
{ origin_to_copy=&local_dartmap; }
Dart_handle new_dart;
for (typename GMap2::Dart_range::iterator
it=amap.darts().begin(), itend=amap.darts().end();
it!=itend; ++it)
for (typename GMap2::Dart_range::iterator it=amap.darts().begin(),
itend=amap.darts().end(); it!=itend; ++it)
{
new_dart=mdarts.emplace();
init_dart(new_dart, amap.get_marks(it));
@ -232,15 +225,16 @@ namespace CGAL {
(*origin_to_copy)[it]=new_dart;
if (copy_to_origin!=NULL) { (*copy_to_origin)[new_dart]=it; }
internal::Copy_dart_info_functor<Refs2, Refs, DartInfoConverter>::
run(static_cast<const Refs2&>(amap), static_cast<Refs&>(*this),
it, new_dart, dartinfoconverter);
internal::Copy_dart_info_functor
<typename GMap2::Refs, Refs, DartInfoConverter>::run
(static_cast<const typename GMap2::Refs&>(amap), static_cast<Refs&>(*this),
it, new_dart, dartinfoconverter);
}
unsigned int min_dim=(dimension<amap.dimension?dimension:amap.dimension);
typename boost::unordered_map<typename GMap2::Dart_handle,Dart_handle>
::iterator dartmap_iter, dartmap_iter_end=origin_to_copy->end();
typename boost::unordered_map<Dart_handle_2, Dart_handle>::iterator
dartmap_iter, dartmap_iter_end=origin_to_copy->end();
for (dartmap_iter=origin_to_copy->begin(); dartmap_iter!=dartmap_iter_end;
++dartmap_iter)
{
@ -260,9 +254,9 @@ namespace CGAL {
++dartmap_iter)
{
Helper::template Foreach_enabled_attributes
< internal::Copy_attributes_functor<Refs2, Refs, Converters,
PointConverter> >::
run(static_cast<const Refs2&>(amap), static_cast<Refs&>(*this),
< internal::Copy_attributes_functor<typename GMap2::Refs, Refs,
Converters, PointConverter> >::
run(static_cast<const typename GMap2::Refs&>(amap), static_cast<Refs&>(*this),
dartmap_iter->first, dartmap_iter->second,
converters, pointconverter);
}
@ -270,58 +264,124 @@ namespace CGAL {
CGAL_assertion(is_valid());
}
template <unsigned int d2, typename Refs2, typename Items2, typename Alloc2,
typename Storage2>
void copy(Generalized_map_base<d2, Refs2, Items2, Alloc2, Storage2>& amap,
boost::unordered_map
<typename Generalized_map_base<d2, Refs2, Items2, Alloc2, Storage2>::
Dart_handle, Dart_handle>* origin_to_copy,
boost::unordered_map
<Dart_handle, typename Generalized_map_base<d2, Refs2, Items2,
Alloc2, Storage2>::Dart_handle>* copy_to_origin)
{
CGAL::cpp11::tuple<> converters;
Default_converter_dart_info<Refs2, Refs> dartinfoconverter;
Default_converter_cmap_0attributes_with_point<Refs2, Refs> pointconverter;
copy(amap, converters, dartinfoconverter, pointconverter,
origin_to_copy, copy_to_origin);
}
template <unsigned int d2, typename Refs2, typename Items2, typename Alloc2,
typename Storage2, typename Converters>
void copy(Generalized_map_base<d2, Refs2, Items2, Alloc2, Storage2>& amap,
// (1a) copy(amap, converters, dartinfoconverter, pointconverter)
template<typename GMap2, typename Converters, typename DartInfoConverter,
typename PointConverter>
void copy(GMap2& amap,
const Converters& converters,
const DartInfoConverter& dartinfoconverter,
const PointConverter& pointconverter,
boost::unordered_map
<typename Generalized_map_base<d2, Refs2, Items2, Alloc2, Storage2>::
Dart_handle, Dart_handle>* origin_to_copy,
<typename GMap2::Dart_handle, Dart_handle>* origin_to_copy=nullptr,
boost::unordered_map
<Dart_handle, typename Generalized_map_base<d2, Refs2, Items2,
Alloc2, Storage2>::Dart_handle>* copy_to_origin)
<Dart_handle, typename GMap2::Dart_handle>* copy_to_origin=nullptr)
{
Default_converter_cmap_0attributes_with_point<Refs2, Refs> pointconverter;
Default_converter_dart_info<Refs2, Refs> dartinfoconverter;
copy(amap, converters, dartinfoconverter, pointconverter,
generic_copy<GMap2, typename GMap2::Dart_handle, Converters,
DartInfoConverter, PointConverter>
(amap, converters, dartinfoconverter, pointconverter,
origin_to_copy, copy_to_origin);
}
template <unsigned int d2, typename Refs2, typename Items2, typename Alloc2,
typename Storage2,
typename Converters, typename DartInfoConverter>
void copy(Generalized_map_base<d2, Refs2, Items2, Alloc2, Storage2>& amap,
// (1b) copy(const amap, converters, dartinfoconverter, pointconverter)
template<typename GMap2, typename Converters, typename DartInfoConverter,
typename PointConverter>
void copy(const GMap2& amap,
const Converters& converters,
const DartInfoConverter& dartinfoconverter,
const PointConverter& pointconverter,
boost::unordered_map
<typename GMap2::Dart_const_handle, Dart_handle>* origin_to_copy=nullptr,
boost::unordered_map
<Dart_handle, typename GMap2::Dart_const_handle>* copy_to_origin=nullptr)
{
generic_copy<GMap2, typename GMap2::Dart_const_handle,
Converters, DartInfoConverter, PointConverter>
(const_cast<GMap2&>(amap), converters, dartinfoconverter,
pointconverter, origin_to_copy, copy_to_origin);
}
// (2a) copy(amap, converters, dartinfoconverter)
template<typename GMap2, typename Converters, typename DartInfoConverter>
void copy(GMap2& amap,
const Converters& converters,
const DartInfoConverter& dartinfoconverter,
boost::unordered_map
<typename Generalized_map_base<d2, Refs2, Items2, Alloc2, Storage2>::
Dart_handle, Dart_handle>* origin_to_copy,
<typename GMap2::Dart_handle, Dart_handle>* origin_to_copy=nullptr,
boost::unordered_map
<Dart_handle, typename Generalized_map_base<d2, Refs2, Items2,
Alloc2, Storage2>::Dart_handle>* copy_to_origin)
<Dart_handle, typename GMap2::Dart_handle>* copy_to_origin=nullptr)
{
Default_converter_cmap_0attributes_with_point<Refs2, Refs> pointconverter;
Default_converter_cmap_0attributes_with_point<typename GMap2::Refs, Refs>
pointconverter;
copy(amap, converters, dartinfoconverter, pointconverter,
origin_to_copy, copy_to_origin);
}
// (2b) copy(const amap, converters, dartinfoconverter)
template <typename GMap2, typename Converters, typename DartInfoConverter>
void copy(const GMap2& amap,
const Converters& converters,
const DartInfoConverter& dartinfoconverter,
boost::unordered_map
<typename GMap2::Dart_const_handle, Dart_handle>* origin_to_copy=nullptr,
boost::unordered_map
<Dart_handle, typename GMap2::Dart_const_handle>* copy_to_origin=nullptr)
{
Default_converter_cmap_0attributes_with_point<typename GMap2::Refs, Refs>
pointconverter;
copy(amap, converters, dartinfoconverter, pointconverter,
origin_to_copy, copy_to_origin);
}
// (3a) copy(amap, converters)
template<typename GMap2, typename Converters>
void copy(GMap2& amap,
const Converters& converters,
boost::unordered_map
<typename GMap2::Dart_handle, Dart_handle>* origin_to_copy=nullptr,
boost::unordered_map
<Dart_handle, typename GMap2::Dart_handle>* copy_to_origin=nullptr)
{
Default_converter_dart_info<typename GMap2::Refs, Refs> dartinfoconverter;
copy(amap, converters, dartinfoconverter, origin_to_copy, copy_to_origin);
}
// (3b) copy(const amap, converters)
template <typename GMap2, typename Converters>
void copy(const GMap2& amap,
const Converters& converters,
boost::unordered_map
<typename GMap2::Dart_const_handle, Dart_handle>* origin_to_copy=nullptr,
boost::unordered_map
<Dart_handle, typename GMap2::Dart_const_handle>* copy_to_origin=nullptr)
{
Default_converter_dart_info<typename GMap2::Refs, Refs> dartinfoconverter;
copy(amap, converters, dartinfoconverter, origin_to_copy, copy_to_origin);
}
// (4a) copy(amap)
template<typename GMap2>
void copy(GMap2& amap,
boost::unordered_map
<typename GMap2::Dart_handle, Dart_handle>* origin_to_copy=nullptr,
boost::unordered_map
<Dart_handle, typename GMap2::Dart_handle>* copy_to_origin=nullptr)
{
CGAL::cpp11::tuple<> converters;
copy(amap, converters, origin_to_copy, copy_to_origin);
}
// (4b) copy(const amap)
template <typename GMap2>
void copy(const GMap2& amap,
boost::unordered_map
<typename GMap2::Dart_const_handle, Dart_handle>* origin_to_copy=nullptr,
boost::unordered_map
<Dart_handle, typename GMap2::Dart_const_handle>* copy_to_origin=nullptr)
{
CGAL::cpp11::tuple<> converters;
copy(amap, converters, origin_to_copy, copy_to_origin);
}
// Copy constructor from a map having exactly the same type.
Generalized_map_base (const Self & amap)
{ copy(amap); }
@ -3692,10 +3752,7 @@ namespace CGAL {
typename Helper::Merge_functors m_onmerge_functors;
};
template < unsigned int d_,
class Items_=Generic_map_min_items,
class Alloc_=CGAL_ALLOCATOR(int),
class Storage_= Generalized_map_storage_1<d_, Items_, Alloc_> >
template<unsigned int d_, class Items_, class Alloc_,class Storage_>
class Generalized_map :
public Generalized_map_base<d_,
Generalized_map<d_,Items_,Alloc_, Storage_>,

View File

@ -0,0 +1,38 @@
// Copyright (c) 2016 CNRS and LIRIS' Establishments (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org)
//
// $URL$
// $Id$
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
//
// Author(s) : Guillaume Damiand <guillaume.damiand@liris.cnrs.fr>
//
#ifndef GENERALIZED_MAP_FWD_H
#define GENERALIZED_MAP_FWD_H 1
#include <CGAL/memory.h>
namespace CGAL {
template<unsigned int d_, class Items_, class Alloc_ >
class Generalized_map_storage_1;
struct Generic_map_min_items;
template < unsigned int d_, class Refs,
class Items_=Generic_map_min_items,
class Alloc_=CGAL_ALLOCATOR(int),
class Storage_= Generalized_map_storage_1<d_, Items_, Alloc_> >
class Generalized_map_base;
template < unsigned int d_,
class Items_=Generic_map_min_items,
class Alloc_=CGAL_ALLOCATOR(int),
class Storage_= Generalized_map_storage_1<d_, Items_, Alloc_> >
class Generalized_map;
} // CGAL
#endif // GENERALIZED_MAP_FWD_H

View File

@ -12,6 +12,7 @@
#ifndef CGAL_LINEAR_CELL_COMPLEX_H
#define CGAL_LINEAR_CELL_COMPLEX_H 1
#include <CGAL/Linear_cell_complex_fwd.h>
#include <CGAL/Linear_cell_complex_for_combinatorial_map.h>
#include <CGAL/Linear_cell_complex_traits.h>
#include <CGAL/Linear_cell_complex_min_items.h>
@ -26,19 +27,10 @@ namespace CGAL {
*/
#if !defined(CGAL_NO_DEPRECATED_CODE)
template < unsigned int d_, unsigned int ambient_dim = d_,
class Traits_ = Linear_cell_complex_traits<ambient_dim>,
#if defined(CGAL_CMAP_DART_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,
class Storage_ = CMap_linear_cell_complex_storage_1<d_, ambient_dim,
Traits_, Items_,
Alloc_> >
template < unsigned int d_, unsigned int ambient_dim,
class Traits_, class Items_, class Alloc_,
template<unsigned int,class,class,class,class> class CMap,
class Storage_ >
class CGAL_DEPRECATED Linear_cell_complex:
public Linear_cell_complex_for_combinatorial_map<d_, ambient_dim, Traits_, Items_,
Alloc_, CMap, Storage_>

View File

@ -12,6 +12,7 @@
#ifndef CGAL_LINEAR_CELL_COMPLEX_BASE_H
#define CGAL_LINEAR_CELL_COMPLEX_BASE_H 1
#include <CGAL/Linear_cell_complex_fwd.h>
#include <CGAL/Combinatorial_map_functors.h>
#include <CGAL/internal/Combinatorial_map_internal_functors.h>
#include <CGAL/Linear_cell_complex_operations.h>
@ -42,21 +43,22 @@ namespace CGAL {
class Alloc_,
template<unsigned int,class,class,class,class>
class Map,
class Refs,
class Refs_,
class Storage_>
class Linear_cell_complex_base:
public Map<d_, Refs, Items_, Alloc_, Storage_>
public Map<d_, Refs_, Items_, Alloc_, Storage_>
{
public:
typedef Linear_cell_complex_base<d_, ambient_dim,
Traits_, Items_, Alloc_, Map,
Refs, Storage_> Self;
typedef Map<d_, Refs, Items_, Alloc_, Storage_> Base;
Refs_, Storage_> Self;
typedef Map<d_, Refs_, Items_, Alloc_, Storage_> Base;
typedef Traits_ Traits;
typedef Items_ Items;
typedef Alloc_ Alloc;
typedef Traits_ Traits;
typedef Items_ Items;
typedef Alloc_ Alloc;
typedef Storage_ Storage;
typedef Refs_ Refs;
static const unsigned int ambient_dimension = ambient_dim;
static const unsigned int dimension = Base::dimension;

View File

@ -12,6 +12,7 @@
#ifndef CGAL_LINEAR_CELL_COMPLEX_FOR_COMBINATORIAL_MAP_H
#define CGAL_LINEAR_CELL_COMPLEX_FOR_COMBINATORIAL_MAP_H 1
#include <CGAL/Linear_cell_complex_fwd.h>
#include <CGAL/Linear_cell_complex_base.h>
#include <CGAL/Linear_cell_complex_traits.h>
#include <CGAL/Linear_cell_complex_min_items.h>
@ -29,19 +30,10 @@ namespace CGAL {
// Linear_cell_complex_for_combinatorial_map class.
// No difference with class Linear_cell_complex_base except the default
// 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>,
#if defined(CGAL_CMAP_DART_DEPRECATED) && !defined(CGAL_NO_DEPRECATED_CODE)
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,
class Storage_ = CMap_linear_cell_complex_storage_1<d_, ambient_dim,
Traits_, Items_,
Alloc_> >
template < unsigned int d_, unsigned int ambient_dim,
class Traits_, class Items_, class Alloc_,
template<unsigned int,class,class,class,class> class CMap,
class Storage_ >
class Linear_cell_complex_for_combinatorial_map:
public Linear_cell_complex_base<d_, ambient_dim, Traits_,
Items_, Alloc_, CMap,

View File

@ -12,6 +12,7 @@
#ifndef CGAL_LINEAR_CELL_COMPLEX_FOR_GENERALIZED_MAP_H
#define CGAL_LINEAR_CELL_COMPLEX_FOR_GENERALIZED_MAP_H 1
#include <CGAL/Linear_cell_complex_fwd.h>
#include <CGAL/Linear_cell_complex_base.h>
#include <CGAL/Linear_cell_complex_traits.h>
#include <CGAL/Linear_cell_complex_min_items.h>
@ -28,15 +29,10 @@ namespace CGAL {
// Linear_cell_complex_for_generalized_map class.
// 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_> >
template < unsigned int d_, unsigned int ambient_dim,
class Traits_, class Items_, class Alloc_,
template<unsigned int,class,class,class,class> class CMap,
class Storage_ >
class Linear_cell_complex_for_generalized_map:
public Linear_cell_complex_base<d_, ambient_dim, Traits_,
Items_, Alloc_, CMap,

View File

@ -0,0 +1,98 @@
// Copyright (c) 2016 CNRS and LIRIS' Establishments (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org)
//
// $URL$
// $Id$
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
//
// Author(s) : Guillaume Damiand <guillaume.damiand@liris.cnrs.fr>
//
#ifndef LINEAR_CELL_COMPLEX_FWD_H
#define LINEAR_CELL_COMPLEX_FWD_H 1
#include <CGAL/memory.h>
#include <CGAL/Combinatorial_map_fwd.h>
#include <CGAL/Generalized_map_fwd.h>
namespace CGAL {
template<unsigned int d_, unsigned int ambient_dim,
class Traits_, class Items_, class Alloc_ >
class CMap_linear_cell_complex_storage_1;
template<unsigned int d_, unsigned int ambient_dim,
class Traits_, class Items_, class Alloc_ >
class GMap_linear_cell_complex_storage_1;
template <unsigned int d>
struct LCC_default_kernel;
template <unsigned int d_,
class Kernel=typename LCC_default_kernel<d_>::type >
struct Linear_cell_complex_traits;
#if defined(CGAL_CMAP_DART_DEPRECATED) && !defined(CGAL_NO_DEPRECATED_CODE)
template <unsigned int d>
struct CGAL_DEPRECATED Linear_cell_complex_min_items;
#else
struct Linear_cell_complex_min_items;
#endif
template < unsigned int d_, unsigned int ambient_dim,
class Traits_,
class Items_,
class Alloc_,
template<unsigned int,class,class,class,class>
class Map,
class Refs_,
class Storage_>
class Linear_cell_complex_base;
template < unsigned int d_, unsigned int ambient_dim = d_,
class Traits_ = Linear_cell_complex_traits<ambient_dim>,
#if defined(CGAL_CMAP_DART_DEPRECATED) && !defined(CGAL_NO_DEPRECATED_CODE)
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,
class Storage_ = CMap_linear_cell_complex_storage_1<d_, ambient_dim,
Traits_, Items_,
Alloc_> >
class Linear_cell_complex_for_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,
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;
#if !defined(CGAL_NO_DEPRECATED_CODE)
template < unsigned int d_, unsigned int ambient_dim = d_,
class Traits_ = Linear_cell_complex_traits<ambient_dim>,
#if defined(CGAL_CMAP_DART_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,
class Storage_ = CMap_linear_cell_complex_storage_1<d_, ambient_dim,
Traits_, Items_,
Alloc_> >
class CGAL_DEPRECATED Linear_cell_complex;
#endif
} // CGAL
#endif // LINEAR_CELL_COMPLEX_FWD_H

View File

@ -16,6 +16,7 @@
#include <CGAL/Dart.h>
#endif
#include <CGAL/Linear_cell_complex_fwd.h>
#include <CGAL/Cell_attribute_with_point.h>
#include <CGAL/tuple.h>

View File

@ -12,6 +12,7 @@
#ifndef CGAL_LINEAR_CELL_COMPLEX_TRAITS_H
#define CGAL_LINEAR_CELL_COMPLEX_TRAITS_H 1
#include <CGAL/Linear_cell_complex_fwd.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Cartesian_d.h>
#include <CGAL/predicates_d.h>
@ -32,8 +33,7 @@ namespace CGAL {
/** Trait class for Linear_cell_complex class.
* dD version (for the moment there is only one dD kernel in CGAL).
*/
template <unsigned int d_,
class Kernel=typename LCC_default_kernel<d_>::type >
template <unsigned int d_, class Kernel>
struct Linear_cell_complex_traits : public Kernel
{
static const unsigned int ambient_dimension = d_;

View File

@ -14,6 +14,7 @@
#include <CGAL/license/Surface_mesh_topology.h>
#include <CGAL/Polygonal_schema_fwd.h>
#include <vector>
#include <unordered_map>
#include <cstddef>
@ -422,9 +423,7 @@ namespace Surface_mesh_topology {
};
/// Polygonal schema with combinatorial map.
template <class Items_=Polygonal_schema_min_items,
class Alloc_=CGAL_ALLOCATOR(int),
class Storage_= Combinatorial_map_storage_1<2, Items_, Alloc_> >
template <class Items_, class Alloc_, class Storage_>
class Polygonal_schema_with_combinatorial_map:
public Polygonal_schema_base<CGAL::Combinatorial_map_base
<2,
@ -483,9 +482,7 @@ namespace Surface_mesh_topology {
};
/// Polygonal schema with generalized map.
template <class Items_=Polygonal_schema_min_items,
class Alloc_=CGAL_ALLOCATOR(int),
class Storage_= Generalized_map_storage_1<2, Items_, Alloc_> >
template <class Items_, class Alloc_, class Storage_>
class Polygonal_schema_with_generalized_map:
public Polygonal_schema_base<CGAL::Generalized_map_base
<2,

View File

@ -0,0 +1,39 @@
// Copyright (c) 2019 CNRS and LIRIS' Establishments (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
//
// $URL$
// $Id$
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
//
// Author(s) : Guillaume Damiand <guillaume.damiand@liris.cnrs.fr>
//
#ifndef CGAL_POLYGONAL_SCHEMA_FWD_H
#define CGAL_POLYGONAL_SCHEMA_FWD_H 1
#include <CGAL/license/Surface_mesh_topology.h>
#include <CGAL/memory.h>
#include <CGAL/Combinatorial_map_fwd.h>
#include <CGAL/Generalized_map_fwd.h>
namespace CGAL {
namespace Surface_mesh_topology {
struct Polygonal_schema_min_items;
template <class Items_=Polygonal_schema_min_items,
class Alloc_=CGAL_ALLOCATOR(int),
class Storage_= Combinatorial_map_storage_1<2, Items_, Alloc_> >
class Polygonal_schema_with_combinatorial_map;
template <class Items_=Polygonal_schema_min_items,
class Alloc_=CGAL_ALLOCATOR(int),
class Storage_= Generalized_map_storage_1<2, Items_, Alloc_> >
class Polygonal_schema_with_generalized_map;
} // Surface_mesh_topology
} // CGAL
#endif // CGAL_POLYGONAL_SCHEMA_FWD_H