use the container in STL_extension and not the internal one

This commit is contained in:
Sébastien Loriot 2021-11-30 13:20:15 +01:00
parent 0f42854878
commit f26de8e819
2 changed files with 18 additions and 21 deletions

View File

@ -57,14 +57,7 @@
#endif
#include <boost/format.hpp>
#ifdef CGAL_MESH_3_USE_RELAXED_HEAP
# error This option CGAL_MESH_3_USE_RELAXED_HEAP is no longer supported
// The reason is that the Boost relaxed heap does not ensure a strict order
// of the priority queue.
#include <boost/pending/relaxed_heap.hpp>
#else
#include <CGAL/Modifiable_priority_queue.h>
#endif //CGAL_MESH_3_USE_RELAXED_HEAP
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/type_traits/is_convertible.hpp>
@ -507,11 +500,8 @@ private:
};
typedef std::less<PVertex> less_PVertex;
#ifdef CGAL_MESH_3_USE_RELAXED_HEAP
typedef boost::relaxed_heap<PVertex, less_PVertex, PVertex_id> PQueue;
#else
typedef ::CGAL::internal::mutable_queue_with_remove<PVertex,std::vector<PVertex>, less_PVertex, PVertex_id> PQueue;
#endif //CGAL_MESH_3_USE_RELAXED_HEAP
typedef Modifiable_priority_queue<PVertex, less_PVertex, PVertex_id> PQueue;
public:
/**
@ -942,10 +932,9 @@ perturb(const FT& sliver_bound, PQueue& pqueue, Visitor& visitor) const
{
this->create_task_group();
while (pqueue.size() > 0)
while (!pqueue.empty())
{
PVertex pv = pqueue.top();
pqueue.pop();
PVertex pv = pqueue.top_and_pop();
enqueue_task(pv, sliver_bound,
visitor, bad_vertices);
}
@ -977,8 +966,7 @@ perturb(const FT& sliver_bound, PQueue& pqueue, Visitor& visitor) const
while ( !is_time_limit_reached() && !pqueue.empty() )
{
// Get pqueue head
PVertex pv = pqueue.top();
pqueue.pop();
PVertex pv = pqueue.top_and_pop();
--pqueue_size;
CGAL_assertion(pv.is_perturbable());
@ -1245,7 +1233,7 @@ update_priority_queue(const PVertex& pv, PQueue& pqueue) const
}
else
{
pqueue.remove(pv);
pqueue.erase(pv);
return -1;
}
}

View File

@ -11,14 +11,13 @@
#ifndef CGAL_MODIFIABLE_PRIORITY_QUEUE_H
#define CGAL_MODIFIABLE_PRIORITY_QUEUE_H
#include <climits> // Neeeded by the following Boost header for CHAR_BIT.
#include <climits> // Needed by the following Boost header for CHAR_BIT.
#include <boost/optional.hpp>
#ifdef CGAL_SURFACE_MESH_SIMPLIFICATION_USE_RELAXED_HEAP
#include <boost/pending/relaxed_heap.hpp>
#else
#include <CGAL/STL_Extension/internal/boost/mutable_queue.hpp>
namespace CGAL {
namespace internal {
template <class IndexedType,
@ -83,12 +82,14 @@ public:
public:
Modifiable_priority_queue( size_type largest_ID, Compare const& c, ID const& id ) : mHeap(largest_ID,c,id) {}
Modifiable_priority_queue( size_type largest_ID, Compare const& c = Compare(), ID const& id = ID() ) : mHeap(largest_ID,c,id) {}
handle push ( value_type const& v ) { mHeap.push(v) ; return handle(true) ; }
handle update ( value_type const& v, handle h ) { mHeap.update(v); return h ; }
void update ( value_type const& v ) { mHeap.update(v); }
handle erase ( value_type const& v, handle ) { mHeap.remove(v); return null_handle() ; }
handle erase ( value_type const& v ) { mHeap.remove(v); return null_handle() ; }
@ -112,6 +113,14 @@ public:
return r ;
}
value_type top_and_pop()
{
CGAL_precondition(!empty());
value_type v = top();
pop();
return v;
}
static handle null_handle() { return handle(false); }
private: