mirror of https://github.com/CGAL/cgal
Merge remote-tracking branch 'cgal/master' into Testsuite-Filter_testsuite-maxGimeno
This commit is contained in:
commit
78461e0b45
|
|
@ -3,7 +3,7 @@ sudo add-apt-repository ppa:mikhailnov/pulseeffects -y
|
|||
sudo apt-get update
|
||||
sudo apt-get install -y libmpfr-dev \
|
||||
libeigen3-dev qtbase5-dev libqt5sql5-sqlite libqt5opengl5-dev qtscript5-dev \
|
||||
libqt5svg5-dev qttools5-dev qttools5-dev-tools libboost1.72-dev zsh
|
||||
libqt5svg5-dev qttools5-dev qttools5-dev-tools libboost-dev libinsighttoolkit4-dev zsh
|
||||
#update cmake to 3.18.4
|
||||
sudo apt purge --auto-remove cmake
|
||||
cd /tmp
|
||||
|
|
|
|||
|
|
@ -527,6 +527,36 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
template <class Query, class Traversal_traits>
|
||||
void traversal_with_priority(const Query& query, Traversal_traits& traits) const
|
||||
{
|
||||
switch(size())
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
traits.intersection(query, singleton_data());
|
||||
break;
|
||||
default: // if(size() >= 2)
|
||||
root_node()->template traversal_with_priority<Traversal_traits,Query>(query, traits, m_primitives.size());
|
||||
}
|
||||
}
|
||||
|
||||
template <class Query, class Traversal_traits>
|
||||
void traversal_with_priority_and_group_traversal(const Query& query, Traversal_traits& traits, const std::size_t group_traversal_bound) const
|
||||
{
|
||||
switch(size())
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
traits.intersection(query, singleton_data());
|
||||
break;
|
||||
default: // if(size() >= 2)
|
||||
root_node()->template traversal_with_priority_and_group_traversal(m_primitives, query, traits, m_primitives.size(), 0, group_traversal_bound);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
typedef AABB_node<AABBTraits> Node;
|
||||
|
||||
|
|
|
|||
|
|
@ -68,6 +68,20 @@ public:
|
|||
Traversal_traits& traits,
|
||||
const std::size_t nb_primitives) const;
|
||||
|
||||
template<class Traversal_traits, class Query>
|
||||
void traversal_with_priority(const Query& query,
|
||||
Traversal_traits& traits,
|
||||
const std::size_t nb_primitives) const;
|
||||
|
||||
template<class Primitive_vector, class Traversal_traits, class Query>
|
||||
void traversal_with_priority_and_group_traversal(const Primitive_vector& primitives,
|
||||
const Query& query,
|
||||
Traversal_traits& traits,
|
||||
const std::size_t nb_primitives,
|
||||
std::size_t first_primitive_index,
|
||||
const std::size_t group_size_bound) const;
|
||||
|
||||
|
||||
private:
|
||||
typedef AABBTraits AABB_traits;
|
||||
typedef AABB_node<AABB_traits> Node;
|
||||
|
|
@ -152,6 +166,156 @@ AABB_node<Tr>::traversal(const Query& query,
|
|||
}
|
||||
}
|
||||
|
||||
template<typename Tr>
|
||||
template<class Traversal_traits, class Query>
|
||||
void
|
||||
AABB_node<Tr>::traversal_with_priority(const Query& query,
|
||||
Traversal_traits& traits,
|
||||
const std::size_t nb_primitives) const
|
||||
{
|
||||
// Recursive traversal
|
||||
switch(nb_primitives)
|
||||
{
|
||||
case 2:
|
||||
traits.intersection(query, left_data());
|
||||
if( traits.go_further() )
|
||||
{
|
||||
traits.intersection(query, right_data());
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
traits.intersection(query, left_data());
|
||||
if( traits.go_further() && traits.do_intersect(query, right_child()) )
|
||||
{
|
||||
right_child().traversal_with_priority(query, traits, 2);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
bool ileft, iright;
|
||||
typename Traversal_traits::Priority pleft, pright;
|
||||
std::tie(ileft, pleft) = traits.do_intersect_with_priority(query, left_child());
|
||||
std::tie(iright, pright) = traits.do_intersect_with_priority(query, right_child());
|
||||
CGAL_precondition( (ileft || iright) ? traits.do_intersect(query, *this) : true );
|
||||
|
||||
if(ileft)
|
||||
{
|
||||
if(iright)
|
||||
{
|
||||
// Both children have to be inspected.
|
||||
if(pleft >= pright)
|
||||
{
|
||||
// Inspect the left child first, has higher priority.
|
||||
left_child().traversal_with_priority(query, traits, nb_primitives/2);
|
||||
if( traits.go_further() )
|
||||
right_child().traversal_with_priority(query, traits, nb_primitives-nb_primitives/2);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Inspect the right child first, has higher priority.
|
||||
right_child().traversal_with_priority(query, traits, nb_primitives-nb_primitives/2);
|
||||
if( traits.go_further() )
|
||||
left_child().traversal_with_priority(query, traits, nb_primitives/2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Only the left child has to be inspected.
|
||||
left_child().traversal_with_priority(query, traits, nb_primitives/2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(iright)
|
||||
{
|
||||
// Only the right child has to be inspected.
|
||||
right_child().traversal_with_priority(query, traits, nb_primitives-nb_primitives/2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: find a better name
|
||||
template<typename Tr>
|
||||
template<class Primitive_vector, class Traversal_traits, class Query>
|
||||
void
|
||||
AABB_node<Tr>::traversal_with_priority_and_group_traversal(const Primitive_vector& primitives,
|
||||
const Query& query,
|
||||
Traversal_traits& traits,
|
||||
const std::size_t nb_primitives,
|
||||
std::size_t first_primitive_index,
|
||||
const std::size_t group_traversal_bound) const
|
||||
{
|
||||
// Group traversal
|
||||
CGAL_assertion(group_traversal_bound >= 2);
|
||||
if ( nb_primitives <= group_traversal_bound )
|
||||
{
|
||||
if ( !traits.do_intersect(query, *this) ) return;
|
||||
CGAL_assertion(traits.do_intersect(query, *this));
|
||||
traits.traverse_group(query, primitives.begin()+first_primitive_index, primitives.begin()+first_primitive_index+nb_primitives);
|
||||
return;
|
||||
}
|
||||
|
||||
// Recursive traversal
|
||||
switch(nb_primitives)
|
||||
{
|
||||
case 2:
|
||||
traits.intersection(query, left_data());
|
||||
if( traits.go_further() )
|
||||
{
|
||||
traits.intersection(query, right_data());
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
traits.intersection(query, left_data());
|
||||
if( traits.go_further() && traits.do_intersect(query, right_child()) )
|
||||
{
|
||||
right_child().traversal_with_priority_and_group_traversal(primitives, query, traits, 2, first_primitive_index+1, group_traversal_bound);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
bool ileft, iright;
|
||||
typename Traversal_traits::Priority pleft, pright;
|
||||
std::tie(ileft, pleft) = traits.do_intersect_with_priority(query, left_child());
|
||||
std::tie(iright, pright) = traits.do_intersect_with_priority(query, right_child());
|
||||
CGAL_precondition( (ileft || iright) ? traits.do_intersect(query, *this) : true );
|
||||
|
||||
if(ileft)
|
||||
{
|
||||
if(iright)
|
||||
{
|
||||
// Both children have to be inspected.
|
||||
if(pleft >= pright)
|
||||
{
|
||||
// Inspect the left child first, has higher priority.
|
||||
left_child().traversal_with_priority_and_group_traversal(primitives, query, traits, nb_primitives/2, first_primitive_index, group_traversal_bound);
|
||||
if( traits.go_further() )
|
||||
right_child().traversal_with_priority_and_group_traversal(primitives, query, traits, nb_primitives-nb_primitives/2, first_primitive_index+nb_primitives/2, group_traversal_bound);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Inspect the right child first, has higher priority.
|
||||
right_child().traversal_with_priority_and_group_traversal(primitives, query, traits, nb_primitives-nb_primitives/2, first_primitive_index+nb_primitives/2, group_traversal_bound);
|
||||
if( traits.go_further() )
|
||||
left_child().traversal_with_priority_and_group_traversal(primitives, query, traits, nb_primitives/2, first_primitive_index, group_traversal_bound);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Only the left child has to be inspected.
|
||||
left_child().traversal_with_priority_and_group_traversal(primitives, query, traits, nb_primitives/2, first_primitive_index, group_traversal_bound);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(iright)
|
||||
{
|
||||
// Only the right child has to be inspected.
|
||||
right_child().traversal_with_priority_and_group_traversal(primitives, query, traits, nb_primitives-nb_primitives/2, first_primitive_index+nb_primitives/2, group_traversal_bound);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // end namespace CGAL
|
||||
|
||||
#endif // CGAL_AABB_NODE_H
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@
|
|||
#include <boost/optional.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/variant/apply_visitor.hpp>
|
||||
#if BOOST_VERSION >= 105000
|
||||
# if defined(BOOST_MSVC)
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4996)
|
||||
|
|
@ -30,9 +29,6 @@
|
|||
# if defined(BOOST_MSVC)
|
||||
# pragma warning(pop)
|
||||
# endif
|
||||
#else
|
||||
# include <queue>
|
||||
#endif
|
||||
|
||||
#include <CGAL/assertions.h>
|
||||
|
||||
|
|
@ -54,11 +50,7 @@ public:
|
|||
// BVH_node::traversal this is done through the function parameter
|
||||
// nb_primitives in the recursion.
|
||||
typedef
|
||||
#if BOOST_VERSION >= 105000
|
||||
boost::heap::priority_queue< Node_ptr_with_ft, boost::heap::compare< std::greater<Node_ptr_with_ft> > >
|
||||
#else
|
||||
std::priority_queue< Node_ptr_with_ft>
|
||||
#endif
|
||||
Heap_type;
|
||||
|
||||
typename AABB_traits::Intersection
|
||||
|
|
@ -167,14 +159,8 @@ private:
|
|||
const Node* node;
|
||||
size_type nb_primitives;
|
||||
FT value;
|
||||
#if BOOST_VERSION >= 105000
|
||||
bool operator<(const Node_ptr_with_ft& other) const { return value < other.value; }
|
||||
bool operator>(const Node_ptr_with_ft& other) const { return value > other.value; }
|
||||
#else
|
||||
bool operator>(const Node_ptr_with_ft& other) const { return value < other.value; }
|
||||
bool operator<(const Node_ptr_with_ft& other) const { return value > other.value; }
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
struct as_ray_param_visitor {
|
||||
|
|
|
|||
|
|
@ -338,6 +338,7 @@ void test_algebraic_structure_intern( const CGAL::Field_tag& ) {
|
|||
test_algebraic_structure_intern< AS >( CGAL::Integral_domain_tag());
|
||||
AS a(1);
|
||||
AS b(3);
|
||||
AS& b_ref = b; b = b_ref; // to exercise self-copy
|
||||
AS c = a / b;
|
||||
(void)c; // avoid warnings for unused variables
|
||||
|
||||
|
|
|
|||
|
|
@ -44,20 +44,12 @@ public:
|
|||
using Base::f;
|
||||
|
||||
protected:
|
||||
#if defined(__POWERPC__) && \
|
||||
defined(__GNUC__) && (__GNUC__ == 3 ) && (__GNUC_MINOR__ == 4)
|
||||
// hack to avoid nasty warning for G++ 3.4 on Darwin
|
||||
static FT OFFSET()
|
||||
{
|
||||
return FT(10000);
|
||||
}
|
||||
#else
|
||||
|
||||
static const FT& OFFSET()
|
||||
{
|
||||
static const FT offset_(10000);
|
||||
return offset_;
|
||||
}
|
||||
#endif
|
||||
|
||||
template< class Stream >
|
||||
inline
|
||||
|
|
|
|||
|
|
@ -122,15 +122,10 @@ public:
|
|||
#if defined(__SUNPRO_CC) || defined(__PGI) || defined(__INTEL_COMPILER)
|
||||
friend class Trapezoidal_decomposition_2<Traits>::Around_point_circulator;
|
||||
friend class Trapezoidal_decomposition_2<Traits>::In_face_iterator;
|
||||
#elif defined(__GNUC__)
|
||||
#elif (__GNUC__ > 0)
|
||||
|
||||
#if ((__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ <= 2)))
|
||||
friend typename Trapezoidal_decomposition_2<Traits>::Around_point_circulator;
|
||||
friend typename Trapezoidal_decomposition_2<Traits>::In_face_iterator;
|
||||
#else
|
||||
friend class Trapezoidal_decomposition_2<Traits>::Around_point_circulator;
|
||||
friend class Trapezoidal_decomposition_2<Traits>::In_face_iterator;
|
||||
#endif
|
||||
|
||||
#else
|
||||
friend class Around_point_circulator;
|
||||
|
|
|
|||
|
|
@ -94,14 +94,8 @@ public:
|
|||
#ifdef CGAL_PM_FRIEND_CLASS
|
||||
#if defined(__SUNPRO_CC) || defined(__PGI) || defined(__INTEL_COMPILER)
|
||||
friend class Trapezoidal_decomposition_2<Traits>::In_face_iterator;
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
#if ((__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ <= 2)))
|
||||
friend typename Trapezoidal_decomposition_2<Traits>::In_face_iterator;
|
||||
#else
|
||||
#elif (__GNUC__ > 0)
|
||||
friend class Trapezoidal_decomposition_2<Traits>::In_face_iterator;
|
||||
#endif
|
||||
|
||||
#else
|
||||
friend class In_face_iterator;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -94,14 +94,8 @@ public:
|
|||
#ifdef CGAL_PM_FRIEND_CLASS
|
||||
#if defined(__SUNPRO_CC) || defined(__PGI) || defined(__INTEL_COMPILER)
|
||||
friend class Trapezoidal_decomposition_2<Traits>::In_face_iterator;
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
#if ((__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ <= 2)))
|
||||
friend typename Trapezoidal_decomposition_2<Traits>::In_face_iterator;
|
||||
#else
|
||||
#elif (__GNUC__ > 0)
|
||||
friend class Trapezoidal_decomposition_2<Traits>::In_face_iterator;
|
||||
#endif
|
||||
|
||||
#else
|
||||
friend class In_face_iterator;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -91,14 +91,8 @@ public:
|
|||
#ifdef CGAL_PM_FRIEND_CLASS
|
||||
#if defined(__SUNPRO_CC) || defined(__PGI) || defined(__INTEL_COMPILER)
|
||||
friend class Trapezoidal_decomposition_2<Traits>::In_face_iterator;
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
#if ((__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ <= 2)))
|
||||
friend typename Trapezoidal_decomposition_2<Traits>::In_face_iterator;
|
||||
#else
|
||||
#elif (__GNUC__ > 0)
|
||||
friend class Trapezoidal_decomposition_2<Traits>::In_face_iterator;
|
||||
#endif
|
||||
|
||||
#else
|
||||
friend class In_face_iterator;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -96,14 +96,8 @@ public:
|
|||
#ifdef CGAL_PM_FRIEND_CLASS
|
||||
#if defined(__SUNPRO_CC) || defined(__PGI) || defined(__INTEL_COMPILER)
|
||||
friend class Trapezoidal_decomposition_2<Traits>::In_face_iterator;
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
#if ((__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ <= 2)))
|
||||
friend typename Trapezoidal_decomposition_2<Traits>::In_face_iterator;
|
||||
#else
|
||||
#elif (__GNUC__ > 0)
|
||||
friend class Trapezoidal_decomposition_2<Traits>::In_face_iterator;
|
||||
#endif
|
||||
|
||||
#else
|
||||
friend class In_face_iterator;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -93,14 +93,8 @@ public:
|
|||
#ifdef CGAL_PM_FRIEND_CLASS
|
||||
#if defined(__SUNPRO_CC) || defined(__PGI) || defined(__INTEL_COMPILER)
|
||||
friend class Trapezoidal_decomposition_2<Traits>::In_face_iterator;
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
#if ((__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ <= 2)))
|
||||
friend typename Trapezoidal_decomposition_2<Traits>::In_face_iterator;
|
||||
#else
|
||||
#elif (__GNUC__ > 0)
|
||||
friend class Trapezoidal_decomposition_2<Traits>::In_face_iterator;
|
||||
#endif
|
||||
|
||||
#else
|
||||
friend class In_face_iterator;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -96,14 +96,8 @@ public:
|
|||
#ifdef CGAL_PM_FRIEND_CLASS
|
||||
#if defined(__SUNPRO_CC) || defined(__PGI) || defined(__INTEL_COMPILER)
|
||||
friend class Trapezoidal_decomposition_2<Traits>::In_face_iterator;
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
#if ((__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ <= 2)))
|
||||
friend typename Trapezoidal_decomposition_2<Traits>::In_face_iterator;
|
||||
#else
|
||||
#elif (__GNUC__ > 0)
|
||||
friend class Trapezoidal_decomposition_2<Traits>::In_face_iterator;
|
||||
#endif
|
||||
|
||||
#else
|
||||
friend class In_face_iterator;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -92,14 +92,8 @@ public:
|
|||
#ifdef CGAL_PM_FRIEND_CLASS
|
||||
#if defined(__SUNPRO_CC) || defined(__PGI) || defined(__INTEL_COMPILER)
|
||||
friend class Trapezoidal_decomposition_2<Traits>::In_face_iterator;
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
#if ((__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ <= 2)))
|
||||
friend typename Trapezoidal_decomposition_2<Traits>::In_face_iterator;
|
||||
#else
|
||||
#elif (__GNUC__ > 0)
|
||||
friend class Trapezoidal_decomposition_2<Traits>::In_face_iterator;
|
||||
#endif
|
||||
|
||||
#else
|
||||
friend class In_face_iterator;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -46,9 +46,7 @@
|
|||
#define CGAL_TD_DEFAULT_SIZE_THRESHOLD 12
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#if !defined __GNUC__ || __GNUC__> 3 || ((__GNUC__== 3) && (__GNUC_MINOR__> 4))
|
||||
#define CGAL_PM_FRIEND_CLASS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -738,35 +738,12 @@ public:
|
|||
|
||||
// read values
|
||||
is >> rep._m_xy;
|
||||
#if BOOST_VERSION < 104300
|
||||
// EBEB: This fixes a bug in optional_io.hpp, reported to Fernando on
|
||||
// April 27, 2010, don't know whether the fix makes it into
|
||||
// boost 1_43.
|
||||
if (!rep._m_xy) {
|
||||
swallow(is, '-');
|
||||
}
|
||||
#endif
|
||||
swallow(is, ',');
|
||||
is >> rep._m_x;
|
||||
#if BOOST_VERSION < 104300
|
||||
if (!rep._m_x) {
|
||||
swallow(is, '-');
|
||||
}
|
||||
#endif
|
||||
swallow(is, ',');
|
||||
is >> rep._m_curve;
|
||||
#if BOOST_VERSION < 104300
|
||||
if (!rep._m_curve) {
|
||||
swallow(is, '-');
|
||||
}
|
||||
#endif
|
||||
swallow(is, ',');
|
||||
is >> rep._m_arcno;
|
||||
#if BOOST_VERSION < 104300
|
||||
if (!rep._m_arcno) {
|
||||
swallow(is, '-');
|
||||
}
|
||||
#endif
|
||||
swallow(is, ',');
|
||||
is >> rep._m_location;
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,10 @@
|
|||
#include <boost/range/has_range_iterator.hpp>
|
||||
#include <boost/unordered_set.hpp>
|
||||
|
||||
#include <bitset>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#ifdef DOXYGEN_RUNNING
|
||||
#define CGAL_BGL_NP_TEMPLATE_PARAMETERS NamedParameters
|
||||
#define CGAL_BGL_NP_CLASS NamedParameters
|
||||
|
|
@ -393,21 +397,68 @@ struct Face_filtered_graph
|
|||
///returns a reference to the underlying graph.
|
||||
Graph& graph(){ return _graph; }
|
||||
|
||||
///change the set of selected faces using a patch id
|
||||
template<class FacePatchIndexMap>
|
||||
void set_selected_faces(typename boost::property_traits<FacePatchIndexMap>::value_type face_patch_id,
|
||||
FacePatchIndexMap face_patch_index_map)
|
||||
// Handling of internal correspondency for index maps.
|
||||
// The indices must be kept valid when the selection changes.
|
||||
void initialize_face_indices() const
|
||||
{
|
||||
if(face_indices.empty())
|
||||
{
|
||||
face_index_type index = 0;
|
||||
face_indices.resize(num_faces(_graph));
|
||||
for(std::size_t i=selected_faces.find_first(); i<selected_faces.npos; i=selected_faces.find_next(i))
|
||||
face_indices[i] = index++;
|
||||
}
|
||||
}
|
||||
|
||||
void initialize_vertex_indices() const
|
||||
{
|
||||
if(vertex_indices.empty())
|
||||
{
|
||||
vertex_index_type index = 0;
|
||||
vertex_indices.resize(num_vertices(_graph));
|
||||
for(std::size_t i=selected_vertices.find_first(); i<selected_vertices.npos; i=selected_vertices.find_next(i))
|
||||
vertex_indices[i] = index++;
|
||||
}
|
||||
}
|
||||
|
||||
void initialize_halfedge_indices() const
|
||||
{
|
||||
if(halfedge_indices.empty())
|
||||
{
|
||||
halfedge_index_type index = 0;
|
||||
halfedge_indices.resize(num_halfedges(_graph));
|
||||
for(std::size_t i=selected_halfedges.find_first(); i<selected_halfedges.npos; i=selected_halfedges.find_next(i))
|
||||
halfedge_indices[i] = index++;
|
||||
}
|
||||
}
|
||||
|
||||
void reset_indices()
|
||||
{
|
||||
face_indices.clear();
|
||||
vertex_indices.clear();
|
||||
halfedge_indices.clear();
|
||||
|
||||
if(is_imap_in_use.test(0))
|
||||
initialize_face_indices();
|
||||
if(is_imap_in_use.test(1))
|
||||
initialize_vertex_indices();
|
||||
if(is_imap_in_use.test(2))
|
||||
initialize_halfedge_indices();
|
||||
}
|
||||
|
||||
///change the set of selected faces using a patch id
|
||||
template<class FacePatchIndexMap>
|
||||
void set_selected_faces(typename boost::property_traits<FacePatchIndexMap>::value_type face_patch_id,
|
||||
FacePatchIndexMap face_patch_index_map)
|
||||
{
|
||||
selected_faces.resize(num_faces(_graph));
|
||||
selected_vertices.resize(num_vertices(_graph));
|
||||
selected_halfedges.resize(num_halfedges(_graph));
|
||||
|
||||
selected_faces.reset();
|
||||
selected_vertices.reset();
|
||||
selected_halfedges.reset();
|
||||
|
||||
for(face_descriptor fd : faces(_graph) )
|
||||
{
|
||||
if(get(face_patch_index_map, fd) == face_patch_id)
|
||||
|
|
@ -421,6 +472,8 @@ struct Face_filtered_graph
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
reset_indices();
|
||||
}
|
||||
/// change the set of selected faces using a range of patch ids
|
||||
template<class FacePatchIndexRange, class FacePatchIndexMap>
|
||||
|
|
@ -433,16 +486,14 @@ struct Face_filtered_graph
|
|||
#endif
|
||||
)
|
||||
{
|
||||
face_indices.clear();
|
||||
vertex_indices.clear();
|
||||
halfedge_indices.clear();
|
||||
|
||||
selected_faces.resize(num_faces(_graph));
|
||||
selected_vertices.resize(num_vertices(_graph));
|
||||
selected_halfedges.resize(num_halfedges(_graph));
|
||||
|
||||
selected_faces.reset();
|
||||
selected_vertices.reset();
|
||||
selected_halfedges.reset();
|
||||
|
||||
typedef typename boost::property_traits<FacePatchIndexMap>::value_type Patch_index;
|
||||
boost::unordered_set<Patch_index> pids(boost::begin(selected_face_patch_indices),
|
||||
boost::end(selected_face_patch_indices));
|
||||
|
|
@ -460,21 +511,22 @@ struct Face_filtered_graph
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
reset_indices();
|
||||
}
|
||||
|
||||
/// change the set of selected faces using a range of face descriptors
|
||||
template<class FaceRange>
|
||||
void set_selected_faces(const FaceRange& selection)
|
||||
{
|
||||
face_indices.clear();
|
||||
vertex_indices.clear();
|
||||
halfedge_indices.clear();
|
||||
|
||||
selected_faces.resize(num_faces(_graph));
|
||||
selected_vertices.resize(num_vertices(_graph));
|
||||
selected_halfedges.resize(num_halfedges(_graph));
|
||||
|
||||
selected_faces.reset();
|
||||
selected_vertices.reset();
|
||||
selected_halfedges.reset();
|
||||
|
||||
for(face_descriptor fd : selection)
|
||||
{
|
||||
selected_faces.set(get(fimap, fd));
|
||||
|
|
@ -485,6 +537,8 @@ struct Face_filtered_graph
|
|||
selected_vertices.set(get(vimap, target(hd, _graph)));
|
||||
}
|
||||
}
|
||||
|
||||
reset_indices();
|
||||
}
|
||||
|
||||
struct Is_simplex_valid
|
||||
|
|
@ -543,45 +597,27 @@ struct Face_filtered_graph
|
|||
Property_map_binder<FIM, typename Pointer_property_map<typename boost::property_traits<FIM>::value_type>::type>
|
||||
get_face_index_map() const
|
||||
{
|
||||
if (face_indices.empty())
|
||||
{
|
||||
face_index_type index = 0;
|
||||
face_indices.resize(num_faces(_graph));
|
||||
for (std::size_t i=selected_faces.find_first(); i < selected_faces.npos; i = selected_faces.find_next(i))
|
||||
{
|
||||
face_indices[i] = index++;
|
||||
}
|
||||
}
|
||||
return bind_property_maps(fimap, make_property_map(face_indices) );
|
||||
is_imap_in_use.set(0);
|
||||
initialize_face_indices();
|
||||
|
||||
return bind_property_maps(fimap, make_property_map(face_indices));
|
||||
}
|
||||
|
||||
Property_map_binder<VIM, typename Pointer_property_map<typename boost::property_traits<VIM>::value_type>::type>
|
||||
get_vertex_index_map() const
|
||||
{
|
||||
if (vertex_indices.empty())
|
||||
{
|
||||
vertex_index_type index = 0;
|
||||
vertex_indices.resize(num_vertices(_graph));
|
||||
for (std::size_t i=selected_vertices.find_first(); i < selected_vertices.npos; i = selected_vertices.find_next(i))
|
||||
{
|
||||
vertex_indices[i] = index++;
|
||||
}
|
||||
}
|
||||
is_imap_in_use.set(1);
|
||||
initialize_vertex_indices();
|
||||
|
||||
return bind_property_maps(vimap, make_property_map(vertex_indices) );
|
||||
}
|
||||
|
||||
Property_map_binder<HIM, typename Pointer_property_map<typename boost::property_traits<HIM>::value_type >::type>
|
||||
get_halfedge_index_map() const
|
||||
{
|
||||
if (halfedge_indices.empty())
|
||||
{
|
||||
halfedge_index_type index = 0;
|
||||
halfedge_indices.resize(num_halfedges(_graph));
|
||||
for (std::size_t i=selected_halfedges.find_first(); i < selected_halfedges.npos; i = selected_halfedges.find_next(i))
|
||||
{
|
||||
halfedge_indices[i] = index++;
|
||||
}
|
||||
}
|
||||
is_imap_in_use.set(2);
|
||||
initialize_halfedge_indices();
|
||||
|
||||
return bind_property_maps(himap, make_property_map(halfedge_indices) );
|
||||
}
|
||||
|
||||
|
|
@ -649,9 +685,11 @@ private:
|
|||
boost::dynamic_bitset<> selected_faces;
|
||||
boost::dynamic_bitset<> selected_vertices;
|
||||
boost::dynamic_bitset<> selected_halfedges;
|
||||
|
||||
mutable std::vector<face_index_type> face_indices;
|
||||
mutable std::vector<vertex_index_type> vertex_indices;
|
||||
mutable std::vector<halfedge_index_type> halfedge_indices;
|
||||
mutable std::bitset<3> is_imap_in_use; // one per descriptor type (face, vertex, halfedge)
|
||||
};
|
||||
|
||||
} // namespace CGAL
|
||||
|
|
@ -1206,40 +1244,6 @@ CGAL_FFG_DYNAMIC_PMAP_SPEC(dynamic_face_property_t)
|
|||
|
||||
#undef CGAL_FFG_DYNAMIC_PMAP_SPEC
|
||||
|
||||
//specializations for indices
|
||||
template <class Graph,
|
||||
typename FIMap,
|
||||
typename VIMap,
|
||||
typename HIMap>
|
||||
typename boost::property_map<Face_filtered_graph<Graph, FIMap, VIMap, HIMap>, CGAL::face_index_t >::type
|
||||
get(CGAL::face_index_t, const Face_filtered_graph<Graph, FIMap, VIMap, HIMap>& w)
|
||||
{
|
||||
return w.get_face_index_map();
|
||||
}
|
||||
|
||||
|
||||
template <class Graph,
|
||||
typename FIMap,
|
||||
typename VIMap,
|
||||
typename HIMap>
|
||||
typename boost::property_map<Face_filtered_graph<Graph, FIMap, VIMap, HIMap>, boost::vertex_index_t >::type
|
||||
get(boost::vertex_index_t, const Face_filtered_graph<Graph, FIMap, VIMap, HIMap>& w)
|
||||
{
|
||||
return w.get_vertex_index_map();
|
||||
}
|
||||
|
||||
|
||||
template <class Graph,
|
||||
typename FIMap,
|
||||
typename VIMap,
|
||||
typename HIMap>
|
||||
typename boost::property_map<Face_filtered_graph<Graph, FIMap, VIMap, HIMap>, CGAL::halfedge_index_t >::type
|
||||
get(CGAL::halfedge_index_t, const Face_filtered_graph<Graph, FIMap, VIMap, HIMap>& w)
|
||||
{
|
||||
return w.get_halfedge_index_map();
|
||||
}
|
||||
|
||||
|
||||
template <class Graph,
|
||||
typename FIMap,
|
||||
typename VIMap,
|
||||
|
|
@ -1307,9 +1311,11 @@ CGAL_FILTERED_FACE_GRAPH_DYNAMIC_PMAP_SPECIALIZATION(dynamic_face_property_t)
|
|||
|
||||
//specializations for indices
|
||||
template<typename Graph, typename FIMap, typename VIMap, typename HIMap>
|
||||
struct property_map<CGAL::Face_filtered_graph<Graph, FIMap, VIMap, HIMap>, CGAL::face_index_t>
|
||||
struct property_map<CGAL::Face_filtered_graph<Graph, FIMap, VIMap, HIMap>, boost::face_index_t>
|
||||
{
|
||||
typedef typename CGAL::Face_filtered_graph<Graph, FIMap, VIMap, HIMap>::FIM FIM;
|
||||
typedef CGAL::Face_filtered_graph<Graph, FIMap, VIMap, HIMap> FFG;
|
||||
typedef typename FFG::FIM FIM;
|
||||
|
||||
typedef typename CGAL::Property_map_binder<FIM,
|
||||
typename CGAL::Pointer_property_map<
|
||||
typename boost::property_traits<FIM>::value_type>::type> type;
|
||||
|
|
@ -1319,20 +1325,21 @@ struct property_map<CGAL::Face_filtered_graph<Graph, FIMap, VIMap, HIMap>, CGAL:
|
|||
template<typename Graph, typename FIMap, typename VIMap, typename HIMap>
|
||||
struct property_map<CGAL::Face_filtered_graph<Graph, FIMap, VIMap, HIMap>, boost::vertex_index_t>
|
||||
{
|
||||
typedef typename CGAL::Face_filtered_graph<Graph, FIMap, VIMap, HIMap>::VIM VIM;
|
||||
typedef CGAL::Face_filtered_graph<Graph, FIMap, VIMap, HIMap> FFG;
|
||||
typedef typename FFG::VIM VIM;
|
||||
|
||||
typedef typename CGAL::Property_map_binder<VIM,
|
||||
typename CGAL::Pointer_property_map<
|
||||
typename boost::property_traits<VIM>::value_type>::type> type;
|
||||
typedef type const_type;
|
||||
};
|
||||
|
||||
template<typename Graph,
|
||||
typename FIMap,
|
||||
typename VIMap,
|
||||
typename HIMap>
|
||||
struct property_map<CGAL::Face_filtered_graph<Graph, FIMap, VIMap, HIMap>, CGAL::halfedge_index_t>
|
||||
template<typename Graph, typename FIMap, typename VIMap, typename HIMap>
|
||||
struct property_map<CGAL::Face_filtered_graph<Graph, FIMap, VIMap, HIMap>, boost::halfedge_index_t>
|
||||
{
|
||||
typedef typename CGAL::Face_filtered_graph<Graph, FIMap, VIMap, HIMap>::HIM HIM;
|
||||
typedef CGAL::Face_filtered_graph<Graph, FIMap, VIMap, HIMap> FFG;
|
||||
typedef typename FFG::HIM HIM;
|
||||
|
||||
typedef typename CGAL::Property_map_binder<HIM,
|
||||
typename CGAL::Pointer_property_map<
|
||||
typename boost::property_traits<HIM>::value_type>::type> type;
|
||||
|
|
@ -1341,4 +1348,52 @@ struct property_map<CGAL::Face_filtered_graph<Graph, FIMap, VIMap, HIMap>, CGAL:
|
|||
|
||||
} // namespace boost
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
//specializations for indices
|
||||
template <class Graph, typename FIMap, typename VIMap, typename HIMap>
|
||||
typename boost::property_map<Face_filtered_graph<Graph, FIMap, VIMap, HIMap>, boost::face_index_t >::const_type
|
||||
get(boost::face_index_t, const Face_filtered_graph<Graph, FIMap, VIMap, HIMap>& w)
|
||||
{
|
||||
return w.get_face_index_map();
|
||||
}
|
||||
|
||||
template <class Graph, typename FIMap, typename VIMap, typename HIMap>
|
||||
typename boost::property_map<Face_filtered_graph<Graph, FIMap, VIMap, HIMap>, boost::vertex_index_t >::const_type
|
||||
get(boost::vertex_index_t, const Face_filtered_graph<Graph, FIMap, VIMap, HIMap>& w)
|
||||
{
|
||||
return w.get_vertex_index_map();
|
||||
}
|
||||
|
||||
template <class Graph, typename FIMap, typename VIMap, typename HIMap>
|
||||
typename boost::property_map<Face_filtered_graph<Graph, FIMap, VIMap, HIMap>, boost::halfedge_index_t >::const_type
|
||||
get(boost::halfedge_index_t, const Face_filtered_graph<Graph, FIMap, VIMap, HIMap>& w)
|
||||
{
|
||||
return w.get_halfedge_index_map();
|
||||
}
|
||||
|
||||
// non-const
|
||||
template <class Graph, typename FIMap, typename VIMap, typename HIMap>
|
||||
typename boost::property_map<Face_filtered_graph<Graph, FIMap, VIMap, HIMap>, boost::face_index_t >::type
|
||||
get(boost::face_index_t, Face_filtered_graph<Graph, FIMap, VIMap, HIMap>& w)
|
||||
{
|
||||
return w.get_face_index_map();
|
||||
}
|
||||
|
||||
template <class Graph, typename FIMap, typename VIMap, typename HIMap>
|
||||
typename boost::property_map<Face_filtered_graph<Graph, FIMap, VIMap, HIMap>, boost::vertex_index_t >::type
|
||||
get(boost::vertex_index_t, Face_filtered_graph<Graph, FIMap, VIMap, HIMap>& w)
|
||||
{
|
||||
return w.get_vertex_index_map();
|
||||
}
|
||||
|
||||
template <class Graph, typename FIMap, typename VIMap, typename HIMap>
|
||||
typename boost::property_map<Face_filtered_graph<Graph, FIMap, VIMap, HIMap>, boost::halfedge_index_t >::type
|
||||
get(boost::halfedge_index_t, Face_filtered_graph<Graph, FIMap, VIMap, HIMap>& w)
|
||||
{
|
||||
return w.get_halfedge_index_map();
|
||||
}
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_BOOST_GRAPH_FACE_FILTERED_GRAPH_H
|
||||
|
|
|
|||
|
|
@ -27,12 +27,7 @@
|
|||
|
||||
#include <boost/graph/adjacency_list.hpp>
|
||||
#include <boost/graph/compressed_sparse_row_graph.hpp>
|
||||
|
||||
#if BOOST_VERSION >= 104400 // at this version kolmogorov_max_flow become depricated.
|
||||
# include <boost/graph/boykov_kolmogorov_max_flow.hpp>
|
||||
#else
|
||||
# include <boost/graph/kolmogorov_max_flow.hpp>
|
||||
#endif
|
||||
#include <boost/graph/boykov_kolmogorov_max_flow.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
|
@ -242,12 +237,8 @@ public:
|
|||
|
||||
double max_flow()
|
||||
{
|
||||
#if BOOST_VERSION >= 104400
|
||||
return boost::boykov_kolmogorov_max_flow(graph, cluster_source,
|
||||
cluster_sink);
|
||||
#else
|
||||
return boost::kolmogorov_max_flow(graph, cluster_source, cluster_sink);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename VertexLabelMap, typename InputVertexDescriptor>
|
||||
|
|
@ -352,13 +343,8 @@ public:
|
|||
|
||||
void init_vertices()
|
||||
{
|
||||
#if BOOST_VERSION >= 104000
|
||||
graph = Graph(boost::edges_are_unsorted, edge_map.begin(), edge_map.end(),
|
||||
edge_map_weights.begin(), nb_vertices);
|
||||
#else
|
||||
graph= Graph(edge_map.begin(), edge_map.end(),
|
||||
edge_map_weights.begin(), nb_vertices);
|
||||
#endif
|
||||
|
||||
// PERFORMANCE PROBLEM
|
||||
// need to set reverse edge map, I guess there is no way to do that before creating the graph
|
||||
|
|
@ -379,7 +365,6 @@ public:
|
|||
|
||||
double max_flow()
|
||||
{
|
||||
#if BOOST_VERSION >= 104400
|
||||
// since properties are bundled, defaults does not work need to specify them
|
||||
return boost::boykov_kolmogorov_max_flow
|
||||
(graph,
|
||||
|
|
@ -392,19 +377,6 @@ public:
|
|||
boost::get(boost::vertex_index,
|
||||
graph), // this is not bundled, get it from graph (CRS provides one)
|
||||
0, 1);
|
||||
#else
|
||||
return boost::kolmogorov_max_flow
|
||||
(graph,
|
||||
boost::get(&EdgeP::edge_capacity, graph),
|
||||
boost::get(&EdgeP::edge_residual_capacity, graph),
|
||||
boost::get(&EdgeP::edge_reverse, graph),
|
||||
boost::get(&VertexP::vertex_predecessor, graph),
|
||||
boost::get(&VertexP::vertex_color, graph),
|
||||
boost::get(&VertexP::vertex_distance_t, graph),
|
||||
boost::get(boost::vertex_index,
|
||||
graph), // this is not bundled, get it from graph
|
||||
0, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename VertexLabelMap, typename InputVertexDescriptor>
|
||||
|
|
|
|||
|
|
@ -124,7 +124,9 @@ CGAL_add_named_parameter(do_not_modify_t, do_not_modify, do_not_modify)
|
|||
CGAL_add_named_parameter(allow_self_intersections_t, allow_self_intersections, allow_self_intersections)
|
||||
CGAL_add_named_parameter(non_manifold_feature_map_t, non_manifold_feature_map, non_manifold_feature_map)
|
||||
CGAL_add_named_parameter(polyhedral_envelope_epsilon_t, polyhedral_envelope_epsilon, polyhedral_envelope_epsilon)
|
||||
CGAL_add_named_parameter(match_faces_t, match_faces, match_faces)
|
||||
CGAL_add_named_parameter(face_epsilon_map_t, face_epsilon_map, face_epsilon_map)
|
||||
CGAL_add_named_parameter(use_one_sided_hausdorff_t, use_one_sided_hausdorff, use_one_sided_hausdorff)
|
||||
|
||||
// List of named parameters that we use in the package 'Surface Mesh Simplification'
|
||||
CGAL_add_named_parameter(get_cost_policy_t, get_cost_policy, get_cost)
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include <boost/parameter/name.hpp>
|
||||
|
||||
#if defined(__clang__) || (BOOST_GCC >= 40600)
|
||||
#if defined(__clang__) || defined(BOOST_GCC)
|
||||
# define CGAL_IGNORE_UNUSED_VARIABLES \
|
||||
_Pragma("GCC diagnostic ignored \"-Wunused-variable\"") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wunused-parameter\"")
|
||||
|
|
|
|||
|
|
@ -1,15 +1,23 @@
|
|||
#include <CGAL/boost/graph/Face_filtered_graph.h>
|
||||
#include <CGAL/Polygon_mesh_processing/connected_components.h>
|
||||
#include <CGAL/boost/graph/copy_face_graph.h>
|
||||
#include <CGAL/boost/graph/Face_filtered_graph.h>
|
||||
#include <CGAL/boost/graph/named_params_helper.h>
|
||||
#include <CGAL/Polygon_mesh_processing/connected_components.h>
|
||||
#include <CGAL/use.h>
|
||||
#include "test_Prefix.h"
|
||||
|
||||
#include <boost/numeric/conversion/cast.hpp>
|
||||
#include <boost/unordered_set.hpp>
|
||||
#include <boost/unordered_map.hpp>
|
||||
#include <CGAL/use.h>
|
||||
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
typedef boost::unordered_set<std::size_t> id_map;
|
||||
|
||||
namespace PMP = CGAL::Polygon_mesh_processing;
|
||||
|
||||
template <typename Graph>
|
||||
void test_halfedge_around_vertex_iterator(const Graph& g)
|
||||
{
|
||||
|
|
@ -17,8 +25,7 @@ void test_halfedge_around_vertex_iterator(const Graph& g)
|
|||
typedef CGAL::Face_filtered_graph<Graph> Adapter;
|
||||
CGAL_GRAPH_TRAITS_MEMBERS(Adapter);
|
||||
boost::unordered_map<g_face_descriptor, std::size_t> map(num_faces(g));
|
||||
CGAL::Polygon_mesh_processing::connected_components(g, boost::make_assoc_property_map(map), CGAL::Polygon_mesh_processing::parameters::all_default());
|
||||
|
||||
PMP::connected_components(g, boost::make_assoc_property_map(map), CGAL::parameters::all_default());
|
||||
|
||||
Adapter fg(g, 0, boost::make_assoc_property_map(map));
|
||||
typename boost::graph_traits<Adapter >::vertex_iterator vit, vend;
|
||||
|
|
@ -45,8 +52,9 @@ void test_halfedge_around_face_iterator(const Graph& g)
|
|||
typedef CGAL::Face_filtered_graph<Graph> Adapter;
|
||||
CGAL_GRAPH_TRAITS_MEMBERS(Adapter);
|
||||
std::map<g_face_descriptor, std::size_t> map;
|
||||
CGAL::Polygon_mesh_processing::connected_components(g, boost::make_assoc_property_map(map), CGAL::Polygon_mesh_processing::parameters::all_default());
|
||||
PMP::connected_components(g, boost::make_assoc_property_map(map), CGAL::parameters::all_default());
|
||||
Adapter fg(g, 0, boost::make_assoc_property_map(map));
|
||||
|
||||
face_iterator fit, fend;
|
||||
for(boost::tie(fit, fend) = faces(fg); fit != fend; ++fit) {
|
||||
halfedge_around_face_iterator hafit, hafend;
|
||||
|
|
@ -65,7 +73,7 @@ void test_edge_iterators(const Graph& g)
|
|||
typedef CGAL::Face_filtered_graph<Graph> Adapter;
|
||||
CGAL_GRAPH_TRAITS_MEMBERS(Adapter);
|
||||
std::map<g_face_descriptor, std::size_t> map;
|
||||
CGAL::Polygon_mesh_processing::connected_components(g, boost::make_assoc_property_map(map), CGAL::Polygon_mesh_processing::parameters::all_default());
|
||||
PMP::connected_components(g, boost::make_assoc_property_map(map), CGAL::parameters::all_default());
|
||||
Adapter fg(g, 0, boost::make_assoc_property_map(map));
|
||||
|
||||
// do we iterate as many as that?
|
||||
|
|
@ -91,7 +99,7 @@ void test_vertex_iterators(Graph& g)
|
|||
typedef CGAL::Face_filtered_graph<Graph> Adapter;
|
||||
CGAL_GRAPH_TRAITS_MEMBERS(Adapter);
|
||||
std::map<g_face_descriptor, std::size_t> map;
|
||||
CGAL::Polygon_mesh_processing::connected_components(g, boost::make_assoc_property_map(map), CGAL::Polygon_mesh_processing::parameters::all_default());
|
||||
PMP::connected_components(g, boost::make_assoc_property_map(map), CGAL::parameters::all_default());
|
||||
Adapter fg(g, 0, boost::make_assoc_property_map(map));
|
||||
vertex_iterator vb, ve;
|
||||
std::size_t count = 0;
|
||||
|
|
@ -121,7 +129,7 @@ void test_out_edges(const Graph& g)
|
|||
typedef CGAL::Face_filtered_graph<Graph> Adapter;
|
||||
CGAL_GRAPH_TRAITS_MEMBERS(Adapter);
|
||||
std::map<g_face_descriptor, std::size_t> map;
|
||||
CGAL::Polygon_mesh_processing::connected_components(g, boost::make_assoc_property_map(map), CGAL::Polygon_mesh_processing::parameters::all_default());
|
||||
PMP::connected_components(g, boost::make_assoc_property_map(map), CGAL::parameters::all_default());
|
||||
Adapter fg(g, 0, boost::make_assoc_property_map(map));
|
||||
|
||||
vertex_iterator vb, ve;
|
||||
|
|
@ -150,7 +158,7 @@ void test_in_edges(const Graph& g)
|
|||
typedef CGAL::Face_filtered_graph<Graph> Adapter;
|
||||
CGAL_GRAPH_TRAITS_MEMBERS(Adapter);
|
||||
std::map<g_face_descriptor, std::size_t> map;
|
||||
CGAL::Polygon_mesh_processing::connected_components(g, boost::make_assoc_property_map(map), CGAL::Polygon_mesh_processing::parameters::all_default());
|
||||
PMP::connected_components(g, boost::make_assoc_property_map(map), CGAL::parameters::all_default());
|
||||
Adapter fg(g, 0, boost::make_assoc_property_map(map));
|
||||
|
||||
vertex_iterator vb, ve;
|
||||
|
|
@ -177,7 +185,7 @@ void test_in_out_edges(const Graph& g)
|
|||
typedef CGAL::Face_filtered_graph<Graph> Adapter;
|
||||
CGAL_GRAPH_TRAITS_MEMBERS(Adapter);
|
||||
std::map<g_face_descriptor, std::size_t> map;
|
||||
CGAL::Polygon_mesh_processing::connected_components(g, boost::make_assoc_property_map(map), CGAL::Polygon_mesh_processing::parameters::all_default());
|
||||
PMP::connected_components(g, boost::make_assoc_property_map(map), CGAL::parameters::all_default());
|
||||
Adapter fg(g, 0, boost::make_assoc_property_map(map));
|
||||
|
||||
// check that the sets of in out edges are the same
|
||||
|
|
@ -219,7 +227,7 @@ void test_edge_find(const Graph& g)
|
|||
typedef CGAL::Face_filtered_graph<Graph> Adapter;
|
||||
CGAL_GRAPH_TRAITS_MEMBERS(Adapter);
|
||||
std::map<g_face_descriptor, std::size_t> map;
|
||||
CGAL::Polygon_mesh_processing::connected_components(g, boost::make_assoc_property_map(map), CGAL::Polygon_mesh_processing::parameters::all_default());
|
||||
PMP::connected_components(g, boost::make_assoc_property_map(map), CGAL::parameters::all_default());
|
||||
Adapter fg(g, 0, boost::make_assoc_property_map(map));
|
||||
typedef std::pair<edge_descriptor, bool> ret;
|
||||
|
||||
|
|
@ -243,7 +251,7 @@ void test_faces(const Graph& g)
|
|||
typedef CGAL::Face_filtered_graph<Graph> Adapter;
|
||||
CGAL_GRAPH_TRAITS_MEMBERS(Adapter);
|
||||
std::map<g_face_descriptor, std::size_t> map;
|
||||
CGAL::Polygon_mesh_processing::connected_components(g, boost::make_assoc_property_map(map), CGAL::Polygon_mesh_processing::parameters::all_default());
|
||||
PMP::connected_components(g, boost::make_assoc_property_map(map), CGAL::parameters::all_default());
|
||||
Adapter fg(g, 0, boost::make_assoc_property_map(map));
|
||||
|
||||
unsigned int count = 0;
|
||||
|
|
@ -262,6 +270,53 @@ void test_faces(const Graph& g)
|
|||
assert(count == num_faces(fg));
|
||||
}
|
||||
|
||||
template<typename Graph>
|
||||
void test_index_property_maps(const Graph& g)
|
||||
{
|
||||
typedef CGAL::Face_filtered_graph<Graph> Adapter;
|
||||
CGAL_GRAPH_TRAITS_MEMBERS(Adapter);
|
||||
|
||||
typedef typename boost::graph_traits<Graph>::face_descriptor g_face_descriptor;
|
||||
std::map<g_face_descriptor, std::size_t> map;
|
||||
PMP::connected_components(g, boost::make_assoc_property_map(map), CGAL::parameters::all_default());
|
||||
Adapter fg(g, -1, boost::make_assoc_property_map(map));
|
||||
assert(is_empty(fg));
|
||||
|
||||
// Non const
|
||||
typedef typename CGAL::GetInitializedVertexIndexMap<Adapter>::type VIMap;
|
||||
VIMap vim = CGAL::get_initialized_vertex_index_map(fg);
|
||||
assert(CGAL::BGL::internal::is_index_map_valid(vim, num_vertices(fg), vertices(fg)));
|
||||
|
||||
typedef typename CGAL::GetInitializedHalfedgeIndexMap<Adapter>::type HIMap;
|
||||
HIMap him = CGAL::get_initialized_halfedge_index_map(fg);
|
||||
assert(CGAL::BGL::internal::is_index_map_valid(him, num_halfedges(fg), halfedges(fg)));
|
||||
|
||||
typedef typename CGAL::GetInitializedFaceIndexMap<Adapter>::type FIMap;
|
||||
FIMap fim = CGAL::get_initialized_face_index_map(fg);
|
||||
assert(CGAL::BGL::internal::is_index_map_valid(fim, num_faces(fg), faces(fg)));
|
||||
|
||||
fg.set_selected_faces(0, boost::make_assoc_property_map(map));
|
||||
assert(!is_empty(fg));
|
||||
|
||||
assert(CGAL::BGL::internal::is_index_map_valid(vim, num_vertices(fg), vertices(fg)));
|
||||
assert(CGAL::BGL::internal::is_index_map_valid(him, num_halfedges(fg), halfedges(fg)));
|
||||
assert(CGAL::BGL::internal::is_index_map_valid(fim, num_faces(fg), faces(fg)));
|
||||
|
||||
// Const
|
||||
const Adapter cfg(g, 0, boost::make_assoc_property_map(map));
|
||||
typedef typename CGAL::GetInitializedVertexIndexMap<Adapter>::const_type CVIMap;
|
||||
CVIMap cvim = CGAL::get_initialized_vertex_index_map(cfg);
|
||||
assert(CGAL::BGL::internal::is_index_map_valid(cvim, num_vertices(cfg), vertices(cfg)));
|
||||
|
||||
typedef typename CGAL::GetInitializedHalfedgeIndexMap<Adapter>::const_type CHIMap;
|
||||
CHIMap chim = CGAL::get_initialized_halfedge_index_map(cfg);
|
||||
assert(CGAL::BGL::internal::is_index_map_valid(chim, num_halfedges(cfg), halfedges(cfg)));
|
||||
|
||||
typedef typename CGAL::GetInitializedFaceIndexMap<Adapter>::const_type CFIMap;
|
||||
CFIMap cfim = CGAL::get_initialized_face_index_map(cfg);
|
||||
assert(CGAL::BGL::internal::is_index_map_valid(cfim, num_faces(cfg), faces(cfg)));
|
||||
}
|
||||
|
||||
template<typename Graph>
|
||||
void test_read(const Graph& g)
|
||||
{
|
||||
|
|
@ -270,7 +325,7 @@ void test_read(const Graph& g)
|
|||
CGAL_GRAPH_TRAITS_MEMBERS(Adapter);
|
||||
|
||||
std::map<g_face_descriptor, std::size_t> map;
|
||||
CGAL::Polygon_mesh_processing::connected_components(g, boost::make_assoc_property_map(map), CGAL::Polygon_mesh_processing::parameters::all_default());
|
||||
PMP::connected_components(g, boost::make_assoc_property_map(map), CGAL::parameters::all_default());
|
||||
Adapter fg(g, 0, boost::make_assoc_property_map(map));
|
||||
assert(fg.is_selection_valid());
|
||||
assert(CGAL::is_valid_polygon_mesh(fg));
|
||||
|
|
@ -292,6 +347,7 @@ test_graph_range(const std::vector<Graph>& graphs)
|
|||
test_edge_iterators(p);
|
||||
test_halfedge_around_face_iterator(p);
|
||||
test_halfedge_around_vertex_iterator(p);
|
||||
test_index_property_maps(p);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -356,7 +412,6 @@ struct Constraint : public boost::put_get_helper<bool,Constraint<Mesh, VertexPoi
|
|||
template<class Mesh, class FCCMAP, class Adapter>
|
||||
void test_mesh(Adapter fga)
|
||||
{
|
||||
|
||||
CGAL_GRAPH_TRAITS_MEMBERS(Adapter);
|
||||
//check that there is the right number of simplices in fga
|
||||
CGAL_assertion(CGAL::is_valid_polygon_mesh(fga));
|
||||
|
|
@ -365,31 +420,23 @@ void test_mesh(Adapter fga)
|
|||
CGAL_assertion(num_halfedges(fga) == 10);
|
||||
CGAL_assertion(num_vertices(fga) == 4);
|
||||
halfedge_descriptor h = halfedge(*faces(fga).first, fga);
|
||||
CGAL_assertion_code( vertex_descriptor v = source(h, fga) );
|
||||
CGAL_assertion_code( vertex_descriptor v = source(h, fga));
|
||||
//check that next() works inside the patch
|
||||
CGAL_assertion(
|
||||
next(next(next(h, fga), fga), fga) == h
|
||||
);
|
||||
CGAL_assertion(next(next(next(h, fga), fga), fga) == h);
|
||||
//check that next() works on bordure of the patch
|
||||
h = opposite(h, fga);
|
||||
CGAL_assertion(
|
||||
next(next(next(next(h, fga), fga), fga), fga) == h
|
||||
);
|
||||
CGAL_assertion(next(next(next(next(h, fga), fga), fga), fga) == h);
|
||||
//check that prev() works inside the patch
|
||||
h = halfedge(*faces(fga).first, fga);
|
||||
CGAL_assertion(
|
||||
prev(prev(prev(h, fga), fga), fga) == h
|
||||
);
|
||||
CGAL_assertion(prev(prev(prev(h, fga), fga), fga) == h);
|
||||
//check that prev() works on bordure of the patch
|
||||
h = opposite(h, fga);
|
||||
CGAL_assertion(
|
||||
prev(prev(prev(prev(h, fga), fga), fga), fga) == h
|
||||
);
|
||||
CGAL_assertion(prev(prev(prev(prev(h, fga), fga), fga), fga) == h);
|
||||
//check degree
|
||||
CGAL_assertion(degree(v, fga) == 3);
|
||||
//check in_edges and out_edges
|
||||
CGAL_assertion(std::distance(in_edges(v, fga).first ,in_edges(v, fga).second) == 3 );
|
||||
CGAL_assertion(std::distance(out_edges(v, fga).first ,out_edges(v, fga).second) == 3 );
|
||||
CGAL_assertion(std::distance(in_edges(v, fga).first ,in_edges(v, fga).second) == 3);
|
||||
CGAL_assertion(std::distance(out_edges(v, fga).first ,out_edges(v, fga).second) == 3);
|
||||
|
||||
Mesh copy;
|
||||
CGAL::copy_face_graph(fga, copy);
|
||||
|
|
@ -454,7 +501,7 @@ int main()
|
|||
{
|
||||
test_graph_range(poly_data());
|
||||
|
||||
#if defined(CGAL_USE_SURFACE_MESH)
|
||||
#ifdef CGAL_USE_SURFACE_MESH
|
||||
test_graph_range(sm_data());
|
||||
#endif
|
||||
|
||||
|
|
@ -464,64 +511,47 @@ int main()
|
|||
|
||||
test_invalid_selections();
|
||||
|
||||
//Make a tetrahedron and test the adapter for a patch that only contains 2 faces
|
||||
// Make a tetrahedron and test the adapter for a patch that only contains 2 faces
|
||||
typedef CGAL::Face_filtered_graph<SM> SM_Adapter;
|
||||
typedef SM::Property_map<boost::graph_traits<SM>::face_descriptor , std::size_t> SM_FCCMap;
|
||||
auto sm = std::make_unique<SM>();
|
||||
CGAL::make_tetrahedron(
|
||||
Point_3(1,1,1),
|
||||
Point_3(0,0,0),
|
||||
Point_3(0,0,1),
|
||||
Point_3(1,0,1),
|
||||
*sm);
|
||||
SM_FCCMap fccmap =
|
||||
sm->add_property_map<boost::graph_traits<SM>::face_descriptor, std::size_t>("f:CC").first;
|
||||
SM::Property_map<boost::graph_traits<SM>::vertex_descriptor, SM::Point> positions =
|
||||
sm->points();
|
||||
CGAL::Polygon_mesh_processing::connected_components(*sm, fccmap, CGAL::Polygon_mesh_processing::parameters::
|
||||
edge_is_constrained_map(Constraint<SM, SM::Property_map<boost::graph_traits<SM>::vertex_descriptor,
|
||||
SM::Point> >(*sm, positions)));
|
||||
CGAL::make_tetrahedron(Point_3(1,1,1), Point_3(0,0,0), Point_3(0,0,1), Point_3(1,0,1), *sm);
|
||||
|
||||
SM_FCCMap fccmap = sm->add_property_map<boost::graph_traits<SM>::face_descriptor, std::size_t>("f:CC").first;
|
||||
SM::Property_map<boost::graph_traits<SM>::vertex_descriptor, SM::Point> positions = sm->points();
|
||||
CGAL::Polygon_mesh_processing::connected_components(
|
||||
*sm, fccmap, CGAL::parameters::edge_is_constrained_map(Constraint<SM, SM::Property_map<boost::graph_traits<SM>::vertex_descriptor,
|
||||
SM::Point> >(*sm, positions)));
|
||||
|
||||
boost::unordered_set<long unsigned int> pids;
|
||||
pids.insert(0);
|
||||
pids.insert(2);
|
||||
SM_Adapter sm_adapter(*sm, pids, fccmap);
|
||||
test_mesh<SM,SM_FCCMap, SM_Adapter>(sm_adapter);
|
||||
|
||||
|
||||
|
||||
|
||||
typedef boost::graph_traits<Polyhedron> PolyTraits;
|
||||
typedef boost::property_map<Polyhedron, boost::vertex_point_t>::const_type VPMap;
|
||||
typedef PolyTraits::face_descriptor poly_face_descriptor;
|
||||
typedef boost::associative_property_map< std::map<poly_face_descriptor,
|
||||
PolyTraits::faces_size_type> > FCMap;
|
||||
typedef boost::associative_property_map<std::map<poly_face_descriptor, PolyTraits::faces_size_type> > FCMap;
|
||||
typedef boost::property_map<Polyhedron, CGAL::face_external_index_t>::const_type FIMap;
|
||||
typedef boost::property_map<Polyhedron, CGAL::vertex_external_index_t>::const_type VIMap;
|
||||
typedef boost::property_map<Polyhedron, CGAL::halfedge_external_index_t>::const_type HIMap;
|
||||
typedef CGAL::Face_filtered_graph<Polyhedron, FIMap, VIMap, HIMap> Poly_Adapter;
|
||||
auto poly = std::make_unique<Polyhedron>();
|
||||
CGAL::make_tetrahedron(
|
||||
Point_3(1,1,1),
|
||||
Point_3(0,0,0),
|
||||
Point_3(0,0,1),
|
||||
Point_3(1,0,1),
|
||||
*poly);
|
||||
|
||||
auto poly = std::make_unique<Polyhedron>();
|
||||
CGAL::make_tetrahedron(Point_3(1,1,1), Point_3(0,0,0), Point_3(0,0,1), Point_3(1,0,1), *poly);
|
||||
|
||||
FIMap poly_fimap = get(CGAL::face_external_index, *poly);
|
||||
VIMap poly_vimap = get(CGAL::vertex_external_index, *poly);
|
||||
HIMap poly_himap = get(CGAL::halfedge_external_index, *poly);
|
||||
std::map<poly_face_descriptor,
|
||||
PolyTraits::faces_size_type> fc_map;
|
||||
std::map<poly_face_descriptor, PolyTraits::faces_size_type> fc_map;
|
||||
FCMap poly_fccmap(fc_map);
|
||||
|
||||
VPMap vpmap = get(boost::vertex_point, *poly);
|
||||
CGAL::Polygon_mesh_processing::connected_components(*poly, poly_fccmap,
|
||||
CGAL::Polygon_mesh_processing::parameters::edge_is_constrained_map(Constraint<Polyhedron, VPMap >(*poly, vpmap))
|
||||
.face_index_map(poly_fimap));
|
||||
Poly_Adapter poly_adapter(*poly,
|
||||
pids,
|
||||
poly_fccmap,
|
||||
PMP::connected_components(*poly, poly_fccmap,
|
||||
CGAL::parameters::edge_is_constrained_map(Constraint<Polyhedron, VPMap >(*poly, vpmap))
|
||||
.face_index_map(poly_fimap));
|
||||
Poly_Adapter poly_adapter(*poly, pids, poly_fccmap,
|
||||
CGAL::parameters::face_index_map(poly_fimap)
|
||||
.vertex_index_map(poly_vimap)
|
||||
.halfedge_index_map(poly_himap));
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@ union yyalloc
|
|||
/* Copy COUNT objects from FROM to TO. The source and destination do
|
||||
not overlap. */
|
||||
# ifndef YYCOPY
|
||||
# if defined (__GNUC__) && 1 < __GNUC__
|
||||
# if (__GNUC__ > 0)
|
||||
# define YYCOPY(To, From, Count) \
|
||||
__builtin_memcpy (To, From, (Count) * sizeof (*(From)))
|
||||
# else
|
||||
|
|
|
|||
|
|
@ -692,11 +692,7 @@ public:
|
|||
}
|
||||
// Write property tree to XML file
|
||||
boost::property_tree::write_xml(output, tree,
|
||||
#if BOOST_VERSION >= 105600
|
||||
boost::property_tree::xml_writer_make_settings<std::string>(' ', 3));
|
||||
#else
|
||||
boost::property_tree::xml_writer_make_settings<char>(' ', 3));
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@
|
|||
#endif
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if (BOOST_GCC >= 40900)
|
||||
#if defined(BOOST_GCC)
|
||||
_Pragma("GCC diagnostic push")
|
||||
_Pragma("GCC diagnostic ignored \"-Warray-bounds\"")
|
||||
#endif
|
||||
|
|
@ -4824,7 +4824,7 @@ namespace CGAL {
|
|||
|
||||
} // namespace CGAL
|
||||
|
||||
#if (BOOST_GCC >= 40900)
|
||||
#if defined(BOOST_GCC)
|
||||
_Pragma("GCC diagnostic pop")
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
#include <bitset>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if (BOOST_GCC >= 40900)
|
||||
#if defined(BOOST_GCC)
|
||||
_Pragma("GCC diagnostic push")
|
||||
_Pragma("GCC diagnostic ignored \"-Warray-bounds\"")
|
||||
#endif
|
||||
|
|
@ -439,7 +439,7 @@ namespace CGAL {
|
|||
|
||||
} // namespace CGAL
|
||||
|
||||
#if (BOOST_GCC >= 40900)
|
||||
#if defined(BOOST_GCC)
|
||||
_Pragma("GCC diagnostic pop")
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -33,8 +33,11 @@ are:
|
|||
If the macro `CGAL_HAS_THREADS` is not defined, then \cgal assumes it can use
|
||||
any thread-unsafe code (such as static variables). By default, this macro is not
|
||||
defined, unless `BOOST_HAS_THREADS` or `_OPENMP` is defined. It is possible
|
||||
to force its definition on the command line, and it is possible to prevent its default
|
||||
definition by setting `CGAL_HAS_NO_THREADS` from the command line.
|
||||
to force its definition in the compiler options, and it is possible to prevent its
|
||||
default definition by defining the macro `CGAL_HAS_NO_THREADS`.
|
||||
If you are using CMake, then you can set the CMake option `CGAL_HAS_NO_THREADS` to
|
||||
`TRUE`. In addition to defining the preprocessor macro CGAL_HAS_NO_THREADS`, it will
|
||||
also avoid CMake to link with the native threads support library on your system.
|
||||
|
||||
\section Preliminaries_cc0x C++14 Support
|
||||
|
||||
|
|
|
|||
|
|
@ -297,11 +297,8 @@ If you experience such an issue, we recommand to compile \ceres without `glog` s
|
|||
|
||||
\glpk (GNU Linear Programming Kit) is a library for solving linear programming (LP), mixed integer programming (MIP), and other related problems.
|
||||
|
||||
In \cgal, \glpk provides an optional linear integer program solver
|
||||
in the \ref PkgPolygonalSurfaceReconstruction package. In order to use
|
||||
\glpk in \cgal programs, the executables should be linked with the
|
||||
CMake imported target `CGAL::GLPK_support` provided in
|
||||
`CGAL_GLPK_support.cmake`.
|
||||
In \cgal, \glpk provides an optional linear integer program solver in the \ref PkgPolygonalSurfaceReconstruction package.
|
||||
In order to use \glpk in \cgal programs, the executables should be linked with the CMake imported target `CGAL::GLPK_support` provided in `CGAL_GLPK_support.cmake`.
|
||||
|
||||
The \glpk web site is <A HREF="https://www.gnu.org/software/glpk/">`https://www.gnu.org/software/glpk/`</A>.
|
||||
|
||||
|
|
@ -309,12 +306,18 @@ The \glpk web site is <A HREF="https://www.gnu.org/software/glpk/">`https://www.
|
|||
|
||||
\scip (Solving Constraint Integer Programs) is currently one of the fastest open source solvers for mixed integer programming (MIP) and mixed integer nonlinear programming (MINLP).
|
||||
|
||||
In \cgal, \scip provides an optional linear integer program solver
|
||||
in the \ref PkgPolygonalSurfaceReconstruction package. In order to use
|
||||
\scip in \cgal programs, the executables should be linked with the
|
||||
CMake imported target `CGAL::SCIP_support` provided in
|
||||
`CGAL_SCIP_support.cmake`.
|
||||
In \cgal, \scip provides an optional linear integer program solver in the \ref PkgPolygonalSurfaceReconstruction package.
|
||||
In order to use \scip in \cgal programs, the executables should be linked with the CMake imported target `CGAL::SCIP_support` provided in `CGAL_SCIP_support.cmake`.
|
||||
|
||||
The \scip web site is <A HREF="http://scip.zib.de/">`http://scip.zib.de/`</A>.
|
||||
|
||||
\subsection thirdpartyOSQP OSQP
|
||||
|
||||
\osqp (Operator Splitting Quadratic Program) is currently one of the fastest open source solvers for convex Quadratic Programs (QP).
|
||||
|
||||
In \cgal, \osqp provides an optional solver for the QP problems often arising in various computational geometry algorithms.
|
||||
In order to use \osqp in \cgal programs, the executables should be linked with the CMake imported target `CGAL::OSQP_support` provided in `CGAL_OSQP_support.cmake`.
|
||||
|
||||
The \osqp web site is <A HREF="https://osqp.org">`https://osqp.org`</A>.
|
||||
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -152050,4 +152050,14 @@ pages = {179--189}
|
|||
Pages = {215--224},
|
||||
Year = {2012},
|
||||
Url = {http://monge.univ-mlv.fr/~colinde/pub/09edgewidth.pdf}
|
||||
|
||||
@inproceedings{tang2009interactive,
|
||||
title={Interactive Hausdorff distance computation for general polygonal models},
|
||||
author={Tang, Min and Lee, Minkyoung and Kim, Young J},
|
||||
booktitle={ACM Transactions on Graphics (TOG)},
|
||||
volume={28},
|
||||
number={3},
|
||||
pages={74},
|
||||
year={2009},
|
||||
organization={ACM}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -267,6 +267,7 @@ ALIASES = "cgal=%CGAL" \
|
|||
"ceres=Ceres" \
|
||||
"glpk=GLPK" \
|
||||
"scip=SCIP" \
|
||||
"osqp=OSQP" \
|
||||
"rs=RS" \
|
||||
"rs3=RS3" \
|
||||
"unix=Unix" \
|
||||
|
|
|
|||
|
|
@ -268,6 +268,7 @@ ALIASES = "cgal=%CGAL" \
|
|||
"ceres=Ceres" \
|
||||
"glpk=GLPK" \
|
||||
"scip=SCIP" \
|
||||
"osqp=OSQP" \
|
||||
"rs=RS" \
|
||||
"rs3=RS3" \
|
||||
"unix=Unix" \
|
||||
|
|
|
|||
|
|
@ -290,6 +290,7 @@ ALIASES = "cgal=%CGAL" \
|
|||
"ceres=Ceres" \
|
||||
"glpk=GLPK" \
|
||||
"scip=SCIP" \
|
||||
"osqp=OSQP" \
|
||||
"rs=RS" \
|
||||
"rs3=RS3" \
|
||||
"unix=Unix" \
|
||||
|
|
|
|||
|
|
@ -236,6 +236,7 @@ ALIASES += "zlib=zlib"
|
|||
ALIASES += "ceres=Ceres"
|
||||
ALIASES += "glpk=GLPK"
|
||||
ALIASES += "scip=SCIP"
|
||||
ALIASES += "osqp=OSQP"
|
||||
ALIASES += "rs=RS"
|
||||
ALIASES += "rs3=RS3"
|
||||
ALIASES += "unix=Unix"
|
||||
|
|
|
|||
|
|
@ -75,11 +75,7 @@ Filtered_predicate_with_state<EP,AP,C2E,C2A,O1,Protection>::
|
|||
CGAL_BRANCH_PROFILER_BRANCH(tmp);
|
||||
Protect_FPU_rounding<!Protection> p(CGAL_FE_TONEAREST);
|
||||
if(! oep){
|
||||
#if BOOST_VERSION < 105600
|
||||
oep = EP(c2e(o1));
|
||||
#else
|
||||
oep.emplace(c2e(o1));
|
||||
#endif
|
||||
}
|
||||
return (*oep)(c2e(args)...);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,9 @@
|
|||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <atomic>
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
|
|
@ -68,22 +71,12 @@ class Lazy_exact_nt;
|
|||
|
||||
template <typename AT, typename ET, typename E2A>
|
||||
inline
|
||||
const AT&
|
||||
decltype(auto)
|
||||
approx(const Lazy<AT,ET,E2A>& l)
|
||||
{
|
||||
return l.approx();
|
||||
}
|
||||
|
||||
// Where is this one (non-const) needed ? Is it ?
|
||||
template <typename AT, typename ET, typename E2A>
|
||||
inline
|
||||
AT&
|
||||
approx(Lazy<AT,ET,E2A>& l)
|
||||
{
|
||||
return l.approx();
|
||||
}
|
||||
|
||||
|
||||
template <typename AT, typename ET, typename E2A>
|
||||
inline
|
||||
const ET&
|
||||
|
|
@ -230,9 +223,67 @@ struct Depth_base {
|
|||
#endif
|
||||
};
|
||||
|
||||
template<class T, bool=std::is_base_of<Handle, T>::value> struct Lazy_reset_member_1 {
|
||||
void operator()(T& t)const{ t = T(); }
|
||||
};
|
||||
template<class T> struct Lazy_reset_member_1<T, true> {
|
||||
void operator()(T& t)const{ t.reset(); }
|
||||
};
|
||||
template<class T>void lazy_reset_member(T&t) {
|
||||
Lazy_reset_member_1<T>()(t);
|
||||
}
|
||||
template<class...T, std::size_t...i>void lazy_reset_member_tuple(std::tuple<T...>&t, std::index_sequence<i...>) {
|
||||
auto ignore = [](auto&&...){};
|
||||
ignore ( (lazy_reset_member(std::get<i>(t)), 0) ... );
|
||||
}
|
||||
template<class...T>void lazy_reset_member(std::tuple<T...>&t) {
|
||||
lazy_reset_member_tuple(t, std::make_index_sequence<sizeof...(T)>());
|
||||
}
|
||||
|
||||
// 0: safe default, AT is behind a pointer that can be atomically changed, and it doesn't disappear during update_exact
|
||||
// 1: use plain AT without protection
|
||||
// 2: split an interval as 2 atomic_double
|
||||
// FIXME: CGAL_USE_SSE2 is clearly not the right condition
|
||||
#ifdef CGAL_HAS_THREADS
|
||||
template<class AT>struct Lazy_rep_selector { static constexpr int value = 0; };
|
||||
# if defined CGAL_USE_SSE2 && !defined __SANITIZE_THREAD__ && !__has_feature(thread_sanitizer)
|
||||
template<bool b>struct Lazy_rep_selector<Interval_nt<b>> { static constexpr int value = 1; };
|
||||
template<bool b, int N>struct Lazy_rep_selector<std::array<Interval_nt<b>,N>> { static constexpr int value = 1; };
|
||||
// Need some declarations, including Simple_cartesian.h would also be possible.
|
||||
template<class>struct Simple_cartesian;
|
||||
template<class>class Point_2;
|
||||
template<class>class Point_3;
|
||||
template<bool b>struct Lazy_rep_selector<CGAL::Point_2<CGAL::Simple_cartesian<CGAL::Interval_nt<b>>>> { static constexpr int value = 1; };
|
||||
template<bool b>struct Lazy_rep_selector<CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Interval_nt<b>>>> { static constexpr int value = 1; };
|
||||
# else
|
||||
template<bool b>struct Lazy_rep_selector<Interval_nt<b>> { static constexpr int value = 2; };
|
||||
# endif
|
||||
#else
|
||||
template<class AT>struct Lazy_rep_selector { static constexpr int value = 1; };
|
||||
#endif
|
||||
|
||||
template<class AT>
|
||||
struct AT_wrap {
|
||||
AT at_;
|
||||
AT_wrap():at_(){}
|
||||
AT_wrap(AT const& a):at_(a){}
|
||||
AT_wrap(AT&& a):at_(std::move(a)){}
|
||||
AT const& at()const{return at_;}
|
||||
};
|
||||
|
||||
// TODO: avoid initializing AT for nothing
|
||||
template<class AT, class ET>
|
||||
struct AT_ET_wrap : AT_wrap<AT> {
|
||||
ET et_;
|
||||
AT_ET_wrap():et_(){}
|
||||
AT_ET_wrap(ET const& e):et_(e){}
|
||||
AT_ET_wrap(ET&& e):et_(std::move(e)){}
|
||||
template<class A, class E>AT_ET_wrap(A&&a, E&&e):AT_wrap<AT>(std::forward<A>(a)),et_(std::forward<E>(e)){}
|
||||
ET const& et()const{return et_;}
|
||||
};
|
||||
|
||||
// Abstract base class for lazy numbers and lazy objects
|
||||
template <typename AT_, typename ET, typename E2A>
|
||||
template <typename AT_, typename ET, typename E2A, int=Lazy_rep_selector<AT_>::value /* 0 */>
|
||||
class Lazy_rep : public Rep, public Depth_base
|
||||
{
|
||||
Lazy_rep (const Lazy_rep&) = delete; // cannot be copied.
|
||||
|
|
@ -241,69 +292,176 @@ class Lazy_rep : public Rep, public Depth_base
|
|||
public:
|
||||
|
||||
typedef AT_ AT;
|
||||
typedef AT_ET_wrap<AT,ET> Indirect;
|
||||
|
||||
mutable AT at;
|
||||
mutable ET *et;
|
||||
AT_wrap<AT> at_orig{};
|
||||
mutable std::atomic<AT_wrap<AT>*> ptr_ { &at_orig };
|
||||
mutable std::once_flag once;
|
||||
|
||||
Lazy_rep ()
|
||||
: at(), et(nullptr){}
|
||||
|
||||
//move-constructor
|
||||
Lazy_rep (Lazy_rep&& other)
|
||||
: at(std::move(other.at)), et(other.et)
|
||||
{
|
||||
other.et = nullptr;
|
||||
this->count = std::move(other.count);
|
||||
}
|
||||
|
||||
//move-assignment
|
||||
Lazy_rep& operator= (Lazy_rep&& other)
|
||||
{
|
||||
if(this->et)
|
||||
{
|
||||
delete this->et;
|
||||
}
|
||||
this->et = other.et;
|
||||
other.et = nullptr;
|
||||
this->at = std::move(other.at);
|
||||
this->count = std::move(other.count);
|
||||
return *this;
|
||||
}
|
||||
Lazy_rep () {}
|
||||
|
||||
template<class A>
|
||||
Lazy_rep (A&& a)
|
||||
: at(std::forward<A>(a)), et(nullptr){}
|
||||
: at_orig(std::forward<A>(a)){}
|
||||
|
||||
template<class A>
|
||||
Lazy_rep (int count, A&& a)
|
||||
: Rep(count), at(std::forward<A>(a)), et(nullptr){}
|
||||
: Rep(count), at_orig(std::forward<A>(a)){}
|
||||
|
||||
template<class A, class E>
|
||||
Lazy_rep (A&& a, E&& e)
|
||||
: at(std::forward<A>(a)), et(new ET(std::forward<E>(e))) {}
|
||||
: ptr_(new AT_ET_wrap<AT,ET>(std::forward<A>(a), std::forward<E>(e))) {}
|
||||
|
||||
const AT& approx() const
|
||||
AT const& approx() const
|
||||
{
|
||||
return at;
|
||||
return ptr_.load(std::memory_order_consume)->at();
|
||||
}
|
||||
|
||||
AT& approx()
|
||||
const ET & exact_unsafe() const
|
||||
{
|
||||
return at;
|
||||
CGAL_assertion(!is_lazy());
|
||||
return static_cast<AT_ET_wrap<AT,ET>*>(ptr_.load(std::memory_order_relaxed))->et();
|
||||
}
|
||||
|
||||
const ET & exact() const
|
||||
{
|
||||
if (et==nullptr)
|
||||
update_exact();
|
||||
return *et;
|
||||
// The test is unnecessary, only use it if benchmark says so, or in order to avoid calling Lazy_exact_Ex_Cst::update_exact() (which used to contain an assertion)
|
||||
//if (is_lazy())
|
||||
std::call_once(once, [this](){this->update_exact();});
|
||||
return exact_unsafe(); // call_once already synchronized memory
|
||||
}
|
||||
|
||||
ET & exact()
|
||||
template<class A>
|
||||
void set_at(AT_ET_wrap<AT,ET>* p, A&& a) const {
|
||||
p->at_ = std::forward<A>(a);
|
||||
}
|
||||
void set_at(AT_ET_wrap<AT,ET>* p) const {
|
||||
p->at_ = E2A()(p->et());
|
||||
}
|
||||
void keep_at(AT_ET_wrap<AT,ET>* p) const {
|
||||
p->at_ = at_orig.at(); // do not move!
|
||||
}
|
||||
|
||||
void set_ptr(AT_ET_wrap<AT,ET>* p) const {
|
||||
ptr_.store(p, std::memory_order_release);
|
||||
}
|
||||
|
||||
// I think we should have different code for cases where there is some cleanup to do (say, a sum of 2 Lazy_exact_nt) and for cases where there isn't (a Lazy_exact_nt constructed from a double), but it may require making exact() virtual. Objects can be hidden in a tuple in Lazy_rep_n, so checking if there is something to clean requires some code. It isn't clear if we also need to restrict that to cases where update_exact doesn't touch AT. The special version would be basically: if(et==0){pet=new ET(...);if(!et.exchange(0,pet))delete pet; update at?}
|
||||
|
||||
#ifdef CGAL_LAZY_KERNEL_DEBUG
|
||||
void print_at_et(std::ostream& os, int level) const
|
||||
{
|
||||
if (et==nullptr)
|
||||
update_exact();
|
||||
return *et;
|
||||
for(int i = 0; i < level; i++){
|
||||
os << " ";
|
||||
}
|
||||
os << "Approximation: ";
|
||||
print_at(os, approx());
|
||||
os << std::endl;
|
||||
if(! is_lazy()){
|
||||
for(int i = 0; i < level; i++){
|
||||
os << " ";
|
||||
}
|
||||
os << "Exact: ";
|
||||
print_at(os, exact_unsafe());
|
||||
os << std::endl;
|
||||
#ifdef CGAL_LAZY_KERNEL_DEBUG_SHOW_TYPEID
|
||||
for(int i = 0; i < level; i++){
|
||||
os << " ";
|
||||
}
|
||||
os << " (type: " << typeid(exact_unsafe()).name() << ")" << std::endl;
|
||||
#endif // CGAL_LAZY_KERNEL_DEBUG_SHOW_TYPEID
|
||||
}
|
||||
}
|
||||
|
||||
virtual void print_dag(std::ostream& os, int level) const {}
|
||||
#endif
|
||||
|
||||
bool is_lazy() const { return ptr_.load(std::memory_order_relaxed) == &at_orig; }
|
||||
virtual void update_exact() const = 0;
|
||||
virtual ~Lazy_rep() {
|
||||
#if !defined __SANITIZE_THREAD__ && !__has_feature(thread_sanitizer)
|
||||
auto* p = ptr_.load(std::memory_order_relaxed);
|
||||
if (p != &at_orig) {
|
||||
std::atomic_thread_fence(std::memory_order_acquire);
|
||||
delete static_cast<Indirect*>(p);
|
||||
}
|
||||
#else
|
||||
auto* p = ptr_.load(std::memory_order_consume);
|
||||
if (p != &at_orig) delete static_cast<Indirect*>(p);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
/* How (un)safe is this? The goal is to minimize the overhead compared to a single-thread version by making the fast path almost identical.
|
||||
* For scalars on x86_64, the interval is aligned, so load/store instructions will not slice any double (although Intel does not explicitly guarantee it). On recent hardware, they should even be atomic, although without an official guarantee, and we don't need 128-bit atomicity anyway. The main danger is the unpredictable optimizations a compiler could apply (volatile would disable most of them, but it doesn't seem great), including replacing load/store with memcpy, where I fear some implementation/hardware combinations might slice sometimes. Making Interval_nt a pair of atomic_double would avoid this problem, but would likely incur a penalty since compilers don't optimize atomics much, and we shouldn't need to store/load all the time (TODO: benchmark).
|
||||
* For aggregate-like types (Simple_cartesian::Point_3), it should be ok for the same reason.
|
||||
* This is definitely NOT safe for a std::vector like a Point_d with Dynamic_dimension_tag, so it should only be enabled on a case by case basis, if at all. Storing a Point_3 piecewise with 6 atomic_double would be doable, but painful, and I didn't benchmark to check the performance. */
|
||||
template <typename AT_, typename ET, typename E2A>
|
||||
class Lazy_rep<AT_, ET, E2A, 1> : public Rep, public Depth_base
|
||||
{
|
||||
Lazy_rep (const Lazy_rep&) = delete; // cannot be copied.
|
||||
Lazy_rep& operator= (const Lazy_rep&) = delete; // cannot be copied.
|
||||
|
||||
public:
|
||||
|
||||
typedef AT_ AT;
|
||||
typedef ET Indirect;
|
||||
|
||||
mutable AT at;
|
||||
mutable std::atomic<ET*> ptr_ { nullptr };
|
||||
#ifdef CGAL_HAS_THREADS
|
||||
mutable std::once_flag once;
|
||||
#endif
|
||||
|
||||
Lazy_rep () {}
|
||||
|
||||
template<class A>
|
||||
Lazy_rep (A&& a)
|
||||
: at(std::forward<A>(a)) {}
|
||||
|
||||
template<class A>
|
||||
Lazy_rep (int count, A&& a)
|
||||
: Rep(count), at(std::forward<A>(a)){}
|
||||
|
||||
template<class A, class E>
|
||||
Lazy_rep (A&& a, E&& e)
|
||||
: at(std::forward<A>(a)), ptr_(new ET(std::forward<E>(e))) {}
|
||||
|
||||
AT const& approx() const
|
||||
{
|
||||
return at;
|
||||
}
|
||||
|
||||
template<class A>
|
||||
void set_at(ET*, A&& a) const {
|
||||
at = std::forward<A>(a);
|
||||
}
|
||||
|
||||
void set_at(ET* p) const {
|
||||
set_at(p, E2A()(*p));
|
||||
}
|
||||
void keep_at(ET*) const { }
|
||||
|
||||
const ET & exact_unsafe() const
|
||||
{
|
||||
return *ptr_.load(std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
const ET & exact() const
|
||||
{
|
||||
#ifdef CGAL_HAS_THREADS
|
||||
// The test is unnecessary, only use it if benchmark says so, or in order to avoid calling Lazy_exact_Ex_Cst::update_exact() (which used to contain an assertion)
|
||||
//if (is_lazy())
|
||||
std::call_once(once, [this](){this->update_exact();});
|
||||
#else
|
||||
if (is_lazy())
|
||||
this->update_exact();
|
||||
#endif
|
||||
return exact_unsafe(); // call_once already synchronized memory
|
||||
}
|
||||
|
||||
void set_ptr(ET* p) const {
|
||||
ptr_.store(p, std::memory_order_release);
|
||||
}
|
||||
|
||||
#ifdef CGAL_LAZY_KERNEL_DEBUG
|
||||
|
|
@ -313,20 +471,20 @@ public:
|
|||
os << " ";
|
||||
}
|
||||
os << "Approximation: ";
|
||||
print_at(os, at);
|
||||
print_at(os, approx());
|
||||
os << std::endl;
|
||||
if(! is_lazy()){
|
||||
for(int i = 0; i < level; i++){
|
||||
os << " ";
|
||||
}
|
||||
os << "Exact: ";
|
||||
print_at(os, *et);
|
||||
print_at(os, exact_unsafe());
|
||||
os << std::endl;
|
||||
#ifdef CGAL_LAZY_KERNEL_DEBUG_SHOW_TYPEID
|
||||
for(int i = 0; i < level; i++){
|
||||
os << " ";
|
||||
}
|
||||
os << " (type: " << typeid(*et).name() << ")" << std::endl;
|
||||
os << " (type: " << typeid(exact_unsafe()).name() << ")" << std::endl;
|
||||
#endif // CGAL_LAZY_KERNEL_DEBUG_SHOW_TYPEID
|
||||
}
|
||||
}
|
||||
|
|
@ -334,16 +492,131 @@ public:
|
|||
virtual void print_dag(std::ostream& os, int level) const {}
|
||||
#endif
|
||||
|
||||
bool is_lazy() const { return et == nullptr; }
|
||||
bool is_lazy() const { return ptr_.load(std::memory_order_relaxed) == nullptr; }
|
||||
virtual void update_exact() const = 0;
|
||||
virtual ~Lazy_rep() { delete et; }
|
||||
virtual ~Lazy_rep() {
|
||||
#if !defined __SANITIZE_THREAD__ && !__has_feature(thread_sanitizer)
|
||||
auto* p = ptr_.load(std::memory_order_relaxed);
|
||||
if (p != nullptr) {
|
||||
std::atomic_thread_fence(std::memory_order_acquire);
|
||||
delete p;
|
||||
}
|
||||
#else
|
||||
auto* p = ptr_.load(std::memory_order_consume);
|
||||
if (p != nullptr) delete p;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
// do we need to (forward) declare Interval_nt?
|
||||
template <bool b, typename ET, typename E2A>
|
||||
class Lazy_rep<Interval_nt<b>, ET, E2A, 2> : public Rep, public Depth_base
|
||||
{
|
||||
Lazy_rep (const Lazy_rep&) = delete; // cannot be copied.
|
||||
Lazy_rep& operator= (const Lazy_rep&) = delete; // cannot be copied.
|
||||
|
||||
public:
|
||||
|
||||
typedef Interval_nt<b> AT;
|
||||
typedef ET Indirect;
|
||||
|
||||
mutable std::atomic<double> x, y; // -inf, +sup
|
||||
mutable std::atomic<ET*> ptr_ { nullptr };
|
||||
mutable std::once_flag once;
|
||||
|
||||
Lazy_rep () {}
|
||||
|
||||
Lazy_rep (AT a)
|
||||
: x(-a.inf()), y(a.sup()) {}
|
||||
|
||||
template<class E>
|
||||
Lazy_rep (AT a, E&& e)
|
||||
: x(-a.inf()), y(a.sup()), ptr_(new ET(std::forward<E>(e))) {}
|
||||
|
||||
AT approx() const
|
||||
{
|
||||
return AT(-x.load(std::memory_order_relaxed), y.load(std::memory_order_relaxed));
|
||||
}
|
||||
|
||||
void set_at(ET*, AT a) const {
|
||||
x.store(-a.inf(), std::memory_order_relaxed);
|
||||
y.store(a.sup(), std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
void set_at(ET* p) const {
|
||||
set_at(p, E2A()(*p));
|
||||
}
|
||||
void keep_at(ET*) const { }
|
||||
|
||||
const ET & exact_unsafe() const
|
||||
{
|
||||
return *ptr_.load(std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
const ET & exact() const
|
||||
{
|
||||
// The test is unnecessary, only use it if benchmark says so, or in order to avoid calling Lazy_exact_Ex_Cst::update_exact() (which used to contain an assertion)
|
||||
//if (is_lazy())
|
||||
std::call_once(once, [this](){this->update_exact();});
|
||||
return exact_unsafe(); // call_once already synchronized memory
|
||||
}
|
||||
|
||||
void set_ptr(ET* p) const {
|
||||
ptr_.store(p, std::memory_order_release);
|
||||
}
|
||||
|
||||
// I think we should have different code for cases where there is some cleanup to do (say, a sum of 2 Lazy_exact_nt) and for cases where there isn't (a Lazy_exact_nt constructed from a double). Objects can be hidden in a tuple in Lazy_rep_n, so checking if there is something to clean requires some code. It isn't clear if we also need to restrict that to cases where update_exact doesn't touch AT. The special version would be basically: if(et==0){pet=new ET(...);if(!et.exchange(0,pet))delete pet; update at?}
|
||||
|
||||
#ifdef CGAL_LAZY_KERNEL_DEBUG
|
||||
void print_at_et(std::ostream& os, int level) const
|
||||
{
|
||||
for(int i = 0; i < level; i++){
|
||||
os << " ";
|
||||
}
|
||||
os << "Approximation: ";
|
||||
print_at(os, approx());
|
||||
os << std::endl;
|
||||
if(! is_lazy()){
|
||||
for(int i = 0; i < level; i++){
|
||||
os << " ";
|
||||
}
|
||||
os << "Exact: ";
|
||||
print_at(os, exact_unsafe());
|
||||
os << std::endl;
|
||||
#ifdef CGAL_LAZY_KERNEL_DEBUG_SHOW_TYPEID
|
||||
for(int i = 0; i < level; i++){
|
||||
os << " ";
|
||||
}
|
||||
os << " (type: " << typeid(exact_unsafe()).name() << ")" << std::endl;
|
||||
#endif // CGAL_LAZY_KERNEL_DEBUG_SHOW_TYPEID
|
||||
}
|
||||
}
|
||||
|
||||
virtual void print_dag(std::ostream& os, int level) const {}
|
||||
#endif
|
||||
|
||||
bool is_lazy() const { return ptr_.load(std::memory_order_relaxed) == nullptr; }
|
||||
virtual void update_exact() const = 0;
|
||||
virtual ~Lazy_rep() {
|
||||
#if !defined __SANITIZE_THREAD__ && !__has_feature(thread_sanitizer)
|
||||
auto* p = ptr_.load(std::memory_order_relaxed);
|
||||
if (p != nullptr) {
|
||||
std::atomic_thread_fence(std::memory_order_acquire);
|
||||
delete p;
|
||||
}
|
||||
#else
|
||||
auto* p = ptr_.load(std::memory_order_consume);
|
||||
if (p != nullptr) delete p;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template<typename AT, typename ET, typename AC, typename EC, typename E2A, typename...L>
|
||||
class Lazy_rep_n :
|
||||
template<typename AT, typename ET, typename AC, typename EC, typename E2A, bool noprune, typename...L>
|
||||
class Lazy_rep_n final :
|
||||
public Lazy_rep< AT, ET, E2A >, private EC
|
||||
{
|
||||
typedef Lazy_rep< AT, ET, E2A > Base;
|
||||
// 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;
|
||||
|
|
@ -351,9 +624,11 @@ class Lazy_rep_n :
|
|||
const EC& ec() const { return *this; }
|
||||
template<std::size_t...I>
|
||||
void update_exact_helper(std::index_sequence<I...>) const {
|
||||
this->et = new ET(ec()( CGAL::exact( std::get<I>(l) ) ... ) );
|
||||
this->at = E2A()(*(this->et));
|
||||
l = std::tuple<L...>{};
|
||||
auto* p = new typename Base::Indirect(ec()( CGAL::exact( std::get<I>(l) ) ... ) );
|
||||
this->set_at(p);
|
||||
this->set_ptr(p);
|
||||
if(!noprune || is_currently_single_threaded())
|
||||
lazy_reset_member(l);
|
||||
}
|
||||
public:
|
||||
void update_exact() const {
|
||||
|
|
@ -381,7 +656,7 @@ class Lazy_rep_n :
|
|||
}
|
||||
public:
|
||||
void print_dag(std::ostream& os, int level) const {
|
||||
print_dag_helper(os, level, std::make_index_sequence<sizeof...L>{});
|
||||
print_dag_helper(os, level, std::make_index_sequence<sizeof...(L)>{});
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
|
@ -400,9 +675,11 @@ class Lazy_rep_optional_n :
|
|||
|
||||
template<std::size_t...I>
|
||||
void update_exact_helper(std::index_sequence<I...>) const {
|
||||
this->et = new ET( * ec()( CGAL::exact( std::get<I>(l) ) ... ) );
|
||||
this->at = E2A()(*(this->et));
|
||||
l = std::tuple<L...>{};
|
||||
typedef Lazy_rep< AT, ET, E2A > Base;
|
||||
auto* p = new typename Base::Indirect( * ec()( CGAL::exact( std::get<I>(l) ) ... ) );
|
||||
this->set_at(p);
|
||||
this->set_ptr(p);
|
||||
lazy_reset_member(l);
|
||||
}
|
||||
public:
|
||||
|
||||
|
|
@ -443,7 +720,7 @@ class Lazy_rep_optional_n :
|
|||
|
||||
public:
|
||||
void print_dag(std::ostream& os, int level) const {
|
||||
print_dag_helper(os, level, std::make_index_sequence<sizeof...L>{});
|
||||
print_dag_helper(os, level, std::make_index_sequence<sizeof...(L)>{});
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
|
@ -452,7 +729,7 @@ class Lazy_rep_optional_n :
|
|||
// The rep for the leaf node
|
||||
|
||||
template <typename AT, typename ET, typename E2A>
|
||||
class Lazy_rep_0 : public Lazy_rep<AT, ET, E2A>
|
||||
class Lazy_rep_0 final : public Lazy_rep<AT, ET, E2A>
|
||||
{
|
||||
|
||||
typedef Lazy_rep<AT, ET, E2A> Base;
|
||||
|
|
@ -461,12 +738,23 @@ public:
|
|||
void
|
||||
update_exact() const
|
||||
{
|
||||
this->et = new ET();
|
||||
#ifdef CGAL_HAS_THREADS
|
||||
// Unless we add is_lazy before call_once in Lazy_rep. This test is
|
||||
// necessary because this class can be used either for default
|
||||
// construction, or to store a non-lazy exact value, and only the first one
|
||||
// should have a non-empty update_exact.
|
||||
// An alternative would be to add in the constructors taking an ET: std::call_once(this->once, [](){});
|
||||
if(!this->is_lazy()) return;
|
||||
#endif
|
||||
auto* p = new typename Base::Indirect();
|
||||
this->set_ptr(p);
|
||||
}
|
||||
|
||||
Lazy_rep_0()
|
||||
: Lazy_rep<AT,ET, E2A>() {}
|
||||
|
||||
// TODO: the case where the exact value is provided at construction should
|
||||
// actually use a different class from the lazy default construction.
|
||||
template<class A, class E>
|
||||
Lazy_rep_0(A&& a, E&& e)
|
||||
: Lazy_rep<AT,ET,E2A>(std::forward<A>(a), std::forward<E>(e)) {}
|
||||
|
|
@ -509,7 +797,7 @@ struct Approx_converter
|
|||
//typedef Converter Number_type_converter;
|
||||
|
||||
template < typename T >
|
||||
const typename T::AT&
|
||||
decltype(auto)
|
||||
operator()(const T&t) const
|
||||
{ return t.approx(); }
|
||||
|
||||
|
|
@ -534,7 +822,7 @@ struct Exact_converter
|
|||
//typedef Converter Number_type_converter;
|
||||
|
||||
template < typename T >
|
||||
const typename T::ET&
|
||||
decltype(auto)
|
||||
operator()(const T&t) const
|
||||
{ return t.exact(); }
|
||||
|
||||
|
|
@ -556,7 +844,7 @@ struct Exact_converter
|
|||
|
||||
|
||||
template <typename AC, typename EC, typename E2A, typename L1>
|
||||
class Lazy_rep_with_vector_1
|
||||
class Lazy_rep_with_vector_1 final
|
||||
: public Lazy_rep<std::vector<Object>, std::vector<Object>, E2A>
|
||||
, private EC
|
||||
{
|
||||
|
|
@ -573,22 +861,21 @@ public:
|
|||
void
|
||||
update_exact() const
|
||||
{
|
||||
// TODO : This looks really unfinished...
|
||||
auto* p = new typename Base::Indirect();
|
||||
// TODO : This looks really unfinished...
|
||||
std::vector<Object> vec;
|
||||
this->et = new ET();
|
||||
//this->et->reserve(this->at.size());
|
||||
ec()(CGAL::exact(l1_), std::back_inserter(*(this->et)));
|
||||
if(this->et==nullptr)
|
||||
E2A()(*(this->et));
|
||||
this->at = E2A()(*(this->et));
|
||||
ec()(CGAL::exact(l1_), std::back_inserter(p->et_));
|
||||
this->set_at(p);
|
||||
this->set_ptr(p);
|
||||
// Prune lazy tree
|
||||
l1_ = L1();
|
||||
lazy_reset_member(l1_);
|
||||
}
|
||||
|
||||
Lazy_rep_with_vector_1(const AC& ac, const EC& /*ec*/, const L1& l1)
|
||||
: l1_(l1)
|
||||
{
|
||||
ac(CGAL::approx(l1), std::back_inserter(this->at));
|
||||
ac(CGAL::approx(l1), std::back_inserter(this->at_orig.at_));
|
||||
}
|
||||
|
||||
#ifdef CGAL_LAZY_KERNEL_DEBUG
|
||||
|
|
@ -596,7 +883,7 @@ public:
|
|||
print_dag(std::ostream& os, int level) const
|
||||
{
|
||||
this->print_at_et(os, level);
|
||||
os << "A Lazy_rep_with_vector_1 of size " << this->at.size() << std::endl;
|
||||
os << "A Lazy_rep_with_vector_1 of size " << this->approx().size() << std::endl;
|
||||
if(this->is_lazy()){
|
||||
CGAL::msg(os, level, "DAG with one child node:");
|
||||
CGAL::print_dag(l1_, os, level+1);
|
||||
|
|
@ -608,7 +895,7 @@ public:
|
|||
|
||||
|
||||
template <typename AC, typename EC, typename E2A, typename L1, typename L2>
|
||||
class Lazy_rep_with_vector_2
|
||||
class Lazy_rep_with_vector_2 final
|
||||
: public Lazy_rep<std::vector<Object>, std::vector<Object>, E2A>
|
||||
, private EC
|
||||
{
|
||||
|
|
@ -626,19 +913,20 @@ public:
|
|||
void
|
||||
update_exact() const
|
||||
{
|
||||
this->et = new ET();
|
||||
this->et->reserve(this->at.size());
|
||||
ec()(CGAL::exact(l1_), CGAL::exact(l2_), std::back_inserter(*(this->et)));
|
||||
this->at = E2A()(*(this->et));
|
||||
auto* p = new typename Base::Indirect();
|
||||
p->et_.reserve(this->at_orig.at().size());
|
||||
ec()(CGAL::exact(l1_), CGAL::exact(l2_), std::back_inserter(p->et_));
|
||||
this->set_at(p);
|
||||
this->set_ptr(p);
|
||||
// Prune lazy tree
|
||||
l1_ = L1();
|
||||
l2_ = L2();
|
||||
lazy_reset_member(l1_);
|
||||
lazy_reset_member(l2_);
|
||||
}
|
||||
|
||||
Lazy_rep_with_vector_2(const AC& ac, const EC& /*ec*/, const L1& l1, const L2& l2)
|
||||
: l1_(l1), l2_(l2)
|
||||
{
|
||||
ac(CGAL::approx(l1), CGAL::approx(l2), std::back_inserter(this->at));
|
||||
ac(CGAL::approx(l1), CGAL::approx(l2), std::back_inserter(this->at_orig.at_));
|
||||
}
|
||||
|
||||
#ifdef CGAL_LAZY_KERNEL_DEBUG
|
||||
|
|
@ -646,7 +934,7 @@ public:
|
|||
print_dag(std::ostream& os, int level) const
|
||||
{
|
||||
this->print_at_et(os, level);
|
||||
os << "A Lazy_rep_with_vector_2 of size " << this->at.size() << std::endl;
|
||||
os << "A Lazy_rep_with_vector_2 of size " << this->approx().size() << std::endl;
|
||||
if(this->is_lazy()){
|
||||
CGAL::msg(os, level, "DAG with two child nodes:");
|
||||
CGAL::print_dag(l1_, os, level+1);
|
||||
|
|
@ -658,7 +946,7 @@ public:
|
|||
|
||||
|
||||
template <typename AC, typename EC, typename E2A, typename L1, typename L2, typename R1>
|
||||
class Lazy_rep_2_1
|
||||
class Lazy_rep_2_1 final
|
||||
: public Lazy_rep<typename R1::AT, typename R1::ET, E2A>
|
||||
, private EC
|
||||
{
|
||||
|
|
@ -676,18 +964,19 @@ public:
|
|||
void
|
||||
update_exact() const
|
||||
{
|
||||
this->et = new ET();
|
||||
ec()(CGAL::exact(l1_), CGAL::exact(l2_), *(this->et));
|
||||
this->at = E2A()(*(this->et));
|
||||
auto* p = new typename Base::Indirect();
|
||||
ec()(CGAL::exact(l1_), CGAL::exact(l2_), p->et_);
|
||||
this->set_at(p);
|
||||
this->set_ptr(p);
|
||||
// Prune lazy tree
|
||||
l1_ = L1();
|
||||
l2_ = L2();
|
||||
lazy_reset_member(l1_);
|
||||
lazy_reset_member(l2_);
|
||||
}
|
||||
|
||||
Lazy_rep_2_1(const AC& ac, const EC& /*ec*/, const L1& l1, const L2& l2)
|
||||
: Lazy_rep<AT,ET,E2A>(), l1_(l1), l2_(l2)
|
||||
{
|
||||
ac(CGAL::approx(l1), CGAL::approx(l2), this->at);
|
||||
ac(CGAL::approx(l1), CGAL::approx(l2), this->at_orig.at_);
|
||||
}
|
||||
|
||||
#ifdef CGAL_LAZY_KERNEL_DEBUG
|
||||
|
|
@ -710,7 +999,7 @@ public:
|
|||
// The following rep class stores two non-const reference parameters of type R1 and R2
|
||||
|
||||
template <typename AC, typename EC, typename E2A, typename L1, typename L2, typename R1, typename R2>
|
||||
class Lazy_rep_2_2
|
||||
class Lazy_rep_2_2 final
|
||||
: public Lazy_rep<std::pair<typename R1::AT,typename R2::AT>, std::pair<typename R1::ET, typename R2::ET>, E2A>
|
||||
, private EC
|
||||
{
|
||||
|
|
@ -728,18 +1017,19 @@ public:
|
|||
void
|
||||
update_exact() const
|
||||
{
|
||||
this->et = new ET();
|
||||
ec()(CGAL::exact(l1_), CGAL::exact(l2_), this->et->first, this->et->second );
|
||||
this->at = E2A()(*(this->et));
|
||||
auto* p = new typename Base::Indirect();
|
||||
ec()(CGAL::exact(l1_), CGAL::exact(l2_), p->et_.first, p->et_.second );
|
||||
this->set_at(p);
|
||||
this->set_ptr(p);
|
||||
// Prune lazy tree
|
||||
l1_ = L1();
|
||||
l2_ = L2();
|
||||
lazy_reset_member(l1_);
|
||||
lazy_reset_member(l2_);
|
||||
}
|
||||
|
||||
Lazy_rep_2_2(const AC& ac, const EC& /*ec*/, const L1& l1, const L2& l2)
|
||||
: Lazy_rep<AT,ET,E2A>(), l1_(l1), l2_(l2)
|
||||
{
|
||||
ac(CGAL::approx(l1), CGAL::approx(l2), this->at.first, this->at.second);
|
||||
ac(CGAL::approx(l1), CGAL::approx(l2), this->at_orig.at_.first, this->at_orig.at_.second);
|
||||
}
|
||||
|
||||
#ifdef CGAL_LAZY_KERNEL_DEBUG
|
||||
|
|
@ -830,18 +1120,12 @@ public :
|
|||
friend void swap(Lazy& a, Lazy& b) noexcept
|
||||
{ swap(static_cast<Handle&>(a), static_cast<Handle&>(b)); }
|
||||
|
||||
const AT& approx() const
|
||||
decltype(auto) approx() const
|
||||
{ return ptr()->approx(); }
|
||||
|
||||
const ET& exact() const
|
||||
{ return ptr()->exact(); }
|
||||
|
||||
AT& approx()
|
||||
{ return ptr()->approx(); }
|
||||
|
||||
ET& exact()
|
||||
{ return ptr()->exact(); }
|
||||
|
||||
unsigned depth() const
|
||||
{
|
||||
return ptr()->depth();
|
||||
|
|
@ -927,7 +1211,8 @@ struct Lazy_construction_optional_for_polygonal_envelope
|
|||
CGAL_STATIC_THREAD_LOCAL_VARIABLE_0(LazyPointRep, rep);
|
||||
|
||||
const typename AK::Point_3 ap = *oap;
|
||||
rep = LazyPointRep(2,ap, ec, l1, l2, l3);
|
||||
// rep = LazyPointRep(2,ap, ec, l1, l2, l3);
|
||||
rep.~LazyPointRep(); new (&rep) LazyPointRep(2, ap, ec, l1, l2, l3);
|
||||
typename LK::Point_3 lp(&rep);
|
||||
return boost::make_optional(lp);
|
||||
|
||||
|
|
@ -965,7 +1250,8 @@ struct Lazy_construction_optional_for_polygonal_envelope
|
|||
|
||||
CGAL_STATIC_THREAD_LOCAL_VARIABLE_0(LazyPointRep, rep);
|
||||
const typename AK::Point_3 ap = *oap;
|
||||
rep = LazyPointRep(2, ap, ec, l1, l2);
|
||||
// rep = LazyPointRep(2, ap, ec, l1, l2);
|
||||
rep.~LazyPointRep(); new (&rep) LazyPointRep(2, ap, ec, l1, l2);
|
||||
typename LK::Point_3 lp(&rep);
|
||||
return boost::make_optional(lp);
|
||||
|
||||
|
|
@ -1011,7 +1297,7 @@ struct Lazy_construction_nt {
|
|||
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
|
||||
Protect_FPU_rounding<Protection> P;
|
||||
try {
|
||||
return new Lazy_rep_n<AT, ET, AC, EC, To_interval<ET>, L... >(ac, ec, l...);
|
||||
return new Lazy_rep_n<AT, ET, AC, EC, To_interval<ET>, false, L... >(ac, ec, l...);
|
||||
} catch (Uncertain_conversion_exception&) {
|
||||
CGAL_BRANCH_PROFILER_BRANCH(tmp);
|
||||
Protect_FPU_rounding<!Protection> P2(CGAL_FE_TONEAREST);
|
||||
|
|
@ -1300,8 +1586,8 @@ public:
|
|||
typedef Lazy<std::pair<typename R1::AT, typename R2::AT>, std::pair<typename R1::ET, typename R2::ET>, E2A> Lazy_pair;
|
||||
Lazy_pair lv(new Lazy_rep_2_2<AC, EC, E2A, L1, L2, R1, R2>(ac, ec, l1, l2));
|
||||
// lv->approx() is a std::pair<R1::AT, R2::AT>;
|
||||
r1 = R1(Handle_1(new Lazy_rep_n<void, void, First<std::pair<typename R1::AT, typename R2::AT> >, First<std::pair<typename R1::ET, typename R2::ET> >, E2A, Lazy_pair>(First<std::pair<typename R1::AT, typename R2::AT> >(), First<std::pair<typename R1::ET, typename R2::ET> >(), lv)));
|
||||
r2 = R2(Handle_2(new Lazy_rep_n<void, void, Second<std::pair<typename R1::AT, typename R2::AT> >, Second<std::pair<typename R1::ET, typename R2::ET> >, E2A, Lazy_pair>(Second<std::pair<typename R1::AT, typename R2::AT> >(), Second<std::pair<typename R1::ET, typename R2::ET> >(), lv)));
|
||||
r1 = R1(Handle_1(new Lazy_rep_n<void, void, First<std::pair<typename R1::AT, typename R2::AT> >, First<std::pair<typename R1::ET, typename R2::ET> >, E2A, false, Lazy_pair>(First<std::pair<typename R1::AT, typename R2::AT> >(), First<std::pair<typename R1::ET, typename R2::ET> >(), lv)));
|
||||
r2 = R2(Handle_2(new Lazy_rep_n<void, void, Second<std::pair<typename R1::AT, typename R2::AT> >, Second<std::pair<typename R1::ET, typename R2::ET> >, E2A, false, Lazy_pair>(Second<std::pair<typename R1::AT, typename R2::AT> >(), Second<std::pair<typename R1::ET, typename R2::ET> >(), lv)));
|
||||
} catch (Uncertain_conversion_exception&) {
|
||||
CGAL_BRANCH_PROFILER_BRANCH(tmp);
|
||||
Protect_FPU_rounding<!Protection> P2(CGAL_FE_TONEAREST);
|
||||
|
|
@ -1348,7 +1634,7 @@ public:
|
|||
// FIXME : I'm not sure how this work...
|
||||
#define CGAL_Kernel_obj(X) if (object_cast<typename AK::X>(& (lv.approx()[i]))) { \
|
||||
*it++ = make_object(typename LK::X(new Lazy_rep_n<typename AK::X, typename EK::X, Ith<typename AK::X>, \
|
||||
Ith<typename EK::X>, E2A, Lazy_vector> \
|
||||
Ith<typename EK::X>, E2A, false, Lazy_vector> \
|
||||
(Ith<typename AK::X>(i), Ith<typename EK::X>(i), lv))); \
|
||||
continue; \
|
||||
}
|
||||
|
|
@ -1419,14 +1705,14 @@ public:
|
|||
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
|
||||
Protect_FPU_rounding<Protection> P;
|
||||
try {
|
||||
Lazy_object lo(new Lazy_rep_n<result_type, result_type, AC, EC, E2A, L1>(ac, ec, l1));
|
||||
Lazy_object lo(new Lazy_rep_n<result_type, result_type, AC, EC, E2A, false, L1>(ac, ec, l1));
|
||||
|
||||
if(lo.approx().is_empty())
|
||||
return Object();
|
||||
|
||||
#define CGAL_Kernel_obj(X) \
|
||||
if (object_cast<typename AK::X>(& (lo.approx()))) { \
|
||||
typedef Lazy_rep_n< typename AK::X, typename EK::X, Object_cast<typename AK::X>, Object_cast<typename EK::X>, E2A, Lazy_object> Lcr; \
|
||||
typedef Lazy_rep_n< typename AK::X, typename EK::X, Object_cast<typename AK::X>, Object_cast<typename EK::X>, E2A, false, Lazy_object> Lcr; \
|
||||
Lcr * lcr = new Lcr(Object_cast<typename AK::X>(), Object_cast<typename EK::X>(), lo); \
|
||||
return make_object(typename LK::X(lcr)); \
|
||||
}
|
||||
|
|
@ -1452,14 +1738,14 @@ public:
|
|||
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
|
||||
Protect_FPU_rounding<Protection> P;
|
||||
try {
|
||||
Lazy_object lo(new Lazy_rep_n<result_type, result_type, AC, EC, E2A, L1, L2>(ac, ec, l1, l2));
|
||||
Lazy_object lo(new Lazy_rep_n<result_type, result_type, AC, EC, E2A, false, L1, L2>(ac, ec, l1, l2));
|
||||
|
||||
if(lo.approx().is_empty())
|
||||
return Object();
|
||||
|
||||
#define CGAL_Kernel_obj(X) \
|
||||
if (object_cast<typename AK::X>(& (lo.approx()))) { \
|
||||
typedef Lazy_rep_n<typename AK::X, typename EK::X, Object_cast<typename AK::X>, Object_cast<typename EK::X>, E2A, Lazy_object> Lcr; \
|
||||
typedef Lazy_rep_n<typename AK::X, typename EK::X, Object_cast<typename AK::X>, Object_cast<typename EK::X>, E2A, false, Lazy_object> Lcr; \
|
||||
Lcr * lcr = new Lcr(Object_cast<typename AK::X>(), Object_cast<typename EK::X>(), lo); \
|
||||
return make_object(typename LK::X(lcr)); \
|
||||
}
|
||||
|
|
@ -1476,7 +1762,7 @@ public:
|
|||
V.resize(v_ptr->size()); \
|
||||
for (unsigned int i = 0; i < v_ptr->size(); i++) { \
|
||||
V[i] = typename LK::X(new Lazy_rep_n<typename AK::X, typename EK::X, Ith_for_intersection<typename AK::X>, \
|
||||
Ith_for_intersection<typename EK::X>, E2A, Lazy_object> \
|
||||
Ith_for_intersection<typename EK::X>, E2A, false, Lazy_object> \
|
||||
(Ith_for_intersection<typename AK::X>(i), Ith_for_intersection<typename EK::X>(i), lo)); \
|
||||
} \
|
||||
return make_object(V); \
|
||||
|
|
@ -1506,14 +1792,14 @@ CGAL_Kernel_obj(Point_3)
|
|||
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
|
||||
Protect_FPU_rounding<Protection> P;
|
||||
try {
|
||||
Lazy_object lo(new Lazy_rep_n<result_type, result_type, AC, EC, E2A, L1, L2, L3>(ac, ec, l1, l2, l3));
|
||||
Lazy_object lo(new Lazy_rep_n<result_type, result_type, AC, EC, E2A, false, L1, L2, L3>(ac, ec, l1, l2, l3));
|
||||
|
||||
if(lo.approx().is_empty())
|
||||
return Object();
|
||||
|
||||
#define CGAL_Kernel_obj(X) \
|
||||
if (object_cast<typename AK::X>(& (lo.approx()))) { \
|
||||
typedef Lazy_rep_n<typename AK::X, typename EK::X, Object_cast<typename AK::X>, Object_cast<typename EK::X>, E2A, Lazy_object> Lcr; \
|
||||
typedef Lazy_rep_n<typename AK::X, typename EK::X, Object_cast<typename AK::X>, Object_cast<typename EK::X>, E2A, false, Lazy_object> Lcr; \
|
||||
Lcr * lcr = new Lcr(Object_cast<typename AK::X>(), Object_cast<typename EK::X>(), lo); \
|
||||
return make_object(typename LK::X(lcr)); \
|
||||
}
|
||||
|
|
@ -1584,7 +1870,7 @@ struct Fill_lazy_variant_visitor_2 : boost::static_visitor<> {
|
|||
typedef typename Type_mapper<AKT, AK, EK>::type EKT;
|
||||
typedef typename Type_mapper<AKT, AK, LK>::type LKT;
|
||||
|
||||
typedef Lazy_rep_n<AKT, EKT, Variant_cast<AKT>, Variant_cast<EKT>, typename LK::E2A, Origin> Lcr;
|
||||
typedef Lazy_rep_n<AKT, EKT, Variant_cast<AKT>, Variant_cast<EKT>, typename LK::E2A, false, Origin> Lcr;
|
||||
Lcr * lcr = new Lcr(Variant_cast<AKT>(), Variant_cast<EKT>(), *o);
|
||||
|
||||
*r = LKT(lcr);
|
||||
|
|
@ -1600,7 +1886,7 @@ struct Fill_lazy_variant_visitor_2 : boost::static_visitor<> {
|
|||
V.resize(t.size());
|
||||
for (unsigned int i = 0; i < t.size(); i++) {
|
||||
V[i] = LKT(new Lazy_rep_n<AKT, EKT, Ith_for_intersection<AKT>,
|
||||
Ith_for_intersection<EKT>, typename LK::E2A, Origin>
|
||||
Ith_for_intersection<EKT>, typename LK::E2A, false, Origin>
|
||||
(Ith_for_intersection<AKT>(i), Ith_for_intersection<EKT>(i), *o));
|
||||
}
|
||||
|
||||
|
|
@ -1683,7 +1969,7 @@ struct Lazy_construction_variant {
|
|||
Protect_FPU_rounding<Protection> P;
|
||||
|
||||
try {
|
||||
Lazy<AT, ET, E2A> lazy(new Lazy_rep_n<AT, ET, AC, EC, E2A, L1, L2>(AC(), EC(), l1, l2));
|
||||
Lazy<AT, ET, E2A> lazy(new Lazy_rep_n<AT, ET, AC, EC, E2A, false, L1, L2>(AC(), EC(), l1, l2));
|
||||
|
||||
// the approximate result requires the trait with types from the AK
|
||||
AT approx_v = lazy.approx();
|
||||
|
|
@ -1736,7 +2022,7 @@ struct Lazy_construction_variant {
|
|||
Protect_FPU_rounding<Protection> P;
|
||||
|
||||
try {
|
||||
Lazy<AT, ET, E2A> lazy(new Lazy_rep_n<AT, ET, AC, EC, E2A, L1, L2, L3>(AC(), EC(), l1, l2, l3));
|
||||
Lazy<AT, ET, E2A> lazy(new Lazy_rep_n<AT, ET, AC, EC, E2A, false, L1, L2, L3>(AC(), EC(), l1, l2, l3));
|
||||
|
||||
// the approximate result requires the trait with types from the AK
|
||||
AT approx_v = lazy.approx();
|
||||
|
|
@ -1775,6 +2061,9 @@ template<typename LK, typename AC, typename EC, typename E2A = Default,
|
|||
bool has_result_type = internal::has_result_type<AC>::value && internal::has_result_type<EC>::value >
|
||||
struct Lazy_construction;
|
||||
|
||||
template<class AK, class AC> struct Disable_lazy_pruning { static const bool value = false; };
|
||||
template<class AK> struct Disable_lazy_pruning<AK, typename AK::Construct_weighted_point_2> { static const bool value = true; };
|
||||
template<class AK> struct Disable_lazy_pruning<AK, typename AK::Construct_weighted_point_3> { static const bool value = true; };
|
||||
|
||||
// we have a result type, low effort
|
||||
template<typename LK, typename AC, typename EC, typename E2A_>
|
||||
|
|
@ -1792,6 +2081,8 @@ struct Lazy_construction<LK, AC, EC, E2A_, true> {
|
|||
|
||||
typedef typename Type_mapper<AT, AK, LK>::type result_type;
|
||||
|
||||
static const bool noprune = Disable_lazy_pruning<AK, AC>::value;
|
||||
|
||||
CGAL_NO_UNIQUE_ADDRESS AC ac;
|
||||
CGAL_NO_UNIQUE_ADDRESS EC ec;
|
||||
|
||||
|
|
@ -1803,7 +2094,7 @@ struct Lazy_construction<LK, AC, EC, E2A_, true> {
|
|||
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); \
|
||||
Protect_FPU_rounding<Protection> P; \
|
||||
try { \
|
||||
return result_type( Handle(new Lazy_rep_n<AT, ET, AC, EC, E2A, BOOST_PP_ENUM_PARAMS(n, L)>(ac, ec, BOOST_PP_ENUM_PARAMS(n, l)))); \
|
||||
return result_type( Handle(new Lazy_rep_n<AT, ET, AC, EC, E2A, noprune, BOOST_PP_ENUM_PARAMS(n, L)>(ac, ec, BOOST_PP_ENUM_PARAMS(n, l)))); \
|
||||
} catch (Uncertain_conversion_exception&) { \
|
||||
CGAL_BRANCH_PROFILER_BRANCH(tmp); \
|
||||
Protect_FPU_rounding<!Protection> P2(CGAL_FE_TONEAREST); \
|
||||
|
|
@ -1819,7 +2110,7 @@ struct Lazy_construction<LK, AC, EC, E2A_, true> {
|
|||
operator()() const
|
||||
{
|
||||
typedef Lazy<AT, ET, E2A> Handle;
|
||||
return result_type( Handle(new Lazy_rep_0<AT,ET,E2A>()) );
|
||||
return result_type( Handle() );
|
||||
}
|
||||
|
||||
#undef CGAL_CONSTRUCTION_OPERATOR
|
||||
|
|
@ -1842,6 +2133,8 @@ struct Lazy_construction<LK, AC, EC, E2A_, false>
|
|||
// you are on your own
|
||||
};
|
||||
|
||||
static const bool noprune = Disable_lazy_pruning<AK, AC>::value;
|
||||
|
||||
CGAL_NO_UNIQUE_ADDRESS AC ac;
|
||||
CGAL_NO_UNIQUE_ADDRESS EC ec;
|
||||
|
||||
|
|
@ -1861,7 +2154,7 @@ struct Lazy_construction<LK, AC, EC, E2A_, false>
|
|||
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); \
|
||||
Protect_FPU_rounding<Protection> P; \
|
||||
try { \
|
||||
return result_type( Handle(new Lazy_rep_n<AT, ET, AC, EC, E2A, BOOST_PP_ENUM_PARAMS(n, L)>(ac, ec, BOOST_PP_ENUM_PARAMS(n, l)))); \
|
||||
return result_type( Handle(new Lazy_rep_n<AT, ET, AC, EC, E2A, noprune, BOOST_PP_ENUM_PARAMS(n, L)>(ac, ec, BOOST_PP_ENUM_PARAMS(n, l)))); \
|
||||
} catch (Uncertain_conversion_exception&) { \
|
||||
CGAL_BRANCH_PROFILER_BRANCH(tmp); \
|
||||
Protect_FPU_rounding<!Protection> P2(CGAL_FE_TONEAREST); \
|
||||
|
|
@ -1881,7 +2174,7 @@ struct Lazy_construction<LK, AC, EC, E2A_, false>
|
|||
typedef Lazy<AT, ET, E2A> Handle;
|
||||
typedef typename Type_mapper<AT, AK, LK>::type result_type;
|
||||
|
||||
return result_type( Handle(new Lazy_rep_0<AT,ET,E2A>()) );
|
||||
return result_type( Handle() );
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -331,6 +331,7 @@ public:
|
|||
typename Approximate_kernel::Construct_weighted_point_2,
|
||||
typename Exact_kernel::Construct_weighted_point_2,
|
||||
E2A_,
|
||||
true,
|
||||
Return_base_tag,
|
||||
Point_2,
|
||||
FT
|
||||
|
|
@ -341,6 +342,7 @@ public:
|
|||
typename Approximate_kernel::Construct_weighted_point_2,
|
||||
typename Exact_kernel::Construct_weighted_point_2,
|
||||
E2A_,
|
||||
true,
|
||||
Return_base_tag,
|
||||
Point_2,
|
||||
int
|
||||
|
|
@ -352,6 +354,8 @@ public:
|
|||
if(tn == typeid(LR).name()){
|
||||
LR * lr = static_cast<LR*>(p.ptr());
|
||||
if(lr->is_lazy()){
|
||||
// Another thread could reset lr->l before this line, so we disable reset for Construct_weighted_point_2 in MT-mode.
|
||||
// We could also always disable reset for Construct_weighted_point_2 and return lr->l here even if update_exact has run.
|
||||
return std::get<2>(lr->l);
|
||||
}
|
||||
}else{
|
||||
|
|
@ -383,6 +387,7 @@ public:
|
|||
typename Approximate_kernel::Construct_weighted_point_3,
|
||||
typename Exact_kernel::Construct_weighted_point_3,
|
||||
E2A_,
|
||||
true,
|
||||
Return_base_tag,
|
||||
Point_3,
|
||||
FT
|
||||
|
|
@ -393,6 +398,7 @@ public:
|
|||
typename Approximate_kernel::Construct_weighted_point_3,
|
||||
typename Exact_kernel::Construct_weighted_point_3,
|
||||
E2A_,
|
||||
true,
|
||||
Return_base_tag,
|
||||
Point_3,
|
||||
int
|
||||
|
|
@ -442,6 +448,7 @@ public:
|
|||
typename Approximate_kernel::Construct_weighted_point_2,
|
||||
typename Exact_kernel::Construct_weighted_point_2,
|
||||
E2A_,
|
||||
true,
|
||||
Return_base_tag,
|
||||
Point_2,
|
||||
FT
|
||||
|
|
@ -452,6 +459,7 @@ public:
|
|||
typename Approximate_kernel::Construct_weighted_point_2,
|
||||
typename Exact_kernel::Construct_weighted_point_2,
|
||||
E2A_,
|
||||
true,
|
||||
Return_base_tag,
|
||||
Point_2,
|
||||
int
|
||||
|
|
@ -501,6 +509,7 @@ public:
|
|||
typename Approximate_kernel::Construct_weighted_point_3,
|
||||
typename Exact_kernel::Construct_weighted_point_3,
|
||||
E2A_,
|
||||
true,
|
||||
Return_base_tag,
|
||||
Point_3,
|
||||
FT
|
||||
|
|
@ -511,6 +520,7 @@ public:
|
|||
typename Approximate_kernel::Construct_weighted_point_3,
|
||||
typename Exact_kernel::Construct_weighted_point_3,
|
||||
E2A_,
|
||||
true,
|
||||
Return_base_tag,
|
||||
Point_3,
|
||||
int
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
#endif
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if (BOOST_GCC >= 40900)
|
||||
#if defined(BOOST_GCC)
|
||||
_Pragma("GCC diagnostic push")
|
||||
_Pragma("GCC diagnostic ignored \"-Warray-bounds\"")
|
||||
#endif
|
||||
|
|
@ -3890,7 +3890,7 @@ namespace CGAL {
|
|||
|
||||
} // namespace CGAL
|
||||
|
||||
#if (BOOST_GCC >= 40900)
|
||||
#if defined(BOOST_GCC)
|
||||
_Pragma("GCC diagnostic pop")
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
#include <bitset>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if (BOOST_GCC >= 40900)
|
||||
#if defined(BOOST_GCC)
|
||||
_Pragma("GCC diagnostic push")
|
||||
_Pragma("GCC diagnostic ignored \"-Warray-bounds\"")
|
||||
#endif
|
||||
|
|
@ -426,7 +426,7 @@ namespace CGAL {
|
|||
|
||||
} // namespace CGAL
|
||||
|
||||
#if (BOOST_GCC >= 40900)
|
||||
#if defined(BOOST_GCC)
|
||||
_Pragma("GCC diagnostic pop")
|
||||
#endif
|
||||
#endif // CGAL_GENERALIZED_MAP_STORAGES_H //
|
||||
|
|
|
|||
|
|
@ -68,19 +68,6 @@ void generate_points_annulus(long n, double a, double b, double small_radius,
|
|||
}
|
||||
if (n == 1) // generation of a point
|
||||
{
|
||||
|
||||
#if BOOST_VERSION < 104700
|
||||
|
||||
boost::uniform_real<double> random_squared_radius_distribution(
|
||||
small_radius * small_radius / (big_radius * big_radius), 1);
|
||||
boost::uniform_real<double> random_angle_distribution(a, b);
|
||||
boost::variate_generator<
|
||||
GEN&, boost::uniform_real<double> > random_angle(gen, random_angle_distribution);
|
||||
boost::variate_generator<
|
||||
GEN&, boost::uniform_real<double> > random_squared_radius(gen, random_squared_radius_distribution);
|
||||
|
||||
#else
|
||||
|
||||
boost::random::uniform_real_distribution<double> random_squared_radius_distribution(
|
||||
small_radius * small_radius / (big_radius * big_radius), 1);
|
||||
|
||||
|
|
@ -90,8 +77,6 @@ void generate_points_annulus(long n, double a, double b, double small_radius,
|
|||
boost::random::variate_generator<
|
||||
GEN&, boost::random::uniform_real_distribution<double> > random_squared_radius(gen, random_squared_radius_distribution);
|
||||
|
||||
#endif
|
||||
|
||||
double alpha = random_angle();
|
||||
double r = big_radius * std::sqrt(random_squared_radius());
|
||||
typedef Creator_uniform_2<double, P> Creator;
|
||||
|
|
|
|||
|
|
@ -7,9 +7,7 @@
|
|||
#include <CGAL/Alpha_shape_2.h>
|
||||
#include <CGAL/Alpha_shape_face_base_2.h>
|
||||
#include <CGAL/Alpha_shape_vertex_base_2.h>
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
#include <CGAL/IO/WKT.h>
|
||||
#endif
|
||||
#include <CGAL/point_generators_2.h>
|
||||
|
||||
// Qt headers
|
||||
|
|
@ -253,9 +251,7 @@ MainWindow::on_actionLoadPoints_triggered()
|
|||
tr("Open Points file"),
|
||||
".",
|
||||
tr("CGAL files (*.pts.cgal);;"
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
"WKT files (*.wktk *.WKT);;"
|
||||
#endif
|
||||
"All files (*)"));
|
||||
if(! fileName.isEmpty()){
|
||||
open(fileName);
|
||||
|
|
@ -274,9 +270,7 @@ MainWindow::open(QString fileName)
|
|||
std::ifstream ifs(qPrintable(fileName));
|
||||
if(fileName.endsWith(".wkt",Qt::CaseInsensitive))
|
||||
{
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
CGAL::IO::read_multi_point_WKT(ifs, points);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,9 +7,7 @@
|
|||
#include <CGAL/Apollonius_graph_hierarchy_2.h>
|
||||
#include <CGAL/Apollonius_graph_filtered_traits_2.h>
|
||||
#include <CGAL/point_generators_2.h>
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
#include <CGAL/IO/WKT.h>
|
||||
#endif
|
||||
|
||||
#include <boost/random/linear_congruential.hpp>
|
||||
#include <boost/random/uniform_real.hpp>
|
||||
|
|
@ -220,9 +218,7 @@ MainWindow::on_actionLoadPoints_triggered()
|
|||
tr("Open Points file"),
|
||||
".",
|
||||
tr("CGAL files (*.wpts.cgal);;"
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
"WKT files (*.wkt *.WKT);;"
|
||||
#endif
|
||||
"All files (*)"));
|
||||
if(! fileName.isEmpty()){
|
||||
open(fileName);
|
||||
|
|
@ -241,14 +237,12 @@ MainWindow::open(QString fileName)
|
|||
std::vector<Apollonius_site_2> points;
|
||||
if(fileName.endsWith(".wkt", Qt::CaseInsensitive))
|
||||
{
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
std::vector<K::Point_3> point_3_s;
|
||||
CGAL::IO::read_multi_point_WKT(ifs, point_3_s);
|
||||
for(const K::Point_3& point_3 : point_3_s)
|
||||
{
|
||||
points.push_back(Apollonius_site_2(K::Point_2(point_3.x(), point_3.y()), point_3.z()));
|
||||
}
|
||||
#endif
|
||||
} else{
|
||||
K::Weighted_point_2 p;
|
||||
while(ifs >> p) {
|
||||
|
|
@ -270,15 +264,12 @@ MainWindow::on_actionSavePoints_triggered()
|
|||
tr("Save points"),
|
||||
".reg.cgal",
|
||||
tr("Weighted Points (*.wpts.cgal);;"
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
"WKT files(*.wkt *.WKT);;"
|
||||
#endif
|
||||
"All (*)"));
|
||||
if(! fileName.isEmpty()){
|
||||
std::ofstream ofs(qPrintable(fileName));
|
||||
if(fileName.endsWith(".wkt",Qt::CaseInsensitive))
|
||||
{
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
std::vector<K::Point_3> points;
|
||||
for(Apollonius::Sites_iterator
|
||||
vit = ag.sites_begin(),
|
||||
|
|
@ -290,7 +281,6 @@ MainWindow::on_actionSavePoints_triggered()
|
|||
vit->weight()));
|
||||
}
|
||||
CGAL::IO::write_multi_point_WKT(ofs, points);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
for(Apollonius::Sites_iterator
|
||||
|
|
|
|||
|
|
@ -15,9 +15,7 @@
|
|||
#include <CGAL/Polygon_2.h>
|
||||
#include <CGAL/min_quadrilateral_2.h>
|
||||
#include <CGAL/rectangular_p_center_2.h>
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
#include <CGAL/IO/WKT.h>
|
||||
#endif
|
||||
|
||||
// Qt headers
|
||||
#include <QtGui>
|
||||
|
|
@ -479,9 +477,7 @@ MainWindow::on_actionLoadPoints_triggered()
|
|||
tr("Open Points file"),
|
||||
".",
|
||||
tr("CGAL files (*.pts.cgal);;"
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
"WKT files (*.WKT *.wkt);;"
|
||||
#endif
|
||||
"All files (*)"));
|
||||
if(! fileName.isEmpty()){
|
||||
open(fileName);
|
||||
|
|
@ -497,14 +493,12 @@ MainWindow::open(QString fileName)
|
|||
std::ifstream ifs(qPrintable(fileName));
|
||||
if(fileName.endsWith(".wkt", Qt::CaseInsensitive))
|
||||
{
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
CGAL::IO::read_multi_point_WKT(ifs, points);
|
||||
for(K::Point_2 p : points)
|
||||
{
|
||||
mc.insert(p);
|
||||
me.insert(p);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -532,15 +526,12 @@ MainWindow::on_actionSavePoints_triggered()
|
|||
tr("Save points"),
|
||||
".",
|
||||
tr("CGAL files (*.pts.cgal);;"
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
"WKT files (*.WKT *.wkt);;"
|
||||
#endif
|
||||
"All files (*)"));
|
||||
if(! fileName.isEmpty()){
|
||||
std::ofstream ofs(qPrintable(fileName));
|
||||
if(fileName.endsWith(".wkt", Qt::CaseInsensitive))
|
||||
{
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
std::vector<K::Point_2> out_pts;
|
||||
out_pts.reserve(std::distance(mc.points_begin(),
|
||||
mc.points_end()));
|
||||
|
|
@ -548,7 +539,6 @@ MainWindow::on_actionSavePoints_triggered()
|
|||
pit != mc.points_end(); ++pit)
|
||||
out_pts.push_back(*pit);
|
||||
CGAL::IO::write_multi_point_WKT(ofs, out_pts);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,9 +10,7 @@
|
|||
#include <CGAL/intersections.h>
|
||||
#include <CGAL/Circular_kernel_2.h>
|
||||
#include <CGAL/Object.h>
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
#include <CGAL/IO/WKT.h>
|
||||
#endif
|
||||
|
||||
// Qt headers
|
||||
#include <QtGui>
|
||||
|
|
@ -216,9 +214,7 @@ MainWindow::on_actionLoadLineAndCircularArcs_triggered()
|
|||
tr("Open Line and Circular Arc File"),
|
||||
".",
|
||||
tr("Edge files (*.arc)\n"
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
"WKT files (*.wkt *.WKT)\n"
|
||||
#endif
|
||||
));
|
||||
if(! fileName.isEmpty()){
|
||||
open(fileName);
|
||||
|
|
@ -236,7 +232,6 @@ MainWindow::open(QString fileName)
|
|||
double x,y;
|
||||
if(fileName.endsWith(".wkt", Qt::CaseInsensitive))
|
||||
{
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
//read pairs as Line_arc_2 and triplets as circular_arc_2
|
||||
do
|
||||
{
|
||||
|
|
@ -279,7 +274,6 @@ MainWindow::open(QString fileName)
|
|||
}
|
||||
}while(ifs.good() && !ifs.eof());
|
||||
ifs.close();
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,9 +24,7 @@
|
|||
#include <QInputDialog>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/version.hpp>
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
#include <CGAL/IO/WKT.h>
|
||||
#endif
|
||||
|
||||
#include <fstream>
|
||||
|
||||
|
|
@ -275,9 +273,7 @@ MainWindow::on_actionLoadPoints_triggered()
|
|||
tr("Open Points file"),
|
||||
".",
|
||||
tr("CGAL files (*.pts.cgal);;"
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
"WKT files (*.wkt *.WKT);;"
|
||||
#endif
|
||||
"All files (*)"));
|
||||
if(! fileName.isEmpty()){
|
||||
open(fileName);
|
||||
|
|
@ -295,9 +291,7 @@ MainWindow::open(QString fileName)
|
|||
std::ifstream ifs(qPrintable(fileName));
|
||||
if(fileName.endsWith(".wkt", Qt::CaseInsensitive))
|
||||
{
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
CGAL::IO::read_multi_point_WKT(ifs, m_sites);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -322,16 +316,12 @@ MainWindow::on_actionSavePoints_triggered()
|
|||
tr("Save points"),
|
||||
".",
|
||||
tr("CGAL files (*.pts.cgal);;"
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
"WKT files (*.wkt *.WKT);;"
|
||||
#endif
|
||||
"All files (*)"));
|
||||
if(! fileName.isEmpty()) {
|
||||
std::ofstream ofs(qPrintable(fileName));
|
||||
if(fileName.endsWith(".wkt", Qt::CaseInsensitive)){
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
CGAL::IO::write_multi_point_WKT(ofs, m_sites);
|
||||
#endif
|
||||
}else
|
||||
for(Points::iterator it = m_sites.begin();
|
||||
it != m_sites.end(); ++it)
|
||||
|
|
|
|||
|
|
@ -8,9 +8,7 @@
|
|||
#include <CGAL/Periodic_2_Delaunay_triangulation_2.h>
|
||||
#include <CGAL/Periodic_2_Delaunay_triangulation_traits_2.h>
|
||||
#include <CGAL/point_generators_2.h>
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
#include <CGAL/IO/WKT.h>
|
||||
#endif
|
||||
|
||||
// Qt headers
|
||||
#include <QtGui>
|
||||
|
|
@ -355,9 +353,7 @@ MainWindow::on_actionLoadPoints_triggered()
|
|||
tr("Open Points file"),
|
||||
".",
|
||||
tr("CGAL files (*.pts.cgal);;"
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
"WKT files (*.wkt *.WKT);;"
|
||||
#endif
|
||||
"All files (*)"));
|
||||
if(! fileName.isEmpty()){
|
||||
open(fileName);
|
||||
|
|
@ -376,9 +372,7 @@ MainWindow::open(QString fileName)
|
|||
std::vector<Point_2> points;
|
||||
if(fileName.endsWith(".wkt", Qt::CaseInsensitive))
|
||||
{
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
CGAL::IO::read_multi_point_WKT(ifs, points);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -404,15 +398,12 @@ MainWindow::on_actionSavePoints_triggered()
|
|||
tr("Save points"),
|
||||
".",
|
||||
tr("CGAL files (*.pts.cgal);;"
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
"WKT files (*.wkt *.WKT);;"
|
||||
#endif
|
||||
"All files (*)"));
|
||||
if(! fileName.isEmpty()){
|
||||
std::ofstream ofs(qPrintable(fileName));
|
||||
if(fileName.endsWith(".wkt", Qt::CaseInsensitive))
|
||||
{
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
std::vector<Point_2> points;
|
||||
points.reserve(std::distance(triang.unique_vertices_begin(),
|
||||
triang.unique_vertices_end()));
|
||||
|
|
@ -424,7 +415,6 @@ MainWindow::on_actionSavePoints_triggered()
|
|||
points.push_back(vit->point());
|
||||
}
|
||||
CGAL::IO::write_multi_point_WKT(ofs, points);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,9 +13,7 @@
|
|||
#include <CGAL/minkowski_sum_2.h>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/version.hpp>
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
#include <CGAL/IO/WKT.h>
|
||||
#endif
|
||||
|
||||
// Qt headers
|
||||
#include <QtGui>
|
||||
|
|
@ -234,9 +232,7 @@ MainWindow::on_actionLoadPolygon_triggered()
|
|||
".",
|
||||
tr( "Polyline files (*.polygons.cgal);;"
|
||||
"WSL files (*.wsl);;"
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
"WKT files (*.wkt *.WKT);;"
|
||||
#endif
|
||||
"All file (*)"));
|
||||
if(! fileName.isEmpty()){
|
||||
open(fileName);
|
||||
|
|
@ -251,12 +247,10 @@ MainWindow::open(QString fileName)
|
|||
poly.clear();
|
||||
if(fileName.endsWith(".wkt", Qt::CaseInsensitive))
|
||||
{
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
CGAL::Polygon_with_holes_2<K> P;
|
||||
CGAL::IO::read_polygon_WKT(ifs, P);
|
||||
poly = Polygon2(P.outer_boundary().begin(),
|
||||
P.outer_boundary().end());
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -276,20 +270,16 @@ MainWindow::on_actionSavePolygon_triggered()
|
|||
tr("Save Polygon"),
|
||||
".",
|
||||
tr( "Polyline files (*.polygons.cgal);;"
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
"WKT files (*.wkt *.WKT);;"
|
||||
#endif
|
||||
"All file (*)"));
|
||||
if(! fileName.isEmpty()){
|
||||
std::ofstream ofs(qPrintable(fileName));
|
||||
if(fileName.endsWith(".wkt", Qt::CaseInsensitive))
|
||||
{
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
CGAL::Polygon_2<K> P(poly.begin(),
|
||||
poly.end());
|
||||
CGAL::Polygon_with_holes_2<K> Pwh(P);
|
||||
CGAL::IO::write_polygon_WKT(ofs, Pwh);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
ofs << poly;
|
||||
|
|
|
|||
|
|
@ -25,9 +25,7 @@
|
|||
#include <CGAL/Qt/GraphicsViewPolylineInput.h>
|
||||
#include <CGAL/Qt/SegmentDelaunayGraphGraphicsItem.h>
|
||||
#include <CGAL/Constraints_loader.h>
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
#include <CGAL/IO/WKT.h>
|
||||
#endif
|
||||
//#include <CGAL/Qt/Converter.h>
|
||||
|
||||
// the two base classes
|
||||
|
|
@ -248,10 +246,8 @@ MainWindow::open(QString fileName)
|
|||
loadEdgConstraints(fileName);
|
||||
this->addToRecentFiles(fileName);
|
||||
} else if(fileName.endsWith(".wkt", Qt::CaseInsensitive)){
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
loadWKTConstraints(fileName);
|
||||
this->addToRecentFiles(fileName);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -264,9 +260,7 @@ MainWindow::on_actionLoadSegments_triggered()
|
|||
".",
|
||||
tr("Edge files (*.edg);;"
|
||||
"Polyline files (*.polygons.cgal);;"
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
"WKT files (*.wkt *.WKT)"
|
||||
#endif
|
||||
));
|
||||
open(fileName);
|
||||
}
|
||||
|
|
@ -342,12 +336,10 @@ MainWindow::loadEdgConstraints(QString fileName)
|
|||
|
||||
void
|
||||
MainWindow::loadWKTConstraints(QString
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
fileName
|
||||
#endif
|
||||
)
|
||||
{
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
|
||||
typedef CGAL::Polygon_with_holes_2<K> Polygon;
|
||||
typedef std::vector<K::Point_2> LineString;
|
||||
|
||||
|
|
@ -414,7 +406,6 @@ MainWindow::loadWKTConstraints(QString
|
|||
}while(ifs.good() && !ifs.eof());
|
||||
Q_EMIT( changed());
|
||||
actionRecenter->trigger();
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -23,9 +23,7 @@
|
|||
#include <CGAL/Qt/GraphicsViewPolylineInput.h>
|
||||
#include <CGAL/Qt/SegmentDelaunayGraphLinfGraphicsItem.h>
|
||||
#include <CGAL/Constraints_loader.h>
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
#include <CGAL/IO/WKT.h>
|
||||
#endif
|
||||
//#include <CGAL/Qt/Converter.h>
|
||||
|
||||
// the two base classes
|
||||
|
|
@ -270,10 +268,8 @@ MainWindow::open(QString fileName)
|
|||
loadSitesInput(fileName);
|
||||
this->addToRecentFiles(fileName);
|
||||
} else if(fileName.endsWith(".wkt", Qt::CaseInsensitive)){
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
loadWKT(fileName);
|
||||
this->addToRecentFiles(fileName);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -291,9 +287,7 @@ MainWindow::on_actionLoadSegments_triggered()
|
|||
"Pts files (*.pts);;"
|
||||
"Edge files (*.edg);;"
|
||||
"Polylines files (*.polygons.cgal);;"
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
"WKT files (*.WKT *.wkt)"
|
||||
#endif
|
||||
));
|
||||
open(fileName);
|
||||
}
|
||||
|
|
@ -388,13 +382,8 @@ MainWindow::loadPoints(QString fileName)
|
|||
}
|
||||
|
||||
void
|
||||
MainWindow::loadWKT(QString
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
fileName
|
||||
#endif
|
||||
)
|
||||
MainWindow::loadWKT(QString fileName )
|
||||
{
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
std::ifstream ifs(qPrintable(fileName));
|
||||
//Points
|
||||
do
|
||||
|
|
@ -479,7 +468,6 @@ MainWindow::loadWKT(QString
|
|||
|
||||
Q_EMIT( changed());
|
||||
actionRecenter->trigger();
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -20,9 +20,7 @@
|
|||
#include <CGAL/Qt/SegmentsGraphicsItem.h>
|
||||
#include <CGAL/Qt/PolylinesGraphicsItem.h>
|
||||
#include <CGAL/Qt/GraphicsViewPolylineInput.h>
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
#include <CGAL/IO/WKT.h>
|
||||
#endif
|
||||
|
||||
// for viewportsBbox
|
||||
#include <CGAL/Qt/utility.h>
|
||||
|
|
@ -252,9 +250,7 @@ MainWindow::on_actionLoadSegments_triggered()
|
|||
tr("Open segment file"),
|
||||
".",
|
||||
tr("Edge files (*.edg);;"
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
"WKT files (*.wkt *.WKT);;"
|
||||
#endif
|
||||
"All files (*)"));
|
||||
if(! fileName.isEmpty()){
|
||||
open(fileName);
|
||||
|
|
@ -270,7 +266,6 @@ MainWindow::open(QString fileName)
|
|||
std::ifstream ifs(qPrintable(fileName));
|
||||
if(fileName.endsWith(".wkt", Qt::CaseInsensitive))
|
||||
{
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
std::vector<std::vector<Point_2> > mls;
|
||||
CGAL::IO::read_multi_linestring_WKT(ifs, mls);
|
||||
for(const std::vector<Point_2>& ls : mls)
|
||||
|
|
@ -280,7 +275,6 @@ MainWindow::open(QString fileName)
|
|||
Segment_2 seg(ls[0], ls[1]);
|
||||
input.push_back(seg);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
std::copy(std::istream_iterator<Segment_2>(ifs),
|
||||
|
|
@ -304,16 +298,13 @@ MainWindow::on_actionSaveSegments_triggered()
|
|||
tr("Save points"),
|
||||
".",
|
||||
tr("Edge files (*.edg);;"
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
"WKT files (*.wkt *.WKT);;"
|
||||
#endif
|
||||
"All files (*)"));
|
||||
if(! fileName.isEmpty()){
|
||||
std::ofstream ofs(qPrintable(fileName));
|
||||
ofs.precision(12);
|
||||
if(fileName.endsWith(".wkt", Qt::CaseInsensitive))
|
||||
{
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
std::vector<std::vector<Point_2> >mls;
|
||||
for(const Segment_2& seg : input)
|
||||
{
|
||||
|
|
@ -323,7 +314,6 @@ MainWindow::on_actionSaveSegments_triggered()
|
|||
mls.push_back(ls);
|
||||
}
|
||||
CGAL::IO::write_multi_linestring_WKT(ofs, mls);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
std::copy(input.begin(), input.end(), std::ostream_iterator<Segment_2>(ofs, "\n"));
|
||||
|
|
|
|||
|
|
@ -17,9 +17,7 @@
|
|||
// GraphicsView items and event filters (input classes)
|
||||
#include <CGAL/Qt/PointsInKdTreeGraphicsItem.h>
|
||||
#include <CGAL/Qt/utility.h>
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
#include <CGAL/IO/WKT.h>
|
||||
#endif
|
||||
|
||||
// the two base classes
|
||||
#include "ui_Spatial_searching_2.h"
|
||||
|
|
@ -249,9 +247,7 @@ MainWindow::on_actionLoadPoints_triggered()
|
|||
tr("Open Points file"),
|
||||
".",
|
||||
tr("CGAL files (*.pts.cgal);;"
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
"WKT files (*.wkt *.WKT);;"
|
||||
#endif
|
||||
"All files (*)"));
|
||||
if(! fileName.isEmpty()){
|
||||
open(fileName);
|
||||
|
|
@ -271,9 +267,7 @@ MainWindow::open(QString fileName)
|
|||
std::vector<K::Point_2> points;
|
||||
if(fileName.endsWith(".wkt", Qt::CaseInsensitive))
|
||||
{
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
CGAL::IO::read_multi_point_WKT(ifs, points);
|
||||
#endif
|
||||
}
|
||||
else{
|
||||
while(ifs >> p) {
|
||||
|
|
|
|||
|
|
@ -21,9 +21,7 @@
|
|||
|
||||
// for viewportsBbox
|
||||
#include <CGAL/Qt/utility.h>
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
#include <CGAL/IO/WKT.h>
|
||||
#endif
|
||||
// the two base classes
|
||||
#include "ui_Stream_lines_2.h"
|
||||
#include <CGAL/Qt/DemosMainWindow.h>
|
||||
|
|
@ -167,14 +165,10 @@ MainWindow::generate()
|
|||
void
|
||||
MainWindow::on_actionLoadPoints_triggered()
|
||||
{
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
#endif
|
||||
QString fileName = QFileDialog::getOpenFileName(this,
|
||||
tr("Open grid file"),
|
||||
"."
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
,tr("WKT files (*.wkt *.WKT)")
|
||||
#endif
|
||||
);
|
||||
if(! fileName.isEmpty()){
|
||||
open(fileName);
|
||||
|
|
@ -194,7 +188,6 @@ MainWindow::open(QString fileName)
|
|||
iXSize = iYSize = 512;
|
||||
if(fileName.endsWith(".wkt", Qt::CaseInsensitive))
|
||||
{
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
std::vector<std::vector<Point_2> > mp;
|
||||
int size= -1;
|
||||
do
|
||||
|
|
@ -216,10 +209,6 @@ MainWindow::open(QString fileName)
|
|||
{
|
||||
regular_grid->set_field(i, j, Vector(mp[j][i].x(), mp[j][i].y()));
|
||||
}
|
||||
#else
|
||||
QApplication::restoreOverrideCursor();
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
else{
|
||||
unsigned int x_samples, y_samples;
|
||||
|
|
@ -248,7 +237,6 @@ MainWindow::open(QString fileName)
|
|||
void
|
||||
MainWindow::on_actionSavePoints_triggered()
|
||||
{
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
QString fileName = QFileDialog::getSaveFileName(this,
|
||||
tr("Save points"),
|
||||
".",
|
||||
|
|
@ -270,7 +258,6 @@ MainWindow::on_actionSavePoints_triggered()
|
|||
}
|
||||
ofs.close();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -25,9 +25,7 @@
|
|||
#include <CGAL/point_generators_2.h>
|
||||
#include <CGAL/Timer.h>
|
||||
#include <CGAL/IO/write_VTU.h>
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
#include <CGAL/IO/WKT.h>
|
||||
#endif
|
||||
|
||||
// Qt headers
|
||||
#include <QtGui>
|
||||
|
|
@ -528,9 +526,7 @@ MainWindow::open(QString fileName)
|
|||
} else if(fileName.endsWith(".poly")){
|
||||
loadPolyConstraints(fileName);
|
||||
} else if(fileName.endsWith(".wkt")){
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
loadWKT(fileName);
|
||||
#endif
|
||||
}
|
||||
this->addToRecentFiles(fileName);
|
||||
}
|
||||
|
|
@ -549,21 +545,14 @@ MainWindow::on_actionLoadConstraints_triggered()
|
|||
"Poly files (*.poly);;"
|
||||
"Plg files (*.plg);;"
|
||||
"CGAL files (*.cpts.cgal);;"
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
"WKT files (*.WKT *.wkt);;"
|
||||
#endif
|
||||
"All (*)"));
|
||||
open(fileName);
|
||||
}
|
||||
|
||||
void
|
||||
MainWindow::loadWKT(QString
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
filename
|
||||
#endif
|
||||
)
|
||||
MainWindow::loadWKT(QString filename)
|
||||
{
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
//Polygons todo : make it multipolygons
|
||||
std::ifstream ifs(qPrintable(filename));
|
||||
do
|
||||
|
|
@ -651,7 +640,6 @@ MainWindow::loadWKT(QString
|
|||
discoverComponents(cdt, m_seeds);
|
||||
Q_EMIT( changed());
|
||||
actionRecenter->trigger();
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -23,9 +23,7 @@
|
|||
#include "TriangulationPointInputAndConflictZone.h"
|
||||
#include <CGAL/Qt/TriangulationGraphicsItem.h>
|
||||
#include <CGAL/Qt/VoronoiGraphicsItem.h>
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
#include <CGAL/IO/WKT.h>
|
||||
#endif
|
||||
|
||||
// for viewportsBbox
|
||||
#include <CGAL/Qt/utility.h>
|
||||
|
|
@ -322,9 +320,7 @@ MainWindow::on_actionLoadPoints_triggered()
|
|||
tr("Open Points file"),
|
||||
".",
|
||||
tr("CGAL files (*.pts.cgal);;"
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
"WKT files (*.WKT *.wkt);;"
|
||||
#endif
|
||||
"All files (*)"));
|
||||
if(! fileName.isEmpty()){
|
||||
open(fileName);
|
||||
|
|
@ -343,9 +339,7 @@ MainWindow::open(QString fileName)
|
|||
std::vector<K::Point_2> points;
|
||||
if(fileName.endsWith(".wkt", Qt::CaseInsensitive))
|
||||
{
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
CGAL::IO::read_multi_point_WKT(ifs, points);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
while(ifs >> p) {
|
||||
|
|
@ -370,15 +364,12 @@ MainWindow::on_actionSavePoints_triggered()
|
|||
tr("Save points"),
|
||||
".",
|
||||
tr("CGAL files (*.pts.cgal);;"
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
"WKT files (*.WKT *.wkt);;"
|
||||
#endif
|
||||
"All files (*)"));
|
||||
if(! fileName.isEmpty()){
|
||||
std::ofstream ofs(qPrintable(fileName));
|
||||
if(fileName.endsWith(".wkt", Qt::CaseInsensitive))
|
||||
{
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
std::vector<K::Point_2> points;
|
||||
points.reserve(dt.number_of_vertices());
|
||||
for(Delaunay::Finite_vertices_iterator
|
||||
|
|
@ -389,7 +380,6 @@ MainWindow::on_actionSavePoints_triggered()
|
|||
points.push_back(vit->point());
|
||||
}
|
||||
CGAL::IO::write_multi_point_WKT(ofs, points);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
for(Delaunay::Finite_vertices_iterator
|
||||
|
|
|
|||
|
|
@ -5,9 +5,7 @@
|
|||
// CGAL headers
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Regular_triangulation_2.h>
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
#include <CGAL/IO/WKT.h>
|
||||
#endif
|
||||
|
||||
#include <CGAL/point_generators_2.h>
|
||||
// Qt headers
|
||||
|
|
@ -248,9 +246,7 @@ MainWindow::on_actionLoadPoints_triggered()
|
|||
tr("Open Points file"),
|
||||
".",
|
||||
tr("Weighted Points (*.wpts.cgal);;"
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
"WKT files (*.wkt *.WKT);;"
|
||||
#endif
|
||||
"All (*)"));
|
||||
|
||||
if(! fileName.isEmpty()){
|
||||
|
|
@ -258,14 +254,12 @@ MainWindow::on_actionLoadPoints_triggered()
|
|||
std::vector<Weighted_point_2> points;
|
||||
if(fileName.endsWith(".wkt",Qt::CaseInsensitive))
|
||||
{
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
std::vector<K::Point_3> points_3;
|
||||
CGAL::IO::read_multi_point_WKT(ifs, points_3);
|
||||
for(const K::Point_3& p : points_3)
|
||||
{
|
||||
points.push_back(Weighted_point_2(K::Point_2(p.x(), p.y()), p.z()));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -289,15 +283,12 @@ MainWindow::on_actionSavePoints_triggered()
|
|||
tr("Save points"),
|
||||
".reg.cgal",
|
||||
tr("Weighted Points (*.wpts.cgal);;"
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
"WKT files (*.wkt *.WKT);;"
|
||||
#endif
|
||||
"All (*)"));
|
||||
if(! fileName.isEmpty()){
|
||||
std::ofstream ofs(qPrintable(fileName));
|
||||
if(fileName.endsWith(".wkt",Qt::CaseInsensitive))
|
||||
{
|
||||
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
|
||||
std::vector<K::Point_3> points_3;
|
||||
for(Regular::Finite_vertices_iterator
|
||||
vit = dt.finite_vertices_begin(),
|
||||
|
|
@ -309,7 +300,6 @@ MainWindow::on_actionSavePoints_triggered()
|
|||
vit->point().weight()));
|
||||
}
|
||||
CGAL::IO::write_multi_point_WKT(ofs, points_3);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,9 +5,29 @@ Release History
|
|||
|
||||
Release date: December 2021
|
||||
|
||||
### [2D and 3D Linear Geometry Kernel](https://doc.cgal.org/5.4/Manual/packages.html#PkgKernel23)
|
||||
|
||||
- Added `construct_centroid_2_object()` and `compute_determinant_2_object()` in `Projection_traits_xy_3`, `Projection_traits_xz_3`,
|
||||
and`Projection_traits_yz_3` classes.
|
||||
|
||||
### [Polygon Mesh Processing](https://doc.cgal.org/5.4/Manual/packages.html#PkgPolygonMeshProcessing)
|
||||
|
||||
- Added the function `CGAL::Polygon_mesh_processing::match_faces()`, which, given two polygon meshes, identifies their common faces as well as as faces present in only either of them.
|
||||
- Added the function `CGAL::Polygon_mesh_processing::match_faces()`, which, given two polygon meshes,
|
||||
identifies their common faces as well as faces present in only either of them.
|
||||
|
||||
- Added the functions: `CGAL::Polygon_mesh_processing::bounded_error_Hausdorff_distance()` that
|
||||
computes an estimate of the one-sided Hausdorff distance between two triangle meshes which
|
||||
is bounded by a user-specified error bound; `CGAL::Polygon_mesh_processing::bounded_error_symmetric_Hausdorff_distance()` that computes
|
||||
an estimate of the symmetric Hausdorff distance bounded by a user-specified error bound;
|
||||
and `CGAL::Polygon_mesh_processing::is_Hausdorff_distance_larger()` that returns `true`
|
||||
if the bounded-error Hausdorff distance between two meshes is larger than the user-specified
|
||||
max distance.
|
||||
|
||||
|
||||
### [CGAL and Solvers](https://doc.cgal.org/5.4/Manual/packages.html#PkgSolverInterface)
|
||||
|
||||
- Added the [OSQP solver](https://osqp.org/) support. This solver enables to efficiently compute the convex Quadratic Programming (QP) problems arising in the context of several packages.
|
||||
|
||||
|
||||
[Release 5.3](https://github.com/CGAL/cgal/releases/tag/v5.3)
|
||||
-----------
|
||||
|
|
|
|||
|
|
@ -469,11 +469,6 @@ if(CMAKE_COMPILER_IS_GNUCXX)
|
|||
uniquely_add_flags(CGAL_CXX_FLAGS "-frounding-math")
|
||||
endif()
|
||||
|
||||
if("${GCC_VERSION}" MATCHES "^4.2")
|
||||
message(STATUS "Using gcc version 4.2. Adding -fno-strict-aliasing")
|
||||
uniquely_add_flags(CGAL_CXX_FLAGS "-fno-strict-aliasing")
|
||||
endif()
|
||||
|
||||
if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "alpha")
|
||||
message(STATUS "Using gcc on alpha. Adding -mieee -mfp-rounding-mode=d")
|
||||
uniquely_add_flags(CGAL_CXX_FLAGS "-mieee -mfp-rounding-mode=d")
|
||||
|
|
@ -660,9 +655,6 @@ cache_get(CGAL_3RD_PARTY_LIBRARIES )
|
|||
cache_get(CGAL_3RD_PARTY_LIBRARIES_DIRS)
|
||||
|
||||
install(DIRECTORY "${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/" DESTINATION "${CGAL_INSTALL_INC_DIR}/CGAL/Qt" COMPONENT CGAL_Qt5)
|
||||
install(DIRECTORY "${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/demo/resources/" DESTINATION "${CGAL_INSTALL_CMAKE_DIR}/demo/resources" COMPONENT CGAL_Qt5)
|
||||
install(DIRECTORY "${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/demo/icons/" DESTINATION "${CGAL_INSTALL_CMAKE_DIR}/demo/icons" COMPONENT CGAL_Qt5)
|
||||
|
||||
|
||||
#
|
||||
# Variables used when WITH_{demos|examples|tests} are TRUE
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
if(METIS_FOUND AND NOT TARGET CGAL::METIS_support)
|
||||
add_library(CGAL::METIS_support INTERFACE IMPORTED)
|
||||
set_target_properties(CGAL::METIS_support PROPERTIES
|
||||
INTERFACE_COMPILE_DEFINITIONS "CGAL_METIS_ENABLED"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${METIS_INCLUDE_DIRS}"
|
||||
INTERFACE_LINK_LIBRARIES "${METIS_LIBRARIES}")
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
if(OSQP_FOUND AND NOT TARGET CGAL::OSQP_support)
|
||||
add_library(CGAL::OSQP_support INTERFACE IMPORTED)
|
||||
set_target_properties(CGAL::OSQP_support PROPERTIES
|
||||
INTERFACE_COMPILE_DEFINITIONS "CGAL_USE_OSQP"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${OSQP_INCLUDE_DIR}"
|
||||
INTERFACE_LINK_LIBRARIES "${OSQP_LIBRARIES}")
|
||||
endif()
|
||||
|
|
@ -102,6 +102,17 @@ function(CGAL_setup_CGAL_dependencies target)
|
|||
target_include_directories(${target} INTERFACE
|
||||
$<INSTALL_INTERFACE:include>)
|
||||
|
||||
# Make CGAL depend on threads-support (for Epeck and Epeck_d)
|
||||
if(CGAL_HAS_NO_THREADS)
|
||||
target_compile_definitions(${target} INTERFACE CGAL_HAS_NO_THREADS)
|
||||
else()
|
||||
if(NOT TARGET Threads::Threads)
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Threads REQUIRED)
|
||||
endif()
|
||||
target_link_libraries(${target} INTERFACE Threads::Threads)
|
||||
endif()
|
||||
|
||||
# Now setup compilation flags
|
||||
if(MSVC)
|
||||
target_compile_options(${target} INTERFACE
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ function(expand_list_with_globbing list_name)
|
|||
endfunction()
|
||||
|
||||
function(cgal_add_compilation_test exe_name)
|
||||
cmake_policy(SET CMP0064 NEW)
|
||||
if(NOT CMAKE_VS_MSBUILD_COMMAND)
|
||||
if(TEST compilation_of__${exe_name})
|
||||
return()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
# This file sets up OSQP for CMake. Once done this will define
|
||||
# OSQP_FOUND - system has OSQP lib
|
||||
# OSQP_INCLUDE_DIR - the OSQP include directory
|
||||
# OSQP_LIBRARIES - link these to use OSQP
|
||||
|
||||
if(NOT OSQP_FOUND)
|
||||
find_path(OSQP_INCLUDE_DIR
|
||||
NAMES osqp.h
|
||||
PATHS /usr/local/include/osqp/
|
||||
ENV OSQP_INC_DIR)
|
||||
|
||||
find_library(OSQP_LIBRARIES
|
||||
NAMES libosqp osqp
|
||||
PATHS ENV LD_LIBRARY_PATH
|
||||
ENV LIBRARY_PATH
|
||||
/usr/local/lib
|
||||
${OSQP_INCLUDE_DIR}/../lib
|
||||
ENV OSQP_LIB_DIR)
|
||||
|
||||
if(OSQP_LIBRARIES AND OSQP_INCLUDE_DIR)
|
||||
set(OSQP_FOUND TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
|
@ -18,7 +18,7 @@ int main() {
|
|||
#endif
|
||||
|
||||
#if __has_feature(cxx_thread_local) || \
|
||||
( (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L )
|
||||
( __GNUC__ > 0 && __cplusplus >= 201103L )
|
||||
return 0;
|
||||
#else
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -127,20 +127,6 @@
|
|||
#include <boost/config.hpp>
|
||||
#include <boost/version.hpp>
|
||||
|
||||
// bug-fix for g++-5.x and Boost.Config<1.57
|
||||
// https://svn.boost.org/trac/boost/ticket/10500
|
||||
#if BOOST_VERSION < 105700 && BOOST_GCC < 60000 && \
|
||||
! defined(__GXX_EXPERIMENTAL_CXX0X__) && defined(BOOST_HAS_VARIADIC_TMPL)
|
||||
# undef BOOST_HAS_VARIADIC_TMPL
|
||||
# define BOOST_NO_CXX11_VARIADIC_TEMPLATES
|
||||
#endif
|
||||
|
||||
// workaround for the bug https://svn.boost.org/trac10/ticket/12534
|
||||
// That bug was introduced in Boost 1.62 and fixed in 1.63.
|
||||
#if BOOST_VERSION >= 106200 && BOOST_VERSION < 106300
|
||||
# include <boost/container/flat_map.hpp>
|
||||
#endif
|
||||
|
||||
// Hack: Boost<1.55 does not detect correctly the C++11 features of ICC.
|
||||
// We declare by hand two features that we need (variadic templates and
|
||||
// rvalue references).
|
||||
|
|
@ -187,78 +173,60 @@
|
|||
// feature is not available, even if that is wrong.
|
||||
// ----------------------------------------------------------------------//
|
||||
|
||||
#if defined(BOOST_NO_CXX11_RANGE_BASED_FOR) || BOOST_VERSION < 105000
|
||||
#define CGAL_CFG_NO_CPP0X_RANGE_BASED_FOR 1
|
||||
#endif
|
||||
#if defined(BOOST_NO_0X_HDR_ARRAY) || \
|
||||
defined(BOOST_NO_CXX11_HDR_ARRAY) || BOOST_VERSION < 104000
|
||||
#if defined(BOOST_NO_0X_HDR_ARRAY)
|
||||
#define CGAL_CFG_NO_CPP0X_ARRAY 1
|
||||
#endif
|
||||
#if defined(BOOST_NO_0X_HDR_UNORDERED_SET) || \
|
||||
defined(BOOST_NO_0X_HDR_UNORDERED_MAP) || \
|
||||
defined(BOOST_NO_CXX11_HDR_UNORDERED_SET) || \
|
||||
defined(BOOST_NO_CXX11_HDR_UNORDERED_MAP) || \
|
||||
(defined(_MSC_VER) && (_MSC_VER == 1800)) // std::unordered_set is very bad in MSVC2013
|
||||
#define CGAL_CFG_NO_CPP0X_UNORDERED 1
|
||||
#endif
|
||||
#if defined( BOOST_NO_0X_HDR_THREAD) || \
|
||||
defined( BOOST_NO_CXX11_HDR_THREAD)
|
||||
#if defined( BOOST_NO_0X_HDR_THREAD)
|
||||
#define CGAL_CFG_NO_STD_THREAD 1
|
||||
#endif
|
||||
#if defined(BOOST_NO_DECLTYPE) || \
|
||||
defined(BOOST_NO_CXX11_DECLTYPE) || (BOOST_VERSION < 103600)
|
||||
#if defined(BOOST_NO_DECLTYPE)
|
||||
#define CGAL_CFG_NO_CPP0X_DECLTYPE 1
|
||||
#endif
|
||||
#if defined(BOOST_NO_DELETED_FUNCTIONS) || \
|
||||
defined(BOOST_NO_DEFAULTED_FUNCTIONS) || \
|
||||
defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) || \
|
||||
defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) || (BOOST_VERSION < 103600) || \
|
||||
(defined(_MSC_VER) && _MSC_VER < 1900) // MSVC 2013 has only partial support
|
||||
#define CGAL_CFG_NO_CPP0X_DELETED_AND_DEFAULT_FUNCTIONS 1
|
||||
#endif
|
||||
#if defined(BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS) || \
|
||||
defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) || \
|
||||
(BOOST_VERSION < 104100)
|
||||
#if defined(BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS)
|
||||
#define CGAL_CFG_NO_CPP0X_DEFAULT_TEMPLATE_ARGUMENTS_FOR_FUNCTION_TEMPLATES 1
|
||||
#endif
|
||||
#if defined(BOOST_NO_INITIALIZER_LISTS) || \
|
||||
defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) || (BOOST_VERSION < 103900)
|
||||
#if defined(BOOST_NO_INITIALIZER_LISTS)
|
||||
#define CGAL_CFG_NO_CPP0X_INITIALIZER_LISTS 1
|
||||
#endif
|
||||
#if defined(BOOST_MSVC)
|
||||
#define CGAL_CFG_NO_CPP0X_ISFINITE 1 // used in <CGAL/CORE/Filter.h>
|
||||
#endif
|
||||
#if defined(BOOST_NO_LONG_LONG) || (BOOST_VERSION < 103600)
|
||||
#if defined(BOOST_NO_LONG_LONG)
|
||||
#define CGAL_CFG_NO_CPP0X_LONG_LONG 1
|
||||
#endif
|
||||
#if defined(BOOST_NO_LAMBDAS) || \
|
||||
defined(BOOST_NO_CXX11_LAMBDAS) || BOOST_VERSION < 104000
|
||||
#if defined(BOOST_NO_LAMBDAS)
|
||||
#define CGAL_CFG_NO_CPP0X_LAMBDAS 1
|
||||
#endif
|
||||
#if defined(BOOST_NO_RVALUE_REFERENCES) || \
|
||||
defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || (BOOST_VERSION < 103600)
|
||||
#if defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
#define CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE 1
|
||||
#endif
|
||||
#if defined(BOOST_NO_STATIC_ASSERT) || \
|
||||
defined(BOOST_NO_CXX11_STATIC_ASSERT) || (BOOST_VERSION < 103600)
|
||||
#if defined(BOOST_NO_STATIC_ASSERT)
|
||||
#define CGAL_CFG_NO_CPP0X_STATIC_ASSERT 1
|
||||
#endif
|
||||
#if defined(BOOST_NO_0X_HDR_TUPLE) || \
|
||||
defined(BOOST_NO_CXX11_HDR_TUPLE) || (BOOST_VERSION < 104000)
|
||||
#if defined(BOOST_NO_0X_HDR_TUPLE)
|
||||
#define CGAL_CFG_NO_CPP0X_TUPLE 1
|
||||
#endif
|
||||
#if defined(BOOST_NO_VARIADIC_TEMPLATES) || \
|
||||
defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || (BOOST_VERSION < 103600)
|
||||
#if defined(BOOST_NO_VARIADIC_TEMPLATES)
|
||||
#define CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES 1
|
||||
#endif
|
||||
// never use TR1
|
||||
#define CGAL_CFG_NO_TR1_ARRAY 1
|
||||
// never use TR1
|
||||
#define CGAL_CFG_NO_TR1_TUPLE 1
|
||||
#if !defined(__GNUC__) || defined(__INTEL_COMPILER)
|
||||
#if (__GNUC__ <= 0) || defined(__INTEL_COMPILER)
|
||||
#define CGAL_CFG_NO_STATEMENT_EXPRESSIONS 1
|
||||
#endif
|
||||
#if defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) || (BOOST_VERSION < 105100) || _MSC_VER==1800
|
||||
#if _MSC_VER==1800
|
||||
#define CGAL_CFG_NO_CPP0X_UNIFIED_INITIALIZATION_SYNTAX
|
||||
#endif
|
||||
#if __cplusplus < 201103L && !(_MSC_VER >= 1600)
|
||||
|
|
@ -266,13 +234,10 @@
|
|||
#define CGAL_CFG_NO_CPP0X_NEXT_PREV 1
|
||||
#endif
|
||||
#if defined(BOOST_NO_EXPLICIT_CONVERSION_OPERATIONS) \
|
||||
|| defined(BOOST_NO_EXPLICIT_CONVERSION_OPERATORS) \
|
||||
|| defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS) \
|
||||
|| (BOOST_VERSION < 103600)
|
||||
|| defined(BOOST_NO_EXPLICIT_CONVERSION_OPERATORS)
|
||||
#define CGAL_CFG_NO_CPP0X_EXPLICIT_CONVERSION_OPERATORS 1
|
||||
#endif
|
||||
#if defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) || \
|
||||
defined(BOOST_NO_TEMPLATE_ALIASES) || (BOOST_VERSION < 103900)
|
||||
#if defined(BOOST_NO_TEMPLATE_ALIASES)
|
||||
#define CGAL_CFG_NO_CPP0X_TEMPLATE_ALIASES 1
|
||||
#endif
|
||||
|
||||
|
|
@ -303,11 +268,6 @@
|
|||
# define CGAL_CXX20 1
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) || BOOST_VERSION < 105000
|
||||
#define CGAL_CFG_NO_STD_HASH 1
|
||||
#define CGAL_CFG_NO_STD_FUNCTION 1
|
||||
#endif
|
||||
|
||||
|
||||
//----------------------------------------------------------------------//
|
||||
// As std::unary_function and std::binary_function are deprecated
|
||||
|
|
@ -365,31 +325,10 @@
|
|||
// Big endian or little endian machine.
|
||||
// ====================================
|
||||
|
||||
#if (BOOST_VERSION >= 105500)
|
||||
# include <boost/predef.h>
|
||||
# if BOOST_ENDIAN_BIG_BYTE
|
||||
# define CGAL_BIG_ENDIAN
|
||||
# elif BOOST_ENDIAN_LITTLE_BYTE
|
||||
# define CGAL_LITTLE_ENDIAN
|
||||
# endif
|
||||
#elif defined (__GLIBC__)
|
||||
# include <endian.h>
|
||||
# if (__BYTE_ORDER == __LITTLE_ENDIAN)
|
||||
# define CGAL_LITTLE_ENDIAN
|
||||
# elif (__BYTE_ORDER == __BIG_ENDIAN)
|
||||
# define CGAL_BIG_ENDIAN
|
||||
# endif
|
||||
#elif defined(__sparc) || defined(__sparc__) \
|
||||
|| defined(_POWER) || defined(__powerpc__) \
|
||||
|| defined(__ppc__) || defined(__hppa) \
|
||||
|| defined(_MIPSEB) || defined(_POWER) \
|
||||
|| defined(__s390__)
|
||||
#include <boost/predef.h>
|
||||
#if BOOST_ENDIAN_BIG_BYTE
|
||||
# define CGAL_BIG_ENDIAN
|
||||
#elif defined(__i386__) || defined(__alpha__) \
|
||||
|| defined(__x86_64) || defined(__x86_64__) \
|
||||
|| defined(__ia64) || defined(__ia64__) \
|
||||
|| defined(_M_IX86) || defined(_M_IA64) \
|
||||
|| defined(_M_ALPHA) || defined(_WIN64)
|
||||
#elif BOOST_ENDIAN_LITTLE_BYTE
|
||||
# define CGAL_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
|
|
@ -550,7 +489,7 @@ using std::max;
|
|||
|
||||
// Macro CGAL_ASSUME
|
||||
// Call a builtin of the compiler to pass a hint to the compiler
|
||||
#if __has_builtin(__builtin_unreachable) || (CGAL_GCC_VERSION >= 40500 && !__STRICT_ANSI__)
|
||||
#if __has_builtin(__builtin_unreachable) || (CGAL_GCC_VERSION > 0 && !__STRICT_ANSI__)
|
||||
// From g++ 4.5, there exists a __builtin_unreachable()
|
||||
// Also in LLVM/clang
|
||||
# define CGAL_ASSUME(EX) if(!(EX)) { __builtin_unreachable(); }
|
||||
|
|
@ -570,26 +509,34 @@ using std::max;
|
|||
#endif
|
||||
|
||||
#if __has_feature(cxx_thread_local) || \
|
||||
( (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L ) || \
|
||||
( (__GNUC__ > 0) && __cplusplus >= 201103L ) || \
|
||||
( _MSC_VER >= 1900 )
|
||||
// see also Installation/cmake/modules/config/support/CGAL_test_cpp_version.cpp
|
||||
#define CGAL_CAN_USE_CXX11_THREAD_LOCAL
|
||||
#endif
|
||||
|
||||
#if ( BOOST_VERSION >= 105000 && ! defined(BOOST_NO_CXX11_HDR_MUTEX) ) || \
|
||||
(__has_include(<mutex>) && __cplusplus >= 201103L ) | \
|
||||
( (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L ) || \
|
||||
#if (__has_include(<mutex>) && __cplusplus >= 201103L ) | \
|
||||
( (__GNUC__ > 0) && __cplusplus >= 201103L ) || \
|
||||
( _MSC_VER >= 1700 )
|
||||
#define CGAL_CAN_USE_CXX11_MUTEX
|
||||
#endif
|
||||
|
||||
#if ( BOOST_VERSION >= 105600 && ! defined(BOOST_NO_CXX11_HDR_ATOMIC) ) || \
|
||||
(__has_include(<atomic>) && __cplusplus >= 201103L ) || \
|
||||
( (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L ) || \
|
||||
#if (__has_include(<atomic>) && __cplusplus >= 201103L ) || \
|
||||
( (__GNUC__ > 0) && __cplusplus >= 201103L ) || \
|
||||
( _MSC_VER >= 1700 )
|
||||
#define CGAL_CAN_USE_CXX11_ATOMIC
|
||||
#endif
|
||||
|
||||
#ifndef CGAL_HAS_THREADS
|
||||
namespace CGAL { inline bool is_currently_single_threaded(){ return true; } }
|
||||
#elif __has_include(<sys/single_threaded.h>)
|
||||
# include <sys/single_threaded.h>
|
||||
namespace CGAL { inline bool is_currently_single_threaded(){ return ::__libc_single_threaded; } }
|
||||
#else
|
||||
/* This is the conservative default */
|
||||
namespace CGAL { inline bool is_currently_single_threaded(){ return false; } }
|
||||
#endif
|
||||
|
||||
// Support for LEDA with threads
|
||||
// Not that, if CGAL_HAS_THREADS is defined, and you want to use LEDA,
|
||||
// you must link with a version of LEDA libraries that support threads.
|
||||
|
|
@ -600,7 +547,7 @@ using std::max;
|
|||
#define LEDA_NUMBERS_DLL 1
|
||||
|
||||
// Helper macros to disable macros
|
||||
#if defined(__clang__) || (BOOST_GCC >= 40600)
|
||||
#if defined(__clang__) || defined(BOOST_GCC)
|
||||
# define CGAL_PRAGMA_DIAG_PUSH _Pragma("GCC diagnostic push")
|
||||
# define CGAL_PRAGMA_DIAG_POP _Pragma("GCC diagnostic pop")
|
||||
#else
|
||||
|
|
@ -676,7 +623,6 @@ namespace cpp11{
|
|||
}//namespace cpp11
|
||||
} //namespace CGAL
|
||||
|
||||
|
||||
// The fallthrough attribute
|
||||
// See for clang:
|
||||
// http://clang.llvm.org/docs/AttributeReference.html#statement-attributes
|
||||
|
|
@ -694,9 +640,10 @@ namespace cpp11{
|
|||
# define CGAL_FALLTHROUGH while(false){}
|
||||
#endif
|
||||
|
||||
// https://svn.boost.org/trac/boost/ticket/2839
|
||||
#if defined(BOOST_MSVC) && BOOST_VERSION < 105600
|
||||
#define CGAL_CFG_BOOST_VARIANT_SWAP_BUG 1
|
||||
#ifndef CGAL_NO_ASSERTIONS
|
||||
# define CGAL_NO_ASSERTIONS_BOOL false
|
||||
#else
|
||||
# define CGAL_NO_ASSERTIONS_BOOL true
|
||||
#endif
|
||||
|
||||
#if defined( __INTEL_COMPILER)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
# define CGAL_DLL_EXPORT __declspec(dllexport)
|
||||
# define CGAL_DLL_LOCAL
|
||||
# else
|
||||
#if __GNUC__ >= 4
|
||||
#ifdef __GNUC__
|
||||
#define CGAL_DLL_IMPORT __attribute__ ((visibility ("default")))
|
||||
#define CGAL_DLL_EXPORT __attribute__ ((visibility ("default")))
|
||||
#define CGAL_DLL_LOCAL __attribute__ ((visibility ("hidden")))
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ CGAL_static_assertion_msg(false, CGAL_INTERNAL_DEPRECATED_MESSAGE);
|
|||
#elif !defined(CGAL_NO_DEPRECATION_WARNINGS) // don't trigger on NO_DEPRECATION_WARNINGS
|
||||
# if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__)
|
||||
# pragma message (CGAL_INTERNAL_DEPRECATED_MESSAGE)
|
||||
# elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__)
|
||||
# elif (__GNUC__ > 0) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__)
|
||||
// warning does not expand its arguments, issue a warning and add the message.
|
||||
# warning "A deprecated header has been included."
|
||||
# pragma message (CGAL_INTERNAL_DEPRECATED_MESSAGE)
|
||||
|
|
|
|||
|
|
@ -62,6 +62,9 @@ public:
|
|||
Circle_2(const RCircle_2& t)
|
||||
: RCircle_2(t) {}
|
||||
|
||||
Circle_2(RCircle_2&& t)
|
||||
: RCircle_2(std::move(t)) {}
|
||||
|
||||
Circle_2(const Point_2 ¢er, const FT &squared_radius,
|
||||
const Orientation &orientation)
|
||||
: RCircle_2(typename R::Construct_circle_2()(Return_base_tag(), center, squared_radius, orientation)) {}
|
||||
|
|
|
|||
|
|
@ -93,6 +93,9 @@ public:
|
|||
Circle_3(const Rep& r)
|
||||
: Rep(r) {}
|
||||
|
||||
Circle_3(Rep&& r)
|
||||
: Rep(std::move(r)) {}
|
||||
|
||||
decltype(auto)
|
||||
diametral_sphere() const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -65,6 +65,9 @@ public:
|
|||
Direction_2(const RDirection_2& d)
|
||||
: RDirection_2(d) {}
|
||||
|
||||
Direction_2(RDirection_2&& d)
|
||||
: RDirection_2(std::move(d)) {}
|
||||
|
||||
explicit Direction_2(const Vector_2& v)
|
||||
: RDirection_2(typename R::Construct_direction_2()(Return_base_tag(), v)) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -64,6 +64,9 @@ public:
|
|||
Direction_3(const Rep& d)
|
||||
: Rep(d) {}
|
||||
|
||||
Direction_3(Rep&& d)
|
||||
: Rep(std::move(d)) {}
|
||||
|
||||
explicit Direction_3(const Vector_3& v)
|
||||
: Rep(typename R::Construct_direction_3()(Return_base_tag(), v)) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,6 +66,9 @@ public:
|
|||
Line_2(const RLine_2& l) // conversion impl -> interface class
|
||||
: RLine_2(l) {}
|
||||
|
||||
Line_2(RLine_2&& l)
|
||||
: RLine_2(std::move(l)) {}
|
||||
|
||||
Line_2(const Point_2 &p, const Point_2 &q)
|
||||
: RLine_2(typename R::Construct_line_2()(Return_base_tag(), p,q)) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,6 +66,9 @@ public:
|
|||
Line_3(const Rep& l)
|
||||
: Rep(l) {}
|
||||
|
||||
Line_3(Rep&& l)
|
||||
: Rep(std::move(l)) {}
|
||||
|
||||
Line_3(const Point_3 & p, const Point_3 & q)
|
||||
: Rep(typename R::Construct_line_3()(Return_base_tag(), p, q)) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,6 +66,9 @@ public:
|
|||
Plane_3(const Rep& p)
|
||||
: Rep(p) {}
|
||||
|
||||
Plane_3(Rep&& p)
|
||||
: Rep(std::move(p)) {}
|
||||
|
||||
Plane_3(const Point_3& p, const Point_3& q, const Point_3& r)
|
||||
: Rep(typename R::Construct_plane_3()(Return_base_tag(), p, q, r)) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,6 +69,10 @@ public:
|
|||
: RPoint_2(p)
|
||||
{}
|
||||
|
||||
Point_2(RPoint_2&& p)
|
||||
: RPoint_2(std::move(p))
|
||||
{}
|
||||
|
||||
explicit
|
||||
Point_2(const Weighted_point_2& wp)
|
||||
: Rep(wp.point())
|
||||
|
|
|
|||
|
|
@ -67,6 +67,9 @@ public:
|
|||
Point_3(const Rep& p)
|
||||
: Rep(p) {}
|
||||
|
||||
Point_3(Rep&& p)
|
||||
: Rep(std::move(p)) {}
|
||||
|
||||
explicit
|
||||
Point_3(const Weighted_point_3& wp)
|
||||
: Rep(wp.point())
|
||||
|
|
|
|||
|
|
@ -67,6 +67,9 @@ public:
|
|||
Ray_2(const RRay_2& r)
|
||||
: RRay_2(r) {}
|
||||
|
||||
Ray_2(RRay_2&& r)
|
||||
: RRay_2(std::move(r)) {}
|
||||
|
||||
Ray_2(const Point_2 &sp, const Point_2 &secondp)
|
||||
: RRay_2(typename R::Construct_ray_2()(Return_base_tag(), sp, secondp)) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,6 +63,9 @@ public:
|
|||
Ray_3(const Rep& r)
|
||||
: Rep(r) {}
|
||||
|
||||
Ray_3(Rep&& r)
|
||||
: Rep(std::move(r)) {}
|
||||
|
||||
Ray_3(const Point_3& sp, const Point_3& secondp)
|
||||
: Rep(typename R::Construct_ray_3()(Return_base_tag(), sp, secondp)) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,6 +66,9 @@ public:
|
|||
Segment_2(const RSegment_2& s)
|
||||
: RSegment_2(s) {}
|
||||
|
||||
Segment_2(RSegment_2&& s)
|
||||
: RSegment_2(std::move(s)) {}
|
||||
|
||||
Segment_2(const Point_2 &sp, const Point_2 &ep)
|
||||
: RSegment_2(typename R::Construct_segment_2()(Return_base_tag(), sp,ep)) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,6 +65,9 @@ public:
|
|||
Segment_3(const Rep& s)
|
||||
: Rep(s) {}
|
||||
|
||||
Segment_3(Rep&& s)
|
||||
: Rep(std::move(s)) {}
|
||||
|
||||
Segment_3(const Point_3& sp, const Point_3& ep)
|
||||
: Rep(typename R::Construct_segment_3()(Return_base_tag(), sp, ep)) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,6 +62,9 @@ public:
|
|||
Sphere_3(const Rep& s)
|
||||
: Rep(s) {}
|
||||
|
||||
Sphere_3(Rep&& s)
|
||||
: Rep(std::move(s)) {}
|
||||
|
||||
Sphere_3(const Point_3_& p, const FT& sq_rad,
|
||||
const Orientation& o = COUNTERCLOCKWISE)
|
||||
: Rep(typename R::Construct_sphere_3()(Return_base_tag(), p, sq_rad, o)) {}
|
||||
|
|
|
|||
|
|
@ -58,6 +58,9 @@ public:
|
|||
Tetrahedron_3(const Rep& t)
|
||||
: Rep(t) {}
|
||||
|
||||
Tetrahedron_3(Rep&& t)
|
||||
: Rep(std::move(t)) {}
|
||||
|
||||
Tetrahedron_3(const Point_3& p, const Point_3& q,
|
||||
const Point_3& r, const Point_3& s)
|
||||
: Rep(typename R::Construct_tetrahedron_3()(Return_base_tag(), p, q, r, s)) {}
|
||||
|
|
|
|||
|
|
@ -70,6 +70,9 @@ public:
|
|||
Vector_2(const RVector_2& v)
|
||||
: RVector_2(v) {}
|
||||
|
||||
Vector_2(RVector_2&& v)
|
||||
: RVector_2(std::move(v)) {}
|
||||
|
||||
Vector_2(const Point_2& a, const Point_2& b)
|
||||
: RVector_2(typename R::Construct_vector_2()(Return_base_tag(), a, b)) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,6 +70,9 @@ public:
|
|||
Vector_3(const Rep& v)
|
||||
: Rep(v) {}
|
||||
|
||||
Vector_3(Rep&& v)
|
||||
: Rep(std::move(v)) {}
|
||||
|
||||
Vector_3(const Point_3& a, const Point_3& b)
|
||||
: Rep(typename R::Construct_vector_3()(Return_base_tag(), a, b)) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,6 +69,9 @@ public:
|
|||
Weighted_point_2(const Rep& p)
|
||||
: Rep(p) {}
|
||||
|
||||
Weighted_point_2(Rep&& p)
|
||||
: Rep(std::move(p)) {}
|
||||
|
||||
explicit
|
||||
Weighted_point_2(const Point_2& p)
|
||||
: Rep(typename R::Construct_weighted_point_2()(Return_base_tag(), p, 0))
|
||||
|
|
|
|||
|
|
@ -71,6 +71,9 @@ public:
|
|||
Weighted_point_3(const Rep& p)
|
||||
: Rep(p) {}
|
||||
|
||||
Weighted_point_3(Rep&& p)
|
||||
: Rep(std::move(p)) {}
|
||||
|
||||
explicit
|
||||
Weighted_point_3(const Point_3& p)
|
||||
: Rep(typename R::Construct_weighted_point_3()(Return_base_tag(), p, 0))
|
||||
|
|
|
|||
|
|
@ -282,6 +282,63 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
template <class R,int dim>
|
||||
class Construct_centroid_projected_3
|
||||
{
|
||||
public:
|
||||
typedef typename R::Point_3 Point_3;
|
||||
typedef typename R::Point_2 Point_2;
|
||||
typedef typename R::FT RT;
|
||||
RT x(const Point_3 &p) const { return Projector<R,dim>::x(p); }
|
||||
RT y(const Point_3 &p) const { return Projector<R,dim>::y(p); }
|
||||
|
||||
Point_2 project(const Point_3& p) const
|
||||
{
|
||||
return Point_2(x(p), y(p));
|
||||
}
|
||||
|
||||
Point_3 embed(const Point_2& p) const
|
||||
{
|
||||
RT coords[3];
|
||||
coords[Projector<R,dim>::x_index] = p.x();
|
||||
coords[Projector<R,dim>::y_index] = p.y();
|
||||
coords[dim] = RT(0);
|
||||
|
||||
return Point_3(coords[0], coords[1], coords[2]);
|
||||
}
|
||||
|
||||
Point_3 operator()(const Point_3& p, const Point_3& q, const Point_3& r) const
|
||||
{
|
||||
const Point_2 p2(project(p));
|
||||
const Point_2 q2(project(q));
|
||||
const Point_2 r2(project(r));
|
||||
return embed(CGAL::centroid(p2, q2, r2));
|
||||
}
|
||||
};
|
||||
|
||||
template <class R,int dim>
|
||||
class Compute_determinant_projected_3
|
||||
{
|
||||
public:
|
||||
typedef typename R::Vector_3 Vector_3;
|
||||
typedef typename R::Vector_2 Vector_2;
|
||||
typedef typename R::FT RT;
|
||||
RT x(const Vector_3 &v) const { return Projector<R,dim>::x(v); }
|
||||
RT y(const Vector_3 &v) const { return Projector<R,dim>::y(v); }
|
||||
|
||||
Vector_2 project(const Vector_3& v) const
|
||||
{
|
||||
return Vector_2(x(v), y(v));
|
||||
}
|
||||
|
||||
RT operator()(const Vector_3& v, const Vector_3& w) const
|
||||
{
|
||||
const Vector_2 v2(project(v));
|
||||
const Vector_2 w2(project(w));
|
||||
return CGAL::determinant(v2, w2);
|
||||
}
|
||||
};
|
||||
|
||||
template <class R,int dim>
|
||||
class Intersect_projected_3
|
||||
{
|
||||
|
|
@ -817,6 +874,9 @@ public:
|
|||
typedef Power_side_of_oriented_power_circle_projected_3<Rp, dim> Power_side_of_oriented_power_circle_2;
|
||||
typedef Construct_bbox_projected_2<Rp,dim> Construct_bbox_2;
|
||||
|
||||
typedef Construct_centroid_projected_3<Rp,dim> Construct_centroid_2;
|
||||
typedef Compute_determinant_projected_3<Rp,dim> Compute_determinant_2;
|
||||
|
||||
typedef typename Rp::Construct_point_3 Construct_point_2;
|
||||
typedef typename Rp::Construct_weighted_point_3 Construct_weighted_point_2;
|
||||
typedef typename Rp::Construct_segment_3 Construct_segment_2;
|
||||
|
|
@ -1014,6 +1074,12 @@ public:
|
|||
Construct_bbox_2 construct_bbox_2_object() const
|
||||
{return Construct_bbox_2();}
|
||||
|
||||
Construct_centroid_2 construct_centroid_2_object() const
|
||||
{return Construct_centroid_2();}
|
||||
|
||||
Compute_determinant_2 compute_determinant_2_object() const
|
||||
{return Compute_determinant_2();}
|
||||
|
||||
Compute_scalar_product_2 compute_scalar_product_2_object() const
|
||||
{return Compute_scalar_product_2();}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,14 @@ int main()
|
|||
|
||||
K k;
|
||||
|
||||
assert( ( k.construct_centroid_2_object()(p3, q3, r3).x() ==
|
||||
CGAL::centroid(p2, q2, r2).x() ) &&
|
||||
( k.construct_centroid_2_object()(p3, q3, r3).y() ==
|
||||
CGAL::centroid(p2, q2, r2).y() ) );
|
||||
|
||||
assert( k.compute_determinant_2_object()(v3, w3) ==
|
||||
CGAL::determinant(v2, w2) );
|
||||
|
||||
assert( k.compute_scalar_product_2_object()(v3, w3) ==
|
||||
v2 * w2 );
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
#include <bitset>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if (BOOST_GCC >= 40900)
|
||||
#if defined(BOOST_GCC)
|
||||
_Pragma("GCC diagnostic push")
|
||||
_Pragma("GCC diagnostic ignored \"-Warray-bounds\"")
|
||||
#endif
|
||||
|
|
@ -476,7 +476,7 @@ namespace CGAL {
|
|||
|
||||
} // namespace CGAL
|
||||
|
||||
#if (BOOST_GCC >= 40900)
|
||||
#if defined(BOOST_GCC)
|
||||
_Pragma("GCC diagnostic pop")
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
#include <bitset>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if (BOOST_GCC >= 40900)
|
||||
#if defined(BOOST_GCC)
|
||||
_Pragma("GCC diagnostic push")
|
||||
_Pragma("GCC diagnostic ignored \"-Warray-bounds\"")
|
||||
#endif
|
||||
|
|
@ -460,7 +460,7 @@ namespace CGAL {
|
|||
Items_, Alloc_, Concurrent_tag>::null_handle = nullptr;
|
||||
} // namespace CGAL
|
||||
|
||||
#if (BOOST_GCC >= 40900)
|
||||
#if defined(BOOST_GCC)
|
||||
_Pragma("GCC diagnostic pop")
|
||||
#endif
|
||||
#endif // CGAL_GMAP_LINEAR_CELL_COMPLEX_STORAGES_H //
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ if(Boost_PROGRAM_OPTIONS_FOUND)
|
|||
list(APPEND CGAL_3RD_PARTY_LIBRARIES ${Boost_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(Boost_FOUND AND Boost_VERSION GREATER 103400)
|
||||
if(Boost_FOUND )
|
||||
# Compilable benchmark
|
||||
set(BENCHMARK_SOURCE_FILES "concurrency.cpp")
|
||||
add_msvc_precompiled_header("StdAfx.h" "StdAfx.cpp" BENCHMARK_SOURCE_FILES)
|
||||
|
|
|
|||
|
|
@ -21,17 +21,12 @@
|
|||
#include <CGAL/license/Mesh_3.h>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if BOOST_VERSION >= 106600
|
||||
# include <boost/callable_traits/is_invocable.hpp>
|
||||
#else
|
||||
# include <boost/mpl/has_xxx.hpp>
|
||||
#endif
|
||||
#include <boost/callable_traits/is_invocable.hpp>
|
||||
|
||||
#include <CGAL/tags.h>
|
||||
|
||||
namespace CGAL {
|
||||
namespace Mesh_3 {
|
||||
#if BOOST_VERSION >= 106600
|
||||
template <typename Tr, typename Type>
|
||||
struct Is_mesh_domain_field_3 :
|
||||
public CGAL::Boolean_tag
|
||||
|
|
@ -45,12 +40,6 @@ namespace CGAL {
|
|||
>::value
|
||||
>
|
||||
{};
|
||||
#else // Boost before 1.66
|
||||
BOOST_MPL_HAS_XXX_TRAIT_DEF(FT)
|
||||
template <typename Tr, typename Type>
|
||||
struct Is_mesh_domain_field_3 : public Boolean_tag<has_FT<Type>::value>
|
||||
{};
|
||||
#endif // Boost before 1.66
|
||||
} // end namespace Mesh_3
|
||||
} // end namespace CGAL
|
||||
|
||||
|
|
|
|||
|
|
@ -21,9 +21,7 @@
|
|||
#include <CGAL/Mesh_3/Is_mesh_domain_field_3.h>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if BOOST_VERSION >= 106600
|
||||
# include <boost/callable_traits/is_invocable.hpp>
|
||||
#endif
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
|
|
|
|||
|
|
@ -40,24 +40,12 @@ FT capsule_function(const Point& p)
|
|||
else if(z < FT(-5)) return base+CGAL::square(z+5);
|
||||
else return base;
|
||||
}
|
||||
#if BOOST_VERSION >= 106600
|
||||
auto field = [](const Point& p, const int, const Mesh_domain::Index)
|
||||
{
|
||||
if(p.z() > 2) return 0.025;
|
||||
if(p.z() < -3) return 0.01;
|
||||
else return 1.;
|
||||
};
|
||||
#else
|
||||
struct Field {
|
||||
typedef ::FT FT;
|
||||
|
||||
FT operator()(const Point& p, const int, const Mesh_domain::Index) const {
|
||||
if(p.z() > 2) return 0.025;
|
||||
if(p.z() < -3) return 0.01;
|
||||
else return 1;
|
||||
}
|
||||
} field;
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -22,13 +22,7 @@
|
|||
#include <CGAL/function_objects.h> // for CGAL::Identity
|
||||
|
||||
#include <boost/version.hpp>
|
||||
#if BOOST_VERSION >= 103500
|
||||
# define CGAL_USE_BOOST_BIMAP
|
||||
#endif
|
||||
|
||||
#if defined(CGAL_USE_BOOST_BIMAP) && BOOST_VERSION == 104100
|
||||
#include <CGAL/internal/container_fwd_fixed.hpp>
|
||||
#endif
|
||||
|
||||
#ifdef CGAL_USE_BOOST_BIMAP
|
||||
# if defined(BOOST_MSVC)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
#include <CGAL/internal/Exact_type_selector.h>
|
||||
#include <CGAL/NewKernel_d/Types/Weighted_point.h>
|
||||
|
||||
// TODO: add static filters somewhere
|
||||
// TODO: In Kernel_23, Epeck predicates first see if they can convert their arguments to Epick types exactly, and in that case use the Epick predicates (including static filters, Mpzf, etc).
|
||||
namespace CGAL {
|
||||
#define CGAL_KA Cartesian_base_d<Interval_nt_advanced,Dim>
|
||||
#define CGAL_KE Cartesian_base_d<internal::Exact_field_selector<double>::Type, Dim>
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ template<typename AT, typename ET, typename AC, typename EC, typename E2A, typen
|
|||
class Lazy_rep_XXX :
|
||||
public Lazy_rep< AT, ET, E2A >, private EC
|
||||
{
|
||||
typedef Lazy_rep< AT, ET, E2A > Base;
|
||||
// `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.
|
||||
|
|
@ -129,9 +130,10 @@ class Lazy_rep_XXX :
|
|||
const EC& ec() const { return *this; }
|
||||
template<class...T>
|
||||
void update_exact_helper(Lazy_internal::typelist<T...>) const {
|
||||
this->et = new ET(ec()( CGAL::exact( Lazy_internal::do_extract(T{},l) ) ... ) );
|
||||
this->at = E2A()(*(this->et));
|
||||
l = LL(); // There should be a nicer way to clear. Destruction for instance. With this->et as a witness of whether l has already been destructed.
|
||||
auto* p = new typename Base::Indirect(ec()( CGAL::exact( Lazy_internal::do_extract(T{},l) ) ... ) );
|
||||
this->set_at(p);
|
||||
this->set_ptr(p);
|
||||
lazy_reset_member(l);
|
||||
}
|
||||
public:
|
||||
void update_exact() const {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
#ifndef CGAL_VECTOR_AVX4_H
|
||||
#define CGAL_VECTOR_AVX4_H
|
||||
|
||||
#if !defined __AVX__ || (__GNUC__ * 100 + __GNUC_MINOR__ < 408)
|
||||
#if !defined __AVX__
|
||||
#error Requires AVX and gcc 4.8+
|
||||
#endif
|
||||
#include <x86intrin.h>
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
#define CGAL_VECTOR_SSE2_H
|
||||
|
||||
// Check what needs adapting for clang, intel and microsoft
|
||||
#if !defined __SSE2__ || (__GNUC__ * 100 + __GNUC_MINOR__ < 408)
|
||||
#if !defined __SSE2__
|
||||
#error Requires SSE2 and gcc 4.8+
|
||||
#endif
|
||||
#include <x86intrin.h> // FIXME: other platforms call it differently
|
||||
|
|
|
|||
|
|
@ -1,13 +1,4 @@
|
|||
#include <boost/config.hpp>
|
||||
#if defined(BOOST_GCC) && (__GNUC__ <= 4) && (__GNUC_MINOR__ < 4)
|
||||
|
||||
#include <iostream>
|
||||
int main()
|
||||
{
|
||||
std::cerr << "NOTICE: This test requires G++ >= 4.4, and will not be compiled." << std::endl;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
//#define BOOST_RESULT_OF_USE_DECLTYPE 1
|
||||
#include <CGAL/Epick_d.h>
|
||||
|
|
@ -768,5 +759,3 @@ int main(){
|
|||
test4<CGAL::Epeck_d<CGAL::Dynamic_dimension_tag>>();
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ inline double IA_opacify(double x)
|
|||
// Intel has a bug where -mno-sse still defines __SSE__ and __SSE2__
|
||||
// (-mno-sse2 works though), no work-around for now.
|
||||
# if defined __SSE2_MATH__ || (defined __INTEL_COMPILER && defined __SSE2__)
|
||||
# if __GNUC__ * 100 + __GNUC_MINOR__ >= 409
|
||||
# if (__GNUC__ > 0)
|
||||
// ICEs in reload/LRA with older versions.
|
||||
asm volatile ("" : "+gx"(x) );
|
||||
# else
|
||||
|
|
@ -275,8 +275,7 @@ inline __m128d IA_opacify128_weak(__m128d x)
|
|||
inline __m128d swap_m128d(__m128d x){
|
||||
# ifdef __llvm__
|
||||
return __builtin_shufflevector(x, x, 1, 0);
|
||||
# elif defined __GNUC__ && !defined __INTEL_COMPILER \
|
||||
&& __GNUC__ * 100 + __GNUC_MINOR__ >= 407
|
||||
# elif defined __GNUC__ && !defined __INTEL_COMPILER
|
||||
return __builtin_shuffle(x, (__m128i){ 1, 0 });
|
||||
# else
|
||||
return _mm_shuffle_pd(x, x, 1);
|
||||
|
|
@ -327,11 +326,6 @@ inline double IA_bug_sqrt(double d)
|
|||
}
|
||||
|
||||
# define CGAL_BUG_SQRT(d) IA_bug_sqrt(d)
|
||||
|
||||
|
||||
#elif defined __SSE2_MATH__
|
||||
// For SSE2, we need to call __builtin_sqrt() instead of libc's sqrt().
|
||||
# define CGAL_BUG_SQRT(d) __builtin_sqrt(d)
|
||||
#elif defined __CYGWIN__
|
||||
inline double IA_bug_sqrt(double d)
|
||||
{
|
||||
|
|
@ -460,7 +454,7 @@ typedef unsigned int FPU_CW_t;
|
|||
# elif defined __aarch64__
|
||||
#define CGAL_IA_SETFPCW(CW) asm volatile ("MSR FPCR, %0" : :"r" (CW))
|
||||
#define CGAL_IA_GETFPCW(CW) asm volatile ("MRS %0, FPCR" : "=r" (CW))
|
||||
typedef unsigned int FPU_CW_t;
|
||||
typedef unsigned long FPU_CW_t;
|
||||
#define CGAL_FE_TONEAREST (0x0)
|
||||
#define CGAL_FE_TOWARDZERO (0xC00000)
|
||||
#define CGAL_FE_UPWARD (0x400000)
|
||||
|
|
|
|||
|
|
@ -113,6 +113,10 @@ struct Lazy_exact_nt_rep : public Lazy_exact_nt<ET>::Self_rep
|
|||
Lazy_exact_nt_rep (const Interval_nt<false> & i)
|
||||
: Base(i) {}
|
||||
|
||||
template<class T>
|
||||
Lazy_exact_nt_rep (const Interval_nt<false> & i, T&& e)
|
||||
: Base(i, std::forward<T>(e)) {}
|
||||
|
||||
#ifdef CGAL_LAZY_KERNEL_DEBUG
|
||||
void
|
||||
print_dag(std::ostream& os, int level) const
|
||||
|
|
@ -123,23 +127,33 @@ struct Lazy_exact_nt_rep : public Lazy_exact_nt<ET>::Self_rep
|
|||
};
|
||||
|
||||
// int constant
|
||||
// Unused. This would make even more sense for a double constant but may not be worth the trouble.
|
||||
// Could be recycled as a partial specialization of Lazy_exact_Cst.
|
||||
template <typename ET>
|
||||
struct Lazy_exact_Int_Cst : public Lazy_exact_nt_rep<ET>
|
||||
struct Lazy_exact_Int_Cst final : public Lazy_exact_nt_rep<ET>
|
||||
{
|
||||
Lazy_exact_Int_Cst (int i)
|
||||
: Lazy_exact_nt_rep<ET>(double(i)) {}
|
||||
|
||||
void update_exact() const { this->et = new ET((int)this->approx().inf()); }
|
||||
void update_exact() const {
|
||||
auto* pet = new typename Lazy_exact_nt_rep<ET>::Indirect((int)this->approx().sup());
|
||||
this->keep_at(pet);
|
||||
this->set_ptr(pet);
|
||||
}
|
||||
};
|
||||
|
||||
// double constant
|
||||
template <typename ET, typename X>
|
||||
struct Lazy_exact_Cst : public Lazy_exact_nt_rep<ET>
|
||||
struct Lazy_exact_Cst final : public Lazy_exact_nt_rep<ET>
|
||||
{
|
||||
Lazy_exact_Cst (X x)
|
||||
: Lazy_exact_nt_rep<ET>(x), cste(x) {}
|
||||
|
||||
void update_exact() const { this->et = new ET(cste); }
|
||||
void update_exact() const {
|
||||
auto* pet = new typename Lazy_exact_nt_rep<ET>::Indirect(cste);
|
||||
this->keep_at(pet);
|
||||
this->set_ptr(pet);
|
||||
}
|
||||
|
||||
private:
|
||||
X cste;
|
||||
|
|
@ -147,25 +161,22 @@ struct Lazy_exact_Cst : public Lazy_exact_nt_rep<ET>
|
|||
|
||||
// Exact constant
|
||||
template <typename ET>
|
||||
struct Lazy_exact_Ex_Cst : public Lazy_exact_nt_rep<ET>
|
||||
struct Lazy_exact_Ex_Cst final : public Lazy_exact_nt_rep<ET>
|
||||
{
|
||||
Lazy_exact_Ex_Cst (const ET & e)
|
||||
: Lazy_exact_nt_rep<ET>(CGAL_NTS to_interval(e))
|
||||
{
|
||||
this->et = new ET(e);
|
||||
}
|
||||
Lazy_exact_Ex_Cst (ET&& e)
|
||||
: Lazy_exact_nt_rep<ET>(CGAL_NTS to_interval(e))
|
||||
{
|
||||
this->et = new ET(std::move(e));
|
||||
}
|
||||
template<class T>
|
||||
Lazy_exact_Ex_Cst (T&& e)
|
||||
: Lazy_exact_nt_rep<ET>(CGAL_NTS to_interval(e), std::forward<T>(e))
|
||||
{ }
|
||||
|
||||
void update_exact() const { CGAL_error(); }
|
||||
void update_exact() const {
|
||||
// Currently we do not check is_lazy() before calling call_once, so this is called.
|
||||
// CGAL_error();
|
||||
}
|
||||
};
|
||||
|
||||
// Construction from a Lazy_exact_nt<ET1> (which keeps the lazyness).
|
||||
template <typename ET, typename ET1>
|
||||
class Lazy_lazy_exact_Cst : public Lazy_exact_nt_rep<ET>
|
||||
class Lazy_lazy_exact_Cst final : public Lazy_exact_nt_rep<ET>
|
||||
{
|
||||
mutable Lazy_exact_nt<ET1> l;
|
||||
|
||||
|
|
@ -179,12 +190,13 @@ public:
|
|||
|
||||
void update_exact() const
|
||||
{
|
||||
this->et = new ET(l.exact());
|
||||
this->at = l.approx();
|
||||
prune_dag();
|
||||
auto* pet = new typename Lazy_exact_nt_rep<ET>::Indirect(l.exact());
|
||||
this->set_at(pet, l.approx());
|
||||
this->set_ptr(pet);
|
||||
this->prune_dag();
|
||||
}
|
||||
|
||||
void prune_dag() const { l = Lazy_exact_nt<ET1>(); }
|
||||
void prune_dag() const { l.reset(); }
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -203,7 +215,7 @@ struct Lazy_exact_unary : public Lazy_exact_nt_rep<ET>
|
|||
this->set_depth(op1.depth() + 1);
|
||||
}
|
||||
|
||||
void prune_dag() const { op1 = Lazy_exact_nt<ET>(); }
|
||||
void prune_dag() const { op1.reset(); }
|
||||
|
||||
#ifdef CGAL_LAZY_KERNEL_DEBUG
|
||||
void
|
||||
|
|
@ -234,8 +246,8 @@ struct Lazy_exact_binary : public Lazy_exact_nt_rep<ET>
|
|||
|
||||
void prune_dag() const
|
||||
{
|
||||
op1 = Lazy_exact_nt<ET1>();
|
||||
op2 = Lazy_exact_nt<ET2>();
|
||||
op1.reset();
|
||||
op2.reset();
|
||||
}
|
||||
|
||||
#ifdef CGAL_LAZY_KERNEL_DEBUG
|
||||
|
|
@ -256,10 +268,12 @@ struct Lazy_exact_binary : public Lazy_exact_nt_rep<ET>
|
|||
// function objects plus, minus, multiplies, divides...). But it would require
|
||||
// a template template parameter, and GCC 2.95 seems to crash easily with them.
|
||||
|
||||
// Instead of having nodes only for simple operations, we should use expression templates to build nodes for arbitrary expressions, a*d-b*c should be a single node, that stores a tuple (a,b,c,d) and knows how to update_exact.
|
||||
|
||||
// Macro for unary operations
|
||||
#define CGAL_LAZY_UNARY_OP(OP, NAME) \
|
||||
template <typename ET> \
|
||||
struct NAME : public Lazy_exact_unary<ET> \
|
||||
struct NAME final : public Lazy_exact_unary<ET> \
|
||||
{ \
|
||||
typedef typename Lazy_exact_unary<ET>::AT::Protector P; \
|
||||
NAME (const Lazy_exact_nt<ET> &a) \
|
||||
|
|
@ -267,11 +281,12 @@ struct NAME : public Lazy_exact_unary<ET> \
|
|||
\
|
||||
void update_exact() const \
|
||||
{ \
|
||||
this->et = new ET(OP(this->op1.exact())); \
|
||||
if (!this->approx().is_point()) \
|
||||
this->at = CGAL_NTS to_interval(*(this->et)); \
|
||||
auto* pet = new typename Lazy_exact_nt_rep<ET>::Indirect(OP(this->op1.exact())); \
|
||||
if (!this->approx().is_point()) \
|
||||
this->set_at(pet); \
|
||||
this->set_ptr(pet); \
|
||||
this->prune_dag(); \
|
||||
} \
|
||||
} \
|
||||
};
|
||||
|
||||
CGAL_LAZY_UNARY_OP(opposite, Lazy_exact_Opp)
|
||||
|
|
@ -282,19 +297,20 @@ CGAL_LAZY_UNARY_OP(CGAL_NTS sqrt, Lazy_exact_Sqrt)
|
|||
// A macro for +, -, * and /
|
||||
#define CGAL_LAZY_BINARY_OP(OP, NAME) \
|
||||
template <typename ET, typename ET1 = ET, typename ET2 = ET> \
|
||||
struct NAME : public Lazy_exact_binary<ET, ET1, ET2> \
|
||||
struct NAME final : public Lazy_exact_binary<ET, ET1, ET2> \
|
||||
{ \
|
||||
typedef typename Lazy_exact_binary<ET,ET1,ET2>::AT::Protector P; \
|
||||
typedef typename Lazy_exact_binary<ET,ET1,ET2>::AT::Protector P; \
|
||||
NAME (const Lazy_exact_nt<ET1> &a, const Lazy_exact_nt<ET2> &b) \
|
||||
: Lazy_exact_binary<ET, ET1, ET2>((P(), a.approx() OP b.approx()), a, b) {} \
|
||||
\
|
||||
void update_exact() const \
|
||||
{ \
|
||||
this->et = new ET(this->op1.exact() OP this->op2.exact()); \
|
||||
if (!this->approx().is_point()) \
|
||||
this->at = CGAL_NTS to_interval(*(this->et)); \
|
||||
auto* pet = new typename Lazy_exact_nt_rep<ET>::Indirect(this->op1.exact() OP this->op2.exact()); \
|
||||
if (!this->approx().is_point()) \
|
||||
this->set_at(pet); \
|
||||
this->set_ptr(pet); \
|
||||
this->prune_dag(); \
|
||||
} \
|
||||
} \
|
||||
};
|
||||
|
||||
CGAL_LAZY_BINARY_OP(+, Lazy_exact_Add)
|
||||
|
|
@ -304,32 +320,35 @@ CGAL_LAZY_BINARY_OP(/, Lazy_exact_Div)
|
|||
|
||||
// Minimum
|
||||
template <typename ET>
|
||||
struct Lazy_exact_Min : public Lazy_exact_binary<ET>
|
||||
struct Lazy_exact_Min final : public Lazy_exact_binary<ET>
|
||||
{
|
||||
Lazy_exact_Min (const Lazy_exact_nt<ET> &a, const Lazy_exact_nt<ET> &b)
|
||||
: Lazy_exact_binary<ET>((CGAL::min)(a.approx(), b.approx()), a, b) {}
|
||||
|
||||
void update_exact() const
|
||||
{
|
||||
this->et = new ET((CGAL::min)(this->op1.exact(), this->op2.exact()));
|
||||
// Should we test is_point earlier, and construct ET from double in that case? Constructing from double is not free, but if op1 or op2 is not exact yet, we may be able to skip a whole tree of exact constructions.
|
||||
auto* pet = new typename Lazy_exact_nt_rep<ET>::Indirect((CGAL::min)(this->op1.exact(), this->op2.exact()));
|
||||
if (!this->approx().is_point())
|
||||
this->at = CGAL_NTS to_interval(*(this->et));
|
||||
this->set_at(pet);
|
||||
this->set_ptr(pet);
|
||||
this->prune_dag();
|
||||
}
|
||||
};
|
||||
|
||||
// Maximum
|
||||
template <typename ET>
|
||||
struct Lazy_exact_Max : public Lazy_exact_binary<ET>
|
||||
struct Lazy_exact_Max final : public Lazy_exact_binary<ET>
|
||||
{
|
||||
Lazy_exact_Max (const Lazy_exact_nt<ET> &a, const Lazy_exact_nt<ET> &b)
|
||||
: Lazy_exact_binary<ET>((CGAL::max)(a.approx(), b.approx()), a, b) {}
|
||||
|
||||
void update_exact() const
|
||||
{
|
||||
this->et = new ET((CGAL::max)(this->op1.exact(), this->op2.exact()));
|
||||
auto* pet = new typename Lazy_exact_nt_rep<ET>::Indirect((CGAL::max)(this->op1.exact(), this->op2.exact()));
|
||||
if (!this->approx().is_point())
|
||||
this->at = CGAL_NTS to_interval(*(this->et));
|
||||
this->set_at(pet);
|
||||
this->set_ptr(pet);
|
||||
this->prune_dag();
|
||||
}
|
||||
};
|
||||
|
|
@ -1297,7 +1316,7 @@ operator>> (std::istream & is, Lazy_exact_nt<ET> & a)
|
|||
ET e;
|
||||
internal::read_float_or_quotient(is, e);
|
||||
if (is)
|
||||
a = e;
|
||||
a = std::move(e);
|
||||
return is;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,21 +52,26 @@ struct Lazy_exact_ro2
|
|||
|
||||
void update_exact() const
|
||||
{
|
||||
typedef typename Base::Indirect I;
|
||||
I* pet;
|
||||
if (old_rep)
|
||||
this->et = new RO2(make_root_of_2(op1.exact(), op2.exact(),
|
||||
op3.exact(), smaller));
|
||||
pet = new I(make_root_of_2(op1.exact(), op2.exact(),
|
||||
op3.exact(), smaller));
|
||||
else
|
||||
this->et = new RO2(make_root_of_2(op1.exact(), op2.exact(),
|
||||
op3.exact()));
|
||||
pet = new I(make_root_of_2(op1.exact(), op2.exact(),
|
||||
op3.exact()));
|
||||
if (!this->approx().is_point())
|
||||
this->at = to_interval(*(this->et));
|
||||
this->set_at(pet);
|
||||
this->set_ptr(pet);
|
||||
this->prune_dag();
|
||||
|
||||
}
|
||||
|
||||
void prune_dag() const
|
||||
{
|
||||
op1 = op2 = op3 = Lazy_exact_nt<ET>();
|
||||
op1.reset();
|
||||
op2.reset();
|
||||
op3.reset();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue