mirror of https://github.com/CGAL/cgal
Clean whitespace / tabs in Spatial_sorting/include (cosmetic only)
This commit is contained in:
parent
902183b701
commit
5c41b10d2b
|
|
@ -45,7 +45,7 @@ times the original size of the set, Hilbert sort is applied on the
|
||||||
second subset.
|
second subset.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
template <class ConcurrencyTag = Sequential_tag, class RandomAccessIterator, class Traits, class PolicyTag>
|
template <class ConcurrencyTag = Sequential_tag, class RandomAccessIterator, class Traits, class PolicyTag>
|
||||||
void
|
void
|
||||||
spatial_sort( RandomAccessIterator begin,
|
spatial_sort( RandomAccessIterator begin,
|
||||||
RandomAccessIterator end,
|
RandomAccessIterator end,
|
||||||
|
|
|
||||||
|
|
@ -19,24 +19,24 @@
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
||||||
template <class K, class Hilbert_policy, class ConcurrencyTag = Sequential_tag >
|
template <class K, class Hilbert_policy, class ConcurrencyTag = Sequential_tag >
|
||||||
class Hilbert_sort_2;
|
class Hilbert_sort_2;
|
||||||
|
|
||||||
template <class K, class ConcurrencyTag>
|
template <class K, class ConcurrencyTag>
|
||||||
class Hilbert_sort_2<K, Hilbert_sort_median_policy, ConcurrencyTag >
|
class Hilbert_sort_2<K, Hilbert_sort_median_policy, ConcurrencyTag >
|
||||||
: public Hilbert_sort_median_2<K, ConcurrencyTag>
|
: public Hilbert_sort_median_2<K, ConcurrencyTag>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Hilbert_sort_2 (const K &k=K() , std::ptrdiff_t limit=1 )
|
Hilbert_sort_2 (const K &k=K(), std::ptrdiff_t limit=1 )
|
||||||
: Hilbert_sort_median_2<K, ConcurrencyTag> (k,limit)
|
: Hilbert_sort_median_2<K, ConcurrencyTag> (k,limit)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class K, class ConcurrencyTag>
|
template <class K, class ConcurrencyTag>
|
||||||
class Hilbert_sort_2<K, Hilbert_sort_middle_policy, ConcurrencyTag >
|
class Hilbert_sort_2<K, Hilbert_sort_middle_policy, ConcurrencyTag >
|
||||||
: public Hilbert_sort_middle_2<K>
|
: public Hilbert_sort_middle_2<K>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Hilbert_sort_2 (const K &k=K() , std::ptrdiff_t limit=1 )
|
Hilbert_sort_2 (const K &k=K(), std::ptrdiff_t limit=1 )
|
||||||
: Hilbert_sort_middle_2<K> (k,limit)
|
: Hilbert_sort_middle_2<K> (k,limit)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -18,25 +18,25 @@
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
||||||
template <class K, class Hilbert_policy, class ConcurrencyTag = Sequential_tag>
|
template <class K, class Hilbert_policy, class ConcurrencyTag = Sequential_tag>
|
||||||
class Hilbert_sort_3;
|
class Hilbert_sort_3;
|
||||||
|
|
||||||
template <class K, class ConcurrencyTag>
|
template <class K, class ConcurrencyTag>
|
||||||
class Hilbert_sort_3<K, Hilbert_sort_median_policy, ConcurrencyTag >
|
class Hilbert_sort_3<K, Hilbert_sort_median_policy, ConcurrencyTag >
|
||||||
: public Hilbert_sort_median_3<K, ConcurrencyTag>
|
: public Hilbert_sort_median_3<K, ConcurrencyTag>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Hilbert_sort_3 (const K &k=K() , std::ptrdiff_t limit=1 )
|
Hilbert_sort_3 (const K &k=K(), std::ptrdiff_t limit=1 )
|
||||||
: Hilbert_sort_median_3<K, ConcurrencyTag> (k,limit)
|
: Hilbert_sort_median_3<K, ConcurrencyTag> (k,limit)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class K, class ConcurrencyTag >
|
template <class K, class ConcurrencyTag >
|
||||||
class Hilbert_sort_3<K, Hilbert_sort_middle_policy, ConcurrencyTag >
|
class Hilbert_sort_3<K, Hilbert_sort_middle_policy, ConcurrencyTag >
|
||||||
: public Hilbert_sort_middle_3<K>
|
: public Hilbert_sort_middle_3<K>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Hilbert_sort_3 (const K &k=K() , std::ptrdiff_t limit=1 )
|
Hilbert_sort_3 (const K &k=K(), std::ptrdiff_t limit=1 )
|
||||||
: Hilbert_sort_middle_3<K> (k,limit)
|
: Hilbert_sort_middle_3<K> (k,limit)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -21,25 +21,27 @@ namespace CGAL {
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
template <class RandomAccessIterator, class Cmp>
|
template <class RandomAccessIterator, class Cmp>
|
||||||
RandomAccessIterator
|
RandomAccessIterator
|
||||||
hilbert_split (RandomAccessIterator begin, RandomAccessIterator end,
|
hilbert_split (RandomAccessIterator begin, RandomAccessIterator end,
|
||||||
Cmp cmp = Cmp ())
|
Cmp cmp = Cmp ())
|
||||||
{
|
{
|
||||||
if (begin >= end) return begin;
|
if (begin >= end)
|
||||||
#if defined(CGAL_HILBERT_SORT_WITH_MEDIAN_POLICY_CROSS_PLATFORM_BEHAVIOR)
|
return begin;
|
||||||
|
|
||||||
|
#if defined(CGAL_HILBERT_SORT_WITH_MEDIAN_POLICY_CROSS_PLATFORM_BEHAVIOR)
|
||||||
RandomAccessIterator middle = begin + (end - begin) / 2;
|
RandomAccessIterator middle = begin + (end - begin) / 2;
|
||||||
CGAL::nth_element (begin, middle, end, cmp);
|
CGAL::nth_element (begin, middle, end, cmp);
|
||||||
return middle;
|
return middle;
|
||||||
#else
|
#else
|
||||||
RandomAccessIterator middle = begin + (end - begin) / 2;
|
RandomAccessIterator middle = begin + (end - begin) / 2;
|
||||||
std::nth_element (begin, middle, end, cmp);
|
std::nth_element (begin, middle, end, cmp);
|
||||||
return middle;
|
return middle;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace internal
|
||||||
|
|
||||||
} // namespace CGAL
|
} // namespace CGAL
|
||||||
|
|
||||||
#endif//CGAL_HILBERT_SORT_BASE_H
|
#endif//CGAL_HILBERT_SORT_BASE_H
|
||||||
|
|
|
||||||
|
|
@ -19,23 +19,23 @@
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
||||||
template <class K, class Hilbert_policy >
|
template <class K, class Hilbert_policy >
|
||||||
class Hilbert_sort_d;
|
class Hilbert_sort_d;
|
||||||
|
|
||||||
template <class K>
|
template <class K>
|
||||||
class Hilbert_sort_d<K, Hilbert_sort_median_policy >
|
class Hilbert_sort_d<K, Hilbert_sort_median_policy >
|
||||||
: public Hilbert_sort_median_d<K>
|
: public Hilbert_sort_median_d<K>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Hilbert_sort_d (const K &k=K() , std::ptrdiff_t limit=1 )
|
Hilbert_sort_d (const K &k=K() , std::ptrdiff_t limit=1 )
|
||||||
: Hilbert_sort_median_d<K> (k,limit)
|
: Hilbert_sort_median_d<K> (k,limit)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class K>
|
template <class K>
|
||||||
class Hilbert_sort_d<K, Hilbert_sort_middle_policy >
|
class Hilbert_sort_d<K, Hilbert_sort_middle_policy >
|
||||||
: public Hilbert_sort_middle_d<K>
|
: public Hilbert_sort_middle_d<K>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Hilbert_sort_d (const K &k=K() , std::ptrdiff_t limit=1 )
|
Hilbert_sort_d (const K &k=K() , std::ptrdiff_t limit=1 )
|
||||||
: Hilbert_sort_middle_d<K> (k,limit)
|
: Hilbert_sort_middle_d<K> (k,limit)
|
||||||
{}
|
{}
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,6 @@
|
||||||
|
|
||||||
#include <CGAL/config.h>
|
#include <CGAL/config.h>
|
||||||
#include <CGAL/tags.h>
|
#include <CGAL/tags.h>
|
||||||
#include <functional>
|
|
||||||
#include <cstddef>
|
|
||||||
#include <CGAL/Hilbert_sort_base.h>
|
#include <CGAL/Hilbert_sort_base.h>
|
||||||
|
|
||||||
#include <boost/type_traits/is_convertible.hpp>
|
#include <boost/type_traits/is_convertible.hpp>
|
||||||
|
|
@ -24,16 +22,19 @@
|
||||||
#include <tbb/parallel_invoke.h>
|
#include <tbb/parallel_invoke.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
template <class K, int x, bool up> struct Hilbert_cmp_2;
|
|
||||||
|
|
||||||
template <class K, int x>
|
template <class K, int x, bool up> struct Hilbert_cmp_2;
|
||||||
struct Hilbert_cmp_2<K,x,true>
|
|
||||||
: public CGAL::cpp98::binary_function<typename K::Point_2,
|
template <class K, int x>
|
||||||
typename K::Point_2, bool>
|
struct Hilbert_cmp_2<K,x,true>
|
||||||
{
|
: public CGAL::cpp98::binary_function<typename K::Point_2, typename K::Point_2, bool>
|
||||||
|
{
|
||||||
typedef typename K::Point_2 Point;
|
typedef typename K::Point_2 Point;
|
||||||
K k;
|
K k;
|
||||||
Hilbert_cmp_2 (const K &_k = K()) : k(_k) {}
|
Hilbert_cmp_2 (const K &_k = K()) : k(_k) {}
|
||||||
|
|
@ -41,13 +42,12 @@ namespace internal {
|
||||||
{
|
{
|
||||||
return Hilbert_cmp_2<K,x,false> (k) (q, p);
|
return Hilbert_cmp_2<K,x,false> (k) (q, p);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class K>
|
template <class K>
|
||||||
struct Hilbert_cmp_2<K,0,false>
|
struct Hilbert_cmp_2<K,0,false>
|
||||||
: public CGAL::cpp98::binary_function<typename K::Point_2,
|
: public CGAL::cpp98::binary_function<typename K::Point_2, typename K::Point_2, bool>
|
||||||
typename K::Point_2, bool>
|
{
|
||||||
{
|
|
||||||
typedef typename K::Point_2 Point;
|
typedef typename K::Point_2 Point;
|
||||||
K k;
|
K k;
|
||||||
Hilbert_cmp_2 (const K &_k = K()) : k(_k) {}
|
Hilbert_cmp_2 (const K &_k = K()) : k(_k) {}
|
||||||
|
|
@ -55,13 +55,12 @@ namespace internal {
|
||||||
{
|
{
|
||||||
return k.less_x_2_object() (p, q);
|
return k.less_x_2_object() (p, q);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class K>
|
template <class K>
|
||||||
struct Hilbert_cmp_2<K,1,false>
|
struct Hilbert_cmp_2<K,1,false>
|
||||||
: public CGAL::cpp98::binary_function<typename K::Point_2,
|
: public CGAL::cpp98::binary_function<typename K::Point_2, typename K::Point_2, bool>
|
||||||
typename K::Point_2, bool>
|
{
|
||||||
{
|
|
||||||
typedef typename K::Point_2 Point;
|
typedef typename K::Point_2 Point;
|
||||||
K k;
|
K k;
|
||||||
Hilbert_cmp_2 (const K &_k = K()) : k(_k) {}
|
Hilbert_cmp_2 (const K &_k = K()) : k(_k) {}
|
||||||
|
|
@ -69,8 +68,9 @@ namespace internal {
|
||||||
{
|
{
|
||||||
return k.less_y_2_object() (p, q);
|
return k.less_y_2_object() (p, q);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
} // namespace internal
|
||||||
|
|
||||||
template <class K, class ConcurrencyTag>
|
template <class K, class ConcurrencyTag>
|
||||||
class Hilbert_sort_median_2
|
class Hilbert_sort_median_2
|
||||||
|
|
@ -84,8 +84,12 @@ private:
|
||||||
Kernel _k;
|
Kernel _k;
|
||||||
std::ptrdiff_t _limit;
|
std::ptrdiff_t _limit;
|
||||||
|
|
||||||
template <int x, bool up> struct Cmp : public internal::Hilbert_cmp_2<Kernel,x,up>
|
template <int x, bool up>
|
||||||
{ Cmp (const Kernel &k) : internal::Hilbert_cmp_2<Kernel,x,up> (k) {} };
|
struct Cmp
|
||||||
|
: public internal::Hilbert_cmp_2<Kernel,x,up>
|
||||||
|
{
|
||||||
|
Cmp (const Kernel &k) : internal::Hilbert_cmp_2<Kernel,x,up> (k) {}
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Hilbert_sort_median_2 (const Kernel &k = Kernel(), std::ptrdiff_t limit = 1)
|
Hilbert_sort_median_2 (const Kernel &k = Kernel(), std::ptrdiff_t limit = 1)
|
||||||
|
|
@ -96,7 +100,8 @@ public:
|
||||||
void recursive_sort (RandomAccessIterator begin, RandomAccessIterator end) const
|
void recursive_sort (RandomAccessIterator begin, RandomAccessIterator end) const
|
||||||
{
|
{
|
||||||
const int y = (x + 1) % 2;
|
const int y = (x + 1) % 2;
|
||||||
if (end - begin <= _limit) return;
|
if (end - begin <= _limit)
|
||||||
|
return;
|
||||||
|
|
||||||
RandomAccessIterator m0 = begin, m4 = end;
|
RandomAccessIterator m0 = begin, m4 = end;
|
||||||
|
|
||||||
|
|
@ -111,7 +116,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
template <int x, bool upx, bool upy, class RandomAccessIterator>
|
template <int x, bool upx, bool upy, class RandomAccessIterator>
|
||||||
struct Recursive_sort {
|
struct Recursive_sort
|
||||||
|
{
|
||||||
const Self& hs;
|
const Self& hs;
|
||||||
RandomAccessIterator begin,end;
|
RandomAccessIterator begin,end;
|
||||||
|
|
||||||
|
|
@ -152,7 +158,8 @@ public:
|
||||||
"Parallel_tag is enabled but TBB is unavailable.");
|
"Parallel_tag is enabled but TBB is unavailable.");
|
||||||
#else
|
#else
|
||||||
const int y = (x + 1) % 2;
|
const int y = (x + 1) % 2;
|
||||||
if (end - begin <= _limit) return;
|
if (end - begin <= _limit)
|
||||||
|
return;
|
||||||
|
|
||||||
RandomAccessIterator m0 = begin, m4 = end;
|
RandomAccessIterator m0 = begin, m4 = end;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,13 +27,12 @@
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
template <class K, int x, bool up> struct Hilbert_cmp_3;
|
template <class K, int x, bool up> struct Hilbert_cmp_3;
|
||||||
|
|
||||||
template <class K, int x>
|
template <class K, int x>
|
||||||
struct Hilbert_cmp_3<K,x,true>
|
struct Hilbert_cmp_3<K,x,true>
|
||||||
: public CGAL::cpp98::binary_function<typename K::Point_3,
|
: public CGAL::cpp98::binary_function<typename K::Point_3, typename K::Point_3, bool>
|
||||||
typename K::Point_3, bool>
|
{
|
||||||
{
|
|
||||||
typedef typename K::Point_3 Point;
|
typedef typename K::Point_3 Point;
|
||||||
K k;
|
K k;
|
||||||
Hilbert_cmp_3 (const K &_k = K()) : k(_k) {}
|
Hilbert_cmp_3 (const K &_k = K()) : k(_k) {}
|
||||||
|
|
@ -41,13 +40,12 @@ namespace internal {
|
||||||
{
|
{
|
||||||
return Hilbert_cmp_3<K,x,false> (k) (q, p);
|
return Hilbert_cmp_3<K,x,false> (k) (q, p);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class K>
|
template <class K>
|
||||||
struct Hilbert_cmp_3<K,0,false>
|
struct Hilbert_cmp_3<K,0,false>
|
||||||
: public CGAL::cpp98::binary_function<typename K::Point_3,
|
: public CGAL::cpp98::binary_function<typename K::Point_3, typename K::Point_3, bool>
|
||||||
typename K::Point_3, bool>
|
{
|
||||||
{
|
|
||||||
typedef typename K::Point_3 Point;
|
typedef typename K::Point_3 Point;
|
||||||
K k;
|
K k;
|
||||||
Hilbert_cmp_3 (const K &_k = K()) : k(_k) {}
|
Hilbert_cmp_3 (const K &_k = K()) : k(_k) {}
|
||||||
|
|
@ -55,13 +53,12 @@ namespace internal {
|
||||||
{
|
{
|
||||||
return k.less_x_3_object() (p, q);
|
return k.less_x_3_object() (p, q);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class K>
|
template <class K>
|
||||||
struct Hilbert_cmp_3<K,1,false>
|
struct Hilbert_cmp_3<K,1,false>
|
||||||
: public CGAL::cpp98::binary_function<typename K::Point_3,
|
: public CGAL::cpp98::binary_function<typename K::Point_3, typename K::Point_3, bool>
|
||||||
typename K::Point_3, bool>
|
{
|
||||||
{
|
|
||||||
typedef typename K::Point_3 Point;
|
typedef typename K::Point_3 Point;
|
||||||
K k;
|
K k;
|
||||||
Hilbert_cmp_3 (const K &_k = K()) : k(_k) {}
|
Hilbert_cmp_3 (const K &_k = K()) : k(_k) {}
|
||||||
|
|
@ -69,13 +66,12 @@ namespace internal {
|
||||||
{
|
{
|
||||||
return k.less_y_3_object() (p, q);
|
return k.less_y_3_object() (p, q);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class K>
|
template <class K>
|
||||||
struct Hilbert_cmp_3<K,2,false>
|
struct Hilbert_cmp_3<K,2,false>
|
||||||
: public CGAL::cpp98::binary_function<typename K::Point_3,
|
: public CGAL::cpp98::binary_function<typename K::Point_3, typename K::Point_3, bool>
|
||||||
typename K::Point_3, bool>
|
{
|
||||||
{
|
|
||||||
typedef typename K::Point_3 Point;
|
typedef typename K::Point_3 Point;
|
||||||
K k;
|
K k;
|
||||||
Hilbert_cmp_3 (const K &_k = K()) : k(_k) {}
|
Hilbert_cmp_3 (const K &_k = K()) : k(_k) {}
|
||||||
|
|
@ -83,14 +79,14 @@ namespace internal {
|
||||||
{
|
{
|
||||||
return k.less_z_3_object() (p, q);
|
return k.less_z_3_object() (p, q);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
} // namespace internal
|
||||||
|
|
||||||
template <class K, class ConcurrencyTag>
|
template <class K, class ConcurrencyTag>
|
||||||
class Hilbert_sort_median_3
|
class Hilbert_sort_median_3
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef Hilbert_sort_median_3<K, ConcurrencyTag> Self;
|
typedef Hilbert_sort_median_3<K, ConcurrencyTag> Self;
|
||||||
typedef K Kernel;
|
typedef K Kernel;
|
||||||
typedef typename Kernel::Point_3 Point;
|
typedef typename Kernel::Point_3 Point;
|
||||||
|
|
@ -99,15 +95,18 @@ private:
|
||||||
Kernel _k;
|
Kernel _k;
|
||||||
std::ptrdiff_t _limit;
|
std::ptrdiff_t _limit;
|
||||||
|
|
||||||
template <int x, bool up> struct Cmp : public internal::Hilbert_cmp_3<Kernel,x,up>
|
template <int x, bool up>
|
||||||
{ Cmp (const Kernel &k) : internal::Hilbert_cmp_3<Kernel,x,up> (k) {} };
|
struct Cmp
|
||||||
|
: public internal::Hilbert_cmp_3<Kernel,x,up>
|
||||||
|
{
|
||||||
|
Cmp (const Kernel &k) : internal::Hilbert_cmp_3<Kernel,x,up> (k) {}
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Hilbert_sort_median_3 (const Kernel &k = Kernel(), std::ptrdiff_t limit = 1)
|
Hilbert_sort_median_3 (const Kernel &k = Kernel(), std::ptrdiff_t limit = 1)
|
||||||
: _k(k), _limit (limit)
|
: _k(k), _limit (limit)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
template <int x, bool upx, bool upy, bool upz, class RandomAccessIterator>
|
template <int x, bool upx, bool upy, bool upz, class RandomAccessIterator>
|
||||||
void recursive_sort (RandomAccessIterator begin, RandomAccessIterator end) const
|
void recursive_sort (RandomAccessIterator begin, RandomAccessIterator end) const
|
||||||
{
|
{
|
||||||
|
|
@ -135,7 +134,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
template <int x, bool upx, bool upy, bool upz, class RandomAccessIterator>
|
template <int x, bool upx, bool upy, bool upz, class RandomAccessIterator>
|
||||||
struct Recursive_sort {
|
struct Recursive_sort
|
||||||
|
{
|
||||||
const Self& hs;
|
const Self& hs;
|
||||||
RandomAccessIterator begin,end;
|
RandomAccessIterator begin,end;
|
||||||
|
|
||||||
|
|
@ -166,12 +166,10 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
template <int x, bool upx, bool upy, bool upz, class RandomAccessIterator>
|
template <int x, bool upx, bool upy, bool upz, class RandomAccessIterator>
|
||||||
void sort (RandomAccessIterator begin, RandomAccessIterator end, Parallel_tag) const
|
void sort (RandomAccessIterator begin, RandomAccessIterator end, Parallel_tag) const
|
||||||
{
|
{
|
||||||
#ifndef CGAL_LINKED_WITH_TBB
|
#ifndef CGAL_LINKED_WITH_TBB
|
||||||
|
|
||||||
CGAL_USE(begin);
|
CGAL_USE(begin);
|
||||||
CGAL_USE(end);
|
CGAL_USE(end);
|
||||||
CGAL_static_assertion_msg (!(boost::is_convertible<ConcurrencyTag, Parallel_tag>::value),
|
CGAL_static_assertion_msg (!(boost::is_convertible<ConcurrencyTag, Parallel_tag>::value),
|
||||||
|
|
@ -185,14 +183,14 @@ public:
|
||||||
RandomAccessIterator m1, m2, m3, m4, m5, m6, m7;
|
RandomAccessIterator m1, m2, m3, m4, m5, m6, m7;
|
||||||
m4 = internal::hilbert_split(m0, m8, Cmp<x, upx>(_k));
|
m4 = internal::hilbert_split(m0, m8, Cmp<x, upx>(_k));
|
||||||
|
|
||||||
tbb::parallel_invoke(Hilbert_split<RandomAccessIterator,Cmp<y, upy> >(m2,m0,m4,Cmp<y, upy>(_k)),
|
tbb::parallel_invoke(Hilbert_split<RandomAccessIterator,Cmp<y, upy> >(m2, m0, m4, Cmp<y, upy>(_k)),
|
||||||
Hilbert_split<RandomAccessIterator,Cmp<y, !upy> >(m6,m4,m8,Cmp<y, !upy>(_k)));
|
Hilbert_split<RandomAccessIterator,Cmp<y, !upy> >(m6, m4, m8, Cmp<y, !upy>(_k)));
|
||||||
|
|
||||||
|
|
||||||
tbb::parallel_invoke(Hilbert_split<RandomAccessIterator,Cmp<z, upz> >(m1,m0,m2,Cmp<z, upz>(_k)),
|
tbb::parallel_invoke(Hilbert_split<RandomAccessIterator,Cmp<z, upz> >(m1, m0, m2, Cmp<z, upz>(_k)),
|
||||||
Hilbert_split<RandomAccessIterator,Cmp<z, !upz> >(m3,m2,m4,Cmp<z, !upz>(_k)),
|
Hilbert_split<RandomAccessIterator,Cmp<z, !upz> >(m3, m2, m4, Cmp<z, !upz>(_k)),
|
||||||
Hilbert_split<RandomAccessIterator,Cmp<z, upz> >(m5,m4,m6,Cmp<z, upz>(_k)),
|
Hilbert_split<RandomAccessIterator,Cmp<z, upz> >(m5, m4, m6, Cmp<z, upz>(_k)),
|
||||||
Hilbert_split<RandomAccessIterator,Cmp<z, !upz> >(m7,m6,m8,Cmp<z, !upz>(_k)));
|
Hilbert_split<RandomAccessIterator,Cmp<z, !upz> >(m7, m6, m8, Cmp<z, !upz>(_k)));
|
||||||
|
|
||||||
tbb::parallel_invoke(Recursive_sort<z, upz, upx, upy, RandomAccessIterator>(*this, m0, m1),
|
tbb::parallel_invoke(Recursive_sort<z, upz, upx, upy, RandomAccessIterator>(*this, m0, m1),
|
||||||
Recursive_sort<y, upy, upz, upx, RandomAccessIterator>(*this, m1, m2),
|
Recursive_sort<y, upy, upz, upx, RandomAccessIterator>(*this, m1, m2),
|
||||||
|
|
@ -202,7 +200,6 @@ public:
|
||||||
Recursive_sort<y, !upy, upz, !upx, RandomAccessIterator>(*this, m5, m6),
|
Recursive_sort<y, !upy, upz, !upx, RandomAccessIterator>(*this, m5, m6),
|
||||||
Recursive_sort<y, !upy, upz, !upx, RandomAccessIterator>(*this, m6, m7),
|
Recursive_sort<y, !upy, upz, !upx, RandomAccessIterator>(*this, m6, m7),
|
||||||
Recursive_sort<z, !upz, !upx, upy, RandomAccessIterator>(*this, m7, m8));
|
Recursive_sort<z, !upz, !upx, upy, RandomAccessIterator>(*this, m7, m8));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
recursive_sort<0, false, false, false>(begin, end);
|
recursive_sort<0, false, false, false>(begin, end);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,25 +23,25 @@ namespace CGAL {
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
template <class K>
|
template <class K>
|
||||||
struct Hilbert_cmp_d
|
struct Hilbert_cmp_d
|
||||||
: public CGAL::cpp98::binary_function<typename K::Point_d,
|
: public CGAL::cpp98::binary_function<typename K::Point_d,
|
||||||
typename K::Point_d, bool>
|
typename K::Point_d, bool>
|
||||||
{
|
{
|
||||||
typedef typename K::Point_d Point;
|
typedef typename K::Point_d Point;
|
||||||
K k;
|
K k;
|
||||||
int axe;
|
int axe;
|
||||||
bool orient;
|
bool orient;
|
||||||
Hilbert_cmp_d (int a, bool o, const K &_k = K())
|
Hilbert_cmp_d (int a, bool o, const K &_k = K()) : k(_k), axe(a), orient(o) {}
|
||||||
: k(_k), axe(a), orient(o) {}
|
|
||||||
bool operator() (const Point &p, const Point &q) const
|
bool operator() (const Point &p, const Point &q) const
|
||||||
{
|
{
|
||||||
return (orient ? (k.less_coordinate_d_object() (q,p,axe) )
|
return (orient ? (k.less_coordinate_d_object() (q,p,axe) )
|
||||||
: (k.less_coordinate_d_object() (p,q,axe) ));
|
: (k.less_coordinate_d_object() (p,q,axe) ));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // namespace internal
|
||||||
|
|
||||||
template <class K>
|
template <class K>
|
||||||
class Hilbert_sort_median_d
|
class Hilbert_sort_median_d
|
||||||
|
|
@ -57,9 +57,11 @@ private:
|
||||||
mutable int _dimension;
|
mutable int _dimension;
|
||||||
mutable int two_to_dim;
|
mutable int two_to_dim;
|
||||||
|
|
||||||
struct Cmp : public internal::Hilbert_cmp_d<Kernel>
|
struct Cmp
|
||||||
{ Cmp (int a, bool dir, const Kernel &k)
|
: public internal::Hilbert_cmp_d<Kernel>
|
||||||
: internal::Hilbert_cmp_d<Kernel> (a,dir,k) {} };
|
{
|
||||||
|
Cmp (int a, bool dir, const Kernel &k) : internal::Hilbert_cmp_d<Kernel> (a,dir,k) {}
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Hilbert_sort_median_d(const Kernel &k = Kernel(), std::ptrdiff_t limit = 1)
|
Hilbert_sort_median_d(const Kernel &k = Kernel(), std::ptrdiff_t limit = 1)
|
||||||
|
|
@ -70,7 +72,8 @@ public:
|
||||||
void sort (RandomAccessIterator begin, RandomAccessIterator end,
|
void sort (RandomAccessIterator begin, RandomAccessIterator end,
|
||||||
Starting_position start, int direction) const
|
Starting_position start, int direction) const
|
||||||
{
|
{
|
||||||
if (end - begin <= _limit) return;
|
if (end - begin <= _limit)
|
||||||
|
return;
|
||||||
|
|
||||||
int nb_directions = _dimension;
|
int nb_directions = _dimension;
|
||||||
int nb_splits = two_to_dim;
|
int nb_splits = two_to_dim;
|
||||||
|
|
@ -129,7 +132,6 @@ public:
|
||||||
sort( places[two_to_dim-1], places[two_to_dim], start, last_dir);
|
sort( places[two_to_dim-1], places[two_to_dim], start, last_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <class RandomAccessIterator>
|
template <class RandomAccessIterator>
|
||||||
void operator() (RandomAccessIterator begin, RandomAccessIterator end) const
|
void operator() (RandomAccessIterator begin, RandomAccessIterator end) const
|
||||||
{
|
{
|
||||||
|
|
@ -139,22 +141,21 @@ public:
|
||||||
|
|
||||||
typename std::iterator_traits<RandomAccessIterator>::difference_type N=end-begin;
|
typename std::iterator_traits<RandomAccessIterator>::difference_type N=end-begin;
|
||||||
N*=2;
|
N*=2;
|
||||||
for (int i=0; i<_dimension; ++i) start[i]=false; // we start below in all coordinates
|
for (int i=0; i<_dimension; ++i)
|
||||||
|
start[i]=false; // we start below in all coordinates
|
||||||
|
|
||||||
for (int i=0; i<_dimension; ++i) {
|
for (int i=0; i<_dimension; ++i) {
|
||||||
two_to_dim *= 2; // compute 2^_dimension
|
two_to_dim *= 2; // compute 2^_dimension
|
||||||
N/=2;
|
N/=2;
|
||||||
if (N==0) break; // not many points, this number of dimension is enough
|
if (N==0)
|
||||||
|
break; // not many points, this number of dimension is enough
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// we start with direction 0;
|
// we start with direction 0;
|
||||||
sort (begin, end, start, 0);
|
sort (begin, end, start, 0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace CGAL
|
} // namespace CGAL
|
||||||
|
|
||||||
#endif//CGAL_HILBERT_SORT_MEDIAN_d_H
|
#endif//CGAL_HILBERT_SORT_MEDIAN_d_H
|
||||||
|
|
|
||||||
|
|
@ -21,13 +21,13 @@
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
template <class K, int x, bool up> struct Fixed_hilbert_cmp_2;
|
template <class K, int x, bool up> struct Fixed_hilbert_cmp_2;
|
||||||
|
|
||||||
template <class K, int x>
|
template <class K, int x>
|
||||||
struct Fixed_hilbert_cmp_2<K,x,true>
|
struct Fixed_hilbert_cmp_2<K,x,true>
|
||||||
: public CGAL::cpp98::binary_function<typename K::Point_2,
|
: public CGAL::cpp98::binary_function<typename K::Point_2,
|
||||||
typename K::Point_2, bool>
|
typename K::Point_2, bool>
|
||||||
{
|
{
|
||||||
typedef typename K::Point_2 Point;
|
typedef typename K::Point_2 Point;
|
||||||
K k;
|
K k;
|
||||||
double value;
|
double value;
|
||||||
|
|
@ -36,13 +36,13 @@ namespace internal {
|
||||||
{
|
{
|
||||||
return ! Fixed_hilbert_cmp_2<K,x,false> (value, k) (p);
|
return ! Fixed_hilbert_cmp_2<K,x,false> (value, k) (p);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class K>
|
template <class K>
|
||||||
struct Fixed_hilbert_cmp_2<K,0,false>
|
struct Fixed_hilbert_cmp_2<K,0,false>
|
||||||
: public CGAL::cpp98::binary_function<typename K::Point_2,
|
: public CGAL::cpp98::binary_function<typename K::Point_2,
|
||||||
typename K::Point_2, bool>
|
typename K::Point_2, bool>
|
||||||
{
|
{
|
||||||
typedef typename K::Point_2 Point;
|
typedef typename K::Point_2 Point;
|
||||||
K k;
|
K k;
|
||||||
double value;
|
double value;
|
||||||
|
|
@ -51,13 +51,13 @@ namespace internal {
|
||||||
{
|
{
|
||||||
return to_double(k.compute_x_2_object()(p)) < value;
|
return to_double(k.compute_x_2_object()(p)) < value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class K>
|
template <class K>
|
||||||
struct Fixed_hilbert_cmp_2<K,1,false>
|
struct Fixed_hilbert_cmp_2<K,1,false>
|
||||||
: public CGAL::cpp98::binary_function<typename K::Point_2,
|
: public CGAL::cpp98::binary_function<typename K::Point_2,
|
||||||
typename K::Point_2, bool>
|
typename K::Point_2, bool>
|
||||||
{
|
{
|
||||||
typedef typename K::Point_2 Point;
|
typedef typename K::Point_2 Point;
|
||||||
K k;
|
K k;
|
||||||
double value;
|
double value;
|
||||||
|
|
@ -66,9 +66,9 @@ namespace internal {
|
||||||
{
|
{
|
||||||
return to_double(k.compute_y_2_object()(p)) < value;
|
return to_double(k.compute_y_2_object()(p)) < value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
|
} // namespace internal
|
||||||
|
|
||||||
template <class K>
|
template <class K>
|
||||||
class Hilbert_sort_middle_2
|
class Hilbert_sort_middle_2
|
||||||
|
|
@ -81,8 +81,12 @@ private:
|
||||||
Kernel _k;
|
Kernel _k;
|
||||||
std::ptrdiff_t _limit;
|
std::ptrdiff_t _limit;
|
||||||
|
|
||||||
template <int x, bool up> struct Cmp : public internal::Fixed_hilbert_cmp_2<Kernel,x,up>
|
template <int x, bool up>
|
||||||
{ Cmp (double v, const Kernel &k) : internal::Fixed_hilbert_cmp_2<Kernel,x,up> (v, k) {} };
|
struct Cmp
|
||||||
|
: public internal::Fixed_hilbert_cmp_2<Kernel,x,up>
|
||||||
|
{
|
||||||
|
Cmp (double v, const Kernel &k) : internal::Fixed_hilbert_cmp_2<Kernel,x,up> (v, k) {}
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Hilbert_sort_middle_2 (const Kernel &k = Kernel(), std::ptrdiff_t limit = 1)
|
Hilbert_sort_middle_2 (const Kernel &k = Kernel(), std::ptrdiff_t limit = 1)
|
||||||
|
|
@ -101,12 +105,9 @@ public:
|
||||||
|
|
||||||
RandomAccessIterator m0 = begin, m4 = end;
|
RandomAccessIterator m0 = begin, m4 = end;
|
||||||
|
|
||||||
RandomAccessIterator m2 =
|
RandomAccessIterator m2 = internal::fixed_hilbert_split (m0, m4, Cmp< x, upx> (xmed,_k));
|
||||||
internal::fixed_hilbert_split (m0, m4, Cmp< x, upx> (xmed,_k));
|
RandomAccessIterator m1 = internal::fixed_hilbert_split (m0, m2, Cmp< y, upy> (ymed,_k));
|
||||||
RandomAccessIterator m1 =
|
RandomAccessIterator m3 = internal::fixed_hilbert_split (m2, m4, Cmp< y, !upy> (ymed,_k));
|
||||||
internal::fixed_hilbert_split (m0, m2, Cmp< y, upy> (ymed,_k));
|
|
||||||
RandomAccessIterator m3 =
|
|
||||||
internal::fixed_hilbert_split (m2, m4, Cmp< y, !upy> (ymed,_k));
|
|
||||||
|
|
||||||
if (m1!=m4)
|
if (m1!=m4)
|
||||||
sort<y, upy, upx> (m0, m1, ymin, xmin, ymed, xmed);
|
sort<y, upy, upx> (m0, m1, ymin, xmin, ymed, xmed);
|
||||||
|
|
@ -144,7 +145,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
} // namespace CGAL
|
} // namespace CGAL
|
||||||
|
|
||||||
#endif//CGAL_HILBERT_SORT_MIDDLE_2_H
|
#endif//CGAL_HILBERT_SORT_MIDDLE_2_H
|
||||||
|
|
|
||||||
|
|
@ -19,17 +19,19 @@ namespace CGAL {
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
template <class RandomAccessIterator, class Cmp>
|
template <class RandomAccessIterator, class Cmp>
|
||||||
RandomAccessIterator
|
RandomAccessIterator
|
||||||
fixed_hilbert_split (RandomAccessIterator begin, RandomAccessIterator end,
|
fixed_hilbert_split (RandomAccessIterator begin, RandomAccessIterator end,
|
||||||
Cmp cmp = Cmp ())
|
Cmp cmp = Cmp ())
|
||||||
{
|
{
|
||||||
if (begin >= end) return begin;
|
if (begin >= end)
|
||||||
|
return begin;
|
||||||
|
|
||||||
return std::partition (begin, end, cmp);
|
return std::partition (begin, end, cmp);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace internal
|
||||||
|
|
||||||
} // namespace CGAL
|
} // namespace CGAL
|
||||||
|
|
||||||
#endif//CGAL_HILBERT_SORT_MIDDLE_BASE_H
|
#endif//CGAL_HILBERT_SORT_MIDDLE_BASE_H
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
//
|
//
|
||||||
// Author(s) : Sebastien Loriot
|
// Author(s) : Sebastien Loriot
|
||||||
|
|
||||||
|
|
||||||
#ifndef CGAL_SPATIAL_SORT_TRAITS_ADAPTER_2_H
|
#ifndef CGAL_SPATIAL_SORT_TRAITS_ADAPTER_2_H
|
||||||
#define CGAL_SPATIAL_SORT_TRAITS_ADAPTER_2_H
|
#define CGAL_SPATIAL_SORT_TRAITS_ADAPTER_2_H
|
||||||
|
|
||||||
|
|
@ -19,47 +18,51 @@
|
||||||
|
|
||||||
#include <CGAL/property_map.h>
|
#include <CGAL/property_map.h>
|
||||||
|
|
||||||
|
|
||||||
namespace CGAL{
|
namespace CGAL{
|
||||||
|
|
||||||
using ::get;
|
using ::get;
|
||||||
|
|
||||||
template<class Base_traits,class PointPropertyMap>
|
template<class Base_traits, class PointPropertyMap>
|
||||||
class Spatial_sort_traits_adapter_2:public Base_traits{
|
class Spatial_sort_traits_adapter_2
|
||||||
|
: public Base_traits
|
||||||
|
{
|
||||||
PointPropertyMap ppmap_;
|
PointPropertyMap ppmap_;
|
||||||
public:
|
public:
|
||||||
Spatial_sort_traits_adapter_2(Base_traits base=Base_traits()):Base_traits(base){}
|
Spatial_sort_traits_adapter_2(Base_traits base=Base_traits()):Base_traits(base){}
|
||||||
|
|
||||||
Spatial_sort_traits_adapter_2(const PointPropertyMap& ppmap,Base_traits base=Base_traits())
|
Spatial_sort_traits_adapter_2(const PointPropertyMap& ppmap, Base_traits base=Base_traits())
|
||||||
:Base_traits(base),ppmap_(ppmap){}
|
:Base_traits(base), ppmap_(ppmap){}
|
||||||
|
|
||||||
typedef Base_traits Gt;
|
typedef Base_traits Gt;
|
||||||
typedef typename boost::property_traits<PointPropertyMap>::key_type Point_2;
|
typedef typename boost::property_traits<PointPropertyMap>::key_type Point_2;
|
||||||
typedef typename boost::call_traits<Point_2>::param_type Arg_type;
|
typedef typename boost::call_traits<Point_2>::param_type Arg_type;
|
||||||
|
|
||||||
struct Less_x_2 : public Base_traits::Less_x_2{
|
struct Less_x_2
|
||||||
Less_x_2(const PointPropertyMap& ppmap,const typename Base_traits::Less_x_2& base):
|
: public Base_traits::Less_x_2
|
||||||
Base_traits::Less_x_2(base),ppmap_(ppmap){}
|
{
|
||||||
|
Less_x_2(const PointPropertyMap& ppmap, const typename Base_traits::Less_x_2& base):
|
||||||
|
Base_traits::Less_x_2(base), ppmap_(ppmap){}
|
||||||
const PointPropertyMap& ppmap_;
|
const PointPropertyMap& ppmap_;
|
||||||
bool operator()(Arg_type p,Arg_type q) const {
|
bool operator()(Arg_type p, Arg_type q) const {
|
||||||
return static_cast<const typename Base_traits::Less_x_2*>(this)->operator()(get(ppmap_,p),get(ppmap_,q));
|
return static_cast<const typename Base_traits::Less_x_2*>(this)->operator()(get(ppmap_,p), get(ppmap_,q));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Less_y_2 : public Base_traits::Less_y_2{
|
struct Less_y_2
|
||||||
Less_y_2(const PointPropertyMap& ppmap,const typename Base_traits::Less_y_2& base):
|
: public Base_traits::Less_y_2
|
||||||
Base_traits::Less_y_2(base),ppmap_(ppmap){}
|
{
|
||||||
|
Less_y_2(const PointPropertyMap& ppmap, const typename Base_traits::Less_y_2& base):
|
||||||
|
Base_traits::Less_y_2(base), ppmap_(ppmap){}
|
||||||
const PointPropertyMap& ppmap_;
|
const PointPropertyMap& ppmap_;
|
||||||
bool operator()(Arg_type p,Arg_type q) const {
|
bool operator()(Arg_type p, Arg_type q) const {
|
||||||
return static_cast<const typename Base_traits::Less_y_2*>(this)->operator()(get(ppmap_,p),get(ppmap_,q));
|
return static_cast<const typename Base_traits::Less_y_2*>(this)->operator()(get(ppmap_,p), get(ppmap_,q));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Less_x_2 less_x_2_object () const {return Less_x_2(ppmap_,static_cast<const Gt*>(this)->less_x_2_object() );}
|
Less_x_2 less_x_2_object () const {return Less_x_2(ppmap_, static_cast<const Gt*>(this)->less_x_2_object() );}
|
||||||
Less_y_2 less_y_2_object () const {return Less_y_2(ppmap_,static_cast<const Gt*>(this)->less_y_2_object() );}
|
Less_y_2 less_y_2_object () const {return Less_y_2(ppmap_, static_cast<const Gt*>(this)->less_y_2_object() );}
|
||||||
|
|
||||||
const PointPropertyMap& point_property_map() const {return ppmap_;}
|
const PointPropertyMap& point_property_map() const {return ppmap_;}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace CGAL
|
} //namespace CGAL
|
||||||
|
|
|
||||||
|
|
@ -17,57 +17,63 @@
|
||||||
|
|
||||||
#include <CGAL/property_map.h>
|
#include <CGAL/property_map.h>
|
||||||
|
|
||||||
|
|
||||||
namespace CGAL{
|
namespace CGAL{
|
||||||
|
|
||||||
using ::get;
|
using ::get;
|
||||||
|
|
||||||
template<class Base_traits,class PointPropertyMap>
|
template<class Base_traits, class PointPropertyMap>
|
||||||
class Spatial_sort_traits_adapter_3:public Base_traits{
|
class Spatial_sort_traits_adapter_3
|
||||||
|
: public Base_traits
|
||||||
|
{
|
||||||
PointPropertyMap ppmap_;
|
PointPropertyMap ppmap_;
|
||||||
public:
|
public:
|
||||||
Spatial_sort_traits_adapter_3(Base_traits base=Base_traits()):Base_traits(base){}
|
Spatial_sort_traits_adapter_3(Base_traits base=Base_traits()):Base_traits(base){}
|
||||||
|
|
||||||
Spatial_sort_traits_adapter_3(const PointPropertyMap& ppmap,Base_traits base=Base_traits())
|
Spatial_sort_traits_adapter_3(const PointPropertyMap& ppmap, Base_traits base=Base_traits())
|
||||||
:Base_traits(base),ppmap_(ppmap){}
|
:Base_traits(base), ppmap_(ppmap){}
|
||||||
|
|
||||||
typedef Base_traits Gt;
|
typedef Base_traits Gt;
|
||||||
typedef typename boost::property_traits<PointPropertyMap>::key_type Point_3;
|
typedef typename boost::property_traits<PointPropertyMap>::key_type Point_3;
|
||||||
typedef typename boost::call_traits<Point_3>::param_type Arg_type;
|
typedef typename boost::call_traits<Point_3>::param_type Arg_type;
|
||||||
|
|
||||||
struct Less_x_3 : public Base_traits::Less_x_3{
|
struct Less_x_3
|
||||||
Less_x_3(const PointPropertyMap& ppmap,const typename Base_traits::Less_x_3& base):
|
: public Base_traits::Less_x_3
|
||||||
Base_traits::Less_x_3(base),ppmap_(ppmap){}
|
{
|
||||||
|
Less_x_3(const PointPropertyMap& ppmap, const typename Base_traits::Less_x_3& base):
|
||||||
|
Base_traits::Less_x_3(base), ppmap_(ppmap){}
|
||||||
const PointPropertyMap& ppmap_;
|
const PointPropertyMap& ppmap_;
|
||||||
bool operator()(Arg_type p,Arg_type q) const {
|
bool operator()(Arg_type p, Arg_type q) const {
|
||||||
return static_cast<const typename Base_traits::Less_x_3*>(this)->operator()(get(ppmap_,p),get(ppmap_,q));
|
return static_cast<const typename Base_traits::Less_x_3*>(this)->operator()(get(ppmap_,p), get(ppmap_,q));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Less_y_3 : public Base_traits::Less_y_3{
|
struct Less_y_3
|
||||||
Less_y_3(const PointPropertyMap& ppmap,const typename Base_traits::Less_y_3& base):
|
: public Base_traits::Less_y_3
|
||||||
|
{
|
||||||
|
Less_y_3(const PointPropertyMap& ppmap, const typename Base_traits::Less_y_3& base):
|
||||||
Base_traits::Less_y_3(base),ppmap_(ppmap){}
|
Base_traits::Less_y_3(base),ppmap_(ppmap){}
|
||||||
const PointPropertyMap& ppmap_;
|
const PointPropertyMap& ppmap_;
|
||||||
bool operator()(Arg_type p,Arg_type q) const {
|
bool operator()(Arg_type p, Arg_type q) const {
|
||||||
return static_cast<const typename Base_traits::Less_y_3*>(this)->operator()(get(ppmap_,p),get(ppmap_,q));
|
return static_cast<const typename Base_traits::Less_y_3*>(this)->operator()(get(ppmap_,p), get(ppmap_,q));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Less_z_3 : public Base_traits::Less_z_3{
|
struct Less_z_3
|
||||||
Less_z_3(const PointPropertyMap& ppmap,const typename Base_traits::Less_z_3& base):
|
: public Base_traits::Less_z_3
|
||||||
Base_traits::Less_z_3(base),ppmap_(ppmap){}
|
{
|
||||||
|
Less_z_3(const PointPropertyMap& ppmap, const typename Base_traits::Less_z_3& base):
|
||||||
|
Base_traits::Less_z_3(base), ppmap_(ppmap){}
|
||||||
const PointPropertyMap& ppmap_;
|
const PointPropertyMap& ppmap_;
|
||||||
bool operator()(Arg_type p,Arg_type q) const {
|
bool operator()(Arg_type p, Arg_type q) const {
|
||||||
return static_cast<const typename Base_traits::Less_z_3*>(this)->operator()(get(ppmap_,p),get(ppmap_,q));
|
return static_cast<const typename Base_traits::Less_z_3*>(this)->operator()(get(ppmap_,p), get(ppmap_,q));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Less_x_3 less_x_3_object () const {return Less_x_3(ppmap_,static_cast<const Gt*>(this)->less_x_3_object() );}
|
Less_x_3 less_x_3_object () const {return Less_x_3(ppmap_, static_cast<const Gt*>(this)->less_x_3_object() );}
|
||||||
Less_y_3 less_y_3_object () const {return Less_y_3(ppmap_,static_cast<const Gt*>(this)->less_y_3_object() );}
|
Less_y_3 less_y_3_object () const {return Less_y_3(ppmap_, static_cast<const Gt*>(this)->less_y_3_object() );}
|
||||||
Less_z_3 less_z_3_object () const {return Less_z_3(ppmap_,static_cast<const Gt*>(this)->less_z_3_object() );}
|
Less_z_3 less_z_3_object () const {return Less_z_3(ppmap_, static_cast<const Gt*>(this)->less_z_3_object() );}
|
||||||
|
|
||||||
const PointPropertyMap& point_property_map() const {return ppmap_;}
|
const PointPropertyMap& point_property_map() const {return ppmap_;}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace CGAL
|
} //namespace CGAL
|
||||||
|
|
|
||||||
|
|
@ -21,57 +21,59 @@ namespace CGAL{
|
||||||
|
|
||||||
using ::get;
|
using ::get;
|
||||||
|
|
||||||
template<class Base_traits,class PointPropertyMap>
|
template<class Base_traits, class PointPropertyMap>
|
||||||
class Spatial_sort_traits_adapter_d:public Base_traits{
|
class Spatial_sort_traits_adapter_d
|
||||||
|
: public Base_traits
|
||||||
|
{
|
||||||
PointPropertyMap ppmap_;
|
PointPropertyMap ppmap_;
|
||||||
public:
|
public:
|
||||||
Spatial_sort_traits_adapter_d(Base_traits base=Base_traits()):Base_traits(base){}
|
Spatial_sort_traits_adapter_d(Base_traits base=Base_traits()) : Base_traits(base){}
|
||||||
|
|
||||||
Spatial_sort_traits_adapter_d(const PointPropertyMap& ppmap,Base_traits base=Base_traits())
|
Spatial_sort_traits_adapter_d(const PointPropertyMap& ppmap, Base_traits base=Base_traits())
|
||||||
:Base_traits(base),ppmap_(ppmap){}
|
:Base_traits(base), ppmap_(ppmap){}
|
||||||
|
|
||||||
typedef Base_traits Gt;
|
typedef Base_traits Gt;
|
||||||
typedef typename boost::property_traits<PointPropertyMap>::key_type Point_d;
|
typedef typename boost::property_traits<PointPropertyMap>::key_type Point_d;
|
||||||
typedef typename boost::call_traits<Point_d>::param_type Arg_type;
|
typedef typename boost::call_traits<Point_d>::param_type Arg_type;
|
||||||
|
|
||||||
|
struct Point_dimension_d
|
||||||
|
: public Base_traits::Point_dimension_d
|
||||||
struct Point_dimension_d: public Base_traits::Point_dimension_d{
|
{
|
||||||
Point_dimension_d(const PointPropertyMap& ppmap,const typename Base_traits::Point_dimension_d& base):
|
Point_dimension_d(const PointPropertyMap& ppmap, const typename Base_traits::Point_dimension_d& base):
|
||||||
Base_traits::Point_dimension_d(base),ppmap_(ppmap){}
|
Base_traits::Point_dimension_d(base), ppmap_(ppmap){}
|
||||||
const PointPropertyMap& ppmap_;
|
const PointPropertyMap& ppmap_;
|
||||||
int operator()(Arg_type p) const {
|
int operator()(Arg_type p) const {
|
||||||
return static_cast<const typename Base_traits::Point_dimension_d*>(this)->operator()(get(ppmap_,p));
|
return static_cast<const typename Base_traits::Point_dimension_d*>(this)->operator()(get(ppmap_, p));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Less_coordinate_d: public Base_traits::Less_coordinate_d{
|
struct Less_coordinate_d
|
||||||
Less_coordinate_d(const PointPropertyMap& ppmap,const typename Base_traits::Less_coordinate_d& base):
|
: public Base_traits::Less_coordinate_d
|
||||||
Base_traits::Less_coordinate_d(base),ppmap_(ppmap){}
|
{
|
||||||
|
Less_coordinate_d(const PointPropertyMap& ppmap, const typename Base_traits::Less_coordinate_d& base):
|
||||||
|
Base_traits::Less_coordinate_d(base), ppmap_(ppmap){}
|
||||||
const PointPropertyMap& ppmap_;
|
const PointPropertyMap& ppmap_;
|
||||||
bool operator()(Arg_type p,Arg_type q,int i) const {
|
bool operator()(Arg_type p, Arg_type q, int i) const {
|
||||||
return static_cast<const typename Base_traits::Less_coordinate_d*>(this)->operator()(get(ppmap_,p),get(ppmap_,q),i);
|
return static_cast<const typename Base_traits::Less_coordinate_d*>(this)->operator()(get(ppmap_,p), get(ppmap_,q), i);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct Compute_coordinate_d
|
||||||
struct Compute_coordinate_d: public Base_traits::Compute_coordinate_d{
|
: public Base_traits::Compute_coordinate_d
|
||||||
Compute_coordinate_d(const PointPropertyMap& ppmap,const typename Base_traits::Compute_coordinate_d& base):
|
{
|
||||||
Base_traits::Compute_coordinate_d(base),ppmap_(ppmap){}
|
Compute_coordinate_d(const PointPropertyMap& ppmap, const typename Base_traits::Compute_coordinate_d& base):
|
||||||
|
Base_traits::Compute_coordinate_d(base), ppmap_(ppmap){}
|
||||||
const PointPropertyMap& ppmap_;
|
const PointPropertyMap& ppmap_;
|
||||||
bool operator()(Arg_type p,int i) const {
|
bool operator()(Arg_type p, int i) const {
|
||||||
return static_cast<const typename Base_traits::Compute_coordinate_d*>(this)->operator()(get(ppmap_,p),i);
|
return static_cast<const typename Base_traits::Compute_coordinate_d*>(this)->operator()(get(ppmap_,p), i);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Point_dimension_d point_dimension_d_object () const {return Point_dimension_d(ppmap_, static_cast<const Gt*>(this)->point_dimension_d_object() );}
|
||||||
|
Less_coordinate_d less_coordinate_d_object () const {return Less_coordinate_d(ppmap_, static_cast<const Gt*>(this)->less_coordinate_d_object() );}
|
||||||
Point_dimension_d point_dimension_d_object () const {return Point_dimension_d(ppmap_,static_cast<const Gt*>(this)->point_dimension_d_object() );}
|
Compute_coordinate_d compute_coordinate_d_object () const {return Compute_coordinate_d(ppmap_, static_cast<const Gt*>(this)->compute_coordinate_d_object() );}
|
||||||
Less_coordinate_d less_coordinate_d_object () const {return Less_coordinate_d(ppmap_,static_cast<const Gt*>(this)->less_coordinate_d_object() );}
|
|
||||||
Compute_coordinate_d compute_coordinate_d_object () const {return Compute_coordinate_d(ppmap_,static_cast<const Gt*>(this)->compute_coordinate_d_object() );}
|
|
||||||
|
|
||||||
const PointPropertyMap& point_property_map() const {return ppmap_;}
|
const PointPropertyMap& point_property_map() const {return ppmap_;}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace CGAL
|
} //namespace CGAL
|
||||||
|
|
|
||||||
|
|
@ -27,54 +27,53 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
template <class ConcurrencyTag = Sequential_tag, class RandomAccessIterator, class Kernel, class Policy>
|
template <class ConcurrencyTag = Sequential_tag, class RandomAccessIterator, class Kernel, class Policy>
|
||||||
void hilbert_sort (RandomAccessIterator begin,
|
void hilbert_sort (RandomAccessIterator begin,
|
||||||
RandomAccessIterator end,
|
RandomAccessIterator end,
|
||||||
const Kernel &k,
|
const Kernel &k,
|
||||||
Policy /*policy*/,
|
Policy /*policy*/,
|
||||||
typename Kernel::Point_2 *)
|
typename Kernel::Point_2 *)
|
||||||
{
|
{
|
||||||
typedef std::iterator_traits<RandomAccessIterator> ITraits;
|
typedef std::iterator_traits<RandomAccessIterator> ITraits;
|
||||||
typedef typename ITraits::difference_type Diff_t;
|
typedef typename ITraits::difference_type Diff_t;
|
||||||
boost::rand48 random;
|
boost::rand48 random;
|
||||||
boost::random_number_generator<boost::rand48, Diff_t> rng(random);
|
boost::random_number_generator<boost::rand48, Diff_t> rng(random);
|
||||||
CGAL::cpp98::random_shuffle(begin,end, rng);
|
CGAL::cpp98::random_shuffle(begin,end, rng);
|
||||||
(Hilbert_sort_2<Kernel, Policy, ConcurrencyTag> (k))(begin, end);
|
(Hilbert_sort_2<Kernel, Policy, ConcurrencyTag> (k))(begin, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ConcurrencyTag = Sequential_tag, class RandomAccessIterator, class Kernel, class Policy>
|
template <class ConcurrencyTag = Sequential_tag, class RandomAccessIterator, class Kernel, class Policy>
|
||||||
void hilbert_sort (RandomAccessIterator begin,
|
void hilbert_sort (RandomAccessIterator begin,
|
||||||
RandomAccessIterator end,
|
RandomAccessIterator end,
|
||||||
const Kernel &k,
|
const Kernel &k,
|
||||||
Policy /*policy*/,
|
Policy /*policy*/,
|
||||||
typename Kernel::Point_3 *)
|
typename Kernel::Point_3 *)
|
||||||
{
|
{
|
||||||
typedef std::iterator_traits<RandomAccessIterator> ITraits;
|
typedef std::iterator_traits<RandomAccessIterator> ITraits;
|
||||||
typedef typename ITraits::difference_type Diff_t;
|
typedef typename ITraits::difference_type Diff_t;
|
||||||
boost::rand48 random;
|
boost::rand48 random;
|
||||||
boost::random_number_generator<boost::rand48, Diff_t> rng(random);
|
boost::random_number_generator<boost::rand48, Diff_t> rng(random);
|
||||||
CGAL::cpp98::random_shuffle(begin,end, rng);
|
CGAL::cpp98::random_shuffle(begin,end, rng);
|
||||||
(Hilbert_sort_3<Kernel, Policy, ConcurrencyTag> (k))(begin, end);
|
(Hilbert_sort_3<Kernel, Policy, ConcurrencyTag> (k))(begin, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ConcurrencyTag = Sequential_tag, class RandomAccessIterator, class Kernel, class Policy>
|
template <class ConcurrencyTag = Sequential_tag, class RandomAccessIterator, class Kernel, class Policy>
|
||||||
void hilbert_sort (RandomAccessIterator begin,
|
void hilbert_sort (RandomAccessIterator begin,
|
||||||
RandomAccessIterator end,
|
RandomAccessIterator end,
|
||||||
const Kernel &k,
|
const Kernel &k,
|
||||||
Policy /*policy*/,
|
Policy /*policy*/,
|
||||||
typename Kernel::Point_d *)
|
typename Kernel::Point_d *)
|
||||||
{
|
{
|
||||||
typedef std::iterator_traits<RandomAccessIterator> ITraits;
|
typedef std::iterator_traits<RandomAccessIterator> ITraits;
|
||||||
typedef typename ITraits::difference_type Diff_t;
|
typedef typename ITraits::difference_type Diff_t;
|
||||||
boost::rand48 random;
|
boost::rand48 random;
|
||||||
boost::random_number_generator<boost::rand48, Diff_t> rng(random);
|
boost::random_number_generator<boost::rand48, Diff_t> rng(random);
|
||||||
CGAL::cpp98::random_shuffle(begin,end, rng);
|
CGAL::cpp98::random_shuffle(begin,end, rng);
|
||||||
(Hilbert_sort_d<Kernel, Policy> (k))(begin, end);
|
(Hilbert_sort_d<Kernel, Policy> (k))(begin, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
|
||||||
template <class ConcurrencyTag = Sequential_tag, class RandomAccessIterator>
|
template <class ConcurrencyTag = Sequential_tag, class RandomAccessIterator>
|
||||||
|
|
@ -102,7 +101,7 @@ void hilbert_sort (RandomAccessIterator begin, RandomAccessIterator end,
|
||||||
static_cast<value_type *> (0));
|
static_cast<value_type *> (0));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ConcurrencyTag = Sequential_tag, class RandomAccessIterator>
|
template <class ConcurrencyTag = Sequential_tag, class RandomAccessIterator>
|
||||||
void hilbert_sort (RandomAccessIterator begin, RandomAccessIterator end,
|
void hilbert_sort (RandomAccessIterator begin, RandomAccessIterator end,
|
||||||
Hilbert_sort_median_policy policy)
|
Hilbert_sort_median_policy policy)
|
||||||
{
|
{
|
||||||
|
|
@ -113,11 +112,9 @@ void hilbert_sort (RandomAccessIterator begin, RandomAccessIterator end,
|
||||||
|
|
||||||
internal::hilbert_sort<ConcurrencyTag>(begin, end, Kernel(), policy,
|
internal::hilbert_sort<ConcurrencyTag>(begin, end, Kernel(), policy,
|
||||||
static_cast<value_type *> (0));
|
static_cast<value_type *> (0));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class ConcurrencyTag = Sequential_tag, class RandomAccessIterator>
|
||||||
template <class ConcurrencyTag = Sequential_tag, class RandomAccessIterator>
|
|
||||||
void hilbert_sort (RandomAccessIterator begin, RandomAccessIterator end,
|
void hilbert_sort (RandomAccessIterator begin, RandomAccessIterator end,
|
||||||
Hilbert_sort_middle_policy policy)
|
Hilbert_sort_middle_policy policy)
|
||||||
{
|
{
|
||||||
|
|
@ -128,11 +125,9 @@ void hilbert_sort (RandomAccessIterator begin, RandomAccessIterator end,
|
||||||
|
|
||||||
internal::hilbert_sort<ConcurrencyTag>(begin, end, Kernel(), policy,
|
internal::hilbert_sort<ConcurrencyTag>(begin, end, Kernel(), policy,
|
||||||
static_cast<value_type *> (0));
|
static_cast<value_type *> (0));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class ConcurrencyTag = Sequential_tag, class RandomAccessIterator, class Kernel, class Policy>
|
||||||
template <class ConcurrencyTag = Sequential_tag, class RandomAccessIterator, class Kernel, class Policy>
|
|
||||||
void hilbert_sort (RandomAccessIterator begin, RandomAccessIterator end,
|
void hilbert_sort (RandomAccessIterator begin, RandomAccessIterator end,
|
||||||
const Kernel &k, Policy policy)
|
const Kernel &k, Policy policy)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,10 @@ void hilbert_sort_on_sphere (RandomAccessIterator begin,
|
||||||
template <class RandomAccessIterator>
|
template <class RandomAccessIterator>
|
||||||
void hilbert_sort_on_sphere (RandomAccessIterator begin, RandomAccessIterator end,
|
void hilbert_sort_on_sphere (RandomAccessIterator begin, RandomAccessIterator end,
|
||||||
double sq_r = 1.0,
|
double sq_r = 1.0,
|
||||||
const typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Point_3 &p =
|
const typename CGAL::Kernel_traits<
|
||||||
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Point_3(0,0,0))
|
typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Point_3 &p =
|
||||||
|
typename CGAL::Kernel_traits<
|
||||||
|
typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Point_3(0,0,0))
|
||||||
{
|
{
|
||||||
|
|
||||||
typedef std::iterator_traits<RandomAccessIterator> ITraits;
|
typedef std::iterator_traits<RandomAccessIterator> ITraits;
|
||||||
|
|
@ -51,52 +53,51 @@ void hilbert_sort_on_sphere (RandomAccessIterator begin, RandomAccessIterator en
|
||||||
typedef CGAL::Kernel_traits<value_type> KTraits;
|
typedef CGAL::Kernel_traits<value_type> KTraits;
|
||||||
typedef typename KTraits::Kernel Kernel;
|
typedef typename KTraits::Kernel Kernel;
|
||||||
|
|
||||||
internal::hilbert_sort_on_sphere(begin, end, Kernel(), Hilbert_sort_median_policy(),
|
internal::hilbert_sort_on_sphere(begin, end, Kernel(), Hilbert_sort_median_policy(), static_cast<value_type *> (0), sq_r, p);
|
||||||
static_cast<value_type *> (0), sq_r, p);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class RandomAccessIterator>
|
template <class RandomAccessIterator>
|
||||||
void hilbert_sort_on_sphere (RandomAccessIterator begin, RandomAccessIterator end, Hilbert_sort_median_policy policy,
|
void hilbert_sort_on_sphere (RandomAccessIterator begin, RandomAccessIterator end, Hilbert_sort_median_policy policy,
|
||||||
double sq_r = 1.0,
|
double sq_r = 1.0,
|
||||||
const typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Point_3 &p =
|
const typename CGAL::Kernel_traits<
|
||||||
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Point_3(0,0,0))
|
typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Point_3 &p =
|
||||||
|
typename CGAL::Kernel_traits<
|
||||||
|
typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Point_3(0,0,0))
|
||||||
{
|
{
|
||||||
typedef std::iterator_traits<RandomAccessIterator> ITraits;
|
typedef std::iterator_traits<RandomAccessIterator> ITraits;
|
||||||
typedef typename ITraits::value_type value_type;
|
typedef typename ITraits::value_type value_type;
|
||||||
typedef CGAL::Kernel_traits<value_type> KTraits;
|
typedef CGAL::Kernel_traits<value_type> KTraits;
|
||||||
typedef typename KTraits::Kernel Kernel;
|
typedef typename KTraits::Kernel Kernel;
|
||||||
|
|
||||||
internal::hilbert_sort_on_sphere(begin, end, Kernel(), policy,
|
internal::hilbert_sort_on_sphere(begin, end, Kernel(), policy, static_cast<value_type *> (0), sq_r, p);
|
||||||
static_cast<value_type *> (0), sq_r, p);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <class RandomAccessIterator>
|
template <class RandomAccessIterator>
|
||||||
void hilbert_sort_on_sphere (RandomAccessIterator begin, RandomAccessIterator end, Hilbert_sort_middle_policy policy,
|
void hilbert_sort_on_sphere (RandomAccessIterator begin, RandomAccessIterator end, Hilbert_sort_middle_policy policy,
|
||||||
double sq_r = 1.0,
|
double sq_r = 1.0,
|
||||||
const typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Point_3 &p =
|
const typename CGAL::Kernel_traits<
|
||||||
typename CGAL::Kernel_traits<typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Point_3(0,0,0))
|
typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Point_3 &p =
|
||||||
|
typename CGAL::Kernel_traits<
|
||||||
|
typename std::iterator_traits<RandomAccessIterator>::value_type>::Kernel::Point_3(0,0,0))
|
||||||
{
|
{
|
||||||
typedef std::iterator_traits<RandomAccessIterator> ITraits;
|
typedef std::iterator_traits<RandomAccessIterator> ITraits;
|
||||||
typedef typename ITraits::value_type value_type;
|
typedef typename ITraits::value_type value_type;
|
||||||
typedef CGAL::Kernel_traits<value_type> KTraits;
|
typedef CGAL::Kernel_traits<value_type> KTraits;
|
||||||
typedef typename KTraits::Kernel Kernel;
|
typedef typename KTraits::Kernel Kernel;
|
||||||
|
|
||||||
internal::hilbert_sort_on_sphere(begin, end, Kernel(), policy,
|
internal::hilbert_sort_on_sphere(begin, end, Kernel(), policy, static_cast<value_type *> (0), sq_r, p);
|
||||||
static_cast<value_type *> (0), sq_r, p);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <class RandomAccessIterator, class Kernel, class Policy>
|
template <class RandomAccessIterator, class Kernel, class Policy>
|
||||||
void hilbert_sort_on_sphere (RandomAccessIterator begin, RandomAccessIterator end, const Kernel &k, Policy policy,
|
void hilbert_sort_on_sphere (RandomAccessIterator begin, RandomAccessIterator end,
|
||||||
double sq_r = 1.0, const typename Kernel::Point_3 &p = typename Kernel::Point_3(0,0,0))
|
const Kernel &k, Policy policy,
|
||||||
|
double sq_r = 1.0,
|
||||||
|
const typename Kernel::Point_3 &p = typename Kernel::Point_3(0,0,0))
|
||||||
{
|
{
|
||||||
typedef std::iterator_traits<RandomAccessIterator> ITraits;
|
typedef std::iterator_traits<RandomAccessIterator> ITraits;
|
||||||
typedef typename ITraits::value_type value_type;
|
typedef typename ITraits::value_type value_type;
|
||||||
|
|
||||||
internal::hilbert_sort_on_sphere(begin, end,
|
internal::hilbert_sort_on_sphere(begin, end, k, policy, static_cast<value_type *> (0), sq_r, p);
|
||||||
k, policy, static_cast<value_type *> (0), sq_r, p);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end of namespace CGAL
|
} // end of namespace CGAL
|
||||||
|
|
|
||||||
|
|
@ -232,10 +232,10 @@ public:
|
||||||
|
|
||||||
template <class R, int x, int y, int z, int ord>
|
template <class R, int x, int y, int z, int ord>
|
||||||
struct Transform_coordinates_traits_3 {
|
struct Transform_coordinates_traits_3 {
|
||||||
private:
|
private:
|
||||||
enum {opt = Transform_constant_struct<x,y,z,ord>::value};
|
enum {opt = Transform_constant_struct<x,y,z,ord>::value};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef Transform_coordinates_traits_3<R,x,y,z,ord> Traits;
|
typedef Transform_coordinates_traits_3<R,x,y,z,ord> Traits;
|
||||||
typedef R Rp;
|
typedef R Rp;
|
||||||
typedef typename Rp::Point_3 Point_2;
|
typedef typename Rp::Point_3 Point_2;
|
||||||
|
|
@ -253,7 +253,6 @@ struct Transform_coordinates_traits_3 {
|
||||||
Compute_y compute_y_2_object() const { return Compute_y(); }
|
Compute_y compute_y_2_object() const { return Compute_y(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
} } //namespace CGAL::internal
|
} } //namespace CGAL::internal
|
||||||
|
|
||||||
#endif // CGAL_INTERNAL_SCALE_COORDINATES_ADAPTOR_TRAITS_3_H
|
#endif // CGAL_INTERNAL_SCALE_COORDINATES_ADAPTOR_TRAITS_3_H
|
||||||
|
|
|
||||||
|
|
@ -29,16 +29,15 @@ namespace CGAL {
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
template <class ConcurrencyTag = Sequential_tag, class RandomAccessIterator, class Policy, class Kernel>
|
template <class ConcurrencyTag = Sequential_tag, class RandomAccessIterator, class Policy, class Kernel>
|
||||||
void spatial_sort (
|
void spatial_sort (RandomAccessIterator begin, RandomAccessIterator end,
|
||||||
RandomAccessIterator begin, RandomAccessIterator end,
|
|
||||||
const Kernel &k,
|
const Kernel &k,
|
||||||
Policy /*policy*/,
|
Policy /*policy*/,
|
||||||
typename Kernel::Point_2 *,
|
typename Kernel::Point_2 *,
|
||||||
std::ptrdiff_t threshold_hilbert,
|
std::ptrdiff_t threshold_hilbert,
|
||||||
std::ptrdiff_t threshold_multiscale,
|
std::ptrdiff_t threshold_multiscale,
|
||||||
double ratio)
|
double ratio)
|
||||||
{
|
{
|
||||||
typedef std::iterator_traits<RandomAccessIterator> Iterator_traits;
|
typedef std::iterator_traits<RandomAccessIterator> Iterator_traits;
|
||||||
typedef typename Iterator_traits::difference_type Diff_t;
|
typedef typename Iterator_traits::difference_type Diff_t;
|
||||||
typedef Hilbert_sort_2<Kernel, Policy, ConcurrencyTag> Sort;
|
typedef Hilbert_sort_2<Kernel, Policy, ConcurrencyTag> Sort;
|
||||||
|
|
@ -50,20 +49,18 @@ namespace internal {
|
||||||
if (threshold_multiscale==0) threshold_multiscale=16;
|
if (threshold_multiscale==0) threshold_multiscale=16;
|
||||||
if (ratio==0.0) ratio=0.25;
|
if (ratio==0.0) ratio=0.25;
|
||||||
|
|
||||||
(Multiscale_sort<Sort> (Sort (k, threshold_hilbert),
|
(Multiscale_sort<Sort> (Sort (k, threshold_hilbert), threshold_multiscale, ratio)) (begin, end);
|
||||||
threshold_multiscale, ratio)) (begin, end);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
template <class ConcurrencyTag = Sequential_tag, class RandomAccessIterator, class Policy, class Kernel>
|
template <class ConcurrencyTag = Sequential_tag, class RandomAccessIterator, class Policy, class Kernel>
|
||||||
void spatial_sort (
|
void spatial_sort (RandomAccessIterator begin, RandomAccessIterator end,
|
||||||
RandomAccessIterator begin, RandomAccessIterator end,
|
|
||||||
const Kernel &k,
|
const Kernel &k,
|
||||||
Policy /*policy*/,
|
Policy /*policy*/,
|
||||||
typename Kernel::Point_3 *,
|
typename Kernel::Point_3 *,
|
||||||
std::ptrdiff_t threshold_hilbert,
|
std::ptrdiff_t threshold_hilbert,
|
||||||
std::ptrdiff_t threshold_multiscale,
|
std::ptrdiff_t threshold_multiscale,
|
||||||
double ratio)
|
double ratio)
|
||||||
{
|
{
|
||||||
typedef std::iterator_traits<RandomAccessIterator> Iterator_traits;
|
typedef std::iterator_traits<RandomAccessIterator> Iterator_traits;
|
||||||
typedef typename Iterator_traits::difference_type Diff_t;
|
typedef typename Iterator_traits::difference_type Diff_t;
|
||||||
typedef Hilbert_sort_3<Kernel, Policy, ConcurrencyTag> Sort;
|
typedef Hilbert_sort_3<Kernel, Policy, ConcurrencyTag> Sort;
|
||||||
|
|
@ -75,20 +72,18 @@ namespace internal {
|
||||||
if (threshold_multiscale==0) threshold_multiscale=64;
|
if (threshold_multiscale==0) threshold_multiscale=64;
|
||||||
if (ratio==0.0) ratio=0.125;
|
if (ratio==0.0) ratio=0.125;
|
||||||
|
|
||||||
(Multiscale_sort<Sort> (Sort (k, threshold_hilbert),
|
(Multiscale_sort<Sort> (Sort (k, threshold_hilbert), threshold_multiscale, ratio)) (begin, end);
|
||||||
threshold_multiscale, ratio)) (begin, end);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
template <class ConcurrencyTag = Sequential_tag, class RandomAccessIterator, class Policy, class Kernel>
|
template <class ConcurrencyTag = Sequential_tag, class RandomAccessIterator, class Policy, class Kernel>
|
||||||
void spatial_sort (
|
void spatial_sort (RandomAccessIterator begin, RandomAccessIterator end,
|
||||||
RandomAccessIterator begin, RandomAccessIterator end,
|
|
||||||
const Kernel &k,
|
const Kernel &k,
|
||||||
Policy /*policy*/,
|
Policy /*policy*/,
|
||||||
typename Kernel::Point_d *,
|
typename Kernel::Point_d *,
|
||||||
std::ptrdiff_t threshold_hilbert,
|
std::ptrdiff_t threshold_hilbert,
|
||||||
std::ptrdiff_t threshold_multiscale,
|
std::ptrdiff_t threshold_multiscale,
|
||||||
double ratio)
|
double ratio)
|
||||||
{
|
{
|
||||||
typedef std::iterator_traits<RandomAccessIterator> Iterator_traits;
|
typedef std::iterator_traits<RandomAccessIterator> Iterator_traits;
|
||||||
typedef typename Iterator_traits::difference_type Diff_t;
|
typedef typename Iterator_traits::difference_type Diff_t;
|
||||||
typedef Hilbert_sort_d<Kernel, Policy> Sort;
|
typedef Hilbert_sort_d<Kernel, Policy> Sort;
|
||||||
|
|
@ -100,13 +95,11 @@ namespace internal {
|
||||||
if (threshold_multiscale==0) threshold_multiscale=500;
|
if (threshold_multiscale==0) threshold_multiscale=500;
|
||||||
if (ratio==0.0) ratio=0.05;
|
if (ratio==0.0) ratio=0.05;
|
||||||
|
|
||||||
(Multiscale_sort<Sort> (Sort (k, threshold_hilbert),
|
(Multiscale_sort<Sort> (Sort (k, threshold_hilbert), threshold_multiscale, ratio)) (begin, end);
|
||||||
threshold_multiscale, ratio)) (begin, end);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
} //namespace internal
|
} //namespace internal
|
||||||
|
|
||||||
|
|
||||||
template <class ConcurrencyTag = Sequential_tag, class RandomAccessIterator, class Policy, class Kernel>
|
template <class ConcurrencyTag = Sequential_tag, class RandomAccessIterator, class Policy, class Kernel>
|
||||||
void spatial_sort (RandomAccessIterator begin, RandomAccessIterator end,
|
void spatial_sort (RandomAccessIterator begin, RandomAccessIterator end,
|
||||||
const Kernel &k,
|
const Kernel &k,
|
||||||
|
|
@ -167,7 +160,7 @@ void spatial_sort (RandomAccessIterator begin, RandomAccessIterator end,
|
||||||
threshold_hilbert,threshold_multiscale,ratio);
|
threshold_hilbert,threshold_multiscale,ratio);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ConcurrencyTag = Sequential_tag, class RandomAccessIterator>
|
template <class ConcurrencyTag = Sequential_tag, class RandomAccessIterator>
|
||||||
void spatial_sort (RandomAccessIterator begin, RandomAccessIterator end,
|
void spatial_sort (RandomAccessIterator begin, RandomAccessIterator end,
|
||||||
std::ptrdiff_t threshold_hilbert=0,
|
std::ptrdiff_t threshold_hilbert=0,
|
||||||
std::ptrdiff_t threshold_multiscale=0,
|
std::ptrdiff_t threshold_multiscale=0,
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,7 @@ namespace CGAL {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
template <class RandomAccessIterator, class Policy, class Kernel>
|
template <class RandomAccessIterator, class Policy, class Kernel>
|
||||||
void spatial_sort_on_sphere (
|
void spatial_sort_on_sphere (RandomAccessIterator begin, RandomAccessIterator end,
|
||||||
RandomAccessIterator begin, RandomAccessIterator end,
|
|
||||||
const Kernel &k,
|
const Kernel &k,
|
||||||
Policy /*policy*/,
|
Policy /*policy*/,
|
||||||
typename Kernel::Point_3 *,
|
typename Kernel::Point_3 *,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue