mirror of https://github.com/CGAL/cgal
Add missing operator->() to Facet_circulator.
This commit is contained in:
parent
990b6df224
commit
606b7aa6f0
|
|
@ -348,6 +348,17 @@ public:
|
|||
return Facet(pos, next_around_edge( pos->index(_s), pos->index(_t) ) );
|
||||
}
|
||||
|
||||
struct Proxy_Facet {
|
||||
Proxy_Facet(const Facet & ff) : f(ff) {}
|
||||
Facet f;
|
||||
const Facet* operator->() const { return &f; }
|
||||
};
|
||||
|
||||
Proxy_Facet operator->() const
|
||||
{
|
||||
return Proxy_Facet(* *this);
|
||||
}
|
||||
|
||||
bool operator==(const Facet_circulator & ccir) const
|
||||
{
|
||||
return pos == ccir.pos && _s == ccir._s && _t == ccir._t;
|
||||
|
|
|
|||
|
|
@ -51,18 +51,18 @@ _test_circulator( const Triangulation &T )
|
|||
Cell_handle ch = cc0; // Test the conversion.
|
||||
(void) ch;
|
||||
do {
|
||||
assert(cc->has_vertex((*eit).first->vertex((*eit).second)));
|
||||
assert(cc->has_vertex((*eit).first->vertex((*eit).third)));
|
||||
assert(cc->has_vertex(eit->first->vertex(eit->second)));
|
||||
assert(cc->has_vertex(eit->first->vertex(eit->third)));
|
||||
cc++; n++;
|
||||
} while (cc != cc0);
|
||||
}
|
||||
// test of incident_cells(cellhandle,int,int) and --
|
||||
feit=T.finite_edges_begin();
|
||||
{
|
||||
cc0=cc=T.incident_cells((*feit).first,(*feit).second,(*feit).third);
|
||||
cc0=cc=T.incident_cells(feit->first, feit->second, feit->third);
|
||||
do {
|
||||
assert(cc->has_vertex((*feit).first->vertex((*feit).second)));
|
||||
assert(cc->has_vertex((*feit).first->vertex((*feit).third)));
|
||||
assert(cc->has_vertex(feit->first->vertex(feit->second)));
|
||||
assert(cc->has_vertex(feit->first->vertex(feit->third)));
|
||||
cc--; n++;
|
||||
} while (cc != cc0);
|
||||
}
|
||||
|
|
@ -70,21 +70,21 @@ _test_circulator( const Triangulation &T )
|
|||
// for (eit=T.edges_begin(); eit!=T.edges_end(); eit++)
|
||||
eit=T.edges_begin();
|
||||
{
|
||||
cc0=cc=T.incident_cells(*eit,(*eit).first);
|
||||
cc0=cc=T.incident_cells(*eit, eit->first);
|
||||
do {
|
||||
assert(cc->has_vertex((*eit).first->vertex((*eit).second)));
|
||||
assert(cc->has_vertex((*eit).first->vertex((*eit).third)));
|
||||
assert(cc->has_vertex(eit->first->vertex(eit->second)));
|
||||
assert(cc->has_vertex(eit->first->vertex(eit->third)));
|
||||
cc++; n++;
|
||||
} while (cc != cc0);
|
||||
}
|
||||
// test of incident_cells(cellhandle,int,int,cellhandle) and --
|
||||
feit=T.finite_edges_begin();
|
||||
{
|
||||
cc0=cc=T.incident_cells((*feit).first,(*feit).second,(*feit).third,
|
||||
(*feit).first);
|
||||
cc0=cc=T.incident_cells(feit->first, feit->second, feit->third,
|
||||
feit->first);
|
||||
do {
|
||||
assert(cc->has_vertex((*feit).first->vertex((*feit).second)));
|
||||
assert(cc->has_vertex((*feit).first->vertex((*feit).third)));
|
||||
assert(cc->has_vertex(feit->first->vertex(feit->second)));
|
||||
assert(cc->has_vertex(feit->first->vertex(feit->third)));
|
||||
cc--; n++;
|
||||
} while (cc != cc0);
|
||||
}
|
||||
|
|
@ -99,7 +99,7 @@ _test_circulator( const Triangulation &T )
|
|||
// }
|
||||
// for (eit=T.finite_edges_begin(); eit!=T.edges_end(); eit++)
|
||||
// {
|
||||
// cc0=cc=T.incident_cells(*eit,(*eit).first);
|
||||
// cc0=cc=T.incident_cells(*eit, eit->first);
|
||||
// do {
|
||||
// cc++; n++;
|
||||
// } while (cc != cc0);
|
||||
|
|
@ -136,20 +136,20 @@ _test_circulator( const Triangulation &T )
|
|||
{
|
||||
fc0=fc=T.incident_facets(*eit);
|
||||
do {
|
||||
assert((*fc).first->has_vertex((*eit).first->vertex((*eit).second), i));
|
||||
assert((*fc).first->has_vertex((*eit).first->vertex((*eit).third), j));
|
||||
assert( (*fc).second == T.next_around_edge(i,j) );
|
||||
assert(fc->first->has_vertex(eit->first->vertex(eit->second), i));
|
||||
assert(fc->first->has_vertex(eit->first->vertex(eit->third), j));
|
||||
assert(fc->second == T.next_around_edge(i, j) );
|
||||
fc++; n++;
|
||||
} while (fc != fc0);
|
||||
}
|
||||
// for (eit=T.edges_begin(); eit!=T.edges_end(); eit++)
|
||||
feit=T.finite_edges_begin(); // test (cell*,int,int)
|
||||
{
|
||||
fc0=fc=T.incident_facets((*feit).first,(*feit).second,(*feit).third);
|
||||
fc0=fc=T.incident_facets(feit->first, feit->second, feit->third);
|
||||
do {
|
||||
assert((*fc).first->has_vertex((*feit).first->vertex((*feit).second), i));
|
||||
assert((*fc).first->has_vertex((*feit).first->vertex((*feit).third), j));
|
||||
assert( (*fc).second == T.next_around_edge(i,j) );
|
||||
assert(fc->first->has_vertex(feit->first->vertex(feit->second), i));
|
||||
assert(fc->first->has_vertex(feit->first->vertex(feit->third), j));
|
||||
assert(fc->second == T.next_around_edge(i, j) );
|
||||
fc--; n++;
|
||||
} while (fc != fc0);
|
||||
}
|
||||
|
|
@ -160,12 +160,12 @@ _test_circulator( const Triangulation &T )
|
|||
// for (fi=0; fi!=4 ; fi++)
|
||||
// {
|
||||
// if (t.dimension()==2) {fi=3;}
|
||||
fc0=fc=T.incident_facets(*eit,(*eit).first,
|
||||
T.next_around_edge((*eit).second,(*eit).third));
|
||||
fc0=fc=T.incident_facets(*eit, eit->first,
|
||||
T.next_around_edge(eit->second, eit->third));
|
||||
do {
|
||||
assert((*fc).first->has_vertex((*eit).first->vertex((*eit).second), i));
|
||||
assert((*fc).first->has_vertex((*eit).first->vertex((*eit).third), j));
|
||||
assert( (*fc).second == T.next_around_edge(i,j) );
|
||||
assert(fc->first->has_vertex(eit->first->vertex(eit->second), i));
|
||||
assert(fc->first->has_vertex(eit->first->vertex(eit->third), j));
|
||||
assert(fc->second == T.next_around_edge(i, j) );
|
||||
fc++; n++;
|
||||
} while (fc != fc0);
|
||||
// }
|
||||
|
|
@ -173,13 +173,13 @@ _test_circulator( const Triangulation &T )
|
|||
// for (eit=T.edges_begin(); eit!=T.edges_end(); eit++)
|
||||
feit=T.finite_edges_begin(); // test (Cell*,int,int,cell*,int)
|
||||
{
|
||||
fc0=fc=T.incident_facets((*feit).first,(*feit).second,(*feit).third,
|
||||
(*feit).first,
|
||||
T.next_around_edge((*feit).second,(*feit).third));
|
||||
fc0=fc=T.incident_facets(feit->first, feit->second, feit->third,
|
||||
feit->first,
|
||||
T.next_around_edge(feit->second, feit->third));
|
||||
do {
|
||||
assert((*fc).first->has_vertex((*feit).first->vertex((*feit).second), i));
|
||||
assert((*fc).first->has_vertex((*feit).first->vertex((*feit).third), j));
|
||||
assert( (*fc).second == T.next_around_edge(i,j) );
|
||||
assert(fc->first->has_vertex(feit->first->vertex(feit->second), i));
|
||||
assert(fc->first->has_vertex(feit->first->vertex(feit->third), j));
|
||||
assert(fc->second == T.next_around_edge(i, j) );
|
||||
fc--; n++;
|
||||
} while (fc != fc0);
|
||||
}
|
||||
|
|
@ -189,13 +189,13 @@ _test_circulator( const Triangulation &T )
|
|||
// for (fi=0; fi!=4 ; fi++)
|
||||
// {
|
||||
// if (t.dimension()==2) {fi=3;}
|
||||
fc0=fc=T.incident_facets(*eit,std::make_pair( (*eit).first,
|
||||
T.next_around_edge((*eit).second,
|
||||
(*eit).third)) );
|
||||
fc0=fc=T.incident_facets(*eit, std::make_pair( eit->first,
|
||||
T.next_around_edge(eit->second,
|
||||
eit->third)) );
|
||||
do {
|
||||
assert((*fc).first->has_vertex((*eit).first->vertex((*eit).second), i));
|
||||
assert((*fc).first->has_vertex((*eit).first->vertex((*eit).third), j));
|
||||
assert( (*fc).second == T.next_around_edge(i,j) );
|
||||
assert(fc->first->has_vertex(eit->first->vertex(eit->second), i));
|
||||
assert(fc->first->has_vertex(eit->first->vertex(eit->third), j));
|
||||
assert(fc->second == T.next_around_edge(i, j) );
|
||||
fc++; n++;
|
||||
} while (fc != fc0);
|
||||
// }
|
||||
|
|
@ -203,14 +203,14 @@ _test_circulator( const Triangulation &T )
|
|||
// for (eit=T.edges_begin(); eit!=T.edges_end(); eit++)
|
||||
feit=T.finite_edges_begin(); // test (Cell*,int,int,Facet)
|
||||
{
|
||||
fc0=fc=T.incident_facets((*feit).first,(*feit).second,(*feit).third,
|
||||
std::make_pair( (*feit).first,
|
||||
T.next_around_edge((*feit).second,
|
||||
(*feit).third)) );
|
||||
fc0=fc=T.incident_facets(feit->first, feit->second, feit->third,
|
||||
std::make_pair( feit->first,
|
||||
T.next_around_edge(feit->second,
|
||||
feit->third)) );
|
||||
do {
|
||||
assert((*fc).first->has_vertex((*feit).first->vertex((*feit).second), i));
|
||||
assert((*fc).first->has_vertex((*feit).first->vertex((*feit).third), j));
|
||||
assert( (*fc).second == T.next_around_edge(i,j) );
|
||||
assert(fc->first->has_vertex(feit->first->vertex(feit->second), i));
|
||||
assert(fc->first->has_vertex(feit->first->vertex(feit->third), j));
|
||||
assert(fc->second == T.next_around_edge(i, j) );
|
||||
fc--; n++;
|
||||
} while (fc != fc0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,14 +25,42 @@ int
|
|||
_test_vertex_iterator( const Triangulation &T )
|
||||
{
|
||||
typedef typename Triangulation::size_type size_type;
|
||||
typedef typename Triangulation::Vertex Vertex;
|
||||
typedef typename Triangulation::Vertex_handle Vertex_handle;
|
||||
typedef typename Triangulation::Cell_handle Cell_handle;
|
||||
typedef typename Triangulation::Vertex_iterator Vertex_iterator;
|
||||
typedef typename Triangulation::Finite_vertices_iterator
|
||||
Finite_vertices_iterator;
|
||||
size_type n = 0;
|
||||
|
||||
Vertex_iterator vit;
|
||||
for (vit = T.vertices_begin(); vit != T.vertices_end(); ++vit)
|
||||
for (Vertex_iterator vit = T.vertices_begin(); vit != T.vertices_end(); ++vit)
|
||||
{
|
||||
Vertex_handle vh = vit; // Test the conversion.
|
||||
n++;
|
||||
const Vertex & v = *vit; // Test operator*;
|
||||
Cell_handle c = vit->cell(); // Test operator->;
|
||||
(void) vh;
|
||||
(void) v;
|
||||
(void) c;
|
||||
}
|
||||
assert( n-1 == T.number_of_vertices() );
|
||||
n=0;
|
||||
for (Finite_vertices_iterator fvit = T.finite_vertices_begin();
|
||||
fvit != T.finite_vertices_end(); ++fvit)
|
||||
{
|
||||
Vertex_handle vh = fvit; // Test the conversion.
|
||||
const Vertex & v = *fvit; // Test operator*;
|
||||
Cell_handle c = fvit->cell(); // Test operator->;
|
||||
n++;
|
||||
(void) vh;
|
||||
(void) v;
|
||||
(void) c;
|
||||
}
|
||||
assert( n == T.number_of_vertices() );
|
||||
|
||||
// Test Backward-ness of the iterators.
|
||||
n=0;
|
||||
for (Vertex_iterator vit = T.vertices_end(); vit != T.vertices_begin(); --vit)
|
||||
{
|
||||
Vertex_handle vh = vit; // Test the conversion.
|
||||
(void) vh;
|
||||
|
|
@ -40,14 +68,15 @@ _test_vertex_iterator( const Triangulation &T )
|
|||
}
|
||||
assert( n-1 == T.number_of_vertices() );
|
||||
n=0;
|
||||
Finite_vertices_iterator fvit;
|
||||
for (fvit = T.finite_vertices_begin(); fvit != T.finite_vertices_end(); ++fvit)
|
||||
for (Finite_vertices_iterator fvit = T.finite_vertices_end();
|
||||
fvit != T.finite_vertices_begin(); --fvit)
|
||||
{
|
||||
Vertex_handle vh = fvit; // Test the conversion.
|
||||
(void) vh;
|
||||
n++;
|
||||
}
|
||||
assert( n == T.number_of_vertices() );
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
|
|
@ -65,7 +94,10 @@ _test_triangulation_iterator( const Triangulation &T )
|
|||
typedef typename Triangulation::Edge_iterator Edge_iterator;
|
||||
typedef typename Triangulation::Vertex_iterator Vertex_iterator;
|
||||
|
||||
typedef typename Triangulation::Cell Cell;
|
||||
typedef typename Triangulation::Facet Facet;
|
||||
typedef typename Triangulation::Edge Edge;
|
||||
typedef typename Triangulation::Vertex Vertex;
|
||||
typedef typename Triangulation::Cell_handle Cell_handle;
|
||||
|
||||
int n=0 , m=0 , f=0 , t=0;
|
||||
|
|
@ -85,15 +117,40 @@ _test_triangulation_iterator( const Triangulation &T )
|
|||
for (FCit = T.finite_cells_begin(); FCit != T.finite_cells_end(); ++FCit)
|
||||
{
|
||||
Cell_handle ch = FCit; // Test the conversion.
|
||||
const Cell & c = *FCit; // Test operator*.
|
||||
Cell_handle ch2 = FCit->neighbor(0); // Test operator->.
|
||||
(void) ch;
|
||||
(void) c;
|
||||
(void) ch2;
|
||||
t++;
|
||||
}
|
||||
for (FFit = T.finite_facets_begin(); FFit != T.finite_facets_end(); ++FFit)
|
||||
for (FFit = T.finite_facets_begin(); FFit != T.finite_facets_end(); ++FFit) {
|
||||
const Facet & f2 = *FFit; // Test operator*.
|
||||
Cell_handle ch = FFit->first; // Test operator->.
|
||||
(void) f2;
|
||||
(void) ch;
|
||||
f++;
|
||||
for (FEit = T.finite_edges_begin(); FEit != T.finite_edges_end(); ++FEit)
|
||||
}
|
||||
for (FEit = T.finite_edges_begin(); FEit != T.finite_edges_end(); ++FEit) {
|
||||
const Edge & e = *FEit; // Test operator*.
|
||||
Cell_handle ch = FEit->first; // Test operator->.
|
||||
(void) e;
|
||||
(void) ch;
|
||||
m++;
|
||||
for (FVit = T.finite_vertices_begin(); FVit != T.finite_vertices_end(); ++FVit)
|
||||
}
|
||||
for (FVit = T.finite_vertices_begin(); FVit != T.finite_vertices_end(); ++FVit) {
|
||||
const Vertex & v = *FVit; // Test operator*.
|
||||
Cell_handle ch = FVit->cell(); // Test operator->.
|
||||
(void) v;
|
||||
(void) ch;
|
||||
n++;
|
||||
}
|
||||
// Test Backward-ness of the iterators.
|
||||
for (FCit = T.finite_cells_end(); FCit != T.finite_cells_begin(); --FCit) ;
|
||||
for (FFit = T.finite_facets_end(); FFit != T.finite_facets_begin(); --FFit) ;
|
||||
for (FEit = T.finite_edges_end(); FEit != T.finite_edges_begin(); --FEit) ;
|
||||
for (FVit = T.finite_vertices_end(); FVit != T.finite_vertices_begin(); --FVit) ;
|
||||
|
||||
assert((n-m+f-t)==1);
|
||||
n=0 ; m=0 ; f=0 ; t=0;
|
||||
for (Cit = T.cells_begin(); Cit != T.cells_end(); ++Cit)
|
||||
|
|
|
|||
Loading…
Reference in New Issue