mirror of https://github.com/CGAL/cgal
Added Allocator template parameter
This commit is contained in:
parent
cf9c7f8524
commit
c5f40dc28a
|
|
@ -24,7 +24,7 @@
|
|||
#include <CGAL/Arrangement_on_surface_2.h>
|
||||
#include <CGAL/No_intersection_surface_sweep_2.h>
|
||||
#include <CGAL/Arr_point_location/Arr_batched_point_location_traits_2.h>
|
||||
#include <CGAL/Surface_sweep_2/No_overlap_event_base.h>
|
||||
#include <CGAL/Surface_sweep_2/No_overlap_event.h>
|
||||
#include <CGAL/Surface_sweep_2/No_overlap_subcurve.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_batched_pl_sl_visitor.h>
|
||||
|
||||
|
|
@ -74,7 +74,8 @@ locate(const Arrangement_on_surface_2<GeometryTraits_2, TopologyTraits>& arr,
|
|||
// Surface sweep types
|
||||
typedef Arr_batched_point_location_traits_2<Arr> Bgt2;
|
||||
typedef Ss2::No_overlap_event<Bgt2, Allocator> Bpl_event;
|
||||
typedef Ss2::No_overlap_subcurve<Bgt2, Bpl_event> Bpl_curve;
|
||||
typedef Ss2::No_overlap_subcurve<Bgt2, Bpl_event, Allocator>
|
||||
Bpl_curve;
|
||||
typedef typename Tt::template Batched_point_location_helper<Bpl_event,
|
||||
Bpl_curve>
|
||||
Bpl_helper;
|
||||
|
|
|
|||
|
|
@ -43,10 +43,13 @@
|
|||
namespace CGAL {
|
||||
|
||||
/*! Compute the overlay of two input arrangements.
|
||||
* \param arr1 The first arrangement.
|
||||
* \param arr2 The second arrangement.
|
||||
* \param arr Output: The resulting arrangement.
|
||||
* \param ovl_tr An overlay-traits class. As arr1, arr2 and res can be
|
||||
* \tparam GeometryTraitsA_2 the geometry traits of the first arrangement.
|
||||
* \tparam GeometryTraitsB_2 the geometry traits of the second arrangement.
|
||||
* \tparam GeometryTraitsRes_2 the geometry traits of the resulting arrangement.
|
||||
* \tparam TopologyTraitsA the topology traits of the first arrangement.
|
||||
* \tparam TopologyTraitsB the topology traits of the second arrangement.
|
||||
* \tparam TopologyTraitsRes the topology traits of the resulting arrangement.
|
||||
* \tparam OverlayTraits An overlay-traits class. As arr1, arr2 and res can be
|
||||
* templated with different geometry-traits class and
|
||||
* different DCELs (encapsulated in the various topology-traits
|
||||
* classes). The geometry-traits of the result arrangement is
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
#include <CGAL/Arrangement_on_surface_2.h>
|
||||
#include <CGAL/No_intersection_surface_sweep_2.h>
|
||||
#include <CGAL/Arr_point_location/Arr_batched_point_location_traits_2.h>
|
||||
#include <CGAL/Surface_sweep_2/No_overlap_event_base.h>
|
||||
#include <CGAL/Surface_sweep_2/No_overlap_event.h>
|
||||
#include <CGAL/Surface_sweep_2/No_overlap_subcurve.h>
|
||||
#include <CGAL/Surface_sweep_2/Arr_vert_decomp_sl_visitor.h>
|
||||
|
||||
|
|
@ -69,7 +69,8 @@ decompose(const Arrangement_on_surface_2<GeometryTraits_2, TopologyTraits>& arr,
|
|||
// Surface sweep types:
|
||||
typedef Arr_batched_point_location_traits_2<Arr> Vgt2;
|
||||
typedef Ss2::No_overlap_event<Vgt2, Allocator> Vd_event;
|
||||
typedef Ss2::No_overlap_subcurve<Vgt2, Vd_event> Vd_curve;
|
||||
typedef Ss2::No_overlap_subcurve<Vgt2, Vd_event, Allocator>
|
||||
Vd_curve;
|
||||
typedef typename Tt::template
|
||||
Vertical_decomposition_helper<Vd_event, Vd_curve> Vd_helper;
|
||||
typedef Arr_vert_decomp_sl_visitor<Vd_helper, Output_iterator>
|
||||
|
|
|
|||
|
|
@ -42,10 +42,13 @@ namespace Ss2 = Surface_sweep_2;
|
|||
* 2D arrangement.
|
||||
*
|
||||
* \tparam GeometryTraits_2 the geometry traits.
|
||||
* \tparam Arrangement_ the type of the costructed arrangement.
|
||||
* \tparam Allocator_ a type of an element that is used to acquire/release
|
||||
* memory for elements of the event queue and the status
|
||||
* structure, and to construct/destroy the elements in that
|
||||
* memory. The type must meet the requirements of Allocator.
|
||||
* \tparam SurfaceSweepBaseEvent the base class of the event.
|
||||
* \tparam SurfaceSweepBaseCurve the base class of the subcurve.
|
||||
*
|
||||
* We exploit the curiously recurring template pattern (CRTP) idiom to establish
|
||||
* an interdependency between the curve and the event types, which are template
|
||||
|
|
@ -64,7 +67,7 @@ template <typename GeometryTraits_2, typename Arrangement_,
|
|||
typename Allocator_ = CGAL_ALLOCATOR(int),
|
||||
template <typename, typename>
|
||||
class SurfaceSweepBaseEvent = Ss2::Default_event_base,
|
||||
template <typename, typename, typename>
|
||||
template <typename, typename, typename, typename>
|
||||
class SurfaceSweepBaseCurve = Ss2::Default_subcurve>
|
||||
class Arr_construction_event :
|
||||
public Arr_construction_event_base<
|
||||
|
|
|
|||
|
|
@ -31,12 +31,12 @@
|
|||
* instance types of Subcurve and Event must be available when the
|
||||
* surface-sweep template is instantiated.
|
||||
*
|
||||
* Arr_construction_subcurve derives from an instance of the
|
||||
* Surface_sweep_subcurve class template. The user is allowed to introduce new
|
||||
* types that derive from an instance of the Arr_construction_subcurve class
|
||||
* template. However, some of the fields of this template depends on the
|
||||
* Subcurve type. We use the curiously recurring template pattern (CRTP) idiom
|
||||
* to force the correct matching of these types.
|
||||
* Arr_construction_subcurve derives from an instance of the Default_subcurve
|
||||
* class template. The user is allowed to introduce new types that derive from
|
||||
* an instance of the Arr_construction_subcurve class template. However, some of
|
||||
* the fields of this template depends on the Subcurve type. We use the
|
||||
* curiously recurring template pattern (CRTP) idiom to force the correct
|
||||
* matching of these types.
|
||||
*/
|
||||
|
||||
#include <CGAL/Surface_sweep_2/Default_subcurve.h>
|
||||
|
|
@ -51,28 +51,35 @@ namespace Ss2 = Surface_sweep_2;
|
|||
* This is the base class of the Arr_construction_subcurve class template used
|
||||
* by the (CRTP) idiom.
|
||||
* \tparam GeometryTraits_2 the geometry traits.
|
||||
* \tparam
|
||||
* Subcurve_ the subcurve actual type.
|
||||
* \tparam Event_ the event type.
|
||||
* \tparam Allocator_ a type of an element that is used to acquire/release
|
||||
* memory for elements of the event queue and the status
|
||||
* structure, and to construct/destroy the elements in that
|
||||
* memory. The type must meet the requirements of Allocator.
|
||||
* \tparam Subcurve_ the subcurve actual type.
|
||||
*
|
||||
* The information contained in this class last:
|
||||
* - ishe event that was handled on the curve.
|
||||
* - The index for a subcurve that may represent a hole
|
||||
* - Indices of all halfedge below the curve that may represent a hole.
|
||||
*/
|
||||
template <typename GeometryTraits_2, typename Event_,
|
||||
template <typename, typename, typename> class SurfaceSweepBaseCurve,
|
||||
template <typename GeometryTraits_2, typename Event_, typename Allocator_,
|
||||
template <typename, typename, typename, typename>
|
||||
class SurfaceSweepBaseCurve,
|
||||
typename Subcurve_>
|
||||
class Arr_construction_subcurve_base :
|
||||
public SurfaceSweepBaseCurve<GeometryTraits_2, Event_, Subcurve_>
|
||||
public SurfaceSweepBaseCurve<GeometryTraits_2, Event_, Allocator_, Subcurve_>
|
||||
{
|
||||
public:
|
||||
typedef GeometryTraits_2 Geometry_traits_2;
|
||||
typedef Subcurve_ Subcurve;
|
||||
typedef Event_ Event;
|
||||
typedef Allocator_ Allocator;
|
||||
|
||||
private:
|
||||
typedef Geometry_traits_2 Gt2;
|
||||
typedef SurfaceSweepBaseCurve<Gt2, Event, Subcurve> Base;
|
||||
typedef SurfaceSweepBaseCurve<Gt2, Event, Allocator, Subcurve>
|
||||
Base;
|
||||
|
||||
public:
|
||||
typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2;
|
||||
|
|
@ -164,12 +171,12 @@ public:
|
|||
*/
|
||||
template <typename GeometryTraits_2, typename Event_,
|
||||
typename Allocator_ = CGAL_ALLOCATOR(int),
|
||||
template <typename, typename, typename>
|
||||
template <typename, typename, typename, typename>
|
||||
class SurfaceSweepBaseCurve = Ss2::Default_subcurve,
|
||||
typename Subcurve_ = Default>
|
||||
class Arr_construction_subcurve :
|
||||
public Arr_construction_subcurve_base<
|
||||
GeometryTraits_2, Event_,
|
||||
GeometryTraits_2, Event_, Allocator_,
|
||||
SurfaceSweepBaseCurve,
|
||||
typename Default::Get<Subcurve_,
|
||||
Arr_construction_subcurve<GeometryTraits_2, Event_,
|
||||
|
|
@ -188,8 +195,9 @@ private:
|
|||
SurfaceSweepBaseCurve, Subcurve_>
|
||||
Self;
|
||||
typedef typename Default::Get<Subcurve_, Self>::type Subcurve;
|
||||
typedef Arr_construction_subcurve_base<Gt2, Event, SurfaceSweepBaseCurve,
|
||||
Subcurve> Base;
|
||||
typedef Arr_construction_subcurve_base<Gt2, Event, Allocator,
|
||||
SurfaceSweepBaseCurve, Subcurve>
|
||||
Base;
|
||||
|
||||
public:
|
||||
typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2;
|
||||
|
|
|
|||
|
|
@ -41,8 +41,7 @@ namespace Ss2 = Surface_sweep_2;
|
|||
* in the proper place in the resulting arrangement.
|
||||
*
|
||||
* \tparam GeometryTraits_2 the geometry traits.
|
||||
* \tparam Arrangement_ the type of the arrangement that is the resulting
|
||||
* arrangement the overlay process.
|
||||
* \tparam Event_ the event type.
|
||||
* \tparam Allocator_ a type of an element that is used to acquire/release
|
||||
* memory for elements of the event queue and the status
|
||||
* structure, and to construct/destroy the elements in that
|
||||
|
|
|
|||
|
|
@ -31,8 +31,6 @@
|
|||
#include <CGAL/memory.h>
|
||||
#include <CGAL/Surface_sweep_2/Event_comparer.h>
|
||||
#include <CGAL/Surface_sweep_2/Curve_comparer.h>
|
||||
#include <CGAL/Surface_sweep_2/No_overlap_event.h>
|
||||
#include <CGAL/Surface_sweep_2/No_overlap_subcurve.h>
|
||||
#include <CGAL/Multiset.h>
|
||||
#include <CGAL/Arrangement_2/Arr_traits_adaptor_2.h>
|
||||
#include <CGAL/Arr_tags.h>
|
||||
|
|
|
|||
|
|
@ -31,8 +31,6 @@
|
|||
#include <CGAL/Object.h>
|
||||
#include <CGAL/No_intersection_surface_sweep_2.h>
|
||||
#include <CGAL/Surface_sweep_2/Curve_pair.h>
|
||||
#include <CGAL/Surface_sweep_2/Default_subcurve.h>
|
||||
#include <CGAL/Surface_sweep_2/Default_event.h>
|
||||
#include <CGAL/Arrangement_2/Open_hash.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
|
|
|||
|
|
@ -62,7 +62,8 @@ class Default_event :
|
|||
public Default_event_base<GeometryTraits_2,
|
||||
Default_subcurve<GeometryTraits_2,
|
||||
Default_event<GeometryTraits_2,
|
||||
Allocator_> > >
|
||||
Allocator_>,
|
||||
Allocator_> >
|
||||
{
|
||||
public:
|
||||
/*! Construct default. */
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ namespace Surface_sweep_2 {
|
|||
*/
|
||||
template <typename GeometryTraits_2, typename Subcurve_>
|
||||
class Default_event_base :
|
||||
public No_overlap_event_base<GeometryTraits_2, Subcurve_>
|
||||
public No_overlap_event_base<GeometryTraits_2, Subcurve_>
|
||||
{
|
||||
public:
|
||||
typedef GeometryTraits_2 Geometry_traits_2;
|
||||
|
|
|
|||
|
|
@ -53,15 +53,21 @@ namespace Surface_sweep_2 {
|
|||
* This is the base class of the Default_subcurve class template used by
|
||||
* the (CRTP) idiom.
|
||||
* \tparam GeometryTraits_2 the geometry traits.
|
||||
* \tparam Event_ the event type.
|
||||
* \tparam Allocator_ a type of an element that is used to acquire/release
|
||||
* memory for elements of the event queue and the status
|
||||
* structure, and to construct/destroy the elements in that
|
||||
* memory. The type must meet the requirements of Allocator.
|
||||
* \tparam Subcurve_ the subcurve actual type.
|
||||
*
|
||||
* The information contained in this class is:
|
||||
* - two pointers to subcurves that are the originating subcurves in case of
|
||||
* an overlap, otherwise thay are both NULL.
|
||||
*/
|
||||
template <typename GeometryTraits_2, typename Event_, typename Subcurve_>
|
||||
template <typename GeometryTraits_2, typename Event_, typename Allocator_,
|
||||
typename Subcurve_>
|
||||
class Default_subcurve_base :
|
||||
public No_overlap_subcurve<GeometryTraits_2, Event_, Subcurve_>
|
||||
public No_overlap_subcurve<GeometryTraits_2, Event_, Allocator_, Subcurve_>
|
||||
{
|
||||
public:
|
||||
typedef GeometryTraits_2 Geometry_traits_2;
|
||||
|
|
@ -220,29 +226,40 @@ public:
|
|||
* X_monotone_curve_2. It contains data that is used when applying the sweep
|
||||
* algorithm on a set of x-monotone curves. This class derives from the
|
||||
* No_overlap_subcurve class template.
|
||||
*
|
||||
* \tparam GeometryTraits_2 the geometry traits.
|
||||
* \tparam Event_ the event type.
|
||||
* \tparam Allocator_ a type of an element that is used to acquire/release
|
||||
* memory for elements of the event queue and the status
|
||||
* structure, and to construct/destroy the elements in that
|
||||
* memory. The type must meet the requirements of Allocator.
|
||||
* \tparam Subcurve_ the type of the subcurve or Default. If the default is not
|
||||
* overriden it implies that the type is
|
||||
* No_overlap_subcurve
|
||||
*/
|
||||
template <typename GeometryTraits_2, typename Event_,
|
||||
typename Allocator_ = CGAL_ALLOCATOR(int),
|
||||
typename Subcurve_ = Default>
|
||||
class Default_subcurve :
|
||||
public Default_subcurve_base<GeometryTraits_2, Event_,
|
||||
public Default_subcurve_base<GeometryTraits_2, Event_, Allocator_,
|
||||
typename Default::Get<Subcurve_,
|
||||
Default_subcurve<
|
||||
GeometryTraits_2, Event_,
|
||||
Allocator_,
|
||||
Subcurve_> >::type>
|
||||
{
|
||||
public:
|
||||
typedef GeometryTraits_2 Geometry_traits_2;
|
||||
typedef Event_ Event;
|
||||
typedef Allocator_ Allocator;
|
||||
|
||||
private:
|
||||
typedef Geometry_traits_2 Gt2;
|
||||
typedef Default_subcurve<Gt2, Event, Subcurve_> Self;
|
||||
typedef Default_subcurve<Gt2, Event, Allocator, Subcurve_>
|
||||
Self;
|
||||
typedef typename Default::Get<Subcurve_, Self>::type Subcurve;
|
||||
typedef Default_subcurve_base<Gt2, Event, Subcurve> Base;
|
||||
typedef Default_subcurve_base<Gt2, Event, Allocator, Subcurve>
|
||||
Base;
|
||||
|
||||
public:
|
||||
typedef typename Gt2::X_monotone_curve_2 X_monotone_curve_2;
|
||||
|
|
@ -266,8 +283,8 @@ public:
|
|||
};
|
||||
|
||||
#ifdef CGAL_SL_VERBOSE
|
||||
template <typename GeometryTraits_2>
|
||||
void Default_subcurve<GeometryTraits_2>::Print() const
|
||||
template <typename Gt2, typename Evt, typename Allocator, typename Scv>
|
||||
void Default_subcurve<Gt2, Evt, Allocator, Scv>::Print() const
|
||||
{
|
||||
std::cout << "Curve " << this
|
||||
<< " (" << this->last_curve() << ") "
|
||||
|
|
|
|||
|
|
@ -41,8 +41,9 @@ namespace Surface_sweep_2 {
|
|||
template <typename Visitor_,
|
||||
typename GeometryTraits_2,
|
||||
typename Allocator_ = CGAL_ALLOCATOR(int),
|
||||
typename Event_ = Default_event<GeometryTraits_2>,
|
||||
typename Subcurve_ = Default_subcurve<GeometryTraits_2, Event_> >
|
||||
typename Event_ = Default_event<GeometryTraits_2, Allocator_>,
|
||||
typename Subcurve_ = Default_subcurve<GeometryTraits_2, Event_,
|
||||
Allocator_> >
|
||||
class Default_visitor : public Default_visitor_base<GeometryTraits_2, Event_,
|
||||
Subcurve_, Allocator_,
|
||||
Visitor_>
|
||||
|
|
|
|||
|
|
@ -64,7 +64,8 @@ class No_overlap_event :
|
|||
No_overlap_subcurve<GeometryTraits_2,
|
||||
No_overlap_event<
|
||||
GeometryTraits_2,
|
||||
Allocator_> > >
|
||||
Allocator_>,
|
||||
Allocator_> >
|
||||
{
|
||||
public:
|
||||
/*! Construct default. */
|
||||
|
|
|
|||
|
|
@ -60,13 +60,14 @@ namespace Surface_sweep_2 {
|
|||
* curve.
|
||||
* - an iterator that points to the location of the subcurve in the status line.
|
||||
*/
|
||||
template <typename GeometryTraits_2, typename Event_, typename Subcurve_>
|
||||
template <typename GeometryTraits_2, typename Event_, typename Allocator_,
|
||||
typename Subcurve_>
|
||||
class No_overlap_subcurve_base {
|
||||
public:
|
||||
typedef GeometryTraits_2 Geometry_traits_2;
|
||||
typedef Subcurve_ Subcurve;
|
||||
typedef Event_ Event;
|
||||
typedef CGAL_ALLOCATOR(int) Allocator;
|
||||
typedef Allocator_ Allocator;
|
||||
|
||||
private:
|
||||
typedef Geometry_traits_2 Gt2;
|
||||
|
|
@ -123,28 +124,35 @@ public:
|
|||
* - the remaining x-monotone curve that is to the right of the current sweep
|
||||
* line.
|
||||
* \tparam GeometryTraits_2 the geometry traits.
|
||||
* \tparam Event_ the event type.
|
||||
* \tparam Allocator_ a type of an element that is used to acquire/release
|
||||
* memory for elements of the event queue and the status
|
||||
* structure, and to construct/destroy the elements in that
|
||||
* memory. The type must meet the requirements of Allocator.
|
||||
* \tparam Subcurve_ the type of the subcurve or Default. If the default is not
|
||||
* overriden it implies that the type is
|
||||
* No_overlap_subcurve.
|
||||
* overriden it implies that the type is No_overlap_subcurve.
|
||||
*/
|
||||
template <typename GeometryTraits_2, typename Event_,
|
||||
typename Allocator_ = CGAL_ALLOCATOR(int),
|
||||
typename Subcurve_ = Default>
|
||||
class No_overlap_subcurve :
|
||||
public No_overlap_subcurve_base<
|
||||
GeometryTraits_2, Event_,
|
||||
GeometryTraits_2, Event_, Allocator_,
|
||||
typename Default::Get<Subcurve_,
|
||||
No_overlap_subcurve<GeometryTraits_2, Event_,
|
||||
Subcurve_> >::type>
|
||||
Allocator_, Subcurve_> >::type>
|
||||
{
|
||||
public:
|
||||
typedef GeometryTraits_2 Geometry_traits_2;
|
||||
typedef Event_ Event;
|
||||
typedef Allocator_ Allocator;
|
||||
|
||||
private:
|
||||
typedef Geometry_traits_2 Gt2;
|
||||
typedef No_overlap_subcurve<Gt2, Event, Subcurve_> Self;
|
||||
typedef No_overlap_subcurve<Gt2, Event, Allocator, Subcurve_>
|
||||
Self;
|
||||
typedef typename Default::Get<Subcurve_, Self>::type Subcurve;
|
||||
typedef No_overlap_subcurve_base<Gt2, Event, Subcurve>
|
||||
typedef No_overlap_subcurve_base<Gt2, Event, Allocator, Subcurve>
|
||||
Base;
|
||||
|
||||
public:
|
||||
|
|
@ -191,11 +199,9 @@ public:
|
|||
};
|
||||
|
||||
#ifdef CGAL_SL_VERBOSE
|
||||
template <typename Traits>
|
||||
template <typename Gt2, typename Evt, typename Allocator, typename Scv>
|
||||
void No_overlap_subcurve<Traits>::Print() const
|
||||
{
|
||||
std::cout << "Curve " << this << " (" << last_curve() << ") ";
|
||||
}
|
||||
{ std::cout << "Curve " << this << " (" << last_curve() << ") "; }
|
||||
#endif
|
||||
|
||||
} // namespace Surface_sweep_2
|
||||
|
|
|
|||
Loading…
Reference in New Issue