Fix examples

This commit is contained in:
Andreas Fabri 2019-11-04 16:45:30 +01:00
parent cffd1fe3a0
commit b98d2f6876
8 changed files with 28 additions and 25 deletions

View File

@ -1,4 +1,5 @@
/*!
\example Spatial_sorting/parallel.cpp
\example Spatial_sorting/hilbert.cpp
\example Spatial_sorting/hilbert_policies.cpp
\example Spatial_sorting/small_example_delaunay_2.cpp

View File

@ -17,12 +17,12 @@ typedef CGAL::Creator_uniform_3<double,Point_3> Creator_3;
int main(int argc, char* argv[])
{
std::vector<Point_3> points;
v.reserve (2000);
points.reserve (2000);
CGAL::Random_points_in_cube_3<Point_3> gen (1.0);
for (int i = 0; i < 2000; ++i){
v.push_back (*gen++);
points.push_back (*gen++);
}
#ifdef CGAL_LINKED_WITH_TBB
CGAL::spatial_sort<CGAL::Parallel_tag>(points.begin(),points.end());

View File

@ -18,7 +18,7 @@
namespace CGAL {
template <class K, class Hilbert_policy, class ConcurrencyTag >
template <class K, class Hilbert_policy, class ConcurrencyTag = Sequential_tag >
class Hilbert_sort_2;
template <class K, class ConcurrencyTag>

View File

@ -18,7 +18,7 @@
namespace CGAL {
template <class K, class Hilbert_policy, class ConcurrencyTag>
template <class K, class Hilbert_policy, class ConcurrencyTag = Sequential_tag>
class Hilbert_sort_3;
template <class K, class ConcurrencyTag>

View File

@ -13,6 +13,7 @@
#define CGAL_HILBERT_SORT_MEDIAN_2_H
#include <CGAL/config.h>
#include <CGAL/tags.h>
#include <functional>
#include <cstddef>
#include <CGAL/Hilbert_sort_base.h>

View File

@ -31,7 +31,7 @@ namespace CGAL {
namespace internal {
template <class RandomAccessIterator, class Kernel, class Policy>
template <class ConcurrencyTag = Sequential_tag, class RandomAccessIterator, class Kernel, class Policy>
void hilbert_sort (RandomAccessIterator begin,
RandomAccessIterator end,
const Kernel &k,
@ -43,10 +43,10 @@ namespace internal {
boost::rand48 random;
boost::random_number_generator<boost::rand48, Diff_t> rng(random);
CGAL::cpp98::random_shuffle(begin,end, rng);
(Hilbert_sort_2<Kernel, Policy> (k))(begin, end);
(Hilbert_sort_2<Kernel, Policy, ConcurrencyTag> (k))(begin, end);
}
template <class RandomAccessIterator, class Kernel, class Policy>
template <class ConcurrencyTag = Sequential_tag, class RandomAccessIterator, class Kernel, class Policy>
void hilbert_sort (RandomAccessIterator begin,
RandomAccessIterator end,
const Kernel &k,
@ -58,10 +58,10 @@ namespace internal {
boost::rand48 random;
boost::random_number_generator<boost::rand48, Diff_t> rng(random);
CGAL::cpp98::random_shuffle(begin,end, rng);
(Hilbert_sort_3<Kernel, Policy> (k))(begin, end);
(Hilbert_sort_3<Kernel, Policy, ConcurrencyTag> (k))(begin, end);
}
template <class RandomAccessIterator, class Kernel, class Policy>
template <class ConcurrencyTag = Sequential_tag, class RandomAccessIterator, class Kernel, class Policy>
void hilbert_sort (RandomAccessIterator begin,
RandomAccessIterator end,
const Kernel &k,
@ -75,9 +75,9 @@ namespace internal {
CGAL::cpp98::random_shuffle(begin,end, rng);
(Hilbert_sort_d<Kernel, Policy> (k))(begin, end);
}
}
} // namespace internal
template <class RandomAccessIterator>
template <class ConcurrencyTag = Sequential_tag, class RandomAccessIterator>
void hilbert_sort (RandomAccessIterator begin, RandomAccessIterator end)
{
@ -86,23 +86,23 @@ void hilbert_sort (RandomAccessIterator begin, RandomAccessIterator end)
typedef CGAL::Kernel_traits<value_type> KTraits;
typedef typename KTraits::Kernel Kernel;
internal::hilbert_sort(begin, end, Kernel(), Hilbert_sort_median_policy(),
internal::hilbert_sort<ConcurrencyTag>(begin, end, Kernel(), Hilbert_sort_median_policy(),
static_cast<value_type *> (0));
}
template <class RandomAccessIterator, class Kernel>
template <class ConcurrencyTag = Sequential_tag, class RandomAccessIterator, class Kernel>
void hilbert_sort (RandomAccessIterator begin, RandomAccessIterator end,
const Kernel &k)
{
typedef std::iterator_traits<RandomAccessIterator> ITraits;
typedef typename ITraits::value_type value_type;
internal::hilbert_sort(begin, end, k, Hilbert_sort_median_policy(),
internal::hilbert_sort<ConcurrencyTag>(begin, end, k, Hilbert_sort_median_policy(),
static_cast<value_type *> (0));
}
template <class RandomAccessIterator>
template <class ConcurrencyTag = Sequential_tag, class RandomAccessIterator>
void hilbert_sort (RandomAccessIterator begin, RandomAccessIterator end,
Hilbert_sort_median_policy policy)
{
@ -111,13 +111,13 @@ void hilbert_sort (RandomAccessIterator begin, RandomAccessIterator end,
typedef CGAL::Kernel_traits<value_type> KTraits;
typedef typename KTraits::Kernel Kernel;
internal::hilbert_sort(begin, end, Kernel(), policy,
internal::hilbert_sort<ConcurrencyTag>(begin, end, Kernel(), policy,
static_cast<value_type *> (0));
}
template <class RandomAccessIterator>
template <class ConcurrencyTag = Sequential_tag, class RandomAccessIterator>
void hilbert_sort (RandomAccessIterator begin, RandomAccessIterator end,
Hilbert_sort_middle_policy policy)
{
@ -126,20 +126,20 @@ void hilbert_sort (RandomAccessIterator begin, RandomAccessIterator end,
typedef CGAL::Kernel_traits<value_type> KTraits;
typedef typename KTraits::Kernel Kernel;
internal::hilbert_sort(begin, end, Kernel(), policy,
internal::hilbert_sort<ConcurrencyTag>(begin, end, Kernel(), policy,
static_cast<value_type *> (0));
}
template <class RandomAccessIterator, class Kernel, class Policy>
template <class ConcurrencyTag = Sequential_tag, class RandomAccessIterator, class Kernel, class Policy>
void hilbert_sort (RandomAccessIterator begin, RandomAccessIterator end,
const Kernel &k, Policy policy)
{
typedef std::iterator_traits<RandomAccessIterator> ITraits;
typedef typename ITraits::value_type value_type;
internal::hilbert_sort(begin, end,
internal::hilbert_sort<ConcurrencyTag>(begin, end,
k, policy, static_cast<value_type *> (0));
}

View File

@ -93,6 +93,7 @@ class Delaunay_triangulation_3<Gt, Tds_, Default, Lock_data_structure_>
typedef Delaunay_triangulation_3<Gt, Tds_, Default, Lock_data_structure_> Self;
public:
typedef typename Tds::Concurrency_tag Concurrency_tag;
typedef Triangulation_3<Gt, Tds, Lock_data_structure_> Tr_Base;
typedef Tds Triangulation_data_structure;
@ -349,7 +350,7 @@ public:
size_type n = number_of_vertices();
std::vector<Point> points(first, last);
spatial_sort(points.begin(), points.end(), geom_traits());
spatial_sort<Concurrency_tag>(points.begin(), points.end(), geom_traits());
// Parallel
#ifdef CGAL_LINKED_WITH_TBB
@ -425,7 +426,7 @@ private:
typedef typename Pointer_property_map<Point>::type Pmap;
typedef Spatial_sort_traits_adapter_3<Geom_traits,Pmap> Search_traits;
spatial_sort(indices.begin(), indices.end(),
spatial_sort<Concurrency_tag>(indices.begin(), indices.end(),
Search_traits(make_property_map(points),geom_traits()));
#ifdef CGAL_LINKED_WITH_TBB