compute_star -> star, remove adjacent, mark Concept function as such

This commit is contained in:
Samuel Hornus 2011-05-11 14:11:50 +00:00
parent 99caf92b87
commit dcf05ce797
5 changed files with 42 additions and 40 deletions

View File

@ -90,7 +90,7 @@ public:
using Base::are_incident_full_cells_valid; using Base::are_incident_full_cells_valid;
using Base::coaffine_orientation_predicate; using Base::coaffine_orientation_predicate;
using Base::current_dimension; using Base::current_dimension;
using Base::compute_star; using Base::star;
using Base::incident_full_cells; using Base::incident_full_cells;
using Base::geom_traits; using Base::geom_traits;
using Base::get_visited; using Base::get_visited;

View File

@ -395,9 +395,9 @@ public:
return tds().incident_full_cells(v, out); return tds().incident_full_cells(v, out);
} }
template< typename OutputIterator > template< typename OutputIterator >
OutputIterator compute_star(const Face & f, OutputIterator out) const OutputIterator star(const Face & f, OutputIterator out) const
{ {
return tds().compute_star(f, out); return tds().star(f, out);
} }
template< typename OutputIterator > template< typename OutputIterator >

View File

@ -511,7 +511,7 @@ public:
template< typename OutputIterator > template< typename OutputIterator >
OutputIterator incident_full_cells(Vertex_const_handle, OutputIterator) const; /* Concept */ OutputIterator incident_full_cells(Vertex_const_handle, OutputIterator) const; /* Concept */
template< typename OutputIterator > template< typename OutputIterator >
OutputIterator compute_star(const Face &, OutputIterator) const; /* Concept */ OutputIterator star(const Face &, OutputIterator) const; /* Concept */
#ifndef CGAL_CFG_NO_CPP0X_DEFAULT_TEMPLATE_ARGUMENTS_FOR_FUNCTION_TEMPLATES #ifndef CGAL_CFG_NO_CPP0X_DEFAULT_TEMPLATE_ARGUMENTS_FOR_FUNCTION_TEMPLATES
template< typename OutputIterator, typename Comparator = std::less<Vertex_const_handle> > template< typename OutputIterator, typename Comparator = std::less<Vertex_const_handle> >
OutputIterator incident_upper_faces(Vertex_const_handle v, const int d, OutputIterator out, Comparator cmp = Comparator()) OutputIterator incident_upper_faces(Vertex_const_handle v, const int d, OutputIterator out, Comparator cmp = Comparator())
@ -581,7 +581,7 @@ template< class Dim, class Vb, class Sb >
template< typename OutputIterator > template< typename OutputIterator >
OutputIterator OutputIterator
Triangulation_data_structure<Dim, Vb, Sb> Triangulation_data_structure<Dim, Vb, Sb>
::compute_star(const Face & f, OutputIterator out) const /* Concept */ ::star(const Face & f, OutputIterator out) const /* Concept */
{ {
// CGAL_precondition_msg(is_full_cell(f.full_cell()), "the facet does not belong to the Triangulation"); // CGAL_precondition_msg(is_full_cell(f.full_cell()), "the facet does not belong to the Triangulation");
Star_traversal_predicate tp(*this, f); Star_traversal_predicate tp(*this, f);
@ -730,7 +730,7 @@ Triangulation_data_structure<Dim, Vb, Sb>
// compute the star of f // compute the star of f
simps.reserve(64); simps.reserve(64);
std::back_insert_iterator<std::vector<Full_cell_handle> > out(simps); std::back_insert_iterator<std::vector<Full_cell_handle> > out(simps);
compute_star(f, out); star(f, out);
Vertex_handle v = insert_in_hole(simps.begin(), simps.end(), Facet(f.full_cell(), f.index(0))); Vertex_handle v = insert_in_hole(simps.begin(), simps.end(), Facet(f.full_cell(), f.index(0)));
for( int i = 0; i <= fd; ++i ) for( int i = 0; i <= fd; ++i )
delete_vertex(s.vertex(i)); delete_vertex(s.vertex(i));

View File

@ -38,12 +38,12 @@ class Triangulation_ds_full_cell
public: public:
typedef typename TDS::Face Face; typedef typename TDS::Face Face;
typedef typename TDS::Vertex_handle Vertex_handle; typedef typename TDS::Vertex_handle Vertex_handle; /* Concept */
typedef typename TDS::Full_cell_handle Full_cell_handle;
typedef typename TDS::Vertex_const_handle Vertex_const_handle; typedef typename TDS::Vertex_const_handle Vertex_const_handle;
typedef typename TDS::Full_cell_const_handle Full_cell_const_handle; typedef typename TDS::Full_cell_handle Full_cell_handle; /* Concept */
typedef typename TDS::Full_cell_const_handle Full_cell_const_handle;
template< typename TDS2 > template< typename TDS2 >
struct Rebind_TDS struct Rebind_TDS /* Concept */
{ {
typedef Triangulation_ds_full_cell<TDS2, FullCellStoragePolicy> Other; typedef Triangulation_ds_full_cell<TDS2, FullCellStoragePolicy> Other;
}; };
@ -66,8 +66,9 @@ private: // STORAGE
public: public:
typedef typename Vertex_handle_array::const_iterator Vertex_handle_const_iterator; typedef typename Vertex_handle_array::const_iterator Vertex_handle_const_iterator;
typedef Vertex_handle_const_iterator Vertex_handle_iterator; /* Concept */
Triangulation_ds_full_cell(const int dmax) Triangulation_ds_full_cell(const int dmax) /* Concept */
: flags_(0), combinatorics_(dmax) : flags_(0), combinatorics_(dmax)
{ {
CGAL_assertion( dmax > 0 ); CGAL_assertion( dmax > 0 );
@ -79,53 +80,53 @@ public:
} }
} }
Triangulation_ds_full_cell(const Triangulation_ds_full_cell & s) Triangulation_ds_full_cell(const Triangulation_ds_full_cell & s) /* Concept */
: flags_(s.flags_), combinatorics_(s.combinatorics_) : flags_(s.flags_), combinatorics_(s.combinatorics_)
{} {}
~Triangulation_ds_full_cell() {} ~Triangulation_ds_full_cell() {}
int ambient_dimension() const int ambient_dimension() const /* Concept */
{ {
return vertices().size() - 1; return vertices().size() - 1;
} }
Vertex_handle_const_iterator vertices_begin() const Vertex_handle_const_iterator vertices_begin() const /* Concept */
{ {
return vertices().begin(); return vertices().begin();
} }
Vertex_handle_const_iterator vertices_end() const Vertex_handle_const_iterator vertices_end() const /* Concept */
{ {
return vertices().end(); return vertices().end();
} }
Vertex_handle vertex(const int i) const Vertex_handle vertex(const int i) const /* Concept */
{ {
CGAL_precondition(0<=i && i<=ambient_dimension()); CGAL_precondition(0<=i && i<=ambient_dimension());
return vertices()[i]; return vertices()[i];
} }
Full_cell_handle neighbor(const int i) const Full_cell_handle neighbor(const int i) const /* Concept */
{ {
CGAL_precondition(0<=i && i<=ambient_dimension()); CGAL_precondition(0<=i && i<=ambient_dimension());
return neighbors()[i]; return neighbors()[i];
} }
int mirror_index(const int i) const int mirror_index(const int i) const /* Concept */
{ {
CGAL_precondition(0<=i && i<=ambient_dimension()); CGAL_precondition(0<=i && i<=ambient_dimension());
return combinatorics_.mirror_index(i); return combinatorics_.mirror_index(i);
} }
// Advanced... // Advanced...
Vertex_handle mirror_vertex(const int i, const int cur_dim) const Vertex_handle mirror_vertex(const int i, const int cur_dim) const /* Concept */
{ {
CGAL_precondition(0<=i && i<=ambient_dimension()); CGAL_precondition(0<=i && i<=ambient_dimension());
return combinatorics_.mirror_vertex(i, cur_dim); return combinatorics_.mirror_vertex(i, cur_dim);
} }
int index(Full_cell_const_handle s) const int index(Full_cell_const_handle s) const /* Concept */
{ {
// WE ASSUME THE FULL CELL WE ARE LOOKING FOR INDEED EXISTS ! // WE ASSUME THE FULL CELL WE ARE LOOKING FOR INDEED EXISTS !
CGAL_precondition(has_neighbor(s)); CGAL_precondition(has_neighbor(s));
@ -135,7 +136,7 @@ public:
return index; return index;
} }
int index(Vertex_const_handle v) const int index(Vertex_const_handle v) const /* Concept */
{ {
// WE ASSUME THE VERTEX WE ARE LOOKING FOR INDEED EXISTS ! // WE ASSUME THE VERTEX WE ARE LOOKING FOR INDEED EXISTS !
CGAL_precondition(has_vertex(v)); CGAL_precondition(has_vertex(v));
@ -145,31 +146,31 @@ public:
return index; return index;
} }
void set_vertex(const int i, Vertex_handle v) void set_vertex(const int i, Vertex_handle v) /* Concept */
{ {
CGAL_precondition(0<=i && i<=ambient_dimension()); CGAL_precondition(0<=i && i<=ambient_dimension());
vertices()[i] = v; vertices()[i] = v;
} }
void set_neighbor(const int i, Full_cell_handle s) void set_neighbor(const int i, Full_cell_handle s) /* Concept */
{ {
CGAL_precondition(0<=i && i<=ambient_dimension()); CGAL_precondition(0<=i && i<=ambient_dimension());
neighbors()[i] = s; neighbors()[i] = s;
} }
void set_mirror_index(const int i, const int index) void set_mirror_index(const int i, const int index) /* Concept */
{ {
CGAL_precondition(0<=i && i<=ambient_dimension()); CGAL_precondition(0<=i && i<=ambient_dimension());
combinatorics_.set_mirror_index(i, index); combinatorics_.set_mirror_index(i, index);
} }
bool has_vertex(Vertex_const_handle v) const bool has_vertex(Vertex_const_handle v) const /* Concept */
{ {
int index; int index;
return has_vertex(v, index); return has_vertex(v, index);
} }
bool has_vertex(Vertex_const_handle v, int & index) const bool has_vertex(Vertex_const_handle v, int & index) const /* Concept */
{ {
const int d = ambient_dimension(); const int d = ambient_dimension();
index = 0; index = 0;
@ -178,13 +179,13 @@ public:
return (index <= d); return (index <= d);
} }
bool has_neighbor(Full_cell_const_handle s) const bool has_neighbor(Full_cell_const_handle s) const /* Concept */
{ {
int index; int index;
return has_neighbor(s, index); return has_neighbor(s, index);
} }
bool has_neighbor(Full_cell_const_handle s, int & index) const bool has_neighbor(Full_cell_const_handle s, int & index) const /* Concept */
{ {
const int d = ambient_dimension(); const int d = ambient_dimension();
index = 0; index = 0;
@ -193,21 +194,21 @@ public:
return (index <= d); return (index <= d);
} }
void swap_vertices(const int d1, const int d2) void swap_vertices(const int d1, const int d2) /* Concept */
{ {
CGAL_precondition(0 <= d1 && d1<=ambient_dimension()); CGAL_precondition(0 <= d1 && d1<=ambient_dimension());
CGAL_precondition(0 <= d2 && d2<=ambient_dimension()); CGAL_precondition(0 <= d2 && d2<=ambient_dimension());
combinatorics_.swap_vertices(d1, d2); combinatorics_.swap_vertices(d1, d2);
} }
unsigned int get_flags() const { return flags_; } unsigned int get_flags() const { return flags_; } /* Concept */
// Don't forget that member variable flags_ is mutable... // Don't forget that member variable flags_ is mutable...
void set_flags(unsigned int f) const { flags_ = f; } void set_flags(unsigned int f) const { flags_ = f; } /* Concept */
void* for_compact_container() const { return combinatorics_.for_compact_container(); } void* for_compact_container() const { return combinatorics_.for_compact_container(); }
void* & for_compact_container() { return combinatorics_.for_compact_container(); } void* & for_compact_container() { return combinatorics_.for_compact_container(); }
bool is_valid(bool verbose = true, int /* level */ = 0) const bool is_valid(bool verbose = true, int /* level */ = 0) const /* Concept */
{ {
const int d = ambient_dimension(); const int d = ambient_dimension();
for( int i = 0; i <= d; ++i ) for( int i = 0; i <= d; ++i )
@ -246,7 +247,7 @@ private:
template < typename TDS, typename SSP > template < typename TDS, typename SSP >
std::ostream & std::ostream &
operator<<(std::ostream & O, const Triangulation_ds_full_cell<TDS,SSP> & s) operator<<(std::ostream & O, const Triangulation_ds_full_cell<TDS,SSP> & s) /* Concept */
{ {
/*if( is_ascii(O) ) /*if( is_ascii(O) )
{ {
@ -258,7 +259,7 @@ operator<<(std::ostream & O, const Triangulation_ds_full_cell<TDS,SSP> & s)
template < typename TDS, typename SSP > template < typename TDS, typename SSP >
std::istream & std::istream &
operator>>(std::istream & I, Triangulation_ds_full_cell<TDS,SSP> & s) operator>>(std::istream & I, Triangulation_ds_full_cell<TDS,SSP> & s) /* Concept */
{ {
/*if( is_ascii(I) ) /*if( is_ascii(I) )
{} {}

View File

@ -42,27 +42,27 @@ public:
}; };
protected: // DATA MEMBERS protected: // DATA MEMBERS
Full_cell_handle full_cell_; // A handle to an adjacent full_cell Full_cell_handle full_cell_; // A handle to an incident full_cell
public: public:
// Constructs a vertex with adjacent full_cell 's' // Constructs a vertex with incident full_cell 's'
Triangulation_ds_vertex(Full_cell_handle s) : full_cell_(s) /* Concept */ Triangulation_ds_vertex(Full_cell_handle s) : full_cell_(s) /* Concept */
{ {
CGAL_assertion( Full_cell_handle() != s ); CGAL_assertion( Full_cell_handle() != s );
} }
// Constructs a vertex with no adjacent full_cell // Constructs a vertex with no incident full_cell
Triangulation_ds_vertex() : full_cell_() {} /* Concept */ Triangulation_ds_vertex() : full_cell_() {} /* Concept */
~Triangulation_ds_vertex() {} ~Triangulation_ds_vertex() {}
/// Set 's' as an adjacent full_cell /// Set 's' as an incident full_cell
void set_full_cell(Full_cell_handle s) /* Concept */ void set_full_cell(Full_cell_handle s) /* Concept */
{ {
CGAL_precondition( Full_cell_handle() != s ); CGAL_precondition( Full_cell_handle() != s );
full_cell_ = s; full_cell_ = s;
} }
/// Returns a full_cell adjacent to the vertex /// Returns a full_cell incident to the vertex
Full_cell_handle full_cell() const /* Concept */ Full_cell_handle full_cell() const /* Concept */
{ {
return full_cell_; return full_cell_;
@ -72,7 +72,8 @@ public:
{ {
if( Full_cell_handle() == full_cell() ) if( Full_cell_handle() == full_cell() )
{ {
if( verbose ) CGAL_warning_msg(false, "vertex has no incident full cell."); if( verbose )
CGAL_warning_msg(false, "vertex has no incident full cell.");
return false; return false;
} }
return true; return true;