Merge branch 'master' into Tetrahedral_remeshing-new-jtournois

This commit is contained in:
Jane Tournois 2020-04-01 07:07:46 +01:00
commit e0171c2f24
258 changed files with 4892 additions and 3669 deletions

View File

@ -60,6 +60,8 @@ int main(int argc, char* argv[])
{
std::ifstream in((argc>1)?argv[1]:"data/half.xyz");
double per = (argc>2)?boost::lexical_cast<double>(argv[2]):0;
double radius_ratio_bound = (argc>3)?boost::lexical_cast<double>(argv[3]):5.0;
std::vector<Point_3> points;
std::vector<Facet> facets;
@ -71,7 +73,8 @@ int main(int argc, char* argv[])
CGAL::advancing_front_surface_reconstruction(points.begin(),
points.end(),
std::back_inserter(facets),
perimeter);
perimeter,
radius_ratio_bound);
std::cout << "OFF\n" << points.size() << " " << facets.size() << " 0\n";
std::copy(points.begin(),

View File

@ -3,7 +3,6 @@
#include <algorithm>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Point_with_normal_3.h>
#include <CGAL/Shape_detection/Efficient_RANSAC.h>
#include <CGAL/structure_point_set.h>
#include <CGAL/Delaunay_triangulation_3.h>

View File

@ -72,7 +72,6 @@ public:
FT s0, FT s1) const
{
CGAL_precondition(STEP > 0);
CGAL_precondition(s0 < s1);
p.clear();

View File

@ -4,11 +4,6 @@ namespace boost {
/// \ingroup PkgBGLProperties
/// @{
/// The constant `edge_index` is a property tag which identifies the <i>index</i> property of an edge of a \sc{Bgl}
/// <a href="https://www.boost.org/libs/graph/doc/Graph.html"><code>Graph</code></a>.
/// \cgalModels <a href="https://www.boost.org/libs/graph/doc/PropertyTag.html"><code>PropertyTag</code></a>
enum edge_index_t { edge_index};
/// The constant `vertex_index` is a property tag which identifies the <i>index</i> property of a vertex of a \sc{Bgl}
/// <a href="https://www.boost.org/libs/graph/doc/Graph.html"><code>Graph</code></a>.
/// \cgalModels <a href="https://www.boost.org/libs/graph/doc/PropertyTag.html"><code>PropertyTag</code></a>
@ -20,13 +15,17 @@ enum vertex_index_t { vertex_index };
/// \cgalModels <a href="https://www.boost.org/libs/graph/doc/PropertyTag.html"><code>PropertyTag</code></a>
enum halfedge_index_t { halfedge_index };
/// The constant `edge_index` is a property tag which identifies the <i>index</i> property of an edge of a \sc{Bgl}
/// <a href="https://www.boost.org/libs/graph/doc/Graph.html"><code>Graph</code></a>.
/// \cgalModels <a href="https://www.boost.org/libs/graph/doc/PropertyTag.html"><code>PropertyTag</code></a>
enum edge_index_t { edge_index };
/// The constant `face_index` is a property tag which identifies the <i>index</i> property of a face of a `FaceGraph`.
///
/// This is a property tag introduced by \cgal.
/// \cgalModels <a href="https://www.boost.org/libs/graph/doc/PropertyTag.html"><code>PropertyTag</code></a>
enum face_index_t { face_index };
/// The constant `vertex_point` is a property tag which refers to the geometric embedding property of
/// a vertex of a `HalfedgeGraph`.
///
@ -34,12 +33,25 @@ enum face_index_t { face_index };
/// \cgalModels <a href="https://www.boost.org/libs/graph/doc/PropertyTag.html"><code>PropertyTag</code></a>
enum vertex_point_t { vertex_point };
/// @}
} // namespace boost
namespace CGAL {
/// \ingroup PkgBGLProperties
///
/// \brief graph_has_property is used to indicate if a model of `HalfedgeGraph` or `FaceGraph`
/// has an internal property associated with the given `PropertyTag`.
///
/// It inherits from \link Tag_true `CGAL::Tag_true` \endlink if there is a
/// default internal property map for the corresponding property tag and from
/// \link Tag_false `CGAL::Tag_false` \endlink otherwise.
///
/// \tparam Graph a model of `HalfedgeGraph` or `FaceGraph`
/// \tparam PropertyTag the type of a property tag referring to the property of interest.
///
template<typename Graph, typename PropertyTag>
struct graph_has_property;
/// @{

View File

@ -55,6 +55,7 @@ int main(int argc, char* argv[])
CGAL::copy_face_graph(T1, S, CGAL::parameters::vertex_to_vertex_output_iterator(std::inserter(v2v, v2v.end()))
.halfedge_to_halfedge_output_iterator(std::inserter(h2h, h2h.end())));
std::ofstream out("reverse.off");
out.precision(17);
out << S;
}
return 0;

View File

@ -43,6 +43,7 @@ int main(int argc, char* argv[])
{
CGAL::copy_face_graph(S, T1);
std::ofstream out("sm.off");
out.precision(17);
out << T1;
}
@ -81,6 +82,7 @@ int main(int argc, char* argv[])
boost::unordered_map<source_face_descriptor, tm_face_descriptor> f2f;
CGAL::copy_face_graph(T1, S, std::inserter(v2v, v2v.end()), std::inserter(h2h, h2h.end()));
std::ofstream out("reverse.off");
out.precision(17);
out << S;
CGAL::copy_face_graph(T1, S, CGAL::parameters::vertex_to_vertex_map(boost::make_assoc_property_map(v2v))
.halfedge_to_halfedge_output_iterator(std::inserter(h2h, h2h.end()))

View File

@ -20,6 +20,7 @@ int main()
CGAL::make_quad(Point(0,0,1), Point(1,0,1),Point(1,1,1),Point(0,1,1), sm);
std::ofstream out("out.inp");
out.precision(17);
CGAL::write_inp(out, sm, "out.inp", "S4R");
return 0;
}

View File

@ -23,63 +23,35 @@
#include <CGAL/basic.h>
#include <string>
namespace CGAL{
/// \ingroup PkgBGLProperties
/// \brief graph_has_property is used to indicate if
/// a model of `HalfedgeGraph` or `FaceGraph`
/// has an internal property associated with the
/// given `PropertyTag`.
///
/// It inherits from `CGAL::Tag_true` if there is a
/// default internal property map for the
/// corresponding property tag and from
/// `CGAL::Tag_false` otherwise.
///
/// \tparam Graph a model of `HalfedgeGraph` or `FaceGraph`
/// \tparam PropertyTag the type of a property tag
/// referring to the property of interest.
///
namespace CGAL {
template<typename Graph, typename PropertyTag>
struct graph_has_property
#ifndef DOXYGEN_RUNNING
: CGAL::Tag_false
#endif
{};
}
/// Boost Namespace
struct graph_has_property : CGAL::Tag_false { };
} // namespace CGAL
namespace boost {
/// \ingroup PkgBGLProperties
/// @{
/// A property tag which refers to the geometric embedding property
/// of a vertex of a \ref HalfedgeGraph.
enum vertex_point_t { vertex_point };
enum vertex_external_index_t { vertex_external_index } ;
/// A property tag which refers to the property
/// of a halfedge of being a border halfedge.
enum edge_external_index_t { edge_external_index } ;
// vertex_index_t is defined in boost
enum vertex_external_index_t { vertex_external_index };
/// A property tag which identifies the *index* property of
/// a halfedge of a \ref HalfedgeGraph.
enum halfedge_index_t { halfedge_index };
enum halfedge_external_index_t { halfedge_external_index } ;
enum halfedge_index_t { halfedge_index };
enum halfedge_external_index_t { halfedge_external_index };
// edge_index_t is defined in boost
enum edge_external_index_t { edge_external_index };
/// A property tag which identifies the *index* property of
/// a face of a \ref FaceGraph.
enum face_index_t { face_index };
enum face_external_index_t { face_external_index } ;
enum face_external_index_t { face_external_index };
struct cgal_no_property
{
typedef bool type;
typedef const bool const_type;
};
/// @}
// Introduce those two tags so we can use BOOST_INSTALL_PROPERTY
// macro. This is dangerous because we now rely on implementation
// details.

View File

@ -2,6 +2,7 @@
// We test speed of discrete harmonic coordinates on a set of automatically generated
// points inside a regular polygon with 100 vertices. We use inexact kernel.
#include <CGAL/number_type_config.h>
#include <CGAL/Real_timer.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Barycentric_coordinates_2/Discrete_harmonic_2.h>
@ -28,12 +29,11 @@ void generate_regular_polygon(const int number_of_vertices, const double polygon
{
const int n = number_of_vertices;
const double r = polygon_radius;
const double number_pi = 3.14159;
vertices.resize(n);
for(int i = 0; i < n; ++i)
vertices[i] = Point(Scalar(r*sin((number_pi / n) + ((i * 2.0 * number_pi) / n))), Scalar(-r*cos((number_pi / n) + ((i * 2.0 * number_pi) / n))));
vertices[i] = Point(Scalar(r*sin((CGAL_PI / n) + ((i * 2.0 * CGAL_PI) / n))), Scalar(-r*cos((CGAL_PI / n) + ((i * 2.0 * CGAL_PI) / n))));
}
int main()

View File

@ -2,6 +2,7 @@
// We test speed of mean value coordinates on a set of automatically generated
// points inside a regular polygon with 100 vertices. We use inexact kernel.
#include <CGAL/number_type_config.h>
#include <CGAL/Real_timer.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Barycentric_coordinates_2/Mean_value_2.h>
@ -28,12 +29,11 @@ void generate_regular_polygon(const int number_of_vertices, const double polygon
{
const int n = number_of_vertices;
const double r = polygon_radius;
const double number_pi = 3.14159;
vertices.resize(n);
for(int i = 0; i < n; ++i)
vertices[i] = Point(Scalar(r*sin((number_pi / n) + ((i * 2.0 * number_pi) / n))), Scalar(-r*cos((number_pi / n) + ((i * 2.0 * number_pi) / n))));
vertices[i] = Point(Scalar(r*sin((CGAL_PI / n) + ((i * 2.0 * CGAL_PI) / n))), Scalar(-r*cos((CGAL_PI / n) + ((i * 2.0 * CGAL_PI) / n))));
}
int main()

View File

@ -2,6 +2,7 @@
// We test speed of Wachspress coordinates on a set of automatically generated
// points inside a regular polygon with 100 vertices. We use inexact kernel.
#include <CGAL/number_type_config.h>
#include <CGAL/Real_timer.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Barycentric_coordinates_2/Wachspress_2.h>
@ -28,12 +29,11 @@ void generate_regular_polygon(const int number_of_vertices, const double polygon
{
const int n = number_of_vertices;
const double r = polygon_radius;
const double number_pi = 3.14159;
vertices.resize(n);
for(int i = 0; i < n; ++i)
vertices[i] = Point(Scalar(r*sin((number_pi / n) + ((i * 2.0 * number_pi) / n))), Scalar(-r*cos((number_pi / n) + ((i * 2.0 * number_pi) / n))));
vertices[i] = Point(Scalar(r*sin((CGAL_PI / n) + ((i * 2.0 * CGAL_PI) / n))), Scalar(-r*cos((CGAL_PI / n) + ((i * 2.0 * CGAL_PI) / n))));
}
int main()

View File

@ -242,6 +242,29 @@ void box_intersection_all_pairs_d(
cutoff parameters are recommended. See also
Section \ref secboxintersperformance .
\cgalHeading{Concurrency}
The first template parameter of the function enables to choose whether
the algorithm is to be run in parallel, if `CGAL::Parallel_tag` is specified
and %CGAL has been linked with the Intel TBB library, or sequentially,
if `CGAL::Sequential_tag` - the default value - is specified.
The parallelization of the algorithm is based on a divide-and-conquer
approach: the two ranges are split in a number of smaller ranges, and
all combinations of subranges are treated in parallel. It is thus
recommended to use ranges of pointers to bounding boxes, to keep
these copies light.
\warning The parallel mode comes with a small overhead due to the
duplication and splitting of the input ranges. It is an improvement
for almost all inputs, but not all. A configuration where the two ranges
are small and entirely disjoint might result in a slightly worse
runtime when using the parallel version. Users should benchmark both
versions to verify that their data does not fall in this (small)
set of inputs.
\warning When using the parallel mode, the callback function must
be threadsafe.
\cgalHeading{Example}
The box implementation provided with
@ -274,7 +297,8 @@ void box_intersection_all_pairs_d(
*/
template< class RandomAccessIterator1,
template< class ConcurrencyTag = CGAL::Sequential_tag,
class RandomAccessIterator1,
class RandomAccessIterator2,
class Callback >
void box_intersection_d(
@ -291,7 +315,8 @@ void box_intersection_d(
Invocation with custom box traits.
*/
template< class RandomAccessIterator1,
template< class ConcurrencyTag = CGAL::Sequential_tag,
class RandomAccessIterator1,
class RandomAccessIterator2,
class Callback, class BoxTraits >
void box_intersection_d(
@ -489,8 +514,11 @@ namespace CGAL {
\cgalHeading{Implementation}
See the implementation section of the `box_intersection_d()`
function.
See the implementation section of the `box_intersection_d()` function.
\cgalHeading{Concurrency}
See the concurrency section of the `box_intersection_d()` function.
\cgalHeading{Example}
@ -520,7 +548,8 @@ namespace CGAL {
`RandomAccessIterator`.
*/
template< class RandomAccessIterator, class Callback >
template< class ConcurrencyTag = CGAL::Sequential_tag,
class RandomAccessIterator, class Callback >
void box_self_intersection_d(
RandomAccessIterator begin, RandomAccessIterator end,
Callback callback,
@ -532,7 +561,8 @@ void box_self_intersection_d(
Invocation with custom box traits.
*/
template< class RandomAccessIterator,
template< class ConcurrencyTag = CGAL::Sequential_tag
class RandomAccessIterator,
class Callback, class BoxTraits >
void box_self_intersection_d(
RandomAccessIterator begin, RandomAccessIterator end,

View File

@ -16,34 +16,34 @@
#include <CGAL/license/Box_intersection_d.h>
#include <CGAL/basic.h>
#include <CGAL/Box_intersection_d/Box_d.h>
namespace CGAL {
namespace Box_intersection_d {
template<class NT_, int N, class Info_>
class Box_with_info_d : public Box_d< NT_, N, ID_FROM_BOX_ADDRESS> {
template<class NT_, int N, class Info_, class IdPolicy = ID_EXPLICIT>
class Box_with_info_d
: public Box_d< NT_, N, IdPolicy>
{
protected:
Info_ m_info;
public:
typedef Box_d< NT_, N, ID_FROM_BOX_ADDRESS> Base;
typedef NT_ NT;
typedef Info_ Info;
typedef Box_d< NT_, N, IdPolicy> Base;
typedef NT_ NT;
typedef Info_ Info;
Box_with_info_d() {}
Box_with_info_d( Info h) : m_info(h) {}
Box_with_info_d( bool complete, Info h): Base(complete), m_info(h) {}
Box_with_info_d(NT l[N], NT h[N], Info n) : Base( l, h), m_info(n) {}
Box_with_info_d( const Bbox_2& b, Info h) : Base( b), m_info(h) {}
Box_with_info_d( const Bbox_3& b, Info h) : Base( b), m_info(h) {}
Info info() const { return m_info; }
};
} // end namespace Box_intersection_d
} // namespace Box_intersection_d
} // namespace CGAL
} //namespace CGAL
#endif
#endif // CGAL_BOX_INTERSECTION_D_BOX_WITH_INFO_D_H

View File

@ -16,7 +16,6 @@
#include <CGAL/license/Box_intersection_d.h>
#include <CGAL/basic.h>
#include <CGAL/Box_intersection_d/box_limits.h>
@ -24,7 +23,6 @@
#include <boost/random/uniform_int.hpp>
#include <boost/random/variate_generator.hpp>
#include <algorithm>
#include <iterator>
#include <functional>
@ -93,6 +91,8 @@ void one_way_scan( RandomAccessIter1 p_begin, RandomAccessIter1 p_end,
bool in_order = true )
{
typedef typename Traits::Compare Compare;
// Putting a parallel sort here slows down the overall parallel algorithm
std::sort( p_begin, p_end, Compare( 0 ) );
std::sort( i_begin, i_end, Compare( 0 ) );
@ -323,7 +323,7 @@ void segment_tree( RandomAccessIter1 p_begin, RandomAccessIter1 p_end,
RandomAccessIter2 i_begin, RandomAccessIter2 i_end,
T lo, T hi,
Callback callback, Predicate_traits traits,
std::ptrdiff_t cutoff, int dim, bool in_order )
std::ptrdiff_t cutoff, int dim, bool in_order)
{
typedef typename Predicate_traits::Spanning Spanning;
typedef typename Predicate_traits::Lo_less Lo_less;

View File

@ -6,7 +6,7 @@
// $URL$
// $Id$
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
//
//
//
// Author(s) : Lutz Kettner <kettner@mpi-sb.mpg.de>
// Andreas Meyer <ameyer@mpi-sb.mpg.de>
@ -25,12 +25,191 @@
#include <CGAL/Box_intersection_d/Box_traits_d.h>
#include <CGAL/Box_intersection_d/box_limits.h>
#include <CGAL/use.h>
#include <CGAL/tags.h>
#ifdef CGAL_LINKED_WITH_TBB
#include <tbb/task_group.h>
#endif
#include <iterator>
#include <vector>
////////////////////////////////////////////////////////////////////////////////////////////////
/// THE CALLBACK MUST BE THREADSAFE IF YOU ARE USING THE PARALLEL MODE
////////////////////////////////////////////////////////////////////////////////////////////////
namespace CGAL {
namespace internal {
// Generic call with custom predicate traits parameter.
template< class RandomAccessIter1, class RandomAccessIter2,
template< class ConcurrencyTag,
class RandomAccessIter1, class RandomAccessIter2,
class Callback, class Traits >
void box_intersection_segment_tree_d(
RandomAccessIter1 begin1, RandomAccessIter1 end1,
RandomAccessIter2 begin2, RandomAccessIter2 end2,
Callback callback,
const Traits& traits,
const std::ptrdiff_t cutoff,
const bool in_order)
{
typedef typename Traits::NT NT;
CGAL_assertion(Traits::dimension() > 0);
const int dim = Traits::dimension() - 1;
const NT inf = Box_intersection_d::box_limits<NT>::inf();
const NT sup = Box_intersection_d::box_limits<NT>::sup();
#ifndef CGAL_LINKED_WITH_TBB
CGAL_static_assertion_msg (!(boost::is_convertible<ConcurrencyTag, Parallel_tag>::value),
"Parallel_tag is enabled but TBB is unavailable.");
#else // CGAL_LINKED_WITH_TBB
if(boost::is_convertible<ConcurrencyTag, Parallel_tag>::value)
{
// Here is an illustration for n=2.
//
// Doing a R1-R2 intersection with a 2-split is doing 4 subpairs in parallel
// a-c and b-d
// r1[0][0] --a-- r1[0][1] --b-- r1[0][2]
// r2[0][0] --c-- r2[0][1] --d-- r2[0][2]
//
// a-d and b-c
// r1[1][0] --a-- r1[1][1] --b-- r1[1][2]
// r2[1][0] --c-- r2[1][1] --d-- r2[1][2]
//
// Ranges must be duplicates since sorting is performed
typedef typename std::iterator_traits<RandomAccessIter1>::value_type val_t;
typedef typename std::iterator_traits<RandomAccessIter1>::difference_type diff_size;
typedef std::vector<val_t> val_container;
typedef typename val_container::iterator It;
static constexpr int n = 4;
const diff_size r1s = std::distance(begin1, end1);
const diff_size r2s = std::distance(begin2, end2);
val_container range_1_copies, range_2_copies;
range_1_copies.reserve(r1s * n);
range_2_copies.reserve(r2s * n);
const diff_size r1_step = r1s / n;
const diff_size r2_step = r2s / n;
for(int i=0; i<n; ++i)
{
range_1_copies.insert(range_1_copies.end(), begin1, end1);
range_2_copies.insert(range_2_copies.end(), begin2, end2);
}
// for example for n=2, there's 'begin', 'mid', and 'end' but we leave out 'end' for convenience
std::array<std::array<It, n>, n> range_1_iterators;
std::array<std::array<It, n>, n> range_2_iterators;
for(int i=0; i<n; ++i)
{
for(int j=0; j<n; ++j)
{
range_1_iterators[i][j] = range_1_copies.begin() + i * r1s + j * r1_step;
range_2_iterators[i][j] = range_2_copies.begin() + i * r2s + j * r2_step;
}
}
tbb::task_group g;
for(int i=0; i<n; ++i)
{
for(int j=0; j<n; ++j)
{
// 'j' vs 'j+i', meaning for each value of 'i' we're matching r1[i] with a shifted version of r2[i]
int r1_endi, r1_endj;
int r2_endi, r2_endj;
if(i == (n-1))
{
if(j == (n-1)) // both very last range and very last iterator
{
r1_endi = -1;
r1_endj = -1;
}
else
{
r1_endi = i;
r1_endj = j+1;
}
}
else // i != (n-1)
{
if(j == (n-1)) // end of that range, but not of the full container
{
r1_endi = i+1;
r1_endj = 0;
}
else
{
r1_endi = i;
r1_endj = j+1;
}
}
if(i == (n-1))
{
if(j+i == (n-1)) // both very last range and very last iterator
{
r2_endi = -1;
r2_endj = -1;
}
else
{
r2_endi = i;
r2_endj = (j+i+1)%n;
}
}
else // i != (n-1)
{
if(j+i == (n-1)) // end of that range, but not of the full container
{
r2_endi = i+1;
r2_endj = 0;
}
else
{
r2_endi = i;
r2_endj = (j+i+1)%n;
}
}
It r1_start = range_1_iterators[i][j];
It r1_end = (r1_endi == -1) ? range_1_copies.end() : range_1_iterators[r1_endi][r1_endj];
It r2_start = range_2_iterators[i][(j+i)%n];
It r2_end = (r2_endi == -1) ? range_2_copies.end() : range_2_iterators[r2_endi][r2_endj];
CGAL_assertion(range_1_copies.begin() <= r1_start && r1_start <= r1_end && r1_end <= range_1_copies.end());
CGAL_assertion(range_2_copies.begin() <= r2_start && r2_start <= r2_end && r2_end <= range_2_copies.end());
// Specify "copy by value" otherwise the values of iterators for next (i,j) iterations
// become shared with different lambdas being run in parallel, and things go wrong
g.run([=]{ Box_intersection_d::segment_tree( r1_start, r1_end, r2_start, r2_end,
inf, sup, callback, traits, cutoff, dim, in_order); });
}
}
g.wait();
}
else
#endif // CGAL_LINKED_WITH_TBB
{
Box_intersection_d::segment_tree(begin1, end1, begin2, end2, inf, sup, callback, traits, cutoff, dim, in_order);
}
}
} // namespace internal
// Generic call with custom predicate traits parameter.
template< class ConcurrencyTag = Sequential_tag,
class RandomAccessIter1, class RandomAccessIter2,
class Callback, class BoxPredicateTraits >
void box_intersection_custom_predicates_d(
RandomAccessIter1 begin1, RandomAccessIter1 end1,
@ -40,23 +219,15 @@ void box_intersection_custom_predicates_d(
std::ptrdiff_t cutoff = 10,
Box_intersection_d::Setting setting = Box_intersection_d::BIPARTITE)
{
typedef BoxPredicateTraits Traits;
typedef typename Traits::NT NT;
CGAL_assertion( Traits::dimension() > 0 );
const int dim = Traits::dimension() - 1;
const NT inf = Box_intersection_d::box_limits<NT>::inf();
const NT sup = Box_intersection_d::box_limits<NT>::sup();
Box_intersection_d::segment_tree(begin1, end1, begin2, end2,
inf, sup, callback, traits, cutoff, dim, true);
if(setting == Box_intersection_d::BIPARTITE)
Box_intersection_d::segment_tree(begin2, end2, begin1, end1,
inf, sup, callback, traits, cutoff, dim, false);
internal::box_intersection_segment_tree_d<ConcurrencyTag>(begin1, end1, begin2, end2, callback, traits, cutoff, true);
if(setting == Box_intersection_d::BIPARTITE)
internal::box_intersection_segment_tree_d<ConcurrencyTag>(begin2, end2, begin1, end1, callback, traits, cutoff, false);
}
// Generic call with box traits parameter.
// - make all default parameters explicit overloads (workaround)
template< class RandomAccessIter1, class RandomAccessIter2,
template< class ConcurrencyTag = Sequential_tag,
class RandomAccessIter1, class RandomAccessIter2,
class Callback, class BoxTraits >
void box_intersection_d(
RandomAccessIter1 begin1, RandomAccessIter1 end1,
@ -67,18 +238,19 @@ void box_intersection_d(
Box_intersection_d::Topology topology,
Box_intersection_d::Setting setting)
{
if (topology == Box_intersection_d::CLOSED) {
typedef Box_intersection_d::Predicate_traits_d<BoxTraits,true> Traits;
box_intersection_custom_predicates_d(begin1, end1, begin2, end2,
callback, Traits(), cutoff, setting);
} else {
typedef Box_intersection_d::Predicate_traits_d<BoxTraits,false> Traits;
box_intersection_custom_predicates_d(begin1, end1, begin2, end2,
callback, Traits(), cutoff, setting);
}
if (topology == Box_intersection_d::CLOSED) {
typedef Box_intersection_d::Predicate_traits_d<BoxTraits,true> Traits;
box_intersection_custom_predicates_d<ConcurrencyTag>(begin1, end1, begin2, end2,
callback, Traits(), cutoff, setting);
} else {
typedef Box_intersection_d::Predicate_traits_d<BoxTraits,false> Traits;
box_intersection_custom_predicates_d<ConcurrencyTag>(begin1, end1, begin2, end2,
callback, Traits(), cutoff, setting);
}
}
template< class RandomAccessIter1, class RandomAccessIter2,
template< class ConcurrencyTag = Sequential_tag,
class RandomAccessIter1, class RandomAccessIter2,
class Callback, class BoxTraits >
void box_intersection_d(
RandomAccessIter1 begin1, RandomAccessIter1 end1,
@ -86,35 +258,39 @@ void box_intersection_d(
Callback callback, BoxTraits box_traits, std::ptrdiff_t cutoff,
Box_intersection_d::Topology topology)
{
box_intersection_d( begin1, end1, begin2, end2, callback, box_traits,
cutoff, topology, Box_intersection_d::BIPARTITE);
box_intersection_d<ConcurrencyTag>( begin1, end1, begin2, end2, callback, box_traits,
cutoff, topology, Box_intersection_d::BIPARTITE);
}
template< class RandomAccessIter1, class RandomAccessIter2,
template< class ConcurrencyTag = Sequential_tag,
class RandomAccessIter1, class RandomAccessIter2,
class Callback, class BoxTraits >
void box_intersection_d(
RandomAccessIter1 begin1, RandomAccessIter1 end1,
RandomAccessIter2 begin2, RandomAccessIter2 end2,
Callback callback, BoxTraits box_traits, std::ptrdiff_t cutoff)
{
box_intersection_d( begin1, end1, begin2, end2, callback, box_traits,
cutoff, Box_intersection_d::CLOSED,
Box_intersection_d::BIPARTITE);
box_intersection_d<ConcurrencyTag>( begin1, end1, begin2, end2, callback, box_traits,
cutoff, Box_intersection_d::CLOSED,
Box_intersection_d::BIPARTITE);
}
template< class RandomAccessIter1, class RandomAccessIter2,
template< class ConcurrencyTag = Sequential_tag,
class RandomAccessIter1, class RandomAccessIter2,
class Callback, class BoxTraits >
void box_intersection_d(
RandomAccessIter1 begin1, RandomAccessIter1 end1,
RandomAccessIter2 begin2, RandomAccessIter2 end2,
Callback callback, BoxTraits box_traits)
{
box_intersection_d( begin1, end1, begin2, end2, callback, box_traits,
10, Box_intersection_d::CLOSED,
Box_intersection_d::BIPARTITE);
box_intersection_d<ConcurrencyTag>( begin1, end1, begin2, end2, callback, box_traits,
10, Box_intersection_d::CLOSED,
Box_intersection_d::BIPARTITE);
}
// Specialized call with default box traits.
// - make all default parameters explicit overloads (workaround)
template< class RandomAccessIter1, class RandomAccessIter2, class Callback >
template< class ConcurrencyTag = Sequential_tag,
class RandomAccessIter1, class RandomAccessIter2, class Callback >
void box_intersection_d(
RandomAccessIter1 begin1, RandomAccessIter1 end1,
RandomAccessIter2 begin2, RandomAccessIter2 end2,
@ -122,53 +298,58 @@ void box_intersection_d(
Box_intersection_d::Topology topology,
Box_intersection_d::Setting setting)
{
typedef typename std::iterator_traits<RandomAccessIter1>::value_type val_t;
typedef Box_intersection_d::Box_traits_d< val_t> Box_traits;
box_intersection_d( begin1, end1, begin2, end2, callback, Box_traits(),
cutoff, topology, setting);
typedef typename std::iterator_traits<RandomAccessIter1>::value_type val_t;
typedef Box_intersection_d::Box_traits_d< val_t> Box_traits;
box_intersection_d<ConcurrencyTag>( begin1, end1, begin2, end2, callback, Box_traits(),
cutoff, topology, setting);
}
template< class RandomAccessIter1, class RandomAccessIter2, class Callback >
template< class ConcurrencyTag = Sequential_tag,
class RandomAccessIter1, class RandomAccessIter2, class Callback >
void box_intersection_d(
RandomAccessIter1 begin1, RandomAccessIter1 end1,
RandomAccessIter2 begin2, RandomAccessIter2 end2,
Callback callback, std::ptrdiff_t cutoff,
Box_intersection_d::Topology topology)
{
typedef typename std::iterator_traits<RandomAccessIter1>::value_type val_t;
typedef Box_intersection_d::Box_traits_d< val_t> Box_traits;
box_intersection_d( begin1, end1, begin2, end2, callback, Box_traits(),
cutoff, topology, Box_intersection_d::BIPARTITE);
typedef typename std::iterator_traits<RandomAccessIter1>::value_type val_t;
typedef Box_intersection_d::Box_traits_d< val_t> Box_traits;
box_intersection_d<ConcurrencyTag>( begin1, end1, begin2, end2, callback, Box_traits(),
cutoff, topology, Box_intersection_d::BIPARTITE);
}
template< class RandomAccessIter1, class RandomAccessIter2, class Callback >
template< class ConcurrencyTag = Sequential_tag,
class RandomAccessIter1, class RandomAccessIter2, class Callback >
void box_intersection_d(
RandomAccessIter1 begin1, RandomAccessIter1 end1,
RandomAccessIter2 begin2, RandomAccessIter2 end2,
Callback callback, std::ptrdiff_t cutoff)
{
typedef typename std::iterator_traits<RandomAccessIter1>::value_type val_t;
typedef Box_intersection_d::Box_traits_d< val_t> Box_traits;
box_intersection_d( begin1, end1, begin2, end2, callback, Box_traits(),
cutoff, Box_intersection_d::CLOSED,
Box_intersection_d::BIPARTITE);
typedef typename std::iterator_traits<RandomAccessIter1>::value_type val_t;
typedef Box_intersection_d::Box_traits_d< val_t> Box_traits;
box_intersection_d<ConcurrencyTag>( begin1, end1, begin2, end2, callback, Box_traits(),
cutoff, Box_intersection_d::CLOSED,
Box_intersection_d::BIPARTITE);
}
template< class RandomAccessIter1, class RandomAccessIter2, class Callback >
template< class ConcurrencyTag = Sequential_tag,
class RandomAccessIter1, class RandomAccessIter2, class Callback >
void box_intersection_d(
RandomAccessIter1 begin1, RandomAccessIter1 end1,
RandomAccessIter2 begin2, RandomAccessIter2 end2,
Callback callback)
{
typedef typename std::iterator_traits<RandomAccessIter1>::value_type val_t;
typedef Box_intersection_d::Box_traits_d< val_t> Box_traits;
box_intersection_d( begin1, end1, begin2, end2, callback, Box_traits(),
10, Box_intersection_d::CLOSED,
Box_intersection_d::BIPARTITE);
typedef typename std::iterator_traits<RandomAccessIter1>::value_type val_t;
typedef Box_intersection_d::Box_traits_d< val_t> Box_traits;
box_intersection_d<ConcurrencyTag>( begin1, end1, begin2, end2, callback, Box_traits(),
10, Box_intersection_d::CLOSED,
Box_intersection_d::BIPARTITE);
}
// Generic call with box traits parameter, specialized for self-intersection.
// - make all default parameters explicit overloads (workaround)
template< class RandomAccessIter, class Callback, class BoxTraits >
template< class ConcurrencyTag = Sequential_tag,
class RandomAccessIter, class Callback, class BoxTraits >
void box_self_intersection_d(
RandomAccessIter begin, RandomAccessIter end,
Callback callback,
@ -176,49 +357,52 @@ void box_self_intersection_d(
std::ptrdiff_t cutoff,
Box_intersection_d::Topology topology)
{
// Copying rather than calling 'box_intersection_d(begin, end, begin, end, ...'
// is necessary because the 'std::partition' and range splits on the first range
// would be messed up by sorts on the second range otherwise.
typedef typename std::iterator_traits<RandomAccessIter>::value_type val_t;
std::vector< val_t> i( begin, end);
box_intersection_d( begin, end, i.begin(), i.end(),
callback, box_traits, cutoff, topology,
Box_intersection_d::COMPLETE);
// Copying rather than calling 'box_intersection_d(begin, end, begin, end, ...'
// is necessary because the 'std::partition' and range splits on the first range
// would be messed up by sorts on the second range otherwise.
typedef typename std::iterator_traits<RandomAccessIter>::value_type val_t;
std::vector< val_t> i( begin, end);
box_intersection_d<ConcurrencyTag>( begin, end, i.begin(), i.end(),
callback, box_traits, cutoff, topology,
Box_intersection_d::COMPLETE);
}
template< class RandomAccessIter, class Callback, class BoxTraits >
template< class ConcurrencyTag = Sequential_tag,
class RandomAccessIter, class Callback, class BoxTraits >
void box_self_intersection_d(
RandomAccessIter begin, RandomAccessIter end,
Callback callback,
BoxTraits box_traits,
std::ptrdiff_t cutoff)
{
return box_self_intersection_d(begin, end, callback, box_traits, cutoff,
Box_intersection_d::CLOSED);
return box_self_intersection_d<ConcurrencyTag>(begin, end, callback, box_traits, cutoff,
Box_intersection_d::CLOSED);
}
template< class RandomAccessIter, class Callback, class BoxTraits >
template< class ConcurrencyTag = Sequential_tag,
class RandomAccessIter, class Callback, class BoxTraits >
void box_self_intersection_d(
RandomAccessIter begin, RandomAccessIter end,
Callback callback,
BoxTraits box_traits)
{
return box_self_intersection_d(begin, end, callback, box_traits, 10);
return box_self_intersection_d<ConcurrencyTag>(begin, end, callback, box_traits, 10);
}
// Specialized call with default box traits, specialized for self-intersection.
// - make all default parameters explicit overloads (workaround)
template< class RandomAccessIter, class Callback >
template< class ConcurrencyTag = Sequential_tag, class RandomAccessIter, class Callback >
void box_self_intersection_d(
RandomAccessIter begin, RandomAccessIter end,
Callback callback)
{
typedef typename std::iterator_traits<RandomAccessIter>::value_type val_t;
typedef Box_intersection_d::Box_traits_d< val_t> Box_traits;
box_self_intersection_d(begin, end, callback, Box_traits());
box_self_intersection_d<ConcurrencyTag>(begin, end, callback, Box_traits());
}
template< class RandomAccessIter, class Callback >
template< class ConcurrencyTag = Sequential_tag, class RandomAccessIter, class Callback >
void box_self_intersection_d(
RandomAccessIter begin, RandomAccessIter end,
Callback callback,
@ -226,10 +410,10 @@ void box_self_intersection_d(
{
typedef typename std::iterator_traits<RandomAccessIter>::value_type val_t;
typedef Box_intersection_d::Box_traits_d< val_t> Box_traits;
box_self_intersection_d(begin, end, callback, Box_traits(), cutoff);
box_self_intersection_d<ConcurrencyTag>(begin, end, callback, Box_traits(), cutoff);
}
template< class RandomAccessIter, class Callback >
template< class ConcurrencyTag = Sequential_tag, class RandomAccessIter, class Callback >
void box_self_intersection_d(
RandomAccessIter begin, RandomAccessIter end,
Callback callback,
@ -238,28 +422,27 @@ void box_self_intersection_d(
{
typedef typename std::iterator_traits<RandomAccessIter>::value_type val_t;
typedef Box_intersection_d::Box_traits_d< val_t> Box_traits;
box_self_intersection_d(begin, end, callback,
Box_traits(), cutoff, topology );
box_self_intersection_d<ConcurrencyTag>(begin, end, callback,
Box_traits(), cutoff, topology );
}
// Generic call for trivial all-pairs algorithm with box traits parameter.
// - make all default parameters explicit overloads (workaround)
template< class ForwardIter1, class ForwardIter2,
class Callback, class BoxTraits >
void box_intersection_all_pairs_d(
void box_intersection_all_pairs_d(
ForwardIter1 begin1, ForwardIter1 end1,
ForwardIter2 begin2, ForwardIter2 end2,
Callback callback, BoxTraits)
{
typedef Box_intersection_d::Predicate_traits_d<BoxTraits,true> Traits;
Box_intersection_d::all_pairs( begin1, end1, begin2, end2,
Box_intersection_d::all_pairs( begin1, end1, begin2, end2,
callback, Traits());
}
template< class ForwardIter1, class ForwardIter2,
class Callback, class BoxTraits >
void box_intersection_all_pairs_d(
void box_intersection_all_pairs_d(
ForwardIter1 begin1, ForwardIter1 end1,
ForwardIter2 begin2, ForwardIter2 end2,
Callback callback, BoxTraits,
@ -269,18 +452,18 @@ void box_intersection_all_pairs_d(
bool complete_case = (setting != Box_intersection_d::BIPARTITE);
if (topology == Box_intersection_d::CLOSED) {
typedef Box_intersection_d::Predicate_traits_d<BoxTraits,true> Traits;
Box_intersection_d::all_pairs( begin1, end1, begin2, end2,
Box_intersection_d::all_pairs( begin1, end1, begin2, end2,
callback, Traits(), complete_case);
} else {
typedef Box_intersection_d::Predicate_traits_d<BoxTraits,false> Traits;
Box_intersection_d::all_pairs( begin1, end1, begin2, end2,
Box_intersection_d::all_pairs( begin1, end1, begin2, end2,
callback, Traits(), complete_case);
}
}
template< class ForwardIter1, class ForwardIter2,
class Callback, class BoxTraits >
void box_intersection_all_pairs_d(
void box_intersection_all_pairs_d(
ForwardIter1 begin1, ForwardIter1 end1,
ForwardIter2 begin2, ForwardIter2 end2,
Callback callback, BoxTraits traits,
@ -293,20 +476,20 @@ void box_intersection_all_pairs_d(
// Specialized call for trivial all-pairs algorithm with default box traits.
// - make all default parameters explicit overloads (workaround)
template< class ForwardIter1, class ForwardIter2, class Callback >
void box_intersection_all_pairs_d(
void box_intersection_all_pairs_d(
ForwardIter1 begin1, ForwardIter1 end1,
ForwardIter2 begin2, ForwardIter2 end2,
Callback callback)
{
typedef typename std::iterator_traits<ForwardIter1>::value_type val_t;
typedef Box_intersection_d::Box_traits_d< val_t> Box_traits;
box_intersection_all_pairs_d( begin1, end1, begin2, end2,
callback, Box_traits(),
Box_intersection_d::CLOSED );
box_intersection_all_pairs_d( begin1, end1, begin2, end2,
callback, Box_traits(),
Box_intersection_d::CLOSED );
}
template< class ForwardIter1, class ForwardIter2, class Callback >
void box_intersection_all_pairs_d(
void box_intersection_all_pairs_d(
ForwardIter1 begin1, ForwardIter1 end1,
ForwardIter2 begin2, ForwardIter2 end2,
Callback callback,
@ -314,12 +497,12 @@ void box_intersection_all_pairs_d(
{
typedef typename std::iterator_traits<ForwardIter1>::value_type val_t;
typedef Box_intersection_d::Box_traits_d< val_t> Box_traits;
box_intersection_all_pairs_d( begin1, end1, begin2, end2,
box_intersection_all_pairs_d( begin1, end1, begin2, end2,
callback, Box_traits(), topology);
}
template< class ForwardIter1, class ForwardIter2, class Callback >
void box_intersection_all_pairs_d(
void box_intersection_all_pairs_d(
ForwardIter1 begin1, ForwardIter1 end1,
ForwardIter2 begin2, ForwardIter2 end2,
Callback callback,
@ -328,7 +511,7 @@ void box_intersection_all_pairs_d(
{
typedef typename std::iterator_traits<ForwardIter1>::value_type val_t;
typedef Box_intersection_d::Box_traits_d< val_t> Box_traits;
box_intersection_all_pairs_d( begin1, end1, begin2, end2,
box_intersection_all_pairs_d( begin1, end1, begin2, end2,
callback, Box_traits(), topology, setting);
}
@ -336,7 +519,7 @@ void box_intersection_all_pairs_d(
// specialized for self-intersection test.
// - make all default parameters explicit overloads (workaround)
template< class ForwardIter, class Callback, class BoxTraits >
void box_self_intersection_all_pairs_d(
void box_self_intersection_all_pairs_d(
ForwardIter begin1, ForwardIter end1, Callback callback, BoxTraits /* traits */)
{
typedef Box_intersection_d::Predicate_traits_d<BoxTraits,true> Traits;
@ -344,7 +527,7 @@ void box_self_intersection_all_pairs_d(
}
template< class ForwardIter, class Callback, class BoxTraits >
void box_self_intersection_all_pairs_d(
void box_self_intersection_all_pairs_d(
ForwardIter begin1, ForwardIter end1, Callback callback, BoxTraits,
Box_intersection_d::Topology topology)
{
@ -361,17 +544,17 @@ void box_self_intersection_all_pairs_d(
// specialized for self-intersection test.
// - make all default parameters explicit overloads (workaround)
template< class ForwardIter, class Callback >
void box_self_intersection_all_pairs_d(
void box_self_intersection_all_pairs_d(
ForwardIter begin1, ForwardIter end1, Callback callback)
{
typedef typename std::iterator_traits<ForwardIter>::value_type val_t;
typedef Box_intersection_d::Box_traits_d< val_t> Box_traits;
box_self_intersection_all_pairs_d( begin1, end1, callback, Box_traits(),
Box_intersection_d::CLOSED );
box_self_intersection_all_pairs_d( begin1, end1, callback, Box_traits(),
Box_intersection_d::CLOSED );
}
template< class ForwardIter, class Callback >
void box_self_intersection_all_pairs_d(
void box_self_intersection_all_pairs_d(
ForwardIter begin1, ForwardIter end1, Callback callback,
Box_intersection_d::Topology topology)
{

View File

@ -5,20 +5,23 @@
cmake_minimum_required(VERSION 3.1...3.15)
project( Box_intersection_d_Tests )
find_package( CGAL QUIET )
find_package(CGAL QUIET)
find_package( TBB )
if ( CGAL_FOUND )
# create a target per cppfile
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
foreach(cppfile ${cppfiles})
create_single_source_cgal_program( "${cppfile}" )
endforeach()
create_single_source_cgal_program( "automated_test.cpp" )
create_single_source_cgal_program( "benchmark_box_intersection.cpp" )
create_single_source_cgal_program( "random_set_test.cpp" )
create_single_source_cgal_program( "test_box_grid.cpp" )
if( TBB_FOUND )
CGAL_target_use_TBB( test_box_grid )
else()
message( STATUS "NOTICE: Intel TBB was not found. Sequential code will be used." )
endif()
else()
message(STATUS "This program requires the CGAL library, and will not be compiled.")
endif()

View File

@ -1,217 +1,297 @@
// file: test/Box_intersection_d/box_grid.C
// similar to examples/Box_intersection_d/box_grid.C but stricter in checking
// and more extensive in what is tested.
#include <CGAL/box_intersection_d.h>
#include <cassert>
#include <vector>
#include <algorithm>
#include <iterator>
typedef CGAL::Box_intersection_d::Box_d<int,2> Box;
#include <CGAL/box_intersection_d.h>
#include <CGAL/tags.h>
#include <algorithm>
#include <cassert>
#include <iterator>
#include <vector>
#ifdef CGAL_LINKED_WITH_TBB
#include <tbb/concurrent_vector.h>
#endif
typedef CGAL::Box_intersection_d::Box_d<int, 2> Box;
// coordinates for 9 boxes of a grid
int p[9*4] = { 0,0,1,1, 1,0,2,1, 2,0,3,1, // lower
0,1,1,2, 1,1,2,2, 2,1,3,2, // middle
0,2,1,3, 1,2,2,3, 2,2,3,3};// upper
// 9 boxes + 2 selected boxes as query; center and upper right
Box init_boxes[11] = { Box( p, p+ 2), Box( p+ 4, p+ 6), Box( p+ 8, p+10),
Box( p+12, p+14), Box( p+16, p+18), Box( p+20, p+22),
Box( p+24, p+26), Box( p+28, p+30), Box( p+32, p+34),
Box( p+16, p+18), Box( p+32, p+34)};
const Box init_boxes[11] = { Box( p, p+ 2), Box( p+ 4, p+ 6), Box( p+ 8, p+10),
Box( p+12, p+14), Box( p+16, p+18), Box( p+20, p+22),
Box( p+24, p+26), Box( p+28, p+30), Box( p+32, p+34),
Box( p+16, p+18), Box( p+32, p+34)};
Box boxes[11];
Box* query = boxes+9;
void init() {
for ( int i = 0; i < 11; ++i)
boxes[i] = init_boxes[i];
void init()
{
for ( int i = 0; i < 11; ++i)
boxes[i] = init_boxes[i];
}
void check_result( const char* text, std::vector<std::size_t>& result,
const std::size_t* check, std::size_t size) {
// sort, show, and check result
std::sort( result.begin(), result.end());
std::cout << text << ": got " << result.size() << " elements, expected "
<< size << " elements\n got : ";
std::copy( result.begin(), result.end(),
std::ostream_iterator<std::size_t>( std::cout, ","));
std::cout << "\n expected: ";
std::copy( check, check+size,
std::ostream_iterator<std::size_t>( std::cout, ","));
std::cout << '\n' << std::endl;
assert( result.size() == size
&& std::equal( check, check+size, result.begin()));
template <typename Vector>
void check_result( const char* text,
Vector& result,
const std::size_t* check,
std::size_t size)
{
// sort, show, and check result
std::sort( result.begin(), result.end());
std::cout << text << ": got " << result.size() << " elements, expected "
<< size << " elements\n got : ";
std::copy( result.begin(), result.end(),
std::ostream_iterator<std::size_t>( std::cout, ","));
std::cout << "\n expected: ";
std::copy( check, check+size,
std::ostream_iterator<std::size_t>( std::cout, ","));
std::cout << '\n' << std::endl;
assert( result.size() == size
&& std::equal( check, check+size, result.begin()));
}
// callback function object writing results to an output iterator
template <class OutputIterator>
struct Report {
OutputIterator it;
Report( OutputIterator i) : it(i) {} // store iterator in object
// We encode both id-numbers in a single number, a.id() + 100 * b.id(),
// and write that number to the output iterator.
void operator()( const Box& a, const Box& b) { *it++ = a.id()+100*b.id(); }
template <class Container>
struct Report
{
Container& c_;
Report(Container& c) : c_(c) {} // store iterator in object
// We encode both id-numbers in a single number, a.id() + 100 * b.id(),
// and write that number to the output iterator.
void operator()(const Box& a, const Box& b) { c_.push_back(a.id()+100*b.id()); }
void operator()(const Box* a, const Box* b) { c_.push_back(a->id()+100*b->id()); }
};
template <class Iter> // helper function to create the function object
Report<Iter> report( Iter it) { return Report<Iter>(it); }
template <class Container> // helper function to create the function object
Report<Container> report(Container& c) { return Report<Container>(c); }
// ---------------------------------------------------------------------
// box_intersection_d
// run the intersection algorithms and store results in a vector
// ---------------------------------------------------------------------
void test_box_intersection() {
// intersect 3x3 with 2 query boxes, closed boxes
init();
std::vector<std::size_t> result;
CGAL::box_intersection_d( boxes, boxes+9, query, query+2,
report( std::back_inserter( result)));
std::size_t check1[13] = {900,901,902,903,904,905,906,907,908,
1004,1005,1007,1008};
check_result( "Box inters. 3x3, 2, closed", result, check1, 13);
void test_box_intersection()
{
#ifdef CGAL_LINKED_WITH_TBB
tbb::concurrent_vector<std::size_t> result;
#else
std::vector<std::size_t> result;
#endif
// intersect 3x3 with 2 query boxes, half-open boxes and changed cutoff
init();
result.clear();
CGAL::box_intersection_d( boxes, boxes+9, query, query+2,
report( std::back_inserter( result)),
std::ptrdiff_t(1),
CGAL::Box_intersection_d::HALF_OPEN);
std::size_t check2[2] = {904,1008};
check_result( "Box inters. 3x3, 2, half-open", result, check2, 2);
// Some degenerate cases
init();
CGAL::box_intersection_d<CGAL::Parallel_if_available_tag>(boxes, boxes, boxes, boxes,
report(result));
assert(result.empty());
// self intersect 3x2, closed boxes
init();
result.clear();
CGAL::box_self_intersection_d( boxes, boxes+6,
report( std::back_inserter( result)));
std::size_t check3[11] = {1,3,4,102,103,104,105,204,205,304,405};
check_result( "Box self inters. 3x2, closed", result, check3, 11);
init();
CGAL::box_intersection_d<CGAL::Parallel_if_available_tag>(boxes, boxes, query, query + 1,
report(result));
assert(result.empty());
// self intersect 3x2, half-open boxes
init();
result.clear();
CGAL::box_self_intersection_d( boxes, boxes+6,
report( std::back_inserter( result)),
std::ptrdiff_t(1),
CGAL::Box_intersection_d::HALF_OPEN);
std::size_t check4[1] = {9999};
check_result( "Box self inters. 3x2, half-open", result, check4, 0);
init();
CGAL::box_intersection_d<CGAL::Parallel_if_available_tag>(boxes, boxes + 3, query, query,
report(result));
assert(result.empty());
// self intersect 3x3+2 query boxes, half-open boxes
init();
result.clear();
CGAL::box_self_intersection_d( boxes, boxes+11,
report( std::back_inserter( result)),
std::ptrdiff_t(1),
CGAL::Box_intersection_d::HALF_OPEN);
std::size_t check5[2] = {409,810};
check_result( "Box self inters. 3x3+2, half-open", result, check5, 2);
// With pointers
init();
std::vector<const Box*> range_1 = {{ boxes, boxes+1, boxes+2, boxes+3, boxes+4, boxes+5,
boxes+6, boxes+7, boxes+8 }};
std::vector<const Box*> range_2 = {{ query, query+1 }};
// self intersect 3x3+2 query boxes, half-open boxes, full function interf.
// tests also mixed types for the two iterator ranges
init();
result.clear();
std::vector<Box> boxes2( boxes, boxes+11);
CGAL::box_intersection_d( boxes, boxes+11, boxes2.begin(), boxes2.end(),
report( std::back_inserter( result)),
std::ptrdiff_t(1),
CGAL::Box_intersection_d::HALF_OPEN,
CGAL::Box_intersection_d::COMPLETE);
check_result( "Box inters. 3x3+2, half-open", result, check5, 2);
// compare this with the bipartite case
// self intersect 3x3+2 query boxes, half-open boxes
// tests also mixed types for the two iterator ranges
init();
result.clear();
boxes2 = std::vector<Box>( boxes, boxes+11);
CGAL::box_intersection_d( boxes, boxes+11, boxes2.begin(), boxes2.end(),
report( std::back_inserter( result)),
std::ptrdiff_t(20),
CGAL::Box_intersection_d::HALF_OPEN,
CGAL::Box_intersection_d::BIPARTITE);
std::size_t check6[4] = {409,810,904,1008};
check_result( "Box inters. 3x3+2, half-open", result, check6, 4);
CGAL::box_intersection_d<CGAL::Parallel_if_available_tag>(range_1.begin(), range_1.begin(),
range_2.begin(), range_2.end(),
report(result));
assert(result.empty());
CGAL::box_intersection_d<CGAL::Parallel_if_available_tag>(range_1.begin(), range_1.end(),
range_2.begin(), range_2.begin(),
report(result));
assert(result.empty());
CGAL::box_intersection_d<CGAL::Parallel_if_available_tag>(range_1.begin(), range_1.end(),
range_2.begin(), range_2.end(),
report(result));
std::size_t check0[13] = {900,901,902,903,904,905,906,907,908,
1004,1005,1007,1008};
check_result( "Box inters. 3x3 (ptr), 2, closed", result, check0, 13);
// intersect 3x3 with 2 query boxes, closed boxes
init();
result.clear();
CGAL::box_intersection_d<CGAL::Parallel_if_available_tag>(boxes, boxes+9, query, query+1, report(result));
std::size_t check1[13] = {900,901,902,903,904,905,906,907,908};
check_result( "Box inters. 3x3, 2, closed", result, check1, 9);
// intersect 3x3 with 2 query boxes, closed boxes
init();
result.clear();
CGAL::box_intersection_d<CGAL::Parallel_if_available_tag>(boxes, boxes+9, query, query+2, report(result));
std::size_t check1bis[13] = {900,901,902,903,904,905,906,907,908,
1004,1005,1007,1008};
check_result( "Box inters. 3x3, 2, closed", result, check1bis, 13);
// intersect 3x3 with 2 query boxes, half-open boxes and changed cutoff
init();
result.clear();
CGAL::box_intersection_d( boxes, boxes+9, query, query+2,
report(result),
std::ptrdiff_t(1),
CGAL::Box_intersection_d::HALF_OPEN);
std::size_t check2[2] = {904,1008};
check_result( "Box inters. 3x3, 2, half-open", result, check2, 2);
// intersect 3x3 with 2 query boxes, half-open boxes and changed cutoff (reversed)
init();
result.clear();
CGAL::box_intersection_d<CGAL::Parallel_if_available_tag>( query, query+2, boxes, boxes+9,
report(result),
std::ptrdiff_t(1),
CGAL::Box_intersection_d::HALF_OPEN);
std::size_t check2bis[2] = {409,810};
check_result( "Box inters. 3x3 (reversed), 2, half-open", result, check2bis, 2);
// self intersect 3x2, closed boxes
init();
result.clear();
CGAL::box_self_intersection_d( boxes, boxes+6,
report(result));
std::size_t check3[11] = {1,3,4,102,103,104,105,204,205,304,405};
check_result( "Box self inters. 3x2, closed", result, check3, 11);
// self intersect 3x2, half-open boxes
init();
result.clear();
CGAL::box_self_intersection_d( boxes, boxes+6,
report(result),
std::ptrdiff_t(1),
CGAL::Box_intersection_d::HALF_OPEN);
std::size_t check4[1] = {9999};
check_result( "Box self inters. 3x2, half-open", result, check4, 0);
// self intersect 3x3+2 query boxes, half-open boxes
init();
result.clear();
CGAL::box_self_intersection_d( boxes, boxes+11,
report(result),
std::ptrdiff_t(1),
CGAL::Box_intersection_d::HALF_OPEN);
std::size_t check5[2] = {409,810};
check_result( "Box self inters. 3x3+2, half-open", result, check5, 2);
// self intersect 3x3+2 query boxes, half-open boxes, full function interf.
// tests also mixed types for the two iterator ranges
init();
result.clear();
std::vector<Box> boxes2( boxes, boxes+11);
CGAL::box_intersection_d( boxes, boxes+11, boxes2.begin(), boxes2.end(),
report(result),
std::ptrdiff_t(1),
CGAL::Box_intersection_d::HALF_OPEN,
CGAL::Box_intersection_d::COMPLETE);
check_result( "Box inters. 3x3+2, half-open", result, check5, 2);
// compare this with the bipartite case
// self intersect 3x3+2 query boxes, half-open boxes
// tests also mixed types for the two iterator ranges
init();
result.clear();
boxes2 = std::vector<Box>( boxes, boxes+11);
CGAL::box_intersection_d( boxes, boxes+11, boxes2.begin(), boxes2.end(),
report(result),
std::ptrdiff_t(20),
CGAL::Box_intersection_d::HALF_OPEN,
CGAL::Box_intersection_d::BIPARTITE);
std::size_t check6[4] = {409,810,904,1008};
check_result( "Box inters. 3x3+2, half-open", result, check6, 4);
}
// ---------------------------------------------------------------------
// box_intersection_all_pairs_d
// run the intersection algorithms and store results in a vector
// ---------------------------------------------------------------------
void test_box_intersection_all_pairs() {
// intersect 3x3 with 2 query boxes, closed boxes
init();
std::vector<std::size_t> result;
CGAL::box_intersection_all_pairs_d( boxes, boxes+9, query, query+2,
report( std::back_inserter( result)));
std::size_t check1[13] = {900,901,902,903,904,905,906,907,908,
1004,1005,1007,1008};
check_result( "All-pairs inters. 3x3, 2, closed", result, check1, 13);
void test_box_intersection_all_pairs()
{
// intersect 3x3 with 2 query boxes, closed boxes
init();
std::vector<std::size_t> result;
CGAL::box_intersection_all_pairs_d( boxes, boxes+9, query, query+2,
report(result));
std::size_t check1[13] = {900,901,902,903,904,905,906,907,908,
1004,1005,1007,1008};
check_result( "All-pairs inters. 3x3, 2, closed", result, check1, 13);
// intersect 3x3 with 2 query boxes, half-open boxes
init();
result.clear();
CGAL::box_intersection_all_pairs_d( boxes, boxes+9, query, query+2,
report( std::back_inserter( result)),
CGAL::Box_intersection_d::HALF_OPEN);
std::size_t check2[2] = {904,1008};
check_result( "All-pairs inters. 3x3, 2, half-open", result, check2, 2);
// intersect 3x3 with 2 query boxes, half-open boxes
init();
result.clear();
CGAL::box_intersection_all_pairs_d( boxes, boxes+9, query, query+2,
report(result),
CGAL::Box_intersection_d::HALF_OPEN);
std::size_t check2[2] = {904,1008};
check_result( "All-pairs inters. 3x3, 2, half-open", result, check2, 2);
// self intersect 3x2, closed boxes
init();
result.clear();
CGAL::box_self_intersection_all_pairs_d( boxes, boxes+6,
report( std::back_inserter( result)));
std::size_t check3[11] = {100,201,300,301,400,401,402,403,501,502,504};
check_result( "All-pairs self inters. 3x2, closed", result, check3, 11);
// self intersect 3x2, closed boxes
init();
result.clear();
CGAL::box_self_intersection_all_pairs_d( boxes, boxes+6,
report(result));
std::size_t check3[11] = {100,201,300,301,400,401,402,403,501,502,504};
check_result( "All-pairs self inters. 3x2, closed", result, check3, 11);
// self intersect 3x2, half-open boxes
init();
result.clear();
CGAL::box_self_intersection_all_pairs_d( boxes, boxes+6,
report( std::back_inserter( result)),
CGAL::Box_intersection_d::HALF_OPEN);
std::size_t check4[1] = {9999};
check_result( "All-pairs self inters. 3x2, half-open", result, check4, 0);
// self intersect 3x2, half-open boxes
init();
result.clear();
CGAL::box_self_intersection_all_pairs_d( boxes, boxes+6,
report(result),
CGAL::Box_intersection_d::HALF_OPEN);
std::size_t check4[1] = {9999};
check_result( "All-pairs self inters. 3x2, half-open", result, check4, 0);
// self intersect 3x3+2 query boxes, half-open boxes
init();
result.clear();
CGAL::box_self_intersection_all_pairs_d( boxes, boxes+11,
report( std::back_inserter( result)),
CGAL::Box_intersection_d::HALF_OPEN);
std::size_t check5[2] = {904,1008};
check_result( "All-pairs self inters. 3x3+2, half-open", result, check5,2);
// self intersect 3x3+2 query boxes, half-open boxes
init();
result.clear();
CGAL::box_self_intersection_all_pairs_d( boxes, boxes+11,
report(result),
CGAL::Box_intersection_d::HALF_OPEN);
std::size_t check5[2] = {904,1008};
check_result( "All-pairs self inters. 3x3+2, half-open", result, check5,2);
// self intersect 3x3+2 query boxes, half-open boxes, full function interf.
// tests also mixed types for the two iterator ranges
init();
result.clear();
std::vector<Box> boxes2( boxes, boxes+11);
CGAL::box_intersection_all_pairs_d( boxes, boxes+11,
boxes2.begin(), boxes2.end(),
report( std::back_inserter( result)),
CGAL::Box_intersection_d::HALF_OPEN,
CGAL::Box_intersection_d::COMPLETE);
check_result( "All-pairs self inters. 3x3+2, half-open", result, check5,2);
// compare this with the bipartite case
// self intersect 3x3+2 query boxes, half-open boxes
// tests also mixed types for the two iterator ranges
init();
result.clear();
boxes2 = std::vector<Box>( boxes, boxes+11);
CGAL::box_intersection_all_pairs_d( boxes, boxes+11,
boxes2.begin(), boxes2.end(),
report( std::back_inserter( result)),
CGAL::Box_intersection_d::HALF_OPEN,
CGAL::Box_intersection_d::BIPARTITE);
std::size_t check6[4] = {409,810,904,1008};
check_result( "All-pairs inters. 3x3+2, half-open", result, check6, 4);
// self intersect 3x3+2 query boxes, half-open boxes, full function interf.
// tests also mixed types for the two iterator ranges
init();
result.clear();
std::vector<Box> boxes2( boxes, boxes+11);
CGAL::box_intersection_all_pairs_d( boxes, boxes+11,
boxes2.begin(), boxes2.end(),
report(result),
CGAL::Box_intersection_d::HALF_OPEN,
CGAL::Box_intersection_d::COMPLETE);
check_result( "All-pairs self inters. 3x3+2, half-open", result, check5,2);
// compare this with the bipartite case
// self intersect 3x3+2 query boxes, half-open boxes
// tests also mixed types for the two iterator ranges
init();
result.clear();
boxes2 = std::vector<Box>( boxes, boxes+11);
CGAL::box_intersection_all_pairs_d( boxes, boxes+11,
boxes2.begin(), boxes2.end(),
report(result),
CGAL::Box_intersection_d::HALF_OPEN,
CGAL::Box_intersection_d::BIPARTITE);
std::size_t check6[4] = {409,810,904,1008};
check_result( "All-pairs inters. 3x3+2, half-open", result, check6, 4);
}
int main()
{
test_box_intersection();
test_box_intersection_all_pairs();
int main() {
test_box_intersection();
test_box_intersection_all_pairs();
return 0;
return EXIT_SUCCESS;
}

View File

@ -11,16 +11,12 @@
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Classification.h>
#include <CGAL/bounding_box.h>
#include <CGAL/tags.h>
#include <CGAL/IO/read_ply_points.h>
#include <CGAL/Real_timer.h>
#ifdef CGAL_LINKED_WITH_TBB
typedef CGAL::Parallel_tag Concurrency_tag;
#else
typedef CGAL::Sequential_tag Concurrency_tag;
#endif
typedef CGAL::Parallel_if_available_tag Concurrency_tag;
typedef CGAL::Simple_cartesian<double> Kernel;
typedef Kernel::Point_3 Point;

View File

@ -18,11 +18,7 @@
#include <CGAL/Shape_detection/Region_growing.h>
#include <CGAL/Real_timer.h>
#ifdef CGAL_LINKED_WITH_TBB
typedef CGAL::Parallel_tag Concurrency_tag;
#else
typedef CGAL::Sequential_tag Concurrency_tag;
#endif
typedef CGAL::Parallel_if_available_tag Concurrency_tag;
typedef CGAL::Simple_cartesian<double> Kernel;
typedef Kernel::Point_3 Point;

View File

@ -127,11 +127,7 @@ public:
std::size_t num_trees = 25,
std::size_t max_depth = 20)
{
#ifdef CGAL_LINKED_WITH_TBB
train<CGAL::Parallel_tag>(ground_truth, reset_trees, num_trees, max_depth);
#else
train<CGAL::Sequential_tag>(ground_truth, reset_trees, num_trees, max_depth);
#endif
train<CGAL::Parallel_if_available_tag>(ground_truth, reset_trees, num_trees, max_depth);
}
/// \endcond
@ -146,7 +142,7 @@ public:
label.
\tparam ConcurrencyTag enables sequential versus parallel
algorithm. Possible values are `Parallel_tag` (default value is
algorithm. Possible values are `Parallel_tag` (default value if
%CGAL is linked with TBB) or `Sequential_tag` (default value
otherwise).

View File

@ -38,7 +38,7 @@
#include <tbb/parallel_for.h>
#include <tbb/blocked_range.h>
#include <tbb/scalable_allocator.h>
#include <tbb/mutex.h>
#include <mutex>
#endif // CGAL_LINKED_WITH_TBB

View File

@ -19,7 +19,7 @@
#include <boost/make_shared.hpp>
#ifdef CGAL_LINKED_WITH_TBB
#include <tbb/mutex.h>
#include <mutex>
#include <tbb/task_group.h>
#endif // CGAL_LINKED_WITH_TBB

View File

@ -34,7 +34,8 @@
#include <tbb/parallel_for.h>
#include <tbb/blocked_range.h>
#include <tbb/scalable_allocator.h>
#include <tbb/mutex.h>
#include <mutex>
#endif // CGAL_LINKED_WITH_TBB
namespace CGAL {
@ -69,7 +70,7 @@ private:
PointMap m_point_map;
const NeighborQuery& m_neighbor_query;
float& m_mean_range;
tbb::mutex& m_mutex;
std::mutex& m_mutex;
public:
@ -78,7 +79,7 @@ private:
PointMap point_map,
const NeighborQuery& neighbor_query,
float& mean_range,
tbb::mutex& mutex)
std::mutex& mutex)
: m_eigen (eigen), m_input (input), m_point_map (point_map),
m_neighbor_query (neighbor_query), m_mean_range (mean_range), m_mutex (mutex)
{ }
@ -120,7 +121,7 @@ private:
const FaceListGraph& m_input;
const NeighborQuery& m_neighbor_query;
float& m_mean_range;
tbb::mutex& m_mutex;
std::mutex& m_mutex;
public:
@ -128,7 +129,7 @@ private:
const FaceListGraph& input,
const NeighborQuery& neighbor_query,
float& mean_range,
tbb::mutex& mutex)
std::mutex& mutex)
: m_eigen (eigen), m_input (input),
m_neighbor_query (neighbor_query), m_mean_range (mean_range), m_mutex (mutex)
{ }
@ -225,7 +226,7 @@ public:
is `CGAL::Point_3`.
\tparam NeighborQuery model of `NeighborQuery`
\tparam ConcurrencyTag enables sequential versus parallel
algorithm. Possible values are `Parallel_tag` (default value is %CGAL
algorithm. Possible values are `Parallel_tag` (default value if %CGAL
is linked with TBB) or `Sequential_tag` (default value otherwise).
\tparam DiagonalizeTraits model of `DiagonalizeTraits` used for
matrix diagonalization. It can be omitted if Eigen 3 (or greater)
@ -241,10 +242,8 @@ public:
typename NeighborQuery,
#if defined(DOXYGEN_RUNNING)
typename ConcurrencyTag,
#elif defined(CGAL_LINKED_WITH_TBB)
typename ConcurrencyTag = CGAL::Parallel_tag,
#else
typename ConcurrencyTag = CGAL::Sequential_tag,
typename ConcurrencyTag = CGAL::Parallel_if_available_tag,
#endif
#if defined(DOXYGEN_RUNNING)
typename DiagonalizeTraits>
@ -271,7 +270,7 @@ public:
#else
if (boost::is_convertible<ConcurrencyTag,Parallel_tag>::value)
{
tbb::mutex mutex;
std::mutex mutex;
Compute_eigen_values<PointRange, PointMap, NeighborQuery, DiagonalizeTraits>
f(out, input, point_map, neighbor_query, out.m_content->mean_range, mutex);
tbb::parallel_for(tbb::blocked_range<size_t>(0, input.size ()), f);
@ -309,7 +308,7 @@ public:
\tparam FaceListGraph model of `FaceListGraph`.
\tparam NeighborQuery model of `NeighborQuery`
\tparam ConcurrencyTag enables sequential versus parallel
algorithm. Possible values are `Parallel_tag` (default value is %CGAL
algorithm. Possible values are `Parallel_tag` (default value if %CGAL
is linked with TBB) or `Sequential_tag` (default value otherwise).
\tparam DiagonalizeTraits model of `DiagonalizeTraits` used for
matrix diagonalization. It can be omitted: if Eigen 3 (or greater)
@ -324,10 +323,8 @@ public:
typename NeighborQuery,
#if defined(DOXYGEN_RUNNING)
typename ConcurrencyTag,
#elif defined(CGAL_LINKED_WITH_TBB)
typename ConcurrencyTag = CGAL::Parallel_tag,
#else
typename ConcurrencyTag = CGAL::Sequential_tag,
typename ConcurrencyTag = CGAL::Parallel_if_available_tag,
#endif
#if defined(DOXYGEN_RUNNING)
typename DiagonalizeTraits>
@ -361,7 +358,7 @@ public:
#else
if (boost::is_convertible<ConcurrencyTag,Parallel_tag>::value)
{
tbb::mutex mutex;
std::mutex mutex;
Compute_eigen_values_graph<FaceListGraph, NeighborQuery, DiagonalizeTraits>
f(out, input, neighbor_query, out.m_content->mean_range, mutex);
@ -395,7 +392,7 @@ public:
`RandomAccessIterator` and its value type is the key type of
`PointMap`.
\tparam ConcurrencyTag enables sequential versus parallel
algorithm. Possible values are `Parallel_tag` (default value is %CGAL
algorithm. Possible values are `Parallel_tag` (default value if %CGAL
is linked with TBB) or `Sequential_tag` (default value otherwise).
\tparam DiagonalizeTraits model of `DiagonalizeTraits` used for
matrix diagonalization. It can be omitted: if Eigen 3 (or greater)
@ -408,10 +405,8 @@ public:
template <typename ClusterRange,
#if defined(DOXYGEN_RUNNING)
typename ConcurrencyTag,
#elif defined(CGAL_LINKED_WITH_TBB)
typename ConcurrencyTag = CGAL::Parallel_tag,
#else
typename ConcurrencyTag = CGAL::Sequential_tag,
typename ConcurrencyTag = CGAL::Parallel_if_available_tag,
#endif
#if defined(DOXYGEN_RUNNING)
typename DiagonalizeTraits>

View File

@ -45,7 +45,7 @@
#ifdef CGAL_LINKED_WITH_TBB
#include <tbb/task_group.h>
#include <tbb/mutex.h>
#include <mutex>
#endif // CGAL_LINKED_WITH_TBB
namespace CGAL {
@ -79,7 +79,7 @@ namespace Classification {
is `GeomTraits::Point_3`.
\tparam ConcurrencyTag enables sequential versus parallel
computation of `CGAL::Classification::Local_eigen_analysis`
objects. Possible values are `Parallel_tag` (default value is %CGAL
objects. Possible values are `Parallel_tag` (default value if %CGAL
is linked with TBB) or `Sequential_tag` (default value otherwise).
\tparam DiagonalizeTraits model of `DiagonalizeTraits` used for
matrix diagonalization. It can be omitted: if Eigen 3 (or greater)
@ -93,10 +93,8 @@ template <typename GeomTraits,
typename PointMap,
#if defined(DOXYGEN_RUNNING)
typename ConcurrencyTag,
#elif defined(CGAL_LINKED_WITH_TBB)
typename ConcurrencyTag = CGAL::Parallel_tag,
#else
typename ConcurrencyTag = CGAL::Sequential_tag,
typename ConcurrencyTag = CGAL::Parallel_if_available_tag,
#endif
typename DiagonalizeTraits = CGAL::Default_diagonalize_traits<float,3> >
class Mesh_feature_generator

View File

@ -90,10 +90,8 @@ template <typename GeomTraits,
typename PointMap,
#if defined(DOXYGEN_RUNNING)
typename ConcurrencyTag,
#elif defined(CGAL_LINKED_WITH_TBB)
typename ConcurrencyTag = CGAL::Parallel_tag,
#else
typename ConcurrencyTag = CGAL::Sequential_tag,
typename ConcurrencyTag = CGAL::Parallel_if_available_tag,
#endif
#if defined(DOXYGEN_RUNNING)
typename DiagonalizeTraits>

View File

@ -33,7 +33,7 @@
#include <tbb/parallel_for.h>
#include <tbb/blocked_range.h>
#include <tbb/scalable_allocator.h>
#include <tbb/mutex.h>
#include <mutex>
#endif // CGAL_LINKED_WITH_TBB
#define CLASSIFICATION_TRAINING_QUICK_ESTIMATION
@ -72,9 +72,9 @@ private:
std::vector<std::size_t>& m_true_positives;
std::vector<std::size_t>& m_false_positives;
std::vector<std::size_t>& m_false_negatives;
std::vector<tbb::mutex>& m_tp_mutex;
std::vector<tbb::mutex>& m_fp_mutex;
std::vector<tbb::mutex>& m_fn_mutex;
std::vector<std::mutex>& m_tp_mutex;
std::vector<std::mutex>& m_fp_mutex;
std::vector<std::mutex>& m_fn_mutex;
public:
@ -85,9 +85,9 @@ private:
std::vector<std::size_t>& true_positives,
std::vector<std::size_t>& false_positives,
std::vector<std::size_t>& false_negatives,
std::vector<tbb::mutex>& tp_mutex,
std::vector<tbb::mutex>& fp_mutex,
std::vector<tbb::mutex>& fn_mutex)
std::vector<std::mutex>& tp_mutex,
std::vector<std::mutex>& fp_mutex,
std::vector<std::mutex>& fn_mutex)
: m_training_set (training_set)
, m_classifier (classifier)
, m_label (label)
@ -901,9 +901,9 @@ private:
#else
if (boost::is_convertible<ConcurrencyTag,Parallel_tag>::value)
{
std::vector<tbb::mutex> tp_mutex (m_labels.size());
std::vector<tbb::mutex> fp_mutex (m_labels.size());
std::vector<tbb::mutex> fn_mutex (m_labels.size());
std::vector<std::mutex> tp_mutex (m_labels.size());
std::vector<std::mutex> fp_mutex (m_labels.size());
std::vector<std::mutex> fn_mutex (m_labels.size());
Compute_iou f(training_sets[j], *this, j,
true_positives, false_positives, false_negatives,
tp_mutex, fp_mutex, fn_mutex);

View File

@ -24,7 +24,7 @@
#include <tbb/parallel_for.h>
#include <tbb/blocked_range.h>
#include <tbb/scalable_allocator.h>
#include <tbb/mutex.h>
#include <mutex>
#endif // CGAL_LINKED_WITH_TBB
namespace CGAL {
@ -334,7 +334,7 @@ namespace internal {
suboptimal results.
\tparam ConcurrencyTag enables sequential versus parallel
algorithm. Possible values are `Parallel_tag` or `Sequential_tag`.
algorithm. Possible values are `Parallel_if_available_tag`, `Parallel_tag` or `Sequential_tag`.
\tparam ItemRange model of `ConstRange`. Its iterator type is
`RandomAccessIterator`. Its value type depends on the data that is
@ -424,7 +424,7 @@ namespace internal {
efficiency and better quality results.
\tparam ConcurrencyTag enables sequential versus parallel
algorithm. Possible values are `Parallel_tag` or `Sequential_tag`.
algorithm. Possible values are `Parallel_if_available_tag`, `Parallel_tag` or `Sequential_tag`.
\tparam ItemRange model of `ConstRange`. Its iterator type is
`RandomAccessIterator`.
\tparam ItemMap model of `ReadablePropertyMap` whose key
@ -502,7 +502,7 @@ namespace internal {
results.
\tparam ConcurrencyTag enables sequential versus parallel
algorithm. Possible values are `Parallel_tag` or `Sequential_tag`.
algorithm. Possible values are `Parallel_if_available_tag`, `Parallel_tag` or `Sequential_tag`.
\tparam ItemRange model of `ConstRange`. Its iterator type is
`RandomAccessIterator`.
\tparam ItemMap model of `ReadablePropertyMap` whose key

View File

@ -12,12 +12,12 @@ cyclic sequence of extreme points is cut into a linear sequence.
\pre The source range [`first`,`beyond`) does not contain `result`.
The default traits class `Default_traits` is the kernel in which the
value type of `InputIterator` is defined.
value type of `ForwardIterator` is defined.
\cgalHeading{Requirements}
<OL>
<LI>The value type of `InputIterator` and
<LI>The value type of `ForwardIterator` and
`OutputIterator` is equivalent to `Traits::Point_2`.
<LI>`Traits` defines the following subset of types from
the concept `ConvexHullTraits_2` and their corresponding member
@ -46,10 +46,10 @@ in the worst case for \f$ n\f$ input points with \f$ h\f$ extreme points.
*/
template <class InputIterator, class OutputIterator, class Traits>
template <class ForwardIterator, class OutputIterator, class Traits>
OutputIterator
ch_jarvis( InputIterator first,
InputIterator beyond,
ch_jarvis( ForwardIterator first,
ForwardIterator beyond,
OutputIterator result,
const Traits & ch_traits = Default_traits);

View File

@ -60,6 +60,12 @@ On most operating systems, package managers offer \cgal and its essential third
On macOS, we recommend using of <a href="https://brew.sh/">Homebrew</a> in the following way:
brew install cgal
brew install cgal-qt5 #(only for GUI)
You should check that cgal and cgal-qt5 are correctly "linked", especially when upgrading from an old version. If not, run the following command:
brew link cgal
brew link cgal-qt5 #(if you installed it)
On Linux distributions such as `Debian`/`Ubuntu`/`Mint`, use `apt-get` in the following way:
@ -148,10 +154,14 @@ The variable `CGAL_DIR` is also generally found when \cgal has been obtained via
In the rare event that it has not, the variable `CGAL_DIR` should be set manually to:
<ul>
<li>something like `/usr/local/Cellar/cgal/CGAL-\cgalReleaseNumber/lib/cmake/CGAL`, for Brew.</li>
<li>something like `/usr/local/opt/cgal/lib/cmake/CGAL`, for Brew.</li>
<li>something like `/usr/lib/x86_64-linux-gnu/cmake/CGAL`, for Linux distributions.</li>
</ul>
Note that you can also use `CMAKE_PREFIX_PATH` to point to a directory that contains all dependencies, like so:
cmake -DCMAKE_PREFIX_PATH=/my/custom/brew/installation/dir -DCMAKE_BUILD_TYPE=Release .
If \cgal has been obtained via other means, `CGAL_DIR` must point to the root directory
of the \cgal source code (either the root of the unpacked release tarball or the root
of the Git working directory).
@ -162,6 +172,13 @@ if no debugging is intended. Users should thus run:
cd CGAL-\cgalReleaseNumber/examples/Triangulation_2
cmake -DCGAL_DIR=$HOME/CGAL-\cgalReleaseNumber -DCMAKE_BUILD_TYPE=Release . # we are here using a release tarball
Note that the package Qt on brew is "keg-only", which means it cannot be "linked" with brew.
You will have to specify the Qt5_DIR by hand to cmake, using something like
-DQt5_DIR=/usr/local/opt/qt/lib/cmake/Qt5
where '/usr/local/` is actually your current brew installation directory.
\subsection usage_configuring_cmake_gui Specifying Missing Dependencies
The configuration process launched above might fail if CMake fails to find

View File

@ -37,8 +37,8 @@ The first step is to clone or download `vcpkg` from
By default `vcpkg` installs for 32 bit binaries and will use the latest version of Visual C++
installed on your machine. If you develop 64 bit software you must
set the Windows environment variable `VCPKG_DEFAULT_TRIPLE` to `x64-windows`
or pass the option `--triplet x64-windows` whenever you install a package.
set the Windows environment variable `VCPKG_DEFAULT_TRIPLET` to `x64-windows`
or add the suffix `:x64-windows` to the package name you want to install (for example `cgal:x64-windows`).
We refer to the
<a href="https://github.com/microsoft/vcpkg/blob/master/docs/examples/installing-and-using-packages.md#step-2-use">official documentation</a>
of `vcpkg` if you want to compile for an older version of a compiler.

View File

@ -3,12 +3,12 @@
var url_re = /(cgal\.geometryfactory\.com\/CGAL\/doc\/|doc\.cgal\.org\/)(master|latest|(\d\.\d+|\d\.\d+\.\d+))\//;
var url_local = /.*\/doc_output\//;
var current_version_local = '5.0.1'
var current_version_local = '5.1-dev'
var all_versions = [
'master',
'latest',
'5.0.1',
'4.14.2',
'5.0.2',
'4.14.3',
'4.13.2',
'4.12.2',
'4.11.3',

View File

@ -3,12 +3,12 @@
var url_re = /(cgal\.geometryfactory\.com\/CGAL\/doc\/|doc\.cgal\.org\/)(master|latest|(\d\.\d+|\d\.\d+\.\d+))\//;
var url_local = /.*\/doc_output\//;
var current_version_local = '5.0.1'
var current_version_local = '5.1-dev'
var all_versions = [
'master',
'latest',
'5.0.1',
'4.14.2',
'5.0.2',
'4.14.3',
'4.13.2',
'4.12.2',
'4.11.3',

View File

@ -3,12 +3,12 @@
var url_re = /(cgal\.geometryfactory\.com\/CGAL\/doc\/|doc\.cgal\.org\/)(master|latest|(\d\.\d+|\d\.\d+\.\d+))\//;
var url_local = /.*\/doc_output\//;
var current_version_local = '5.0.1'
var current_version_local = '5.1-dev'
var all_versions = [
'master',
'latest',
'5.0.1',
'4.14.2',
'5.0.2',
'4.14.3',
'4.13.2',
'4.12.2',
'4.11.3',

View File

@ -0,0 +1,54 @@
// Copyright (c) 2011 GeometryFactory (France)
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org)
//
// $URL$
// $Id$
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
//
//
// Author(s) : Andreas Fabri, Laurent Rineau
#ifndef CGAL_INTERNAL_STATIC_FILTERS_COPLANAR_3_H
#define CGAL_INTERNAL_STATIC_FILTERS_COPLANAR_3_H
namespace CGAL {
namespace internal {
namespace Static_filters_predicates {
template < typename K_base, typename SFK >
class Coplanar_3
: public K_base::Coplanar_3
{
typedef typename K_base::Point_3 Point_3;
typedef typename K_base::Coplanar_3 Base;
typedef typename SFK::Orientation_3 Orientation_3;
public:
typedef typename Base::result_type result_type;
result_type
operator()(const Point_3& p,const Point_3& q, const Point_3& r, const Point_3& s) const
{
return Orientation_3()(p,q,r,s) == COPLANAR;
}
}; // end class Coplanar_3
} // end namespace Static_filters_predicates
} // end namespace internal
} // end namespace CGAL
#endif // CGAL_INTERNAL_STATIC_FILTERS_COPLANAR_3_H

View File

@ -41,7 +41,6 @@
#endif // CGAL_DISABLE_STATIC_FILTERS_ADDED_2011
#ifndef CGAL_NO_EQUAL_3_STATIC_FILTERS
# include <CGAL/internal/Static_filters/Equal_3.h>
# include <CGAL/internal/Static_filters/Equal_2.h>
@ -65,6 +64,7 @@
# include <CGAL/internal/Static_filters/Do_intersect_2.h>
#endif // NOT NOT CGAL_NO_DO_INTERSECT_STATIC_FILTERS
#include <CGAL/internal/Static_filters/Coplanar_3.h>
#include <CGAL/internal/Static_filters/Compare_y_at_x_2.h>
#include <CGAL/internal/Static_filters/Side_of_oriented_circle_2.h>
#include <CGAL/internal/Static_filters/Side_of_oriented_sphere_3.h>
@ -121,6 +121,7 @@ public:
typedef Static_filters_predicates::Side_of_oriented_circle_2<K_base> Side_of_oriented_circle_2;
typedef Static_filters_predicates::Side_of_oriented_sphere_3<K_base> Side_of_oriented_sphere_3;
typedef Static_filters_predicates::Compare_squared_radius_3<K_base> Compare_squared_radius_3;
typedef Static_filters_predicates::Coplanar_3<K_base,Self> Coplanar_3;
typedef Static_filters_predicates::Compare_weighted_squared_radius_3<K_base> Compare_weighted_squared_radius_3;
typedef Static_filters_predicates::Power_side_of_oriented_power_sphere_3<K_base> Power_side_of_oriented_power_sphere_3;
@ -138,28 +139,28 @@ public:
{ return Collinear_3(); }
#ifndef CGAL_NO_EQUAL_3_STATIC_FILTERS
Equal_2
Equal_2
equal_2_object() const
{ return Equal_2(); }
Equal_3
Equal_3
equal_3_object() const
{ return Equal_3(); }
#endif // NOT CGAL_NO_EQUAL_3_STATIC_FILTERS
#ifndef CGAL_NO_COMPARE_X_2_STATIC_FILTERS
Compare_x_2
Compare_x_2
compare_x_2_object() const
{ return Compare_x_2(); }
Compare_y_2
Compare_y_2
compare_y_2_object() const
{ return Compare_y_2(); }
#endif // NOT CGAL_NO_COMPARE_Y_2_STATIC_FILTERS
#ifndef CGAL_NO_IS_DEGENERATE_3_STATIC_FILTERS
Is_degenerate_3
Is_degenerate_3
is_degenerate_3_object() const
{ return Is_degenerate_3(); }
#endif // NOT CGAL_NO_IS_DEGENERATE_3_STATIC_FILTERS
@ -182,7 +183,12 @@ Compare_y_2
compare_squared_radius_3_object() const
{ return Compare_squared_radius_3(); }
Power_side_of_oriented_power_sphere_3 power_side_of_oriented_power_sphere_3_object() const
Coplanar_3
coplanar_3_object() const
{ return Coplanar_3(); }
Power_side_of_oriented_power_sphere_3
power_side_of_oriented_power_sphere_3_object() const
{ return Power_side_of_oriented_power_sphere_3();}
Compare_weighted_squared_radius_3

View File

@ -18,6 +18,8 @@
#include <CGAL/generators.h>
#include <CGAL/number_type_basic.h>
#include <CGAL/number_type_config.h>
#include <cmath>
#include <vector>
@ -56,11 +58,10 @@ generate_point() {
for(int i=0; i<dimension; ++i) {
// normal distribution
//( a product of normal distib is a normal distrib in higher dim)
const double pi = 3.141592653589793238462643;
double a=this->_rnd.get_double();
a = std::sqrt( -2* std::log(1-a) );
double b=this->_rnd.get_double();
b = std::cos(2*pi*b);
b = std::cos(2*CGAL_PI*b);
coord[i]= a*b;
norm += coord[i]*coord[i];
}
@ -104,11 +105,10 @@ generate_point() {
for(int i=0; i<dimension; ++i) {
// normal distribution
const double pi = 3.141592653589793238462643;
double a=this->_rnd.get_double();
a = std::sqrt( -2* std::log(1-a) );
double b=this->_rnd.get_double();
b = std::cos(2*pi*b);
b = std::cos(2*CGAL_PI*b);
coord[i]= a*b;
norm += coord[i]*coord[i];
}

View File

@ -31,8 +31,8 @@ if(COMMAND add_config_flag)
add_config_flag( CGAL_HAS_QT5 )
endif()
install(DIRECTORY "../../include/CGAL/Qt/" DESTINATION "${CGAL_INSTALL_INC_DIR}/CGAL/Qt" COMPONENT CGAL_Qt5)
if (CGAL_HEADER_ONLY)
install(DIRECTORY "../../include/CGAL/Qt/" DESTINATION "${CGAL_INSTALL_INC_DIR}/CGAL/include/CGAL/Qt" COMPONENT CGAL_Qt5)
install(DIRECTORY "../../demo/resources/" DESTINATION "${CGAL_INSTALL_CMAKE_DIR}/demo/resources" COMPONENT CGAL_Qt5)
install(DIRECTORY "../../demo/icons/" DESTINATION "${CGAL_INSTALL_CMAKE_DIR}/demo/icons" COMPONENT CGAL_Qt5)
endif()

View File

@ -145,8 +145,9 @@ int main()
#ifdef CGAL_LINKED_WITH_TBB
Triangulation_3 T3;
fct3(T3);
fct3(T3);
#endif
return 0;
}

View File

@ -1,55 +1,52 @@
NOTICE
======
Building an Example or a Demo of CGAL
=====================================
Since Version 5.0, CGAL is a header-only library it is not needed
to build and install it. Usage of CGAL should thus simply amount to:
Since Version 5.0, CGAL is a header-only library, hence it is not needed to build it. Usage of CGAL should simply amount to:
``` {.bash}
git clone https://github.com/CGAL/cgal.git /path/to/cgal.git
cd /path/to/cgal.git/Triangulation_2/examples/Triangulation_2
mkdir -p build/debug
cd build/debug
cmake -DCMAKE_BUILD_TYPE=Debug -DCGAL_DIR=/path/to/cgal.git
cmake -DCMAKE_BUILD_TYPE=Debug -DCGAL_DIR=/path/to/cgal.git ../..
make
```
in the case of the building of an example in debug mode.
For more information head over to the [CGAL manual](https://doc.cgal.org/latest/Manual/general_intro.html).
Note that this page describes the setting of CGAL as a sources release and, as such,
files are organized in a slightly different way, see the [Layout of the CGAL Git Repository](README.md).
in the case of building some CGAL-provided examples in debug mode.
Note that although CGAL is a header-only library, some parts of it must link to several external libraries, such as GMP, MPFR, etc.
Building a Program Using CGAL
=============================
To compile a program using CGAL, simply set `CGAL_DIR` to the location
of the directory containing `CGALConfig.cmake` (for example the root
of the extracted source archive or the root of a git checkout).
Here is an example of how to build in debug the examples from the 3D Triangulations package:
If you wish to build a program that is not provided with CGAL and does not already have a `CMakeLists.txt`,
you can trigger the creation of a basic `CMakeLists.txt` by calling the script [`cgal_create_cmake_script`](Scripts/scripts/cgal_create_cmake_script)
found in `/path/to/cgal.git/Scripts/scripts/` at the root of your program directory.
``` {.bash}
cd /path/to/cgal.git/Triangulation_3/examples/Triangulation_3
mkdir -p build/debug
cd build/debug
cmake -DCGAL_DIR:PATH=/path/to/cgal.git ../..
make
```
If you are trying to build examples or tests that do not already have a `CMakeLists.txt`,
you can trigger its creation by calling the script [`cgal_create_cmake_script`](Scripts/scripts/cgal_create_cmake_script)
found in `/path/to/cgal.git/Scripts/scripts/` at the root of the example/test directory.
Here is an example for the examples of the 2D Triangulation package:
``` {.bash}
cd /path/to/cgal.git/Triangulation_2/examples/Triangulation_2
git clone https://github.com/CGAL/cgal.git /path/to/cgal.git
cd /path/to/your/program
/path/to/cgal.git/Scripts/scripts/cgal_create_cmake_script
cd /path/to/cgal.git/Triangulation_2/examples/Triangulation_2
mkdir -p build/debug
cd build/debug
cmake -DCGAL_DIR:PATH=/path/to/cgal.git ../..
make
cmake -DCMAKE_BUILD_TYPE=Debug -DCGAL_DIR:PATH=/path/to/cgal.git ../..
make your_program
```
For more information head over to the [CGAL manual](https://doc.cgal.org/latest/Manual/general_intro.html).
Since the basic `CMakeLists.txt` created by the script `cgal_create_cmake_script` cannot
guess which part(s) of CGAL you are using, it does not link with any optional third party
dependency of CGAL. You should look at the documentation of the package(s) that you
are using to learn which dependencies you must add. The `CMakeLists.txt`
of the examples and demos provided with the package(s) that you are using can be used
to complete your basic `CMakeLists.txt`.
Repository Structure
====================
If you have downloaded a source release instead of cloning the Git repository, the files will be organized in a slightly different way, see the [Layout of the CGAL Git Repository](README.md).
Documentation
=============
For more information see the [CGAL manual](https://doc.cgal.org/latest/Manual/general_intro.html).

View File

@ -18,6 +18,9 @@ Release date: June 2020
- **Breaking change**: the internal search tree is now lazily constructed. To disable it, one must call
the new function `do_not_accelerate_distance_queries()` before the first distance query.
### Intersecting Sequences of dD Iso-oriented Boxes
- Added parallel versions of the functions `CGAL::box_intersection_d()` and `CGAL::box_self_intersection_d()`.
### Polygon Mesh Processing
- Introduced a new function, `CGAL::Polygon_mesh_processing::remove_connected_components_of_negligible_size()`,
@ -28,6 +31,8 @@ Release date: June 2020
components that would be removed with the specified threshold, but without actually removing them.
- The function `CGAL::Polygon_mesh_processing::stitch_borders()` now returns the number
of halfedge pairs that were stitched.
- Added parallel versions of the functions `CGAL::Polygon_mesh_processing::does_self_intersect()`
and `CGAL::Polygon_mesh_processing::self_intersections()`.
### 2D Triangulations
- To fix an inconsistency between code and documentation and to clarify which types of intersections
@ -65,6 +70,10 @@ Release date: June 2020
k-NN search to interrupt some distance computations before its end,
saving precious milliseconds, in particular in medium-to-high dimension.
### Spatial Sorting
- Added parallel versions of `hilbert_sort()` and `spatial_sort()` in 2D and 3D when the median policy is used.
The parallel versions use up to four threads in 2D, and up to eight threads in 3D.
### dD Geometry Kernel
- Epick\_d and Epeck\_d gain 2 new functors: `Power_side_of_bounded_power_sphere_d` and
`Compute_squared_radius_smallest_orthogonal_sphere_d`. Those are
@ -75,6 +84,10 @@ Release date: June 2020
- The concept "EdgeProfile" has been removed. This concept was not actually in use as the CGAL-provided model `CGAL::Edge_profile`
was imposed to the user. Other concepts have been clarified to reflect the fact that the API uses this particular class.
### STL Extensions for CGAL
- Added a new concurrency tag: `CGAL::Parallel_if_available_tag`. This tag is a convenience typedef to `CGAL::Parallel_tag`
if the third party library TBB has been found and linked with, and to `CGAL::Sequential_tag` otherwise.
[Release 5.0](https://github.com/CGAL/cgal/releases/tag/releases%2FCGAL-5.0)
-----------

View File

@ -568,10 +568,6 @@ message("== Detect external libraries ==")
# Coin is used in KDS, but no FindCoin or FindCOIN exists
# There exists FindIPE, FindMKL, but they are only used to support supporting libs
list (INSERT CGAL_SUPPORTING_3RD_PARTY_LIBRARIES 0 GMP MPFR ZLIB OpenGL LEDA MPFI RS RS3 OpenNL Eigen3 ESBTL Coin3D NTL IPE)
if (NOT WIN32)
# GMPXX is not supported on WIN32 machines
list (INSERT CGAL_SUPPORTING_3RD_PARTY_LIBRARIES 1 GMPXX)
endif()
# Where CMake is run several times, to avoid duplicates
list(REMOVE_DUPLICATES CGAL_SUPPORTING_3RD_PARTY_LIBRARIES)
@ -611,8 +607,6 @@ if(CGAL_DISABLE_GMP)
unset(WITH_GMP CACHE)
unset(CGAL_USE_GMP)
unset(CGAL_USE_GMP CACHE)
unset(WITH_GMPXX)
unset(WITH_GMPXX CACHE)
unset(WITH_MPFR)
unset(WITH_MPFR CACHE)
@ -621,9 +615,6 @@ if(CGAL_DISABLE_GMP)
"#error GMP is disabled by the CMake option CGAL_DISABLE_GMP")
else()
list(APPEND CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES GMP MPFR)
if(WITH_GMPXX)
list(APPEND CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES GMPXX)
endif()
# When CMake is run several times, to avoid duplicates
list (REMOVE_DUPLICATES CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES)
@ -643,7 +634,7 @@ foreach (lib ${CGAL_SUPPORTING_3RD_PARTY_LIBRARIES})
# add option
list( FIND CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES "${lib}" POSITION )
if ( "${POSITION}" STRGREATER "-1" ) # if lib is essential
option(WITH_${lib} "Select external library ${lib}" ON)
option(WITH_${lib} "Select external library ${lib}" ON)
else()
option(WITH_${lib} "Select external library ${lib}" OFF)
endif()
@ -891,11 +882,11 @@ endif()
foreach (dir ${CGAL_CONFIGURED_PACKAGES})
if (EXISTS ${dir}/include/CGAL)
install(DIRECTORY ${dir}/include/CGAL DESTINATION ${CGAL_INSTALL_INC_DIR} PATTERN ".svn" EXCLUDE)
install(DIRECTORY ${dir}/include/CGAL DESTINATION ${CGAL_INSTALL_INC_DIR} PATTERN ".svn" EXCLUDE PATTERN "Qt" EXCLUDE)
endif()
endforeach()
if(EXISTS ${CMAKE_BINARY_DIR}/include/CGAL)
install(DIRECTORY ${CMAKE_BINARY_DIR}/include/CGAL DESTINATION ${CGAL_INSTALL_INC_DIR} PATTERN ".svn" EXCLUDE)
install(DIRECTORY ${CMAKE_BINARY_DIR}/include/CGAL DESTINATION ${CGAL_INSTALL_INC_DIR} PATTERN ".svn" EXCLUDE PATTERN "Qt" EXCLUDE)
endif()
file(GLOB scripts "scripts/*")

View File

@ -23,12 +23,12 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CGAL_MODULES_DIR})
find_package(GMP REQUIRED)
find_package(MPFR REQUIRED)
find_package(GMPXX QUIET)
if(NOT DEFINED WITH_GMPXX)
if(NOT GMPXX_FOUND)
option(CGAL_WITH_GMPXX "Use CGAL with GMPXX: use C++ classes of GNU MP instead of CGAL wrappers" OFF)
endif()
if(WITH_GMPXX OR CGAL_WITH_GMPXX)
find_package(GMPXX REQUIRED)
else()
option(CGAL_WITH_GMPXX "Use CGAL with GMPXX: use C++ classes of GNU MP instead of CGAL wrappers" ON)
endif()
#.rst:

View File

@ -52,11 +52,13 @@ void call_do_intersect_with_kernel(const A& a, const B& b, const K&) {
}
int main()
int main(int argc, char**)
{
CGAL::Interval_nt_advanced::Protector p;
CGAL_USE(p);
try {
//we only want to check compilation
if(argc > 666 )
{
call_intersection_global(S(), S());
call_intersection_global(S(), L());
call_intersection_global(S(), Pl());
@ -264,10 +266,6 @@ int main()
call_do_intersect_with_kernel(Bbox_3(), S(), K());
call_do_intersect_with_kernel(Bbox_3(), Sph(), K());
call_do_intersect_with_kernel(Bbox_3(), Tr(), K());
// There is no kernel to call
// call_do_intersect_with_kernel(Bbox_3(), Bbox_3(), K());
} catch(...) {
// as long as this test compiles, it is fine
}
return EXIT_SUCCESS;
}

View File

@ -488,7 +488,7 @@ CGAL_Kernel_pred_RT(Coplanar_orientation_3,
coplanar_orientation_3_object)
CGAL_Kernel_pred_RT(Coplanar_side_of_bounded_circle_3,
coplanar_side_of_bounded_circle_3_object)
CGAL_Kernel_pred(Coplanar_3,
CGAL_Kernel_pred_RT(Coplanar_3,
coplanar_3_object)
CGAL_Kernel_pred(Counterclockwise_in_between_2,
counterclockwise_in_between_2_object)

View File

@ -25,11 +25,11 @@ LC_CTYPE=en_US.UTF-8
# "master" alone
0 21 * * Sun cd $HOME/CGAL/create_internal_release && /usr/bin/time scl enable rh-git29 -- $HOME/bin/create_release $HOME/CGAL/branches/master.git --do-it || echo ERROR
# "integration"
0 21 * * Mon,Tue,Wed,Thu cd $HOME/CGAL/create_internal_release && /usr/bin/time scl enable rh-git29 -- $HOME/bin/create_release $HOME/CGAL/branches/integration.git $HOME/CGAL/branches/empty-dir --do-it --public || echo ERROR
0 21 * * Mon,Tue,Wed,Thu,Fri cd $HOME/CGAL/create_internal_release && /usr/bin/time scl enable rh-git29 -- $HOME/bin/create_release $HOME/CGAL/branches/integration.git $HOME/CGAL/branches/empty-dir --do-it --public || echo ERROR
# from branch 5.0
0 21 * * Fri cd $HOME/CGAL/create_internal_release-5.0-branch && /usr/bin/time scl enable rh-git29 -- $HOME/bin/create_release $HOME/CGAL/branches/CGAL-5.0-branch.git --public --do-it || echo ERROR
0 21 * * Sat cd $HOME/CGAL/create_internal_release-5.0-branch && /usr/bin/time scl enable rh-git29 -- $HOME/bin/create_release $HOME/CGAL/branches/CGAL-5.0-branch.git --public --do-it || echo ERROR
# from branch 4.14
0 21 * * Sat cd $HOME/CGAL/create_internal_release-4.14-branch && /usr/bin/time scl enable rh-git29 -- $HOME/bin/create_release $HOME/CGAL/branches/CGAL-4.14-branch.git --public --do-it || echo ERROR
#0 21 * * Sat cd $HOME/CGAL/create_internal_release-4.14-branch && /usr/bin/time scl enable rh-git29 -- $HOME/bin/create_release $HOME/CGAL/branches/CGAL-4.14-branch.git --public --do-it || echo ERROR
## Older stuff
# from branch 4.13

View File

@ -12,8 +12,8 @@ type to be used for the 3D triangulation embedding the mesh.
and defaults to `Kernel_traits<MD>::%Kernel`.
\tparam Concurrency_tag enables sequential versus parallel meshing and optimization algorithms.
Possible values are `Sequential_tag` (the default) and
`Parallel_tag`.
Possible values are `Sequential_tag` (the default), `Parallel_tag`,
and `Parallel_if_available_tag`.
\tparam Vertex_base must be a model of `MeshVertexBase_3` or `Default`
and defaults to `Mesh_vertex_base_3<Gt, MD>`.

View File

@ -34,9 +34,64 @@
#ifdef CGAL_LINKED_WITH_TBB
# include <tbb/atomic.h>
# include <atomic>
#endif
namespace internal_tbb
{
//classic pointer{
//normal
template<typename T>
void set_weighted_circumcenter(T* &t, T* value)
{
t = value;
}
//overload for nullptr
template<typename T>
void set_weighted_circumcenter(T* &t, std::nullptr_t)
{
t = nullptr;
}
template<typename T>
bool compare_weighted_circumcenter(T* t)
{
return t == nullptr;
}
template<typename T>
void delete_circumcenter(T* &t )
{
delete t;
}
//} atomic {
//normal
template<typename T>
void set_weighted_circumcenter(std::atomic<T*>& t, T* value)
{
t.load() = value;
}
//nullptr
template<typename T>
void set_weighted_circumcenter(std::atomic<T*>& t, std::nullptr_t)
{
t = nullptr;
}
template<typename T>
bool compare_weighted_circumcenter(std::atomic<T*>& t)
{
return t.load() == nullptr;
}
template<typename T>
void delete_circumcenter(std::atomic<T*>& t)
{
delete t.load();
}
//}
} //end internal_tbb
namespace CGAL {
// Class Compact_mesh_cell_base_3_base
@ -52,8 +107,9 @@ class Compact_mesh_cell_base_3_base
protected:
Compact_mesh_cell_base_3_base()
: bits_(0)
, weighted_circumcenter_(nullptr)
{}
{
internal_tbb::set_weighted_circumcenter(weighted_circumcenter_, nullptr);
}
public:
#if defined(CGAL_MESH_3_USE_LAZY_SORTED_REFINEMENT_QUEUE) \
@ -152,7 +208,8 @@ public:
{
CGAL_precondition(facet>=0 && facet<4);
char current_bits = bits_;
while (bits_.compare_and_swap(current_bits | char(1 << facet), current_bits) != current_bits)
while (!bits_.compare_exchange_weak(current_bits, current_bits | char(1 << facet)))
{
current_bits = bits_;
}
@ -165,7 +222,7 @@ public:
char current_bits = bits_;
char mask = char(15 & ~(1 << facet));
char wanted_value = current_bits & mask;
while (bits_.compare_and_swap(wanted_value, current_bits) != current_bits)
while (!bits_.compare_exchange_weak(current_bits, wanted_value))
{
current_bits = bits_;
}
@ -182,18 +239,19 @@ public:
/// this function "deletes" cc
void try_to_set_circumcenter(Point_3 *cc) const
{
if (weighted_circumcenter_.compare_and_swap(cc, nullptr) != nullptr)
Point_3* base_test = nullptr;
if (!weighted_circumcenter_.compare_exchange_strong(base_test, cc))
delete cc;
}
private:
typedef tbb::atomic<unsigned int> Erase_counter_type;
typedef std::atomic<unsigned int> Erase_counter_type;
Erase_counter_type m_erase_counter;
/// Stores visited facets (4 first bits)
tbb::atomic<char> bits_;
std::atomic<char> bits_;
protected:
mutable tbb::atomic<Point_3*> weighted_circumcenter_;
mutable std::atomic<Point_3*> weighted_circumcenter_;
};
#endif // CGAL_LINKED_WITH_TBB
@ -244,9 +302,9 @@ public:
public:
void invalidate_weighted_circumcenter_cache() const
{
if (weighted_circumcenter_) {
delete weighted_circumcenter_;
weighted_circumcenter_ = nullptr;
if (!internal_tbb::compare_weighted_circumcenter(weighted_circumcenter_)) {
internal_tbb::delete_circumcenter(weighted_circumcenter_);
internal_tbb::set_weighted_circumcenter(weighted_circumcenter_, nullptr);
}
}
@ -328,8 +386,9 @@ public:
~Compact_mesh_cell_base_3()
{
if(weighted_circumcenter_ != nullptr){
delete weighted_circumcenter_;
if(!internal_tbb::compare_weighted_circumcenter(weighted_circumcenter_)){
internal_tbb::delete_circumcenter(weighted_circumcenter_);
internal_tbb::set_weighted_circumcenter(weighted_circumcenter_, nullptr);
}
}

View File

@ -47,7 +47,7 @@
#ifdef CGAL_LINKED_WITH_TBB
# include <tbb/parallel_do.h>
# include <tbb/mutex.h>
# include <mutex>
#endif
#include <functional>
@ -595,7 +595,7 @@ public:
protected:
Lock_data_structure *m_lock_ds;
typedef tbb::mutex Mutex_type;
typedef std::mutex Mutex_type;
mutable Mutex_type m_mut_outdated_cells;
mutable Mutex_type m_mut_moving_vertices;
mutable Mutex_type m_mut_vertex_to_proj;

View File

@ -41,7 +41,7 @@
#ifdef CGAL_LINKED_WITH_TBB
#include <tbb/atomic.h>
#include <atomic>
#include <tbb/concurrent_hash_map.h>
namespace CGAL {
@ -174,7 +174,7 @@ public:
, manifold_info_initialized_(false) //TODO: parallel!
{
// We don't put it in the initialization list because
// tbb::atomic has no contructors
// std::atomic has no contructors
number_of_facets_ = 0;
number_of_cells_ = 0;
}
@ -186,8 +186,9 @@ public:
, edge_facet_counter_(rhs.edge_facet_counter_)
, manifold_info_initialized_(rhs.manifold_info_initialized_)
{
number_of_facets_ = rhs.number_of_facets_;
number_of_cells_ = rhs.number_of_cells_;
Init_number_of_elements<Concurrency_tag> init;
init(number_of_facets_, rhs.number_of_facets_);
init(number_of_cells_, rhs.number_of_cells_);
}
/// Destructor
@ -505,9 +506,10 @@ public:
/// Swaps this & rhs
void swap(Self& rhs)
{
std::swap(rhs.number_of_facets_, number_of_facets_);
Swap_elements<Concurrency_tag> swapper;
swapper(rhs.number_of_facets_, number_of_facets_);
tr_.swap(rhs.tr_);
std::swap(rhs.number_of_cells_, number_of_cells_);
swapper(rhs.number_of_cells_, number_of_cells_);
}
/// Returns bbox
@ -850,12 +852,55 @@ private:
{
typedef size_type type;
};
template<typename Concurrency_tag2, typename dummy = void>
struct Init_number_of_elements
{
template<typename T>
void operator()(T& a, const T& b)
{
a = b;
}
};
template<typename Concurrency_tag2, typename dummy = void>
struct Swap_elements
{
template<typename T>
void operator()(T& a, T& b)
{
std::swap(a, b);
}
};
#ifdef CGAL_LINKED_WITH_TBB
// Parallel: atomic
template<typename dummy>
struct Number_of_elements<Parallel_tag, dummy>
{
typedef tbb::atomic<size_type> type;
typedef std::atomic<size_type> type;
};
template<typename dummy>
struct Init_number_of_elements<Parallel_tag, dummy>
{
template<typename T>
void operator()(T& a, const T& b)
{
a = b.load();
}
};
template<typename dummy>
struct Swap_elements<Parallel_tag, dummy>
{
template<typename T>
void operator()(T& a, T& b)
{
T tmp;
tmp.exchange(a);
a.exchange(b);
b.exchange(tmp);
}
};
#endif // CGAL_LINKED_WITH_TBB

View File

@ -47,7 +47,8 @@
#include <boost/type_traits/is_convertible.hpp>
#ifdef CGAL_LINKED_WITH_TBB
# include <tbb/atomic.h>
# include <atomic>
# include <mutex>
# include <tbb/parallel_do.h>
# include <tbb/concurrent_vector.h>
#endif
@ -122,7 +123,7 @@ protected:
typedef typename Tr::Lock_data_structure Lock_data_structure;
typedef tbb::concurrent_vector<std::tuple<typename Tr::Vertex_handle, Vector_3, FT> >
Moves_vector;
typedef tbb::atomic<unsigned int> Nb_frozen_points_type ;
typedef std::atomic<unsigned int> Nb_frozen_points_type ;
Mesh_global_optimizer_base(const Bbox_3 &bbox, int num_grid_cells_per_axis)
: big_moves_size_(0)
@ -136,7 +137,7 @@ protected:
{
if (++big_moves_current_size_ <= big_moves_size_ )
{
tbb::mutex::scoped_lock lock(m_big_moves_mutex);
std::lock_guard<std::mutex> lock(m_big_moves_mutex);
typename std::multiset<FT>::const_iterator it = big_moves_.insert(new_sq_move);
// New smallest move of all big moves?
@ -149,7 +150,7 @@ protected:
if( new_sq_move > big_moves_smallest_ )
{
tbb::mutex::scoped_lock lock(m_big_moves_mutex);
std::lock_guard<std::mutex> lock(m_big_moves_mutex);
// Test it again since it may have been modified by another
// thread in the meantime
if( new_sq_move > big_moves_smallest_ )
@ -185,11 +186,11 @@ protected:
public:
protected:
tbb::atomic<std::size_t> big_moves_current_size_;
tbb::atomic<FT> big_moves_smallest_;
std::atomic<std::size_t> big_moves_current_size_;
std::atomic<FT> big_moves_smallest_;
std::size_t big_moves_size_;
std::multiset<FT> big_moves_;
tbb::mutex m_big_moves_mutex;
std::mutex m_big_moves_mutex;
/// Lock data structure
Lock_data_structure m_lock_ds;

View File

@ -27,7 +27,7 @@
#include <CGAL/Mesh_3/io_signature.h>
#ifdef CGAL_LINKED_WITH_TBB
# include <tbb/atomic.h>
# include <atomic>
#endif
#ifdef _MSC_VER
@ -123,7 +123,7 @@ public:
protected:
/// Stores visited facets (4 first bits)
tbb::atomic<char> bits_;
std::atomic<char> bits_;
};
#endif // CGAL_LINKED_WITH_TBB

View File

@ -50,7 +50,7 @@
#endif
#ifdef CGAL_LINKED_WITH_TBB
# include <tbb/task_scheduler_init.h>
# include <thread>
#endif
#include <boost/format.hpp>
@ -659,7 +659,7 @@ initialize()
# endif
Random_points_on_sphere_3<Bare_point> random_point(radius);
const int NUM_PSEUDO_INFINITE_VERTICES = static_cast<int>(
float(tbb::task_scheduler_init::default_num_threads())
float(std::thread::hardware_concurrency())
* Concurrent_mesher_config::get().num_pseudo_infinite_vertices_per_core);
for (int i = 0 ; i < NUM_PSEUDO_INFINITE_VERTICES ; ++i, ++random_point)
r_c3t3_.add_far_point(r_c3t3_.triangulation().geom_traits().construct_weighted_point_3_object()

View File

@ -28,7 +28,7 @@
#include <tbb/concurrent_vector.h>
#include <tbb/scalable_allocator.h>
#include <tbb/atomic.h>
#include <atomic>
#include <vector>
@ -65,8 +65,8 @@ public:
m_num_cells =
num_grid_cells_per_axis*num_grid_cells_per_axis*num_grid_cells_per_axis;
m_occupation_grid = new tbb::atomic<int>[m_num_cells];
m_num_batches_grid = new tbb::atomic<int>[m_num_cells];
m_occupation_grid = new std::atomic<int>[m_num_cells];
m_num_batches_grid = new std::atomic<int>[m_num_cells];
// Initialize grid
for (int i = 0 ; i < m_num_cells ; ++i)
{
@ -106,15 +106,15 @@ public:
void add_batch(int cell_index, int to_add)
{
m_num_batches_grid[cell_index].fetch_and_add(to_add);
m_num_batches_grid[cell_index].fetch_add(to_add);
}
void add_occupation(int cell_index, int to_add, int)
{
m_occupation_grid[cell_index].fetch_and_add(to_add);
m_occupation_grid[cell_index].fetch_add(to_add);
/*int new_occupation =
(m_occupation_grid[cell_index].fetch_and_add(to_add))
(m_occupation_grid[cell_index].fetch_add(to_add))
+ to_add;
//m_num_batches_grid[cell_index] = num_items_in_work_queue;
@ -221,7 +221,7 @@ public:
// Rotate
static tbb::atomic<int> last_cell_index;
static std::atomic<int> last_cell_index;
//std::cerr << "last=" << last_cell_index << std::endl;
int i = (last_cell_index + 1) % m_num_cells;
for ( ; i != last_cell_index ; i = (i + 1) % m_num_cells)
@ -246,11 +246,11 @@ protected:
int m_num_grid_cells_per_axis;
int m_num_cells;
tbb::atomic<int> * m_occupation_grid;
tbb::atomic<int> * m_num_batches_grid;
std::atomic<int> * m_occupation_grid;
std::atomic<int> * m_num_batches_grid;
tbb::atomic<int> m_laziest_cell_index;
tbb::atomic<int> m_laziest_cell_occupation;
std::atomic<int> m_laziest_cell_index;
std::atomic<int> m_laziest_cell_occupation;
};
@ -504,7 +504,7 @@ public:
{
m_tls_work_buffers = new TLS_WorkBuffer[m_num_cells];
m_work_batches = new tbb::concurrent_queue<WorkBatch>[m_num_cells];
m_num_batches = new tbb::atomic<int>[m_num_cells];
m_num_batches = new std::atomic<int>[m_num_cells];
for (int i = 0 ; i < m_num_cells ; ++i)
m_num_batches[i] = 0;
@ -673,7 +673,7 @@ protected:
Work_statistics m_stats;
TLS_WorkBuffer *m_tls_work_buffers;
tbb::concurrent_queue<WorkBatch> *m_work_batches;
tbb::atomic<int> *m_num_batches;
std::atomic<int> *m_num_batches;
};
@ -822,7 +822,7 @@ protected:
}
const size_t NUM_WORK_ITEMS_PER_BATCH;
tbb::atomic<int> m_cache_number_of_tasks;
std::atomic<int> m_cache_number_of_tasks;
TLS_WorkBuffer m_tls_work_buffers;
};

View File

@ -30,7 +30,7 @@
#include <CGAL/Timer.h>
#ifdef CGAL_LINKED_WITH_TBB
#include <tbb/enumerable_thread_specific.h>
#include <tbb/atomic.h>
#include <atomic>
#endif
#endif
@ -193,7 +193,7 @@ public:
#endif
{
#ifdef CGAL_MESH_3_PERTURBER_VERBOSE
// Initialized here in case it's some tbb::atomic
// Initialized here in case it's some std::atomic
total_counter_ = 0;
total_time_ = 0;
#endif
@ -354,8 +354,8 @@ private:
mutable int counter_;
#ifdef CGAL_LINKED_WITH_TBB
mutable tbb::enumerable_thread_specific<CGAL::Timer> timer_;
tbb::atomic<int> total_counter_;
tbb::atomic<std::size_t> total_time_;
std::atomic<int> total_counter_;
std::atomic<std::size_t> total_time_;
#else
mutable CGAL::Timer timer_;
int total_counter_;

View File

@ -33,7 +33,7 @@
#include <boost/type_traits/is_convertible.hpp>
#ifdef CGAL_LINKED_WITH_TBB
# include <tbb/atomic.h>
# include <atomic>
#endif
namespace CGAL {
@ -87,7 +87,7 @@ public:
}
protected:
typedef tbb::atomic<unsigned int> Erase_counter_type;
typedef std::atomic<unsigned int> Erase_counter_type;
Erase_counter_type m_erase_counter;
};
#endif // CGAL_LINKED_WITH_TBB

View File

@ -65,14 +65,15 @@ if ( CGAL_FOUND )
test_meshing_verbose
test_meshing_polyhedron_with_features
test_meshing_utilities.h
test_mesh_implicit_domains
test_meshing_implicit_function
test_meshing_3D_image
test_meshing_3D_gray_image
test_meshing_unit_tetrahedron
test_backward_compatibility
test_meshing_polyhedron
test_meshing_polyhedral_complex
test_mesh_capsule_var_distance_bound
test_mesh_3_issue_1554
test_mesh_polyhedral_domain_with_features_deprecated
)
if(TBB_FOUND AND TARGET ${target})
CGAL_target_use_TBB(${target})

View File

@ -18,11 +18,7 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Mesh_polyhedron_3<K>::type Polyhedron;
typedef CGAL::Polyhedral_mesh_domain_with_features_3<K> Mesh_domain;
#ifdef CGAL_CONCURRENT_MESH_3
typedef CGAL::Parallel_tag Concurrency_tag;
#else
typedef CGAL::Sequential_tag Concurrency_tag;
#endif
typedef CGAL::Parallel_if_available_tag Concurrency_tag;
// Triangulation
typedef CGAL::Mesh_triangulation_3<Mesh_domain,

View File

@ -16,11 +16,7 @@ typedef K::Point_3 Point;
typedef FT (Function)(const Point&);
typedef CGAL::Labeled_mesh_domain_3<K> Mesh_domain;
#ifdef CGAL_CONCURRENT_MESH_3
typedef CGAL::Parallel_tag Concurrency_tag;
#else
typedef CGAL::Sequential_tag Concurrency_tag;
#endif
typedef CGAL::Parallel_if_available_tag Concurrency_tag;
// Triangulation
typedef CGAL::Mesh_triangulation_3<Mesh_domain,K,Concurrency_tag>::type Tr;

View File

@ -14,12 +14,7 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Mesh_polyhedron_3<K>::type Polyhedron;
typedef CGAL::Polyhedral_mesh_domain_with_features_3<K> Mesh_domain;
#ifdef CGAL_CONCURRENT_MESH_3
typedef CGAL::Parallel_tag Concurrency_tag;
#else
typedef CGAL::Sequential_tag Concurrency_tag;
#endif
typedef CGAL::Parallel_if_available_tag Concurrency_tag;
// Triangulation
typedef CGAL::Mesh_triangulation_3<Mesh_domain,CGAL::Default,Concurrency_tag>::type Tr;

View File

@ -13,7 +13,6 @@
//******************************************************************************
// File Description :
//***************************************************************************
#include "test_meshing_utilities.h"
#include <CGAL/Image_3.h>
#include <CGAL/Labeled_mesh_domain_3.h>

View File

@ -13,9 +13,9 @@
#include <fstream>
#include <sstream>
#include <cstring>
#ifdef CGAL_LINKED_WITH_TBB
# include <tbb/task_scheduler_init.h>
#define TBB_PREVIEW_GLOBAL_CONTROL 1
# include <tbb/global_control.h>
#endif
// To avoid verbose function and named parameters call
@ -119,7 +119,7 @@ int main(int, char*[])
{
test<CGAL::Sequential_tag>();
#ifdef CGAL_LINKED_WITH_TBB
tbb::task_scheduler_init init(1);
tbb::global_control c(tbb::global_control::max_allowed_parallelism, 1);
test<CGAL::Parallel_tag>();
#endif
}

View File

@ -109,6 +109,12 @@ template<typename AT, typename ET, typename AC, typename EC, typename E2A, typen
class Lazy_rep_XXX :
public Lazy_rep< AT, ET, E2A >, private EC
{
// `default_construct<T>()` is the same as `T{}`. But, this is a
// workaround to a MSVC-2015 bug (fixed in MSVC-2017): its parser
// seemed confused by `T{}` somewhere below.
template <typename T>
static T default_construct() { return T(); }
// Lazy_rep_0 does not inherit from EC or take a parameter AC. It has different constructors.
static_assert(sizeof...(L)>0, "Use Lazy_rep_0 instead");
template <class Ei, class Ai, class E2Ai, class Ki> friend class Lazy_kernel_base;
@ -138,7 +144,7 @@ class Lazy_rep_XXX :
// Currently we construct the vectors, then move them into the tuple. It would be nicer to construct them in their final destination, because eventually we will also have arrays instead of vectors.
template<class...T,class LLL,class...LL>
Lazy_rep_XXX(Lazy_internal::typelist<T...>, const AC& ac, const EC& ec, LLL const&lll, LL const&...ll) :
Lazy_rep<AT, ET, E2A>(ac(CGAL::approx(ll)...)), EC(ec), l(Lazy_internal::do_extract(T{},lll)...)
Lazy_rep<AT, ET, E2A>(ac(CGAL::approx(ll)...)), EC(ec), l(Lazy_internal::do_extract(default_construct<T>(),lll)...)
{
//this->set_depth(std::max({ -1, (int)CGAL::depth(ll)...}) + 1);
this->set_depth(1); // FIXME: now that we have ranges, we could actually compute the depth if we cared...

View File

@ -408,7 +408,7 @@ typedef unsigned int FPU_CW_t;
#elif defined __mips__
#define CGAL_IA_SETFPCW(CW) asm volatile ("ctc1 %0,$31" : :"r" (CW))
#define CGAL_IA_GETFPCW(CW) asm volatile ("cfc1 %0,$31" : "=r" (CW))
#define CGAL_IA_GETFPCW(CW) asm volatile ("cfc1 %0,$31" : "=r" (CW)); CW &= 3
typedef unsigned int FPU_CW_t;
#define CGAL_FE_TONEAREST (0x0)
#define CGAL_FE_TOWARDZERO (0x1)

View File

@ -18,9 +18,11 @@
#define cimg_display 0 // To avoid X11 or Windows-GDI dependency
#include <CImg.h>
#endif
#include <CGAL/Random.h>
#include <utility> // std::pair
#include <vector>
#include <CGAL/number_type_config.h>
#include <CGAL/Random.h>
#include <CGAL/property_map.h>
#include <CGAL/value_type_traits.h>
#include <CGAL/compute_average_spacing.h>
@ -953,7 +955,7 @@ public:
void append_star(const int nb_branches, const int density) {
std::cerr << "append star...";
const double deg_in_rad = 3.1415926535897932384626 / 180.0;
const double deg_in_rad = CGAL_PI / 180.0;
const double incr = 180.0 / nb_branches;
double angle = 0.0;
const Point center(0.5, 0.5);
@ -970,7 +972,7 @@ public:
void append_predefined_increasingly_sharp_angles(const int density,
const double min_angle) {
const double deg_in_rad = 3.1415926535897932384626 / 180.0;
const double deg_in_rad = CGAL_PI / 180.0;
double prev_angle = 0.0;
double curr_angle = min_angle;
double incr = min_angle;

View File

@ -88,11 +88,6 @@ _test_cell_tds_3(const Tds &)
assert(c2->index(v1)==0);
assert(c2->index(v2)==1);
assert(c2->index(v3)==2);
// c2->set_vertices();
// assert(c2->vertex(0)==NULL);
// assert(c2->vertex(1)==NULL);
// assert(c2->vertex(2)==NULL);
// assert(c2->vertex(3)==NULL);
c2->set_vertices(v0, v1, v2, v3);
assert(c2->index(v0)==0);
assert(c2->index(v1)==1);
@ -107,11 +102,6 @@ _test_cell_tds_3(const Tds &)
assert(c2->index(n1)==0);
assert(c2->index(n2)==1);
assert(c2->index(n3)==2);
// c2->set_neighbors();
// assert(c2->neighbor(0)==NULL);
// assert(c2->neighbor(1)==NULL);
// assert(c2->neighbor(2)==NULL);
// assert(c2->neighbor(3)==NULL);
c2->set_neighbors(n0, n1, n2, n3);
assert(c2->index(n0)==0);
assert(c2->index(n1)==1);

View File

@ -16,12 +16,7 @@ typedef Kernel::Point_3 Point;
typedef boost::tuple<int, Point, int, int, int> IndexedPointWithColorTuple;
// Concurrency
#ifdef CGAL_LINKED_WITH_TBB
typedef CGAL::Parallel_tag Concurrency_tag;
#else
typedef CGAL::Sequential_tag Concurrency_tag;
#endif
typedef CGAL::Parallel_if_available_tag Concurrency_tag;
int main(int argc, char*argv[])
{

View File

@ -17,12 +17,7 @@ typedef Kernel::Vector_3 Vector;
typedef std::pair<Point, Vector> PointVectorPair;
// Concurrency
#ifdef CGAL_LINKED_WITH_TBB
typedef CGAL::Parallel_tag Concurrency_tag;
#else
typedef CGAL::Sequential_tag Concurrency_tag;
#endif
typedef CGAL::Parallel_if_available_tag Concurrency_tag;
int main(int argc, char*argv[])
{

View File

@ -18,12 +18,7 @@ typedef Kernel::Point_3 Point;
typedef CGAL::Random_points_on_sphere_3<Point> Generator;
// Concurrency
#ifdef CGAL_LINKED_WITH_TBB
typedef CGAL::Parallel_tag Concurrency_tag;
#else
typedef CGAL::Sequential_tag Concurrency_tag;
#endif
typedef CGAL::Parallel_if_available_tag Concurrency_tag;
// instance of std::function<bool(double)>
struct Progress_to_std_cerr_callback

View File

@ -16,12 +16,7 @@ typedef Kernel::Vector_3 Vector;
typedef std::pair<Point, Vector> PointVectorPair;
// Concurrency
#ifdef CGAL_LINKED_WITH_TBB
typedef CGAL::Parallel_tag Concurrency_tag;
#else
typedef CGAL::Sequential_tag Concurrency_tag;
#endif
typedef CGAL::Parallel_if_available_tag Concurrency_tag;
int main(int argc, char* argv[])
{

View File

@ -8,12 +8,7 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::Point_3 Point;
// Concurrency
#ifdef CGAL_LINKED_WITH_TBB
typedef CGAL::Parallel_tag Concurrency_tag;
#else
typedef CGAL::Sequential_tag Concurrency_tag;
#endif
typedef CGAL::Parallel_if_available_tag Concurrency_tag;
int main(void)
{

View File

@ -48,12 +48,7 @@ typedef std::pair<Point, Vector> PointVectorPair;
typedef std::vector<PointVectorPair> PointList;
// Concurrency
#ifdef CGAL_LINKED_WITH_TBB
typedef CGAL::Parallel_tag Concurrency_tag;
#else
typedef CGAL::Sequential_tag Concurrency_tag;
#endif
typedef CGAL::Parallel_if_available_tag Concurrency_tag;
// ----------------------------------------------------------------------------
// Private functions

View File

@ -18,11 +18,7 @@ typedef Kernel::Vector_3 Vector;
typedef std::pair<Point, Vector> PointVectorPair;
// Concurrency
#ifdef CGAL_LINKED_WITH_TBB
typedef CGAL::Parallel_tag Concurrency_tag;
#else
typedef CGAL::Sequential_tag Concurrency_tag;
#endif
typedef CGAL::Parallel_if_available_tag Concurrency_tag;
int main(int argc, char*argv[])
{

View File

@ -12,11 +12,7 @@
#include <fstream>
// Concurrency
#ifdef CGAL_LINKED_WITH_TBB
typedef CGAL::Parallel_tag Concurrency_tag;
#else
typedef CGAL::Sequential_tag Concurrency_tag;
#endif
typedef CGAL::Parallel_if_available_tag Concurrency_tag;
// Types
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;

View File

@ -1,7 +1,6 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/IO/read_xyz_points.h>
#include <CGAL/IO/write_xyz_points.h>
#include <CGAL/Point_with_normal_3.h>
#include <CGAL/property_map.h>
#include <CGAL/Shape_detection/Efficient_RANSAC.h>

View File

@ -12,11 +12,7 @@ typedef CGAL::Simple_cartesian<double> Kernel;
typedef Kernel::Point_3 Point;
// Concurrency
#ifdef CGAL_LINKED_WITH_TBB
typedef CGAL::Parallel_tag Concurrency_tag;
#else
typedef CGAL::Sequential_tag Concurrency_tag;
#endif
typedef CGAL::Parallel_if_available_tag Concurrency_tag;
int main(int argc, char** argv)
{

View File

@ -16,6 +16,7 @@
#include <CGAL/disable_warnings.h>
#include <CGAL/number_type_config.h>
#include <CGAL/Search_traits_3.h>
#include <CGAL/Orthogonal_k_neighbor_search.h>
#include <CGAL/Point_set_processing_3/internal/neighbor_query.h>
@ -38,11 +39,12 @@
#include <CGAL/property_map.h>
#ifdef CGAL_LINKED_WITH_TBB
#include <CGAL/Point_set_processing_3/internal/Parallel_callback.h>
#include <tbb/parallel_for.h>
#include <tbb/blocked_range.h>
#include <tbb/scalable_allocator.h>
#include <tbb/atomic.h>
#include <atomic>
#endif // CGAL_LINKED_WITH_TBB
// Default allocator: use TBB allocators if available
@ -143,7 +145,7 @@ compute_denoise_projection(
FT project_weight_sum = FT(0.0);
Vector normal_sum = CGAL::NULL_VECTOR;
FT cos_sigma = cos(sharpness_angle / 180.0 * 3.1415926);
FT cos_sigma = cos(sharpness_angle * CGAL_PI / 180.0);
FT sharpness_bandwidth = std::pow((CGAL::max)(1e-8, 1 - cos_sigma), 2);
typename std::vector<Pwn,CGAL_PSP3_DEFAULT_ALLOCATOR<Pwn> >::const_iterator
@ -349,9 +351,8 @@ public:
\pre Normals must be unit vectors
\pre k >= 2
\tparam ConcurrencyTag enables sequential versus parallel algorithm.
Possible values are `Sequential_tag`
And `Parallel_tag`.
\tparam ConcurrencyTag enables sequential versus parallel algorithm. Possible values are `Sequential_tag`,
`Parallel_tag`, and `Parallel_if_available_tag`.
\tparam PointRange is a model of `Range`. The value type of
its iterator is the key type of the named parameter `point_map`.

View File

@ -150,9 +150,8 @@ compute_average_spacing(const typename Kernel::Point_3& query, ///< 3D point who
\pre `k >= 2.`
\tparam ConcurrencyTag enables sequential versus parallel algorithm.
Possible values are `Sequential_tag`
and `Parallel_tag`.
\tparam ConcurrencyTag enables sequential versus parallel algorithm. Possible values are `Sequential_tag`,
`Parallel_tag`, and `Parallel_if_available_tag`.
\tparam PointRange is a model of `ConstRange`. The value type of
its iterator is the key type of the named parameter `point_map`.

View File

@ -280,8 +280,8 @@ update_new_point(
Normals of points are required as input. For more details, please refer to \cgalCite{ear-2013}.
\tparam ConcurrencyTag enables sequential versus parallel versions
of `compute_average_spacing()` (called internally). Possible
values are `Sequential_tag` and `Parallel_tag`.
of `compute_average_spacing()` (called internally). Possible
values are `Sequential_tag`, `Parallel_tag`, and `Parallel_if_available_tag`.
\tparam PointRange is a model of `ConstRange`. The value type of
its iterator is the key type of the named parameter `point_map`.
\tparam OutputIterator Type of the output iterator.

View File

@ -152,9 +152,8 @@ jet_estimate_normal(const typename Kernel::Point_3& query, ///< point to compute
\pre `k >= 2`
\tparam ConcurrencyTag enables sequential versus parallel algorithm.
Possible values are `Sequential_tag`
and `Parallel_tag`.
\tparam ConcurrencyTag enables sequential versus parallel algorithm. Possible values are `Sequential_tag`,
`Parallel_tag`, and `Parallel_if_available_tag`.
\tparam PointRange is a model of `Range`. The value type of
its iterator is the key type of the named parameter `point_map`.

View File

@ -156,9 +156,8 @@ jet_smooth_point(
\pre `k >= 2`
\tparam ConcurrencyTag enables sequential versus parallel algorithm.
Possible values are `Sequential_tag`
and `Parallel_tag`.
\tparam ConcurrencyTag enables sequential versus parallel algorithm. Possible values are `Sequential_tag`,
`Parallel_tag`, and `Parallel_if_available_tag`.
\tparam PointRange is a model of `Range`. The value type of
its iterator is the key type of the named parameter `point_map`.

View File

@ -142,9 +142,8 @@ pca_estimate_normal(const typename Kernel::Point_3& query, ///< point to compute
\pre `k >= 2`
\tparam ConcurrencyTag enables sequential versus parallel algorithm.
Possible values are `Sequential_tag`
and `Parallel_tag`.
\tparam ConcurrencyTag enables sequential versus parallel algorithm. Possible values are `Sequential_tag`,
`Parallel_tag`, and `Parallel_if_available_tag`.
\tparam PointRange is a model of `Range`. The value type of
its iterator is the key type of the named parameter `point_map`.

View File

@ -411,9 +411,8 @@ public:
See the <a href="https://www.threadingbuildingblocks.org/documentation">TBB documentation</a>
for more details.
\tparam ConcurrencyTag enables sequential versus parallel algorithm.
Possible values are `Sequential_tag`
and `Parallel_tag`.
\tparam ConcurrencyTag enables sequential versus parallel algorithm. Possible values are `Sequential_tag`,
`Parallel_tag`, and `Parallel_if_available_tag`.
\tparam PointRange is a model of `Range`. The value type of
its iterator is the key type of the named parameter `point_map`.
\tparam OutputIterator Type of the output iterator.

View File

@ -33,12 +33,7 @@ typedef Kernel::FT FT;
typedef Kernel::Point_3 Point;
// Concurrency
#ifdef CGAL_LINKED_WITH_TBB
typedef CGAL::Parallel_tag Concurrency_tag;
#else
typedef CGAL::Sequential_tag Concurrency_tag;
#endif
typedef CGAL::Parallel_if_available_tag Concurrency_tag;
// ----------------------------------------------------------------------------
// Tests

View File

@ -36,12 +36,7 @@ typedef Kernel::Vector_3 Vector;
typedef std::pair<Point, Vector> PointVectorPair;
// Concurrency
#ifdef CGAL_LINKED_WITH_TBB
typedef CGAL::Parallel_tag Concurrency_tag;
#else
typedef CGAL::Sequential_tag Concurrency_tag;
#endif
typedef CGAL::Parallel_if_available_tag Concurrency_tag;
// ----------------------------------------------------------------------------
// Tests

View File

@ -45,12 +45,7 @@ typedef CGAL::Point_with_normal_3<Kernel> Point_with_normal; // position + norma
typedef std::vector<Point_with_normal> PointList;
// Concurrency
#ifdef CGAL_LINKED_WITH_TBB
typedef CGAL::Parallel_tag Concurrency_tag;
#else
typedef CGAL::Sequential_tag Concurrency_tag;
#endif
typedef CGAL::Parallel_if_available_tag Concurrency_tag;
// ----------------------------------------------------------------------------
// Tests

View File

@ -36,11 +36,7 @@ typedef Kernel::Point_3 Point;
typedef Kernel::Vector_3 Vector;
// Concurrency
#ifdef CGAL_LINKED_WITH_TBB
typedef CGAL::Parallel_tag Concurrency_tag;
#else
typedef CGAL::Sequential_tag Concurrency_tag;
#endif
typedef CGAL::Parallel_if_available_tag Concurrency_tag;
// ----------------------------------------------------------------------------
// Tests

View File

@ -20,7 +20,6 @@
#include <CGAL/Poisson_implicit_surface_3.h>
#include <CGAL/IO/facets_in_complex_2_to_triangle_mesh.h>
#include <CGAL/Poisson_reconstruction_function.h>
#include <CGAL/Point_with_normal_3.h>
#include <CGAL/IO/read_xyz_points.h>
#include <CGAL/compute_average_spacing.h>
#include <CGAL/Polygon_mesh_processing/compute_normal.h>
@ -41,7 +40,7 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::FT FT;
typedef Kernel::Point_3 Point;
typedef Kernel::Vector_3 Vector;
typedef CGAL::Point_with_normal_3<Kernel> Point_with_normal;
typedef std::pair<Point, Vector> Point_with_normal;
typedef Kernel::Sphere_3 Sphere;
typedef std::deque<Point_with_normal> PointList;
@ -178,7 +177,7 @@ int main(int argc, char * argv[])
vertices(input_mesh)){
const Point& p = v->point();
Vector n = CGAL::Polygon_mesh_processing::compute_vertex_normal(v,input_mesh);
points.push_back(Point_with_normal(p,n));
points.push_back(std::make_pair(p,n));
}
}
// If XYZ file format
@ -188,14 +187,14 @@ int main(int argc, char * argv[])
// Reads the point set file in points[].
// Note: read_xyz_points_and_normals() requires an iterator over points
// + property maps to access each point's position and normal.
// The position property map can be omitted here as we use iterators over Point_3 elements.
std::ifstream stream(input_filename.c_str());
if (!stream ||
!CGAL::read_xyz_points(
stream,
std::back_inserter(points),
CGAL::parameters::normal_map
(CGAL::make_normal_of_point_with_normal_map(PointList::value_type()))))
CGAL::parameters::point_map
(CGAL::make_first_of_pair_property_map(Point_with_normal())).
normal_map (CGAL::make_second_of_pair_property_map(Point_with_normal()))))
{
std::cerr << "Error: cannot read file " << input_filename << std::endl;
return EXIT_FAILURE;
@ -224,7 +223,7 @@ int main(int argc, char * argv[])
return EXIT_FAILURE;
}
bool points_have_normals = (points.begin()->normal() != CGAL::NULL_VECTOR);
bool points_have_normals = (points.begin()->second != CGAL::NULL_VECTOR);
if ( ! points_have_normals )
{
std::cerr << "Input point set not supported: this reconstruction method requires oriented normals" << std::endl;
@ -247,11 +246,10 @@ int main(int argc, char * argv[])
// Creates implicit function from the read points.
// Note: this method requires an iterator over points
// + property maps to access each point's position and normal.
// The position property map can be omitted here as we use iterators over Point_3 elements.
Poisson_reconstruction_function function(
points.begin(), points.end(),
CGAL::make_identity_property_map(PointList::value_type()),
CGAL::make_normal_of_point_with_normal_map(PointList::value_type()),
CGAL::make_first_of_pair_property_map(Point_with_normal()),
CGAL::make_second_of_pair_property_map(Point_with_normal()),
visitor);
#ifdef CGAL_EIGEN3_ENABLED
@ -293,7 +291,9 @@ int main(int argc, char * argv[])
std::cerr << "Surface meshing...\n";
// Computes average spacing
FT average_spacing = CGAL::compute_average_spacing<CGAL::Sequential_tag>(points, 6 /* knn = 1 ring */);
FT average_spacing = CGAL::compute_average_spacing<CGAL::Sequential_tag>
(points, 6 /* knn = 1 ring */,
CGAL::parameters::point_map (CGAL::make_first_of_pair_property_map(Point_with_normal())));
// Gets one point inside the implicit surface
Point inner_point = function.get_inner_point();
@ -366,7 +366,7 @@ int main(int argc, char * argv[])
double avg_distance = 0;
for (PointList::const_iterator p=points.begin(); p!=points.end(); p++)
{
double distance = std::sqrt(tree.squared_distance(*p));
double distance = std::sqrt(tree.squared_distance(p->first));
max_distance = (std::max)(max_distance, distance);
avg_distance += distance;

View File

@ -5,13 +5,14 @@
#include <CGAL/Implicit_surface_3.h>
#include <CGAL/IO/facets_in_complex_2_to_triangle_mesh.h>
#include <CGAL/Poisson_reconstruction_function.h>
#include <CGAL/Point_with_normal_3.h>
#include <CGAL/property_map.h>
#include <CGAL/IO/read_xyz_points.h>
#include <CGAL/compute_average_spacing.h>
#include <CGAL/Polygon_mesh_processing/distance.h>
#include <boost/iterator/transform_iterator.hpp>
#include <vector>
#include <fstream>
@ -19,7 +20,10 @@
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::FT FT;
typedef Kernel::Point_3 Point;
typedef CGAL::Point_with_normal_3<Kernel> Point_with_normal;
typedef Kernel::Vector_3 Vector;
typedef std::pair<Point, Vector> Point_with_normal;
typedef CGAL::First_of_pair_property_map<Point_with_normal> Point_map;
typedef CGAL::Second_of_pair_property_map<Point_with_normal> Normal_map;
typedef Kernel::Sphere_3 Sphere;
typedef std::vector<Point_with_normal> PointList;
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
@ -38,14 +42,14 @@ int main(void)
// Reads the point set file in points[].
// Note: read_xyz_points_and_normals() requires an iterator over points
// + property maps to access each point's position and normal.
// The position property map can be omitted here as we use iterators over Point_3 elements.
PointList points;
std::ifstream stream("data/kitten.xyz");
if (!stream ||
!CGAL::read_xyz_points(
stream,
std::back_inserter(points),
CGAL::parameters::normal_map(CGAL::make_normal_of_point_with_normal_map(PointList::value_type()))))
CGAL::parameters::point_map (Point_map()).
normal_map (Normal_map())))
{
std::cerr << "Error: cannot read file data/kitten.xyz" << std::endl;
return EXIT_FAILURE;
@ -55,9 +59,7 @@ int main(void)
// Note: this method requires an iterator over points
// + property maps to access each point's position and normal.
// The position property map can be omitted here as we use iterators over Point_3 elements.
Poisson_reconstruction_function function(points.begin(), points.end(),
CGAL::make_normal_of_point_with_normal_map(PointList::value_type()) );
Poisson_reconstruction_function function(points.begin(), points.end(), Point_map(), Normal_map());
// Computes the Poisson indicator function f()
// at each vertex of the triangulation.
@ -65,7 +67,9 @@ int main(void)
return EXIT_FAILURE;
// Computes average spacing
FT average_spacing = CGAL::compute_average_spacing<CGAL::Sequential_tag>(points, 6 /* knn = 1 ring */);
FT average_spacing = CGAL::compute_average_spacing<CGAL::Sequential_tag>
(points, 6 /* knn = 1 ring */,
CGAL::parameters::point_map (Point_map()));
// Gets one point inside the implicit surface
// and computes implicit function bounding sphere radius.
@ -107,9 +111,13 @@ int main(void)
/// [PMP_distance_snippet]
// computes the approximation error of the reconstruction
double max_dist =
CGAL::Polygon_mesh_processing::approximate_max_distance_to_point_set(output_mesh,
points,
4000);
CGAL::Polygon_mesh_processing::approximate_max_distance_to_point_set
(output_mesh,
CGAL::make_range (boost::make_transform_iterator
(points.begin(), CGAL::Property_map_to_unary_function<Point_map>()),
boost::make_transform_iterator
(points.end(), CGAL::Property_map_to_unary_function<Point_map>())),
4000);
std::cout << "Max distance to point_set: " << max_dist << std::endl;
/// [PMP_distance_snippet]

View File

@ -412,10 +412,13 @@ one incident non-null face) after each hole filling step.
Holes are filled one after the other, and the process stops when there is no border edge left.
This process is illustrated by the example below, where holes are
iteratively filled, refined and faired to get a faired mesh with no hole.
iteratively filled, refined and faired. Optionally, only holes
not exceeding a certain diameter or number of edges can be filled.
This example assumes that the mesh is stored in a `Surface_mesh`
datastructure. Analogous examples when using the `Polyhedron_3`
class and a few others are part of the code base.
\cgalExample{Polygon_mesh_processing/hole_filling_example.cpp}
\cgalExample{Polygon_mesh_processing/hole_filling_example_SM.cpp}
\cgalFigureBegin{Triangulated_fork, fork.jpg}
Holes in the fork model are filled with triangle patches.

View File

@ -2,6 +2,7 @@
\example Polygon_mesh_processing/self_intersections_example.cpp
\example Polygon_mesh_processing/hole_filling_example.cpp
\example Polygon_mesh_processing/hole_filling_example_SM.cpp
\example Polygon_mesh_processing/stitch_borders_example.cpp
\example Polygon_mesh_processing/compute_normals_example.cpp
\example Polygon_mesh_processing/point_inside_example.cpp

View File

@ -109,6 +109,7 @@ endif(OpenMesh_FOUND)
find_package( TBB )
if( TBB_FOUND )
CGAL_target_use_TBB(self_intersections_example)
CGAL_target_use_TBB(hausdorff_distance_remeshing_example)
else()
message( STATUS "NOTICE: Intel TBB was not found. Sequential code will be used." )

View File

@ -34,6 +34,7 @@ int main(int argc, char* argv[])
<< num_vertices(mesh2) << "\n";
std::ofstream output("mesh1_refined.off");
output.precision(17);
CGAL::write_off(output, mesh1);
output.close();
output.open("mesh2_refined.off");

View File

@ -41,6 +41,7 @@ int main(int argc, char* argv[])
<< num_vertices(mesh2) << "\n";
std::ofstream output("mesh1_refined.off");
output.precision(17);
output << mesh1;
output.close();
output.open("mesh2_refined.off");

View File

@ -136,6 +136,7 @@ int main(int argc, char* argv[])
{
std::cout << "Intersection and union were successfully computed\n";
std::ofstream output("inter_union.off");
output.precision(17);
output << mesh2;
return 0;
}

View File

@ -67,6 +67,7 @@ int main(int argc, char* argv[])
{
std::cout << "Difference was successfully computed\n";
std::ofstream output("difference.off");
output.precision(17);
output << mesh1;
}
else{
@ -111,6 +112,7 @@ int main(int argc, char* argv[])
params::edge_is_constrained_map(is_constrained_map) );
std::ofstream output("difference_remeshed.off");
output.precision(17);
output << mesh1;
return 0;

View File

@ -37,6 +37,7 @@ int main(int argc, char* argv[])
{
std::cout << "Union was successfully computed\n";
std::ofstream output("union.off");
output.precision(17);
output << out;
return 0;
}

View File

@ -55,6 +55,7 @@ int main(int argc, char* argv[])
{
std::cout << "Union was successfully computed\n";
std::ofstream output("union.off");
output.precision(17);
output << out_union;
}
else
@ -64,6 +65,7 @@ int main(int argc, char* argv[])
{
std::cout << "Intersection was successfully computed\n";
std::ofstream output("intersection.off");
output.precision(17);
output << out_intersection;
}
else

View File

@ -94,6 +94,7 @@ int main(int argc, char* argv[])
{
std::cout << "Union was successfully computed\n";
std::ofstream output("union.off");
output.precision(17);
output << out;
return 0;
}

View File

@ -39,6 +39,7 @@ int main(int argc, char* argv[])
{
std::cout << "Union was successfully computed\n";
std::ofstream output("union.off");
output.precision(17);
output << out;
return 0;
}

View File

@ -3,11 +3,7 @@
#include <CGAL/Polygon_mesh_processing/distance.h>
#include <CGAL/Polygon_mesh_processing/remesh.h>
#if defined(CGAL_LINKED_WITH_TBB)
#define TAG CGAL::Parallel_tag
#else
#define TAG CGAL::Sequential_tag
#endif
#define TAG CGAL::Parallel_if_available_tag
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef K::Point_3 Point;

Some files were not shown because too many files have changed in this diff Show More