mirror of https://github.com/CGAL/cgal
Changed the place of the erase counters.
Changed Compact_container_strategy_XXX::Uses_erase_counter type + moved the erase counters from Triangulation_ds_xxx_base_3 to Mesh_xxx_base_3.
This commit is contained in:
parent
ecd4ce7bfc
commit
3a4caaaa1c
|
|
@ -30,8 +30,50 @@
|
|||
#include <CGAL/Mesh_3/Mesh_surface_cell_base_3.h>
|
||||
#include <CGAL/Mesh_3/io_signature.h>
|
||||
|
||||
#ifdef CGAL_LINKED_WITH_TBB
|
||||
# include <tbb/atomic.h>
|
||||
#endif
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
// Without erase counter
|
||||
template <typename Use_erase_counter, typename Concurrency_tag>
|
||||
class Mesh_cell_base_3_base
|
||||
{
|
||||
};
|
||||
|
||||
// Specialized version (with erase counter)
|
||||
template <typename Concurrency_tag>
|
||||
class Mesh_cell_base_3_base<Tag_true, Concurrency_tag>
|
||||
{
|
||||
public:
|
||||
// Erase counter (cf. Compact_container)
|
||||
unsigned int get_erase_counter() const
|
||||
{
|
||||
return this->m_erase_counter;
|
||||
}
|
||||
void set_erase_counter(unsigned int c)
|
||||
{
|
||||
this->m_erase_counter = c;
|
||||
}
|
||||
void increment_erase_counter()
|
||||
{
|
||||
++this->m_erase_counter;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
#ifdef CGAL_LINKED_WITH_TBB
|
||||
typedef typename boost::mpl::if_c<
|
||||
boost::is_base_of<Parallel_tag, Concurrency_tag>::value,
|
||||
tbb::atomic<unsigned int>,
|
||||
unsigned int>::type Erase_counter_type;
|
||||
#else
|
||||
typedef unsigned int Erase_counter_type;
|
||||
#endif
|
||||
Erase_counter_type m_erase_counter;
|
||||
|
||||
};
|
||||
// Class Mesh_cell_base_3
|
||||
// Cell base class used in 3D meshing process.
|
||||
// Adds information to Cb about the cell of the input complex containing it
|
||||
|
|
@ -40,7 +82,10 @@ template< class GT,
|
|||
class Cb = CGAL::Regular_triangulation_cell_base_3<
|
||||
GT, CGAL::Triangulation_cell_base_with_circumcenter_3<GT> > >
|
||||
class Mesh_cell_base_3
|
||||
: public Mesh_3::Mesh_surface_cell_base_3<GT, MD, Cb>
|
||||
: public Mesh_3::Mesh_surface_cell_base_3<GT, MD, Cb>,
|
||||
public Mesh_cell_base_3_base<
|
||||
typename Mesh_3::Mesh_surface_cell_base_3<GT, MD, Cb>::Tds::Cell_container_strategy::Uses_erase_counter,
|
||||
typename Mesh_3::Mesh_surface_cell_base_3<GT, MD, Cb>::Tds::Concurrency_tag>
|
||||
{
|
||||
typedef typename GT::FT FT;
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,40 @@
|
|||
#include <CGAL/Mesh_3/io_signature.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
// Without erase counter
|
||||
template <typename Use_erase_counter>
|
||||
class Mesh_vertex_base_3_base
|
||||
{
|
||||
};
|
||||
|
||||
#ifdef CGAL_LINKED_WITH_TBB
|
||||
// Specialized version (with erase counter)
|
||||
template <>
|
||||
class Mesh_vertex_base_3_base<Tag_true>
|
||||
{
|
||||
public:
|
||||
|
||||
// Erase counter (cf. Compact_container)
|
||||
unsigned int get_erase_counter() const
|
||||
{
|
||||
return this->m_erase_counter;
|
||||
}
|
||||
void set_erase_counter(unsigned int c)
|
||||
{
|
||||
this->m_erase_counter = c;
|
||||
}
|
||||
void increment_erase_counter()
|
||||
{
|
||||
++this->m_erase_counter;
|
||||
}
|
||||
|
||||
protected:
|
||||
typedef tbb::atomic<unsigned int> Erase_counter_type;
|
||||
Erase_counter_type m_erase_counter;
|
||||
|
||||
};
|
||||
#endif // CGAL_LINKED_WITH_TBB
|
||||
|
||||
// Class Mesh_vertex_base_3
|
||||
// Vertex base class used in 3D meshing process.
|
||||
|
|
@ -46,7 +80,9 @@ template<class GT,
|
|||
class MT,
|
||||
class Vb = Triangulation_vertex_base_3<GT> >
|
||||
class Mesh_vertex_base_3
|
||||
: public Surface_mesh_vertex_base_3<GT, Vb>
|
||||
: public Surface_mesh_vertex_base_3<GT, Vb>,
|
||||
public Mesh_vertex_base_3_base<
|
||||
typename Surface_mesh_vertex_base_3<GT, Vb>::Tds::Cell_container_strategy::Uses_erase_counter>
|
||||
{
|
||||
public:
|
||||
typedef Surface_mesh_vertex_base_3<GT, Vb> Mvb3_base;
|
||||
|
|
|
|||
|
|
@ -33,9 +33,10 @@ public:
|
|||
/// \name Constants
|
||||
/// @{
|
||||
/*!
|
||||
Constant saying if this strategy uses an erase counter or not
|
||||
Tells if this strategy uses an erase counter or not.
|
||||
Can be `CGAL::Tag_true` or `CGAL::Tag_false`.
|
||||
*/
|
||||
static const bool Uses_erase_counter;
|
||||
typedef Hidden_type Uses_erase_counter;
|
||||
|
||||
/// @}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,13 +20,15 @@
|
|||
#ifndef CGAL_COMPACT_CONTAINER_STRATEGIES_H
|
||||
#define CGAL_COMPACT_CONTAINER_STRATEGIES_H
|
||||
|
||||
#include <CGAL/tags.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
// A basic "do nothing" strategy
|
||||
// One can inheritate from it for partial specialisation
|
||||
class Compact_container_strategy_base {
|
||||
public:
|
||||
static const bool Uses_erase_counter = false;
|
||||
typedef Tag_false Uses_erase_counter;
|
||||
|
||||
// Do nothing
|
||||
template <typename Element>
|
||||
|
|
@ -42,7 +44,7 @@ public:
|
|||
class Compact_container_strategy_with_counter
|
||||
{
|
||||
public:
|
||||
static const bool Uses_erase_counter = true;
|
||||
typedef Tag_true Uses_erase_counter;
|
||||
|
||||
template <typename Element>
|
||||
static unsigned int get_erase_counter(const Element &e)
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@
|
|||
#endif
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/type_traits/is_base_of.hpp>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
|
|
|
|||
|
|
@ -27,59 +27,10 @@
|
|||
#include <CGAL/triangulation_assertions.h>
|
||||
#include <CGAL/internal/Dummy_tds_3.h>
|
||||
|
||||
#ifdef CGAL_LINKED_WITH_TBB
|
||||
# include <tbb/atomic.h>
|
||||
# include <boost/type_traits/is_base_of.hpp>
|
||||
#endif
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
// Without erase counter
|
||||
template <bool Use_erase_counter, typename Concurrency_tag>
|
||||
class Triangulation_ds_cell_base_3_base
|
||||
{
|
||||
};
|
||||
|
||||
// Specialized version (with erase counter)
|
||||
template <typename Concurrency_tag>
|
||||
class Triangulation_ds_cell_base_3_base<true, Concurrency_tag>
|
||||
{
|
||||
public:
|
||||
// Erase counter (cf. Compact_container)
|
||||
unsigned int get_erase_counter() const
|
||||
{
|
||||
return this->m_erase_counter;
|
||||
}
|
||||
void set_erase_counter(unsigned int c)
|
||||
{
|
||||
this->m_erase_counter = c;
|
||||
}
|
||||
void increment_erase_counter()
|
||||
{
|
||||
++this->m_erase_counter;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
#ifdef CGAL_LINKED_WITH_TBB
|
||||
typedef typename boost::mpl::if_c<
|
||||
boost::is_base_of<Parallel_tag, Concurrency_tag>::value,
|
||||
tbb::atomic<unsigned int>,
|
||||
unsigned int>::type Erase_counter_type;
|
||||
#else
|
||||
typedef unsigned int Erase_counter_type;
|
||||
#endif
|
||||
Erase_counter_type m_erase_counter;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
template < typename TDS = void >
|
||||
class Triangulation_ds_cell_base_3
|
||||
: public Triangulation_ds_cell_base_3_base<
|
||||
TDS::Cell_container_strategy::Uses_erase_counter,
|
||||
typename TDS::Concurrency_tag>
|
||||
{
|
||||
public:
|
||||
typedef TDS Triangulation_data_structure;
|
||||
|
|
|
|||
|
|
@ -25,47 +25,8 @@
|
|||
|
||||
namespace CGAL {
|
||||
|
||||
|
||||
// Without erase counter
|
||||
template <bool Use_erase_counter>
|
||||
class Triangulation_ds_vertex_base_3_base
|
||||
{
|
||||
};
|
||||
|
||||
#ifdef CGAL_LINKED_WITH_TBB
|
||||
// Specialized version (with erase counter)
|
||||
template <>
|
||||
class Triangulation_ds_vertex_base_3_base<true>
|
||||
{
|
||||
public:
|
||||
|
||||
// Erase counter (cf. Compact_container)
|
||||
unsigned int get_erase_counter() const
|
||||
{
|
||||
return this->m_erase_counter;
|
||||
}
|
||||
void set_erase_counter(unsigned int c)
|
||||
{
|
||||
this->m_erase_counter = c;
|
||||
}
|
||||
void increment_erase_counter()
|
||||
{
|
||||
++this->m_erase_counter;
|
||||
}
|
||||
|
||||
protected:
|
||||
typedef tbb::atomic<unsigned int> Erase_counter_type;
|
||||
Erase_counter_type m_erase_counter;
|
||||
|
||||
};
|
||||
#endif // CGAL_LINKED_WITH_TBB
|
||||
|
||||
|
||||
|
||||
template < typename TDS = void >
|
||||
class Triangulation_ds_vertex_base_3
|
||||
: public Triangulation_ds_vertex_base_3_base<
|
||||
TDS::Vertex_container_strategy::Uses_erase_counter>
|
||||
{
|
||||
public:
|
||||
typedef TDS Triangulation_data_structure;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,13 @@ namespace CGAL { namespace internal {
|
|||
|
||||
// Dummy TDS which provides all types that a vertex_base or cell_base can use.
|
||||
struct Dummy_tds_3 {
|
||||
typedef Sequential_tag Concurrency_tag;
|
||||
struct Concurrency_tag {};
|
||||
struct Cell_container_strategy {
|
||||
struct Uses_erase_counter{};
|
||||
};
|
||||
struct Vertex_container_strategy {
|
||||
struct Uses_erase_counter{};
|
||||
};
|
||||
|
||||
struct Vertex {};
|
||||
struct Cell {};
|
||||
|
|
|
|||
Loading…
Reference in New Issue