mirror of https://github.com/CGAL/cgal
Merge pull request #6055 from gdamiand/LCC_improvements-gdamiand
Lcc improvements
This commit is contained in:
commit
921380202b
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include <CGAL/tags.h>
|
||||
#include <CGAL/assertions.h>
|
||||
#include <cstddef>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
|
|
@ -88,8 +89,7 @@ namespace CGAL {
|
|||
{ m_id=id; }
|
||||
|
||||
protected:
|
||||
/// id of the cell
|
||||
std::size_t m_id;
|
||||
std::size_t m_id; ///< id of the cell
|
||||
};
|
||||
|
||||
/// If the tag WithId is false, we do not add id to cells.
|
||||
|
|
|
|||
|
|
@ -42,8 +42,9 @@
|
|||
#include <vector>
|
||||
#include <deque>
|
||||
#include <tuple>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/unordered_map.hpp>
|
||||
#include <boost/graph/graph_traits.hpp>
|
||||
#include <CGAL/boost/graph/helpers.h>
|
||||
|
||||
|
|
@ -230,15 +231,15 @@ namespace CGAL {
|
|||
typename Converters, typename DartInfoConverter,
|
||||
typename PointConverter>
|
||||
void generic_copy(CMap2& amap,
|
||||
boost::unordered_map<Dart_handle_2, Dart_handle>* origin_to_copy,
|
||||
boost::unordered_map<Dart_handle, Dart_handle_2>* copy_to_origin,
|
||||
std::unordered_map<Dart_handle_2, Dart_handle>* origin_to_copy,
|
||||
std::unordered_map<Dart_handle, Dart_handle_2>* copy_to_origin,
|
||||
const Converters& converters,
|
||||
const DartInfoConverter& dartinfoconverter,
|
||||
const PointConverter& pointconverter,
|
||||
bool copy_perforated_darts=false,
|
||||
size_type mark_perforated=INVALID_MARK)
|
||||
{
|
||||
this->clear();
|
||||
// this->clear();
|
||||
|
||||
/*this->mnb_used_marks = amap.mnb_used_marks;
|
||||
this->mmask_marks = amap.mmask_marks;
|
||||
|
|
@ -259,7 +260,7 @@ 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<Dart_handle_2, Dart_handle> local_dartmap;
|
||||
std::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; }
|
||||
|
||||
|
|
@ -287,7 +288,7 @@ namespace CGAL {
|
|||
|
||||
unsigned int min_dim=(dimension<amap.dimension?dimension:amap.dimension);
|
||||
|
||||
typename boost::unordered_map<Dart_handle_2,Dart_handle>::iterator
|
||||
typename std::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)
|
||||
|
|
@ -322,9 +323,9 @@ namespace CGAL {
|
|||
template<typename CMap2, typename Converters, typename DartInfoConverter,
|
||||
typename PointConverter>
|
||||
void copy(CMap2& amap,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<typename CMap2::Dart_handle, Dart_handle>* origin_to_copy,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<Dart_handle, typename CMap2::Dart_handle>* copy_to_origin,
|
||||
const Converters& converters,
|
||||
const DartInfoConverter& dartinfoconverter,
|
||||
|
|
@ -343,9 +344,9 @@ namespace CGAL {
|
|||
template<typename CMap2, typename Converters, typename DartInfoConverter,
|
||||
typename PointConverter>
|
||||
void copy_from_const(const CMap2& amap,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<typename CMap2::Dart_const_handle, Dart_handle>* origin_to_copy,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<Dart_handle, typename CMap2::Dart_const_handle>* copy_to_origin,
|
||||
const Converters& converters,
|
||||
const DartInfoConverter& dartinfoconverter,
|
||||
|
|
@ -363,9 +364,9 @@ namespace CGAL {
|
|||
// (2a) copy(amap, converters, dartinfoconverter)
|
||||
template<typename CMap2, typename Converters, typename DartInfoConverter>
|
||||
void copy(CMap2& amap,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<typename CMap2::Dart_handle, Dart_handle>* origin_to_copy,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<Dart_handle, typename CMap2::Dart_handle>* copy_to_origin,
|
||||
const Converters& converters,
|
||||
const DartInfoConverter& dartinfoconverter,
|
||||
|
|
@ -382,9 +383,9 @@ namespace CGAL {
|
|||
// (2b) copy_from_const(const amap, converters, dartinfoconverter)
|
||||
template <typename CMap2, typename Converters, typename DartInfoConverter>
|
||||
void copy_from_const(const CMap2& amap,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<typename CMap2::Dart_const_handle, Dart_handle>* origin_to_copy,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<Dart_handle, typename CMap2::Dart_const_handle>* copy_to_origin,
|
||||
const Converters& converters,
|
||||
const DartInfoConverter& dartinfoconverter,
|
||||
|
|
@ -401,9 +402,9 @@ namespace CGAL {
|
|||
// (3a) copy(amap, converters)
|
||||
template<typename CMap2, typename Converters>
|
||||
void copy(CMap2& amap,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<typename CMap2::Dart_handle, Dart_handle>* origin_to_copy,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<Dart_handle, typename CMap2::Dart_handle>* copy_to_origin,
|
||||
const Converters& converters,
|
||||
bool copy_perforated_darts=false,
|
||||
|
|
@ -417,9 +418,9 @@ namespace CGAL {
|
|||
// (3b) copy_from_const(const amap, converters)
|
||||
template <typename CMap2, typename Converters>
|
||||
void copy_from_const(const CMap2& amap,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<typename CMap2::Dart_const_handle, Dart_handle>* origin_to_copy,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<Dart_handle, typename CMap2::Dart_const_handle>* copy_to_origin,
|
||||
const Converters& converters,
|
||||
bool copy_perforated_darts=false,
|
||||
|
|
@ -433,9 +434,9 @@ namespace CGAL {
|
|||
// (4a) copy(amap)
|
||||
template<typename CMap2>
|
||||
void copy(CMap2& amap,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<typename CMap2::Dart_handle, Dart_handle>* origin_to_copy=nullptr,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<Dart_handle, typename CMap2::Dart_handle>* copy_to_origin=nullptr,
|
||||
bool copy_perforated_darts=false,
|
||||
size_type mark_perforated=INVALID_MARK)
|
||||
|
|
@ -448,9 +449,9 @@ namespace CGAL {
|
|||
// (4b) copy_from_const(const amap)
|
||||
template <typename CMap2>
|
||||
void copy_from_const(const CMap2& amap,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<typename CMap2::Dart_const_handle, Dart_handle>* origin_to_copy=nullptr,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<Dart_handle, typename CMap2::Dart_const_handle>* copy_to_origin=nullptr,
|
||||
bool copy_perforated_darts=false,
|
||||
size_type mark_perforated=INVALID_MARK)
|
||||
|
|
@ -554,10 +555,10 @@ namespace CGAL {
|
|||
/** Import the given hds which should be a model of an halfedge graph. */
|
||||
template<class HEG>
|
||||
void import_from_halfedge_graph(const HEG& heg,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<typename boost::graph_traits<HEG>::halfedge_descriptor,
|
||||
Dart_handle>* origin_to_copy=NULL,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<Dart_handle,
|
||||
typename boost::graph_traits<HEG>::halfedge_descriptor>*
|
||||
copy_to_origin=NULL,
|
||||
|
|
@ -567,7 +568,7 @@ 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
|
||||
std::unordered_map
|
||||
<typename boost::graph_traits<HEG>::halfedge_descriptor,
|
||||
Dart_handle> local_dartmap;
|
||||
if (origin_to_copy==NULL) // Used local_dartmap if user does not provides its own unordered_map
|
||||
|
|
@ -590,7 +591,7 @@ namespace CGAL {
|
|||
}
|
||||
}
|
||||
|
||||
typename boost::unordered_map
|
||||
typename std::unordered_map
|
||||
<typename boost::graph_traits<HEG>::halfedge_descriptor,
|
||||
Dart_handle>::iterator dartmap_iter, dartmap_iter_end=origin_to_copy->end();
|
||||
for (dartmap_iter=origin_to_copy->begin(); dartmap_iter!=dartmap_iter_end;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
#include <CGAL/Combinatorial_map_functors.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
|
|
@ -161,15 +161,9 @@ namespace CGAL {
|
|||
struct My_functor_cmap_save_one_attrib<CMap, i, true, true>
|
||||
{
|
||||
static void run(CMap& amap, boost::property_tree::ptree& ptree,
|
||||
std::map<typename CMap::Dart_const_handle,
|
||||
typename CMap::size_type>& myDarts)
|
||||
std::unordered_map<typename CMap::Dart_const_handle,
|
||||
typename CMap::size_type>& myDarts)
|
||||
{
|
||||
// to check all i-cells of the map
|
||||
typename CMap::template Attribute_range<i>::type::const_iterator
|
||||
it_attrib, itend_attrib;
|
||||
it_attrib=amap.template attributes<i>().begin();
|
||||
itend_attrib=amap.template attributes<i>().end();
|
||||
|
||||
// add dimension & type
|
||||
boost::property_tree::ptree& ndim = ptree.add("dimension", "");
|
||||
ndim.put("<xmlattr>.index", i);
|
||||
|
|
@ -177,16 +171,20 @@ namespace CGAL {
|
|||
ndim.add("type_point", typeid(typename CMap::Point).name());
|
||||
|
||||
// for every attribute of the dimension
|
||||
for (; it_attrib!=itend_attrib; ++it_attrib)
|
||||
for (auto it=amap.template one_dart_per_cell<i>().begin(),
|
||||
itend=amap.template one_dart_per_cell<i>().end(); it!=itend; ++it)
|
||||
{
|
||||
// make composant, dart and property node
|
||||
boost::property_tree::ptree & nattr = ndim.add("a", "");
|
||||
/* boost::property_tree::ptree & ndarts = */
|
||||
nattr.add("d", myDarts[it_attrib->dart()]);
|
||||
if (amap.template attribute<i>(it)!=nullptr)
|
||||
{
|
||||
// make composant, dart and property node
|
||||
boost::property_tree::ptree & nattr = ndim.add("a", "");
|
||||
/* boost::property_tree::ptree & ndarts = */
|
||||
nattr.add("d", myDarts[it]);
|
||||
|
||||
// update property node to add a value node (from basic or custom type
|
||||
write_cmap_attribute_node(nattr, it_attrib->info());
|
||||
write_cmap_attribute_node(nattr, it_attrib->point());
|
||||
// update property node to add a value node (from basic or custom type
|
||||
write_cmap_attribute_node(nattr, amap.template info<i>(it));
|
||||
write_cmap_attribute_node(nattr, amap.point(it));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -196,15 +194,9 @@ namespace CGAL {
|
|||
struct My_functor_cmap_save_one_attrib<CMap, i, false, true>
|
||||
{
|
||||
static void run(CMap& amap, boost::property_tree::ptree& ptree,
|
||||
std::map<typename CMap::Dart_const_handle,
|
||||
typename CMap::size_type>& myDarts)
|
||||
std::unordered_map<typename CMap::Dart_const_handle,
|
||||
typename CMap::size_type>& myDarts)
|
||||
{
|
||||
// to check all i-cells of the map
|
||||
typename CMap::template Attribute_range<i>::type::const_iterator
|
||||
it_attrib, itend_attrib;
|
||||
it_attrib=amap.template attributes<i>().begin();
|
||||
itend_attrib=amap.template attributes<i>().end();
|
||||
|
||||
// add dimension & type
|
||||
boost::property_tree::ptree& ndim = ptree.add("dimension", "");
|
||||
ndim.put("<xmlattr>.index", i);
|
||||
|
|
@ -212,15 +204,19 @@ namespace CGAL {
|
|||
ndim.add("type_point", typeid(typename CMap::Point).name());
|
||||
|
||||
// for every attribute of the dimension
|
||||
for (; it_attrib!=itend_attrib; ++it_attrib)
|
||||
for (auto it=amap.template one_dart_per_cell<i>().begin(),
|
||||
itend=amap.template one_dart_per_cell<i>().end(); it!=itend; ++it)
|
||||
{
|
||||
// make composant, dart and property node
|
||||
boost::property_tree::ptree & nattr = ndim.add("a", "");
|
||||
/* boost::property_tree::ptree & ndarts = */
|
||||
nattr.add("d", myDarts[it_attrib->dart()]);
|
||||
if (amap.template attribute<i>(it)!=nullptr)
|
||||
{
|
||||
// make composant, dart and property node
|
||||
boost::property_tree::ptree & nattr = ndim.add("a", "");
|
||||
/* boost::property_tree::ptree & ndarts = */
|
||||
nattr.add("d", myDarts[it]);
|
||||
|
||||
// update property node to add a value node (from basic or custom type
|
||||
write_cmap_attribute_node(nattr, it_attrib->point());
|
||||
// update property node to add a value node (from basic or custom type
|
||||
write_cmap_attribute_node(nattr, amap.point(it));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -230,15 +226,9 @@ namespace CGAL {
|
|||
struct My_functor_cmap_save_one_attrib<CMap, i, true, false>
|
||||
{
|
||||
static void run(CMap& amap, boost::property_tree::ptree& ptree,
|
||||
std::map<typename CMap::Dart_const_handle,
|
||||
typename CMap::size_type>& myDarts)
|
||||
std::unordered_map<typename CMap::Dart_const_handle,
|
||||
typename CMap::size_type>& myDarts)
|
||||
{
|
||||
// to check all i-cells of the map
|
||||
typename CMap::template Attribute_range<i>::type::const_iterator
|
||||
it_attrib, itend_attrib;
|
||||
it_attrib=amap.template attributes<i>().begin();
|
||||
itend_attrib=amap.template attributes<i>().end();
|
||||
|
||||
// add dimension & type
|
||||
boost::property_tree::ptree& ndim = ptree.add("dimension", "");
|
||||
ndim.put("<xmlattr>.index", i);
|
||||
|
|
@ -247,15 +237,19 @@ namespace CGAL {
|
|||
ndim.add("type_point", "void");
|
||||
|
||||
// for every attribute of the dimension
|
||||
for (; it_attrib!=itend_attrib; ++it_attrib)
|
||||
for (auto it=amap.template one_dart_per_cell<i>().begin(),
|
||||
itend=amap.template one_dart_per_cell<i>().end(); it!=itend; ++it)
|
||||
{
|
||||
// make composant, dart and property node
|
||||
boost::property_tree::ptree & nattr = ndim.add("a", "");
|
||||
/* boost::property_tree::ptree & ndarts = */
|
||||
nattr.add("d", myDarts[it_attrib->dart()]);
|
||||
if (amap.template attribute<i>(it)!=nullptr)
|
||||
{
|
||||
// make composant, dart and property node
|
||||
boost::property_tree::ptree & nattr = ndim.add("a", "");
|
||||
/* boost::property_tree::ptree & ndarts = */
|
||||
nattr.add("d", myDarts[it]);
|
||||
|
||||
// update property node to add a value node (from basic or custom type
|
||||
write_cmap_attribute_node(nattr, it_attrib->info());
|
||||
// update property node to add a value node (from basic or custom type
|
||||
write_cmap_attribute_node(nattr, amap.template info<i>(it));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -265,15 +259,9 @@ namespace CGAL {
|
|||
struct My_functor_cmap_save_one_attrib<CMap, i, false, false>
|
||||
{
|
||||
static void run(CMap& amap, boost::property_tree::ptree& ptree,
|
||||
std::map<typename CMap::Dart_const_handle,
|
||||
typename CMap::size_type>& myDarts)
|
||||
std::unordered_map<typename CMap::Dart_const_handle,
|
||||
typename CMap::size_type>& myDarts)
|
||||
{
|
||||
// to check all i-cells of the map
|
||||
typename CMap::template Attribute_range<i>::type::const_iterator
|
||||
it_attrib, itend_attrib;
|
||||
it_attrib=amap.template attributes<i>().begin();
|
||||
itend_attrib=amap.template attributes<i>().end();
|
||||
|
||||
// add dimension & type
|
||||
boost::property_tree::ptree& ndim = ptree.add("dimension", "");
|
||||
ndim.put("<xmlattr>.index", i);
|
||||
|
|
@ -281,12 +269,16 @@ namespace CGAL {
|
|||
ndim.add("type_point", "void");
|
||||
|
||||
// for every attribute of the dimension
|
||||
for (; it_attrib!=itend_attrib; ++it_attrib)
|
||||
for (auto it=amap.template one_dart_per_cell<i>().begin(),
|
||||
itend=amap.template one_dart_per_cell<i>().end(); it!=itend; ++it)
|
||||
{
|
||||
// make composant, dart and property node
|
||||
boost::property_tree::ptree & nattr = ndim.add("a", "");
|
||||
/* boost::property_tree::ptree & ndarts = */
|
||||
nattr.add("d", myDarts[it_attrib->dart()]);
|
||||
if (amap.template attribute<i>(it)!=nullptr)
|
||||
{
|
||||
// make composant, dart and property node
|
||||
boost::property_tree::ptree & nattr = ndim.add("a", "");
|
||||
/* boost::property_tree::ptree & ndarts = */
|
||||
nattr.add("d", myDarts[it]);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -296,8 +288,8 @@ namespace CGAL {
|
|||
{
|
||||
template <unsigned int i>
|
||||
static void run(CMap& amap, boost::property_tree::ptree& ptree,
|
||||
std::map<typename CMap::Dart_const_handle,
|
||||
typename CMap::size_type>& myDarts)
|
||||
std::unordered_map<typename CMap::Dart_const_handle,
|
||||
typename CMap::size_type>& myDarts)
|
||||
{
|
||||
My_functor_cmap_save_one_attrib<CMap, i>::run(amap, ptree, myDarts);
|
||||
}
|
||||
|
|
@ -305,12 +297,12 @@ namespace CGAL {
|
|||
|
||||
template < class CMap >
|
||||
boost::property_tree::ptree cmap_save_darts
|
||||
(CMap& amap, std::map<typename CMap::Dart_const_handle,
|
||||
typename CMap::size_type>& myDarts)
|
||||
(CMap& amap, std::unordered_map<typename CMap::Dart_const_handle,
|
||||
typename CMap::size_type>& myDarts)
|
||||
{
|
||||
CGAL_assertion( myDarts.empty() );
|
||||
|
||||
// First we numbered each dart by using the std::map.
|
||||
// First we numbered each dart by using the unordered_map.
|
||||
typename CMap::Dart_range::const_iterator it(amap.darts().begin());
|
||||
for(typename CMap::size_type num=1; num<=amap.number_of_darts();
|
||||
++num, ++it)
|
||||
|
|
@ -349,8 +341,8 @@ namespace CGAL {
|
|||
|
||||
template < class CMap >
|
||||
boost::property_tree::ptree cmap_save_attributes
|
||||
(const CMap& amap, std::map<typename CMap::Dart_const_handle,
|
||||
typename CMap::size_type>& myDarts)
|
||||
(const CMap& amap, std::unordered_map<typename CMap::Dart_const_handle,
|
||||
typename CMap::size_type>& myDarts)
|
||||
{
|
||||
using boost::property_tree::ptree;
|
||||
ptree pt;
|
||||
|
|
@ -383,7 +375,7 @@ namespace CGAL {
|
|||
f(tree);
|
||||
|
||||
// map dart => number
|
||||
std::map<typename CMap::Dart_const_handle, typename CMap::size_type> myDarts;
|
||||
std::unordered_map<typename CMap::Dart_const_handle, typename CMap::size_type> myDarts;
|
||||
|
||||
// Save darts
|
||||
ptree pt_darts=cmap_save_darts(amap, myDarts);
|
||||
|
|
|
|||
|
|
@ -196,15 +196,15 @@ namespace CGAL {
|
|||
typename Converters, typename DartInfoConverter,
|
||||
typename PointConverter>
|
||||
void generic_copy(GMap2& amap,
|
||||
boost::unordered_map<Dart_handle_2, Dart_handle>* origin_to_copy,
|
||||
boost::unordered_map<Dart_handle, Dart_handle_2>* copy_to_origin,
|
||||
std::unordered_map<Dart_handle_2, Dart_handle>* origin_to_copy,
|
||||
std::unordered_map<Dart_handle, Dart_handle_2>* copy_to_origin,
|
||||
const Converters& converters,
|
||||
const DartInfoConverter& dartinfoconverter,
|
||||
const PointConverter& pointconverter,
|
||||
bool copy_perforated_darts=false,
|
||||
size_type mark_perforated=INVALID_MARK)
|
||||
{
|
||||
this->clear();
|
||||
//this->clear();
|
||||
|
||||
/*this->mnb_used_marks = amap.mnb_used_marks;
|
||||
this->mmask_marks = amap.mmask_marks;
|
||||
|
|
@ -223,7 +223,7 @@ 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<Dart_handle_2, Dart_handle> local_dartmap;
|
||||
std::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; }
|
||||
|
||||
|
|
@ -251,7 +251,7 @@ namespace CGAL {
|
|||
|
||||
unsigned int min_dim=(dimension<amap.dimension?dimension:amap.dimension);
|
||||
|
||||
typename boost::unordered_map<Dart_handle_2, Dart_handle>::iterator
|
||||
typename std::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)
|
||||
|
|
@ -286,9 +286,9 @@ namespace CGAL {
|
|||
template<typename GMap2, typename Converters, typename DartInfoConverter,
|
||||
typename PointConverter>
|
||||
void copy(GMap2& amap,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<typename GMap2::Dart_handle, Dart_handle>* origin_to_copy,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<Dart_handle, typename GMap2::Dart_handle>* copy_to_origin,
|
||||
const Converters& converters,
|
||||
const DartInfoConverter& dartinfoconverter,
|
||||
|
|
@ -307,9 +307,9 @@ namespace CGAL {
|
|||
template<typename GMap2, typename Converters, typename DartInfoConverter,
|
||||
typename PointConverter>
|
||||
void copy_from_const(const GMap2& amap,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<typename GMap2::Dart_const_handle, Dart_handle>* origin_to_copy,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<Dart_handle, typename GMap2::Dart_const_handle>* copy_to_origin,
|
||||
const Converters& converters,
|
||||
const DartInfoConverter& dartinfoconverter,
|
||||
|
|
@ -327,9 +327,9 @@ namespace CGAL {
|
|||
// (2a) copy(amap, converters, dartinfoconverter)
|
||||
template<typename GMap2, typename Converters, typename DartInfoConverter>
|
||||
void copy(GMap2& amap,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<typename GMap2::Dart_handle, Dart_handle>* origin_to_copy,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<Dart_handle, typename GMap2::Dart_handle>* copy_to_origin,
|
||||
const Converters& converters,
|
||||
const DartInfoConverter& dartinfoconverter,
|
||||
|
|
@ -346,9 +346,9 @@ namespace CGAL {
|
|||
// (2b) copy_from_const(const amap, converters, dartinfoconverter)
|
||||
template <typename GMap2, typename Converters, typename DartInfoConverter>
|
||||
void copy_from_const(const GMap2& amap,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<typename GMap2::Dart_const_handle, Dart_handle>* origin_to_copy,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<Dart_handle, typename GMap2::Dart_const_handle>* copy_to_origin,
|
||||
const Converters& converters,
|
||||
const DartInfoConverter& dartinfoconverter,
|
||||
|
|
@ -365,9 +365,9 @@ namespace CGAL {
|
|||
// (3a) copy(amap, converters)
|
||||
template<typename GMap2, typename Converters>
|
||||
void copy(GMap2& amap,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<typename GMap2::Dart_handle, Dart_handle>* origin_to_copy,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<Dart_handle, typename GMap2::Dart_handle>* copy_to_origin,
|
||||
const Converters& converters,
|
||||
bool copy_perforated_darts=false,
|
||||
|
|
@ -381,9 +381,9 @@ namespace CGAL {
|
|||
// (3b) copy_from_const(const amap, converters)
|
||||
template <typename GMap2, typename Converters>
|
||||
void copy_from_const(const GMap2& amap,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<typename GMap2::Dart_const_handle, Dart_handle>* origin_to_copy,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<Dart_handle, typename GMap2::Dart_const_handle>* copy_to_origin,
|
||||
const Converters& converters,
|
||||
bool copy_perforated_darts=false,
|
||||
|
|
@ -397,9 +397,9 @@ namespace CGAL {
|
|||
// (4a) copy(amap)
|
||||
template<typename GMap2>
|
||||
void copy(GMap2& amap,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<typename GMap2::Dart_handle, Dart_handle>* origin_to_copy=nullptr,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<Dart_handle, typename GMap2::Dart_handle>* copy_to_origin=nullptr,
|
||||
bool copy_perforated_darts=false,
|
||||
size_type mark_perforated=INVALID_MARK)
|
||||
|
|
@ -412,9 +412,9 @@ namespace CGAL {
|
|||
// (4b) copy_from_const(const amap)
|
||||
template <typename GMap2>
|
||||
void copy_from_const(const GMap2& amap,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<typename GMap2::Dart_const_handle, Dart_handle>* origin_to_copy=nullptr,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<Dart_handle, typename GMap2::Dart_const_handle>* copy_to_origin=nullptr,
|
||||
bool copy_perforated_darts=false,
|
||||
size_type mark_perforated=INVALID_MARK)
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#include <CGAL/Combinatorial_map_save_load.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
|
|
@ -70,12 +70,12 @@ namespace CGAL {
|
|||
template < class GMap >
|
||||
boost::property_tree::ptree gmap_save_darts
|
||||
(const GMap& amap,
|
||||
std::map<typename GMap::Dart_const_handle,
|
||||
std::unordered_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.
|
||||
// First we numbered each dart by using the unordered_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)
|
||||
|
|
@ -119,7 +119,7 @@ namespace CGAL {
|
|||
ptree tree;
|
||||
|
||||
// map dart => number
|
||||
std::map<typename GMap::Dart_const_handle, typename GMap::size_type> myDarts;
|
||||
std::unordered_map<typename GMap::Dart_const_handle, typename GMap::size_type> myDarts;
|
||||
|
||||
// Save darts
|
||||
ptree pt_darts=gmap_save_darts(amap, myDarts);
|
||||
|
|
|
|||
|
|
@ -450,12 +450,16 @@ namespace CGAL {
|
|||
}
|
||||
|
||||
/// Sew3 the marked facets having same geometry
|
||||
/// (a facet is considered marked if one of its dart is marked).
|
||||
/// (a facet is considered marked if ALL its darts are marked).
|
||||
/// Only marked faces are proceed, but they can be 3-sewn with non
|
||||
/// marked faces.
|
||||
unsigned int sew3_same_facets(size_type AMark)
|
||||
{
|
||||
unsigned int res = 0;
|
||||
|
||||
std::map<Point, std::vector<Dart_handle> > one_dart_per_facet;
|
||||
// We store one dart per face, the face being accessed through its
|
||||
// minimal and maximal points.
|
||||
std::map<Point, std::map<Point, std::vector<Dart_handle>>> one_dart_per_facet;
|
||||
size_type mymark = get_new_mark();
|
||||
|
||||
// First we fill the std::map by one dart per facet, and by using
|
||||
|
|
@ -463,59 +467,69 @@ namespace CGAL {
|
|||
for (typename Dart_range::iterator it(darts().begin()),
|
||||
itend(darts().end()); it!=itend; ++it )
|
||||
{
|
||||
if ( !is_marked(it, mymark) && is_marked(it, AMark) )
|
||||
if (!is_marked(it, mymark) && !this->template is_opposite_exist<3>(it))
|
||||
{
|
||||
Point min_point=point(it);
|
||||
Dart_handle min_dart = it;
|
||||
mark(it, mymark);
|
||||
typename Base::template
|
||||
Dart_of_cell_range<2>::iterator it2(*this,it);
|
||||
Point max_point=min_point;
|
||||
Dart_handle min_dart=it;
|
||||
auto it2=this->template darts_of_cell_basic<2>(it, mymark).begin();
|
||||
this->mark(it2, mymark);
|
||||
++it2;
|
||||
for ( ; it2.cont(); ++it2 )
|
||||
{
|
||||
Point cur_point=point(it2);
|
||||
this->mark(it2, mymark);
|
||||
if ( cur_point < min_point )
|
||||
Point& cur_point=point(it2);
|
||||
if (cur_point<min_point)
|
||||
{
|
||||
min_point = cur_point;
|
||||
min_dart = it2;
|
||||
}
|
||||
if (cur_point>max_point)
|
||||
{ max_point=cur_point; }
|
||||
}
|
||||
one_dart_per_facet[min_point].push_back(min_dart);
|
||||
one_dart_per_facet[min_point][max_point].push_back(min_dart);
|
||||
}
|
||||
else
|
||||
this->mark(it, mymark);
|
||||
{ this->mark(it, mymark); }
|
||||
}
|
||||
|
||||
// Second we run through the map: candidates for sew3 have necessary the
|
||||
// same minimal point.
|
||||
typename std::map<Point, std::vector<Dart_handle> >::iterator
|
||||
itmap=one_dart_per_facet.begin(),
|
||||
itmapend=one_dart_per_facet.end();
|
||||
|
||||
for (; itmap!=itmapend; ++itmap)
|
||||
// same minimal and maximal points.
|
||||
for (auto itmap=one_dart_per_facet.begin(),
|
||||
itmapend=one_dart_per_facet.end(); itmap!=itmapend; ++itmap)
|
||||
{
|
||||
for (typename std::vector<Dart_handle>::iterator
|
||||
it1=(itmap->second).begin(),
|
||||
it1end=(itmap->second).end(); it1!=it1end; ++it1)
|
||||
for (auto itmap2=(itmap->second).begin(),
|
||||
itmap2end=(itmap->second).end(); itmap2!=itmap2end; ++itmap2)
|
||||
{
|
||||
typename std::vector<Dart_handle>::iterator it2=it1;
|
||||
for (++it2; it2!=it1end; ++it2)
|
||||
for (typename std::vector<Dart_handle>::iterator
|
||||
it1=(itmap2->second).begin(),
|
||||
it1end=(itmap2->second).end(); it1!=it1end; ++it1)
|
||||
{
|
||||
if (*it1!=*it2 &&
|
||||
!this->template is_opposite_exist<3>(*it1) &&
|
||||
!this->template is_opposite_exist<3>(*it2) &&
|
||||
are_facets_opposite_and_same_geometry
|
||||
(*it1, this->previous(*it2)))
|
||||
// We only proceed 3-free marked faces for it1
|
||||
if (!this->template is_opposite_exist<3>(*it1) &&
|
||||
is_marked(*it1, AMark))
|
||||
{
|
||||
++res;
|
||||
this->template sew<3>(*it1,
|
||||
this->other_orientation(previous(*it2)));
|
||||
typename std::vector<Dart_handle>::iterator it2=it1;
|
||||
{
|
||||
for (++it2; it2!=it1end; )
|
||||
{
|
||||
assert(*it1!=*it2);
|
||||
if (!this->template is_opposite_exist<3>(*it2) &&
|
||||
are_facets_opposite_and_same_geometry
|
||||
(*it1, this->previous(*it2)))
|
||||
{
|
||||
++res;
|
||||
this->template sew<3>(*it1,
|
||||
this->other_orientation(previous(*it2)));
|
||||
it2=it1end; // to leave the "for loop" since it1 is no more 3-free
|
||||
}
|
||||
else { ++it2; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CGAL_assertion( this->is_whole_map_marked(mymark) );
|
||||
this->free_mark(mymark);
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -204,9 +204,7 @@ namespace CGAL {
|
|||
m_file_header = scanner; // Remember file header after return.
|
||||
|
||||
Linear_cell_complex_incremental_builder_3<LCC> B(alcc);
|
||||
B.begin_surface(scanner.size_of_vertices(),
|
||||
scanner.size_of_facets(),
|
||||
scanner.size_of_halfedges());
|
||||
B.begin_surface();
|
||||
|
||||
typedef typename LCC::Point Point;
|
||||
|
||||
|
|
@ -247,7 +245,7 @@ namespace CGAL {
|
|||
} */
|
||||
for (std::size_t j=0; j<no; j++)
|
||||
{
|
||||
std::size_t index;
|
||||
std::size_t index=0;
|
||||
scanner.scan_facet_vertex_index(index, j+1, i);
|
||||
if(! in){
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
#include <CGAL/Combinatorial_map.h>
|
||||
#include <CGAL/CMap_linear_cell_complex_storages.h>
|
||||
#include <CGAL/boost/graph/properties.h>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
|
|
@ -146,20 +147,32 @@ namespace CGAL {
|
|||
return *this;
|
||||
}
|
||||
|
||||
friend std::ostream& operator<< (std::ostream& os, const Self& amap)
|
||||
{
|
||||
save_combinatorial_map(amap, os);
|
||||
return os;
|
||||
}
|
||||
|
||||
friend std::ifstream& operator>> (std::ifstream& is, Self& amap)
|
||||
{
|
||||
load_combinatorial_map(is, amap);
|
||||
return is;
|
||||
}
|
||||
|
||||
/** Import the given hds which should be a model of an halfedge graph. */
|
||||
template<class HEG, class PointConverter>
|
||||
void import_from_halfedge_graph(const HEG& heg ,
|
||||
const PointConverter& pointconverter,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<typename boost::graph_traits<HEG>::halfedge_descriptor,
|
||||
Dart_handle>* origin_to_copy=NULL,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<Dart_handle,
|
||||
typename boost::graph_traits<HEG>::halfedge_descriptor>*
|
||||
copy_to_origin=NULL)
|
||||
|
||||
{
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<typename boost::graph_traits<HEG>::halfedge_descriptor,
|
||||
Dart_handle> local_dartmap;
|
||||
if (origin_to_copy==NULL) // Used local_dartmap if user does not provides its own unordered_map
|
||||
|
|
@ -171,7 +184,7 @@ namespace CGAL {
|
|||
Point_property_map;
|
||||
Point_property_map ppmap = get(CGAL::vertex_point, heg);
|
||||
|
||||
typename boost::unordered_map
|
||||
typename std::unordered_map
|
||||
<typename boost::graph_traits<HEG>::halfedge_descriptor,
|
||||
Dart_handle>::iterator dartmap_iter, dartmap_iter_end=origin_to_copy->end();
|
||||
for (dartmap_iter=origin_to_copy->begin(); dartmap_iter!=dartmap_iter_end;
|
||||
|
|
@ -190,10 +203,10 @@ namespace CGAL {
|
|||
/** Import the given hds which should be a model of an halfedge graph. */
|
||||
template<class HEG>
|
||||
void import_from_halfedge_graph(const HEG& heg,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<typename boost::graph_traits<HEG>::halfedge_descriptor,
|
||||
Dart_handle>* origin_to_copy=NULL,
|
||||
boost::unordered_map
|
||||
std::unordered_map
|
||||
<Dart_handle,
|
||||
typename boost::graph_traits<HEG>::halfedge_descriptor>*
|
||||
copy_to_origin=NULL)
|
||||
|
|
|
|||
|
|
@ -145,6 +145,18 @@ namespace CGAL {
|
|||
Base::operator=(alcc);
|
||||
return *this;
|
||||
}
|
||||
|
||||
friend std::ostream& operator<< (std::ostream& os, const Self& amap)
|
||||
{
|
||||
save_generalized_map(amap, os);
|
||||
return os;
|
||||
}
|
||||
|
||||
friend std::ifstream& operator>> (std::ifstream& is, Self& amap)
|
||||
{
|
||||
load_generalized_map(is, amap);
|
||||
return is;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace CGAL
|
||||
|
|
|
|||
|
|
@ -14,9 +14,12 @@
|
|||
|
||||
#include <vector>
|
||||
#include <cstddef>
|
||||
#include <unordered_map>
|
||||
#include <initializer_list>
|
||||
#include <CGAL/Linear_cell_complex_base.h>
|
||||
|
||||
namespace CGAL {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template<class LCC, class Combinatorial_data_structure=
|
||||
typename LCC::Combinatorial_data_structure>
|
||||
struct Add_vertex_to_face
|
||||
|
|
@ -71,139 +74,332 @@ namespace CGAL {
|
|||
lcc.template link_alpha<0>(prev_dart, lcc.create_dart(vh));
|
||||
}
|
||||
};
|
||||
|
||||
// Incremental builder
|
||||
template < class LCC_ >
|
||||
class Linear_cell_complex_incremental_builder_3
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template<class LCC, class Combinatorial_data_structure=
|
||||
typename LCC::Combinatorial_data_structure>
|
||||
struct Find_opposite_2_no_control // No difference for CMap and GMap
|
||||
{
|
||||
typedef typename LCC::Dart_handle DH;
|
||||
typedef typename LCC::Vertex_attribute_handle VAH;
|
||||
static DH run(LCC&,
|
||||
std::unordered_map<VAH, std::unordered_map<VAH, DH>>&
|
||||
vertex_to_dart_map_in_surface,
|
||||
VAH vah1, VAH vah2)
|
||||
{
|
||||
public:
|
||||
typedef LCC_ LCC;
|
||||
typedef typename LCC::Dart_handle Dart_handle;
|
||||
typedef typename LCC::Vertex_attribute_handle Vertex_attribute_handle;
|
||||
typedef typename LCC::Point Point_3;
|
||||
typedef typename LCC::size_type size_type;
|
||||
|
||||
Linear_cell_complex_incremental_builder_3(LCC & alcc) :
|
||||
lcc(alcc)
|
||||
{}
|
||||
|
||||
Vertex_attribute_handle add_vertex(const Point_3& p)
|
||||
// We are searching edge vah2->vah1 (the opposite of edge vah1->vah2)
|
||||
auto it2=vertex_to_dart_map_in_surface.find(vah2);
|
||||
if (it2!=vertex_to_dart_map_in_surface.end())
|
||||
{
|
||||
Vertex_attribute_handle res = lcc.create_vertex_attribute(p);
|
||||
vertex_map.push_back(res);
|
||||
vertex_to_dart_map.push_back(std::vector<Dart_handle>());
|
||||
++new_vertices;
|
||||
return res;
|
||||
auto it1=it2->second.find(vah1);
|
||||
if (it1!=it2->second.end())
|
||||
{ return it1->second; }
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template<class LCC, class Combinatorial_data_structure=
|
||||
typename LCC::Combinatorial_data_structure>
|
||||
struct Find_opposite_2_with_control
|
||||
{
|
||||
typedef typename LCC::Dart_handle DH;
|
||||
typedef typename LCC::Vertex_attribute_handle VAH;
|
||||
static DH run(LCC&,
|
||||
std::unordered_map<VAH, std::unordered_map<VAH, DH>>&,
|
||||
VAH, VAH)
|
||||
{ return nullptr; }
|
||||
};
|
||||
template<class LCC>
|
||||
struct Find_opposite_2_with_control<LCC, CGAL::Combinatorial_map_tag>
|
||||
{
|
||||
typedef typename LCC::Dart_handle DH;
|
||||
typedef typename LCC::Vertex_attribute_handle VAH;
|
||||
static DH run(LCC& lcc,
|
||||
std::unordered_map<VAH, std::unordered_map<VAH, DH>>&
|
||||
vertex_to_dart_map_in_surface,
|
||||
VAH vah1, VAH vah2)
|
||||
{
|
||||
DH res=Find_opposite_2_no_control<LCC>::run(lcc,
|
||||
vertex_to_dart_map_in_surface,
|
||||
vah1, vah2);
|
||||
if (res!=nullptr)
|
||||
{
|
||||
if (!lcc.template is_free<2>(res))
|
||||
{ // Here a dart vah1->vah2 already exists, and it was already 2-sewn.
|
||||
std::cerr<<"ERROR in My_linear_cell_complex_incremental_builder_3: try to use a same oriented edge twice."<<std::endl;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
if (Find_opposite_2_no_control<LCC>::run(lcc,
|
||||
vertex_to_dart_map_in_surface,
|
||||
vah2, vah1)!=nullptr)
|
||||
{ // Here a dart vah1->vah2 already exists (but it was not already 2-sewn).
|
||||
std::cerr<<"ERROR in My_linear_cell_complex_incremental_builder_3: try to use a same oriented edge twice."<<std::endl;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void begin_facet()
|
||||
return res;
|
||||
}
|
||||
};
|
||||
template<class LCC>
|
||||
struct Find_opposite_2_with_control<LCC, CGAL::Generalized_map_tag>
|
||||
{
|
||||
typedef typename LCC::Dart_handle DH;
|
||||
typedef typename LCC::Vertex_attribute_handle VAH;
|
||||
static DH run(LCC& lcc,
|
||||
std::unordered_map<VAH, std::unordered_map<VAH, DH>>&
|
||||
vertex_to_dart_map_in_surface,
|
||||
VAH vah1, VAH vah2)
|
||||
{
|
||||
DH res=Find_opposite_2_no_control<LCC>::run(lcc,
|
||||
vertex_to_dart_map_in_surface,
|
||||
vah1, vah2);
|
||||
if (res!=nullptr)
|
||||
{
|
||||
first_dart = lcc.null_handle;
|
||||
prev_dart = lcc.null_handle;
|
||||
// std::cout<<"Begin facet: "<<std::flush;
|
||||
if (!lcc.template is_free<2>(res))
|
||||
{ // Here a dart vah1->vah2 already exists, and it was already 2-sewn.
|
||||
std::cerr<<"ERROR in My_linear_cell_complex_incremental_builder_3: try to use a same oriented edge twice."<<std::endl;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template<class LCC, class Combinatorial_data_structure=
|
||||
typename LCC::Combinatorial_data_structure>
|
||||
struct Add_edge_in_associative_array
|
||||
{
|
||||
typedef typename LCC::Dart_handle DH;
|
||||
typedef typename LCC::Vertex_attribute_handle VAH;
|
||||
static void run(LCC&, DH,
|
||||
std::unordered_map<VAH, std::unordered_map<VAH, DH>>&)
|
||||
{}
|
||||
};
|
||||
template<class LCC>
|
||||
struct Add_edge_in_associative_array<LCC, CGAL::Combinatorial_map_tag>
|
||||
{
|
||||
typedef typename LCC::Dart_handle DH;
|
||||
typedef typename LCC::Vertex_attribute_handle VAH;
|
||||
static void run(LCC& lcc, DH dh,
|
||||
std::unordered_map<VAH, std::unordered_map<VAH, DH>>&
|
||||
vertex_to_dart_map_in_surface)
|
||||
{
|
||||
vertex_to_dart_map_in_surface[lcc.vertex_attribute(dh)].insert
|
||||
(std::make_pair(lcc.vertex_attribute(lcc.next(dh)), dh));
|
||||
}
|
||||
};
|
||||
template<class LCC>
|
||||
struct Add_edge_in_associative_array<LCC, CGAL::Generalized_map_tag>
|
||||
{
|
||||
typedef typename LCC::Dart_handle DH;
|
||||
typedef typename LCC::Vertex_attribute_handle VAH;
|
||||
static void run(LCC& lcc, DH dh,
|
||||
std::unordered_map<VAH, std::unordered_map<VAH, DH>>&
|
||||
vertex_to_dart_map_in_surface)
|
||||
{
|
||||
vertex_to_dart_map_in_surface[lcc.vertex_attribute(dh)].insert
|
||||
(std::make_pair(lcc.vertex_attribute(lcc.template alpha<0>(dh)), dh));
|
||||
|
||||
void add_vertex_to_facet(size_type i)
|
||||
vertex_to_dart_map_in_surface
|
||||
[lcc.vertex_attribute(lcc.template alpha<0>(dh))].insert
|
||||
(std::make_pair(lcc.vertex_attribute(dh), lcc.template alpha<0>(dh)));
|
||||
}
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template<class LCC_, unsigned int dim=LCC_::dimension>
|
||||
struct Sew3_for_LCC_incremental_builder
|
||||
{
|
||||
static void run(LCC_& lcc,
|
||||
typename LCC_::Dart_handle dh1, typename LCC_::Dart_handle dh2)
|
||||
{
|
||||
if(dh1!=nullptr)
|
||||
{
|
||||
CGAL_assertion( i<new_vertices );
|
||||
// std::cout<<i<<" "<<std::flush;
|
||||
Dart_handle cur = Add_vertex_to_face<LCC>::
|
||||
run(lcc, vertex_map[i], prev_dart);
|
||||
|
||||
if ( prev_dart!=lcc.null_handle )
|
||||
if(!lcc.template is_free<3>(dh1))
|
||||
{
|
||||
Dart_handle opposite=
|
||||
find_dart_between(i,lcc.vertex_attribute(prev_dart));
|
||||
if ( opposite!=lcc.null_handle )
|
||||
{
|
||||
CGAL_assertion( lcc.template is_free<2>(opposite) );
|
||||
lcc.template set_opposite<2>(prev_dart, opposite);
|
||||
}
|
||||
|
||||
add_dart_in_vertex_to_dart_map(prev_dart, prev_vertex);
|
||||
std::cerr<<"ERROR in My_linear_cell_complex_incremental_builder_3: "
|
||||
<<"it exists more than 2 faces with same indices."<<std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
first_dart = cur;
|
||||
first_vertex = i;
|
||||
}
|
||||
|
||||
prev_dart = cur;
|
||||
prev_vertex = i;
|
||||
{ lcc.template sew<3>(lcc.other_orientation(dh1), dh2); }
|
||||
}
|
||||
}
|
||||
};
|
||||
template<class LCC_>
|
||||
struct Sew3_for_LCC_incremental_builder<LCC_, 2>
|
||||
{
|
||||
static void run(LCC_&, typename LCC_::Dart_handle, typename LCC_::Dart_handle)
|
||||
{}
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Incremental builder
|
||||
template < class LCC_ >
|
||||
class Linear_cell_complex_incremental_builder_3
|
||||
{
|
||||
public:
|
||||
typedef LCC_ LCC;
|
||||
typedef typename LCC::Dart_handle DH;
|
||||
typedef typename LCC::Vertex_attribute_handle VAH;
|
||||
typedef typename LCC::Point Point_3;
|
||||
typedef typename LCC::size_type size_type;
|
||||
|
||||
// End of the facet. Return the first dart of this facet.
|
||||
Dart_handle end_facet()
|
||||
Linear_cell_complex_incremental_builder_3(LCC & alcc) :
|
||||
lcc(alcc)
|
||||
{}
|
||||
|
||||
VAH add_vertex(const Point_3& p)
|
||||
{
|
||||
VAH res=lcc.create_vertex_attribute(p);
|
||||
vertex_map.push_back(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
void begin_facet()
|
||||
{ // std::cout<<"Begin facet: "<<std::flush;
|
||||
first_dart=lcc.null_handle;
|
||||
prev_dart =lcc.null_handle;
|
||||
}
|
||||
|
||||
void add_vertex_to_facet(size_type i)
|
||||
{
|
||||
CGAL_assertion(i<vertex_map.size());
|
||||
// std::cout<<i<<" "<<std::flush;
|
||||
DH cur_dart=Add_vertex_to_face<LCC>::run(lcc, vertex_map[i], prev_dart);
|
||||
if ( prev_dart!=lcc.null_handle )
|
||||
{
|
||||
CGAL_assertion( first_dart!=lcc.null_handle && prev_dart!=lcc.null_handle );
|
||||
|
||||
Add_vertex_to_face<LCC>::run_for_last(lcc, vertex_map[first_vertex],
|
||||
prev_dart);
|
||||
|
||||
lcc.set_next(prev_dart, first_dart);
|
||||
|
||||
Dart_handle opposite =
|
||||
find_dart_between(first_vertex,lcc.vertex_attribute(prev_dart));
|
||||
DH opposite=Find_opposite_2_with_control<LCC>::
|
||||
run(lcc,
|
||||
vertex_to_dart_map_in_surface,
|
||||
lcc.vertex_attribute(prev_dart),
|
||||
lcc.vertex_attribute(cur_dart));
|
||||
if ( opposite!=lcc.null_handle )
|
||||
{
|
||||
CGAL_assertion( lcc.template is_free<2>(opposite) );
|
||||
lcc.template set_opposite<2>(prev_dart, opposite);
|
||||
}
|
||||
|
||||
add_dart_in_vertex_to_dart_map(prev_dart, prev_vertex);
|
||||
Add_edge_in_associative_array<LCC>::run(lcc, prev_dart,
|
||||
vertex_to_dart_map_in_surface);
|
||||
|
||||
return first_dart;
|
||||
if (i<min_vertex) { min_vertex=i; min_dart=cur_dart; }
|
||||
if (i>max_vertex) { max_vertex=i; }
|
||||
}
|
||||
else
|
||||
{ first_dart=cur_dart; min_vertex=max_vertex=i; min_dart=cur_dart; }
|
||||
|
||||
void begin_surface( std::size_t v, std::size_t /*f*/, std::size_t /*h*/)
|
||||
prev_dart=cur_dart;
|
||||
}
|
||||
|
||||
// End of the facet. Return the first dart of this facet.
|
||||
DH end_facet()
|
||||
{
|
||||
CGAL_assertion( first_dart!=lcc.null_handle && prev_dart!=lcc.null_handle );
|
||||
|
||||
Add_vertex_to_face<LCC>::run_for_last(lcc,
|
||||
lcc.vertex_attribute(first_dart),
|
||||
prev_dart);
|
||||
|
||||
lcc.set_next(prev_dart, first_dart);
|
||||
|
||||
DH opposite=Find_opposite_2_with_control<LCC>::
|
||||
run(lcc,
|
||||
vertex_to_dart_map_in_surface,
|
||||
lcc.vertex_attribute(prev_dart),
|
||||
lcc.vertex_attribute(first_dart));
|
||||
if ( opposite!=lcc.null_handle )
|
||||
{
|
||||
new_vertices = 0;
|
||||
first_dart = lcc.null_handle;
|
||||
prev_dart = lcc.null_handle;
|
||||
vertex_map.clear();
|
||||
vertex_to_dart_map.clear();
|
||||
vertex_map.reserve(v);
|
||||
vertex_to_dart_map.reserve(v);
|
||||
// lcc.reserve(v,h);
|
||||
CGAL_assertion( lcc.template is_free<2>(opposite) );
|
||||
lcc.template set_opposite<2>(prev_dart, opposite);
|
||||
}
|
||||
|
||||
Add_edge_in_associative_array<LCC>::run(lcc, prev_dart,
|
||||
vertex_to_dart_map_in_surface);
|
||||
|
||||
if(LCC::dimension>2)
|
||||
{
|
||||
opposite=opposite_face();
|
||||
Sew3_for_LCC_incremental_builder<LCC>::run(lcc, opposite, min_dart);
|
||||
add_face_in_array();
|
||||
}
|
||||
return first_dart;
|
||||
}
|
||||
|
||||
DH add_facet(std::initializer_list<size_type> l)
|
||||
{
|
||||
begin_facet();
|
||||
for (std::size_t i:l)
|
||||
{ add_vertex_to_facet(i); }
|
||||
return end_facet();
|
||||
}
|
||||
|
||||
void begin_surface()
|
||||
{
|
||||
vertex_to_dart_map_in_surface.clear();
|
||||
}
|
||||
|
||||
// End of the surface. Return one dart of the created surface.
|
||||
Dart_handle end_surface()
|
||||
DH end_surface()
|
||||
{ return first_dart; }
|
||||
|
||||
protected:
|
||||
|
||||
Dart_handle find_dart_between(size_type i, Vertex_attribute_handle vh)
|
||||
/** test if the two given facets have the same vertex handle but with
|
||||
* opposite orientations. For closed facets.
|
||||
* @return true iff the two facets have the same vertex handle with opposite
|
||||
* orientation.
|
||||
*/
|
||||
bool are_facets_opposite_and_same_vertex_handles(DH d1, DH d2) const
|
||||
{
|
||||
DH s1=d1;
|
||||
DH s2=d2;
|
||||
do
|
||||
{
|
||||
typename std::vector<Dart_handle>::reverse_iterator
|
||||
it(vertex_to_dart_map[i].rbegin());
|
||||
typename std::vector<Dart_handle>::reverse_iterator
|
||||
itend(vertex_to_dart_map[i].rend());
|
||||
assert(lcc.is_next_exist(d1) && lcc.is_previous_exist(d2));
|
||||
assert(lcc.other_extremity(d2)!=lcc.null_handle);
|
||||
|
||||
for ( ; it!=itend; ++it )
|
||||
{
|
||||
if ( lcc.vertex_attribute(lcc.next(*it))==vh ) return (*it);
|
||||
}
|
||||
return lcc.null_handle;
|
||||
if (lcc.vertex_attribute(d1)!=lcc.vertex_attribute(d2))
|
||||
{ return false; }
|
||||
d1=lcc.next(d1);
|
||||
d2=lcc.previous(d2);
|
||||
}
|
||||
while(d1!=s1);
|
||||
|
||||
void add_dart_in_vertex_to_dart_map( Dart_handle adart, size_type i )
|
||||
if (d2!=s2) { return false; }
|
||||
return true;
|
||||
}
|
||||
|
||||
DH opposite_face()
|
||||
{
|
||||
auto it1=faces.find(min_vertex);
|
||||
if(it1==faces.end()) { return nullptr; }
|
||||
auto it2=it1->second.find(max_vertex);
|
||||
if(it2==it1->second.end()) { return nullptr; }
|
||||
for(auto it3=it2->second.begin(), it3end=it2->second.end(); it3!=it3end; ++it3)
|
||||
{
|
||||
CGAL_assertion( adart!=lcc.null_handle );
|
||||
vertex_to_dart_map[i].push_back(adart);
|
||||
if (are_facets_opposite_and_same_vertex_handles(*it3, min_dart))
|
||||
{ return lcc.previous(*it3); }
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<Vertex_attribute_handle> vertex_map;
|
||||
std::vector<std::vector<Dart_handle> > vertex_to_dart_map;
|
||||
void add_face_in_array()
|
||||
{
|
||||
faces[min_vertex][max_vertex].push_back(min_dart);
|
||||
}
|
||||
|
||||
LCC& lcc;
|
||||
Dart_handle first_dart;
|
||||
Dart_handle prev_dart;
|
||||
size_type first_vertex;
|
||||
size_type prev_vertex;
|
||||
size_type new_vertices;
|
||||
};
|
||||
private:
|
||||
LCC& lcc;
|
||||
std::vector<VAH> vertex_map; // Map each index to the corresponding vertex handle
|
||||
|
||||
// A map to associate to each edge of a surface its dart. The edge is given
|
||||
// by its two vertex handles (source-target).
|
||||
std::unordered_map<VAH, std::unordered_map<VAH, DH>> vertex_to_dart_map_in_surface;
|
||||
std::unordered_map<std::size_t, std::unordered_map<std::size_t, std::vector<DH>>> faces;
|
||||
|
||||
DH first_dart; /// First dart of the current face
|
||||
DH prev_dart; /// Prev dart of the current face
|
||||
DH min_dart; /// dart with the min vertex of the current facet.
|
||||
std::size_t min_vertex, max_vertex; /// min and max indices of vertices of the current face
|
||||
};
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,179 @@
|
|||
#include <CGAL/Linear_cell_complex_for_combinatorial_map.h>
|
||||
#include <CGAL/Linear_cell_complex_for_generalized_map.h>
|
||||
#include <CGAL/Linear_cell_complex_incremental_builder.h>
|
||||
#include <CGAL/Combinatorial_map_save_load.h>
|
||||
|
||||
#include "Linear_cell_complex_3_test.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/* 3
|
||||
* /|\
|
||||
* 0-|-2
|
||||
* \|/
|
||||
* 1
|
||||
*/
|
||||
template<typename IncrementalBuilder>
|
||||
void make_tetrahedron_with_builder(IncrementalBuilder& ib,
|
||||
std::size_t i0,
|
||||
std::size_t i1,
|
||||
std::size_t i2,
|
||||
std::size_t i3)
|
||||
{
|
||||
ib.begin_surface();
|
||||
ib.add_facet({i0,i1,i2});
|
||||
ib.add_facet({i1,i0,i3});
|
||||
ib.add_facet({i2,i1,i3});
|
||||
ib.add_facet({i0,i2,i3});
|
||||
ib.end_surface();
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/* 4
|
||||
* /|\
|
||||
* 0-|-3
|
||||
* | | |
|
||||
* 1---2
|
||||
*/
|
||||
template<typename IncrementalBuilder>
|
||||
void make_pyramid_with_builder(IncrementalBuilder& ib,
|
||||
std::size_t i0,
|
||||
std::size_t i1,
|
||||
std::size_t i2,
|
||||
std::size_t i3,
|
||||
std::size_t i4)
|
||||
{
|
||||
ib.begin_surface();
|
||||
ib.add_facet({i0,i1,i2,i3});
|
||||
ib.add_facet({i1,i0,i4});
|
||||
ib.add_facet({i2,i1,i4});
|
||||
ib.add_facet({i3,i2,i4});
|
||||
ib.add_facet({i0,i3,i4});
|
||||
ib.end_surface();
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/* 3
|
||||
* /|\
|
||||
* 4---5
|
||||
* | | |
|
||||
* | 0 |
|
||||
* |/ \|
|
||||
* 1---2
|
||||
*/
|
||||
template<typename IncrementalBuilder>
|
||||
void make_prism_with_builder(IncrementalBuilder& ib,
|
||||
std::size_t i0,
|
||||
std::size_t i1,
|
||||
std::size_t i2,
|
||||
std::size_t i3,
|
||||
std::size_t i4,
|
||||
std::size_t i5)
|
||||
{
|
||||
ib.begin_surface();
|
||||
ib.add_facet({i0,i1,i2});
|
||||
ib.add_facet({i1,i0,i3,i4});
|
||||
ib.add_facet({i2,i1,i4,i5});
|
||||
ib.add_facet({i0,i2,i5,i3});
|
||||
ib.add_facet({i5,i4,i3});
|
||||
ib.end_surface();
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/* 7----6
|
||||
* /| /|
|
||||
* 4----5 |
|
||||
* | 3--|-2
|
||||
* |/ |/
|
||||
* 0----1
|
||||
*/
|
||||
template<typename IncrementalBuilder>
|
||||
void make_hexahedron_with_builder(IncrementalBuilder& ib,
|
||||
std::size_t i0,
|
||||
std::size_t i1,
|
||||
std::size_t i2,
|
||||
std::size_t i3,
|
||||
std::size_t i4,
|
||||
std::size_t i5,
|
||||
std::size_t i6,
|
||||
std::size_t i7)
|
||||
{
|
||||
ib.begin_surface();
|
||||
ib.add_facet({i0,i1,i2,i3});
|
||||
ib.add_facet({i1,i0,i4,i5});
|
||||
ib.add_facet({i2,i1,i5,i6});
|
||||
ib.add_facet({i3,i2,i6,i7});
|
||||
ib.add_facet({i0,i3,i7,i4});
|
||||
ib.add_facet({i7,i6,i5,i4});
|
||||
ib.end_surface();
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template<typename LCC>
|
||||
bool test_ib(const char* filename)
|
||||
{
|
||||
typedef typename LCC::Point Point;
|
||||
LCC lcc;
|
||||
CGAL::Linear_cell_complex_incremental_builder_3<LCC> ib(lcc);
|
||||
|
||||
ib.add_vertex(Point(0,0,0)); // 0
|
||||
ib.add_vertex(Point(1,0,0)); // 1
|
||||
ib.add_vertex(Point(1,2,0)); // 2
|
||||
ib.add_vertex(Point(0,2,0)); // 3
|
||||
|
||||
ib.add_vertex(Point(0,0,1.5)); // 4
|
||||
ib.add_vertex(Point(1,0,1.5)); // 5
|
||||
ib.add_vertex(Point(1,2,1.5)); // 6
|
||||
ib.add_vertex(Point(0,2,1.5)); // 7
|
||||
|
||||
ib.add_vertex(Point(0.5,1,2.5)); // 8
|
||||
|
||||
ib.add_vertex(Point(2,0,0)); // 9
|
||||
ib.add_vertex(Point(2,0,1)); // 10
|
||||
|
||||
trace_test_begin();
|
||||
make_hexahedron_with_builder(ib, 0,1,2,3,4,5,6,7);
|
||||
make_pyramid_with_builder(ib, 4,5,6,7,8);
|
||||
make_prism_with_builder(ib, 2,1,9,6,5,10);
|
||||
make_tetrahedron_with_builder(ib, 6,5,10,8);
|
||||
|
||||
if ( !check_number_of_cells_3(lcc, 11, 22, 16, 4, 1) )
|
||||
{ return false; }
|
||||
|
||||
LCC lcc2;
|
||||
std::ifstream input(std::string("data/")+filename);
|
||||
if (!input)
|
||||
{
|
||||
std::cout<<"Problem to load LCC data/"<<filename<<std::endl;
|
||||
return false;
|
||||
}
|
||||
input>>lcc2;
|
||||
input.close();
|
||||
|
||||
if (!lcc.is_isomorphic_to(lcc2))
|
||||
{ return false; }
|
||||
trace_test_end();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout<<"LCC_3_incremental_builder_test (v1)."<<std::flush;
|
||||
|
||||
// ****************** TEST FOR CMAP ******************
|
||||
trace_display_msg("test_LCC_3<LCC3>");
|
||||
typedef CGAL::Linear_cell_complex_for_combinatorial_map<3> LCC3;
|
||||
if ( !test_ib<LCC3>("lcc3_ib_test.cmap") )
|
||||
{
|
||||
std::cout<<" Error during Test_LCC_3<LCC3>."<<std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// ****************** TEST FOR GMAP ******************
|
||||
trace_display_msg("test_LCC_3<GLCC3>");
|
||||
typedef CGAL::Linear_cell_complex_for_generalized_map<3> GLCC3;
|
||||
if ( !test_ib<GLCC3>("lcc3_ib_test.gmap") )
|
||||
{
|
||||
std::cout<<" Error during Test_LCC_3<GLCC3>."<<std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
std::cout<<" Success."<<std::endl;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<data><darts><d><b i="1">2</b><b i="2">5</b></d><d><b i="1">3</b><b i="2">9</b></d><d><b i="1">4</b><b i="2">13</b></d><d><b i="1">1</b><b i="2">17</b></d><d><b i="1">6</b><b i="2">1</b></d><d><b i="1">7</b><b i="2">20</b></d><d><b i="1">8</b><b i="2">23</b></d><d><b i="1">5</b><b i="2">10</b></d><d><b i="1">10</b><b i="2">2</b><b i="3">44</b></d><d><b i="1">11</b><b i="2">8</b><b i="3">47</b></d><d><b i="1">12</b><b i="2">22</b><b i="3">46</b></d><d><b i="1">9</b><b i="2">14</b><b i="3">45</b></d><d><b i="1">14</b><b i="2">3</b></d><d><b i="1">15</b><b i="2">12</b></d><d><b i="1">16</b><b i="2">21</b></d><d><b i="1">13</b><b i="2">18</b></d><d><b i="1">18</b><b i="2">4</b></d><d><b i="1">19</b><b i="2">16</b></d><d><b i="1">20</b><b i="2">24</b></d><d><b i="1">17</b><b i="2">6</b></d><d><b i="1">22</b><b i="2">15</b><b i="3">27</b></d><d><b i="1">23</b><b i="2">11</b><b i="3">26</b></d><d><b i="1">24</b><b i="2">7</b><b i="3">25</b></d><d><b i="1">21</b><b i="2">19</b><b i="3">28</b></d><d><b i="1">26</b><b i="2">29</b><b i="3">23</b></d><d><b i="1">27</b><b i="2">32</b><b i="3">22</b></d><d><b i="1">28</b><b i="2">35</b><b i="3">21</b></d><d><b i="1">25</b><b i="2">38</b><b i="3">24</b></d><d><b i="1">30</b><b i="2">25</b></d><d><b i="1">31</b><b i="2">40</b></d><d><b i="1">29</b><b i="2">33</b></d><d><b i="1">33</b><b i="2">26</b><b i="3">62</b></d><d><b i="1">34</b><b i="2">31</b><b i="3">64</b></d><d><b i="1">32</b><b i="2">36</b><b i="3">63</b></d><d><b i="1">36</b><b i="2">27</b></d><d><b i="1">37</b><b i="2">34</b></d><d><b i="1">35</b><b i="2">39</b></d><d><b i="1">39</b><b i="2">28</b></d><d><b i="1">40</b><b i="2">37</b></d><d><b i="1">38</b><b i="2">30</b></d><d><b i="1">42</b><b i="2">44</b></d><d><b i="1">43</b><b i="2">48</b></d><d><b i="1">41</b><b i="2">52</b></d><d><b i="1">45</b><b i="2">41</b><b i="3">9</b></d><d><b i="1">46</b><b i="2">55</b><b i="3">12</b></d><d><b i="1">47</b><b i="2">57</b><b i="3">11</b></d><d><b i="1">44</b><b i="2">49</b><b i="3">10</b></d><d><b i="1">49</b><b i="2">42</b></d><d><b i="1">50</b><b i="2">47</b></d><d><b i="1">51</b><b i="2">56</b></d><d><b i="1">48</b><b i="2">53</b></d><d><b i="1">53</b><b i="2">43</b></d><d><b i="1">54</b><b i="2">51</b></d><d><b i="1">55</b><b i="2">58</b></d><d><b i="1">52</b><b i="2">45</b></d><d><b i="1">57</b><b i="2">50</b><b i="3">60</b></d><d><b i="1">58</b><b i="2">46</b><b i="3">59</b></d><d><b i="1">56</b><b i="2">54</b><b i="3">61</b></d><d><b i="1">60</b><b i="2">62</b><b i="3">57</b></d><d><b i="1">61</b><b i="2">65</b><b i="3">56</b></d><d><b i="1">59</b><b i="2">68</b><b i="3">58</b></d><d><b i="1">63</b><b i="2">59</b><b i="3">32</b></d><d><b i="1">64</b><b i="2">70</b><b i="3">34</b></d><d><b i="1">62</b><b i="2">66</b><b i="3">33</b></d><d><b i="1">66</b><b i="2">60</b></d><d><b i="1">67</b><b i="2">64</b></d><d><b i="1">65</b><b i="2">69</b></d><d><b i="1">69</b><b i="2">61</b></d><d><b i="1">70</b><b i="2">67</b></d><d><b i="1">68</b><b i="2">63</b></d></darts><attributes><dimension index="0"><type>void</type><type_point>N4CGAL7Point_3INS_5EpickEEE</type_point><a><d>17</d><p><x>0</x><y>0</y><z>0</z></p></a><a><d>49</d><p><x>1</x><y>0</y><z>0</z></p></a><a><d>52</d><p><x>1</x><y>2</y><z>0</z></p></a><a><d>18</d><p><x>0</x><y>2</y><z>0</z></p></a><a><d>38</d><p><x>0</x><y>0</y><z>1.5</z></p></a><a><d>66</d><p><x>1</x><y>0</y><z>1.5</z></p></a><a><d>68</d><p><x>1</x><y>2</y><z>1.5</z></p></a><a><d>39</d><p><x>0</x><y>2</y><z>1.5</z></p></a><a><d>70</d><p><x>0.5</x><y>1</y><z>2.5</z></p></a><a><d>53</d><p><x>2</x><y>0</y><z>0</z></p></a><a><d>69</d><p><x>2</x><y>0</y><z>1</z></p></a></dimension></attributes></data>
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -8,7 +8,7 @@
|
|||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <cstdlib>
|
||||
#include <unordered_set>
|
||||
#include <unordered_map>
|
||||
|
||||
using LCC_3 =CGAL::Linear_cell_complex_for_generalized_map<2, 3>;
|
||||
using Dart_handle =LCC_3::Dart_handle;
|
||||
|
|
@ -97,7 +97,7 @@ int main(int argc, char* argv[])
|
|||
CGAL::load_off(lccoriginal, inp);
|
||||
std::cout<<"File '"<<filename<<"' loaded. Running the main program..."<<std::endl;
|
||||
|
||||
boost::unordered_map<Dart_handle, Dart_handle> origin_to_copy;
|
||||
std::unordered_map<Dart_handle, Dart_handle> origin_to_copy;
|
||||
lcccopy.copy(lccoriginal, &origin_to_copy, nullptr);
|
||||
|
||||
LCC_3::size_type is_root=lccoriginal.get_new_mark();
|
||||
|
|
|
|||
|
|
@ -44,9 +44,9 @@ namespace internal {
|
|||
using Mesh_original = Mesh_;
|
||||
using Generic_map = CGAL::Generalized_map<2, Items_>;
|
||||
using Dart_const_handle_original = typename Mesh_original::Dart_const_handle;
|
||||
using Copy_to_origin_map = boost::unordered_map<typename Generic_map::Dart_handle,
|
||||
using Copy_to_origin_map = std::unordered_map<typename Generic_map::Dart_handle,
|
||||
Dart_const_handle_original>;
|
||||
using Origin_to_copy_map = boost::unordered_map<Dart_const_handle_original,
|
||||
using Origin_to_copy_map = std::unordered_map<Dart_const_handle_original,
|
||||
typename Generic_map::Dart_handle>;
|
||||
|
||||
static void copy(Generic_map& target, const Mesh_original& source,
|
||||
|
|
@ -64,9 +64,9 @@ namespace internal {
|
|||
using Mesh_original = Mesh_;
|
||||
using Generic_map = CGAL::Combinatorial_map<2, Items_>;
|
||||
using Dart_const_handle_original = typename Mesh_original::Dart_const_handle;
|
||||
using Copy_to_origin_map = boost::unordered_map<typename Generic_map::Dart_handle,
|
||||
using Copy_to_origin_map = std::unordered_map<typename Generic_map::Dart_handle,
|
||||
Dart_const_handle_original>;
|
||||
using Origin_to_copy_map = boost::unordered_map<Dart_const_handle_original,
|
||||
using Origin_to_copy_map = std::unordered_map<Dart_const_handle_original,
|
||||
typename Generic_map::Dart_handle>;
|
||||
|
||||
static void copy(Generic_map& target, const Mesh_original& source,
|
||||
|
|
@ -83,9 +83,9 @@ namespace internal {
|
|||
using Mesh_original = Mesh_;
|
||||
using Generic_map = CGAL::Combinatorial_map<2, Items_>;
|
||||
using Dart_const_handle_original = typename boost::graph_traits<Mesh_original>::halfedge_descriptor;
|
||||
using Copy_to_origin_map = boost::unordered_map<typename Generic_map::Dart_handle,
|
||||
using Copy_to_origin_map = std::unordered_map<typename Generic_map::Dart_handle,
|
||||
Dart_const_handle_original>;
|
||||
using Origin_to_copy_map = boost::unordered_map<Dart_const_handle_original,
|
||||
using Origin_to_copy_map = std::unordered_map<Dart_const_handle_original,
|
||||
typename Generic_map::Dart_handle>;
|
||||
|
||||
static void copy(Generic_map& target, const Mesh_original& source,
|
||||
|
|
|
|||
|
|
@ -65,8 +65,8 @@ public:
|
|||
using Path =CGAL::Surface_mesh_topology::Path_on_surface<Mesh>;
|
||||
|
||||
// Associations between original darts and their copy.
|
||||
using Origin_to_copy=boost::unordered_map<Original_dart_const_handle, Dart_handle>;
|
||||
using Copy_to_origin=boost::unordered_map<Dart_handle, Original_dart_const_handle>;
|
||||
using Origin_to_copy=std::unordered_map<Original_dart_const_handle, Dart_handle>;
|
||||
using Copy_to_origin=std::unordered_map<Dart_handle, Original_dart_const_handle>;
|
||||
|
||||
/// @return the local map
|
||||
const Local_map& get_local_map() const
|
||||
|
|
|
|||
Loading…
Reference in New Issue