simple fixes

This commit is contained in:
Michael Seel 2001-07-16 12:47:27 +00:00
parent 36bf3018b6
commit c3822abe30
14 changed files with 2601 additions and 70 deletions

View File

@ -1 +1,2 @@
TODO
noweb

View File

@ -29,7 +29,7 @@
#define CGAL_PM_CONSTR_TRIANG_TRAITS_H
#include <CGAL/basic.h>
#include <CGAL/Hash_map.h>
#include <CGAL/Unique_hash_map.h>
#include <CGAL/generic_sweep.h>
#include <CGAL/Nef_2/PM_checker.h>
#include <string>
@ -143,7 +143,7 @@ public:
Vertex_handle event;
Point p_sweep;
Sweep_status_structure SL;
CGAL::Hash_map<Halfedge_handle,ss_iterator> SLItem;
CGAL::Unique_hash_map<Halfedge_handle,ss_iterator> SLItem;
const NEWEDGE& Treat_new_edge;
Halfedge_handle e_low,e_high; // framing edges !
Halfedge_handle e_search;

View File

@ -125,7 +125,7 @@ struct HDS_items {
void set_face(Face_handle f) { _f=f; }
/*{\Mop makes |f| the incident face of |\Mvar|.}*/
Point& point() { return _p; }
Point& point() { return _p; }
/*{\Mop returns the embedding point of |\Mvar|.}*/
const Point& point() const { return _p; }
@ -133,7 +133,7 @@ struct HDS_items {
/*{\Mop returns the mark of |\Mvar|.}*/
const Mark& mark() const { return _m; }
GenPtr& info() { return _i; }
GenPtr& info() { return _i; }
/*{\Mop returns a generic information slot of |\Mvar|.}*/
const GenPtr& info() const { return _i; }

View File

@ -31,7 +31,7 @@
#include <CGAL/In_place_list.h>
#include <CGAL/Nef_2/HalfedgeDS_items_decorator.h>
#include <CGAL/Nef_2/HDS_items_MSC.h>
#include <CGAL/Hash_map.h>
#include <CGAL/Unique_hash_map.h>
#include <iterator>
CGAL_BEGIN_NAMESPACE
@ -248,7 +248,7 @@ public:
: Base(), nb_border_halfedges(0), nb_border_edges(0) {}
// not used here.
~HalfedgeDS_ipl_MSC() { erase_all(); }
~HalfedgeDS_ipl_MSC() { clear(); }
HalfedgeDS_ipl_MSC(const Self& hds)
: vertices( hds.vertices),
@ -261,7 +261,7 @@ public:
Self& operator=( const Self& hds) {
if ( this != &hds) {
erase_all();
clear();
vertices = hds.vertices;
halfedges = hds.halfedges;
faces = hds.faces;
@ -421,7 +421,7 @@ public:
faces_erase(first++);
}
void erase_all() {
void clear() {
vertices.destroy();
edges_erase( halfedges.begin(), halfedges.end());
faces.destroy();
@ -483,12 +483,9 @@ HalfedgeDS_ipl_MSC<p_Traits>::
pointer_update( const HalfedgeDS_ipl_MSC<p_Traits>& hds) {
// Update own pointers assuming that they lived previously
// in a halfedge data structure `hds' with lists.
typedef CGAL::Hash_map<Vertex_const_handle,Vertex_handle> V_map;
typedef CGAL::Hash_map<Halfedge_const_handle,Halfedge_handle> H_map;
typedef CGAL::Hash_map<Face_const_handle,Face_handle> F_map;
V_map v_map;
H_map h_map;
F_map f_map;
CGAL::Unique_hash_map<Vertex_const_handle,Vertex_handle> v_map;
CGAL::Unique_hash_map<Halfedge_const_handle,Halfedge_handle> h_map;
CGAL::Unique_hash_map<Face_const_handle,Face_handle> f_map;
h_map[Halfedge_const_iterator()] = Halfedge_iterator();
v_map[Vertex_const_iterator()] = Vertex_iterator();
f_map[Face_const_iterator()] = Face_iterator();

View File

@ -38,14 +38,16 @@ CGAL_BEGIN_NAMESPACE
template < class Vertex_base>
class HalfedgeDS_in_place_list_vertex
: public Vertex_base, public CGAL::In_place_list_base<
HalfedgeDS_in_place_list_vertex< Vertex_base> > {
HalfedgeDS_in_place_list_vertex<Vertex_base> > {
public:
typedef HalfedgeDS_in_place_list_vertex< Vertex_base> Self;
typedef HalfedgeDS_in_place_list_vertex<Vertex_base> Self;
typedef CGAL::In_place_list_base<Self> Base2;
typedef typename Vertex_base::Vertex_handle Vertex_handle;
typedef typename Vertex_base::Vertex_const_handle Vertex_const_handle;
HalfedgeDS_in_place_list_vertex() {} // down cast
HalfedgeDS_in_place_list_vertex( const Vertex_base& v)
: Vertex_base(v) {}
HalfedgeDS_in_place_list_vertex() : Vertex_base(), Base2() {}
HalfedgeDS_in_place_list_vertex( const Vertex_base& v) :
Vertex_base(v) {}
Self& operator=( const Self& v) {
// This self written assignment avoids that assigning vertices will
// overwrite the list linking of the target vertex.
@ -57,15 +59,16 @@ public:
template < class Halfedge_base>
class HalfedgeDS_in_place_list_halfedge
: public Halfedge_base, public CGAL::In_place_list_base<
HalfedgeDS_in_place_list_halfedge< Halfedge_base> > {
HalfedgeDS_in_place_list_halfedge<Halfedge_base> > {
public:
typedef HalfedgeDS_in_place_list_halfedge< Halfedge_base> Self;
typedef typename Halfedge_base::Halfedge_handle Halfedge_handle;
typedef CGAL::In_place_list_base<Self> Base2;
typedef typename Halfedge_base::Halfedge_handle Halfedge_handle;
typedef typename Halfedge_base::Halfedge_const_handle
Halfedge_const_handle;
HalfedgeDS_in_place_list_halfedge() {} // down cast
HalfedgeDS_in_place_list_halfedge( const Halfedge_base& h)
: Halfedge_base(h) {}
HalfedgeDS_in_place_list_halfedge() : Halfedge_base(), Base2() {}
HalfedgeDS_in_place_list_halfedge( const Halfedge_base& h) :
Halfedge_base(h) {}
Self& operator=( const Self& h) {
// This self written assignment avoids that assigning halfedges will
// overwrite the list linking of the target halfedge.
@ -77,12 +80,13 @@ public:
template < class Face_base>
class HalfedgeDS_in_place_list_face
: public Face_base, public CGAL::In_place_list_base<
HalfedgeDS_in_place_list_face< Face_base> > {
HalfedgeDS_in_place_list_face<Face_base> > {
public:
typedef HalfedgeDS_in_place_list_face< Face_base> Self;
typedef HalfedgeDS_in_place_list_face<Face_base> Self;
typedef CGAL::In_place_list_base<Self> Base2;
typedef typename Face_base::Face_handle Face_handle;
typedef typename Face_base::Face_const_handle Face_const_handle;
HalfedgeDS_in_place_list_face() {} // down cast
HalfedgeDS_in_place_list_face() : Face_base(), Base2() {}
HalfedgeDS_in_place_list_face( const Face_base& f) : Face_base(f) {}
Self& operator=( const Self& f) {
// This self written assignment avoids that assigning faces will
@ -125,8 +129,8 @@ public:
typedef typename Halfedge_list::const_iterator Halfedge_const_iterator;
typedef typename Face_wrapper::Face Face_base;
typedef HalfedgeDS_in_place_list_face< Face_base> Face;
typedef CGAL::In_place_list<Face,false> Face_list;
typedef HalfedgeDS_in_place_list_face< Face_base> Face;
typedef CGAL::In_place_list<Face,false> Face_list;
typedef typename Face_list::iterator Face_handle;
typedef typename Face_list::const_iterator Face_const_handle;
typedef typename Face_list::iterator Face_iterator;

View File

@ -30,7 +30,7 @@
#define OBJECT_INDEX_H
#include <CGAL/basic.h>
#include <CGAL/Hash_map.h>
#include <CGAL/Unique_hash_map.h>
#include <string>
#include <strstream>
@ -39,7 +39,7 @@ CGAL_BEGIN_NAMESPACE
template <typename I>
class Object_index {
char _prefix;
CGAL::Hash_map<I,int> _index;
CGAL::Unique_hash_map<I,int> _index;
public:
Object_index() : _prefix('\0'), _index(-1) {}
Object_index(I first, I beyond, char c=' ') : _prefix(c), _index(-1)

View File

@ -29,6 +29,7 @@
#define CGAL_PM_CHECKER_H
#include <CGAL/basic.h>
#include <CGAL/Unique_hash_map.h>
#include <CGAL/Nef_2/PM_const_decorator.h>
#define USING(t) typedef typename Base::t t
@ -246,7 +247,7 @@ check_is_triangulation() const
check_order_preserving_embedding();
eb = check_boundary_is_clockwise_weakly_polygon();
CGAL::Hash_map< Halfedge_const_iterator, bool> on_boundary(false);
CGAL::Unique_hash_map< Halfedge_const_iterator, bool> on_boundary(false);
Halfedge_around_face_const_circulator hit(eb), hend(hit);
std::ostrstream error_status;
CGAL::set_pretty_mode ( error_status );

View File

@ -30,7 +30,7 @@
#include <CGAL/basic.h>
#include <CGAL/circulator.h>
#include <CGAL/Hash_map.h>
#include <CGAL/Unique_hash_map.h>
#include <string>
#include <list>
#include <strstream>
@ -580,7 +580,7 @@ PM_const_decorator<HDS>::
number_of_face_cycles() const
{
unsigned int fc_num=0;
CGAL::Hash_map<Halfedge_const_handle,bool> visited;
CGAL::Unique_hash_map<Halfedge_const_handle,bool> visited;
// init with bool() == false
Halfedge_const_iterator eit = phds->halfedges_begin();
Halfedge_const_iterator eend = phds->halfedges_end();
@ -600,7 +600,7 @@ number_of_connected_components() const
typedef Vertex_const_iterator vc_handle;
typedef Halfedge_around_vertex_const_circulator hvc_circulator;
int comp_num=0;
CGAL::Hash_map< vc_handle, bool> handled(false);
CGAL::Unique_hash_map< vc_handle, bool> handled(false);
vc_handle vit = vertices_begin(), vend = vertices_end();
for ( ; vit != vend; ++vit) {
if (handled[vit]) continue;
@ -643,9 +643,8 @@ void print_as_leda_graph(std::ostream& os, const PMCDEC& D,
typedef typename PMCDEC::Halfedge_const_iterator
Halfedge_const_iterator;
int vn(1), en(1);
CGAL::Hash_map<Vertex_const_iterator,int> v_num;
CGAL::Hash_map<Halfedge_const_iterator,int> e_num;
CGAL::Hash_map<Halfedge_const_iterator,int> ec_num;
CGAL::Unique_hash_map<Vertex_const_iterator,int> v_num;
CGAL::Unique_hash_map<Halfedge_const_iterator,int> e_num;
os << "LEDA.GRAPH\n" << "point\n" << "int\n";
os << D.number_of_vertices() << std::endl;
Vertex_const_iterator vit;
@ -655,7 +654,7 @@ void print_as_leda_graph(std::ostream& os, const PMCDEC& D,
typename PMCDEC::Halfedge_around_vertex_const_circulator
ecirc(D.first_out_edge(vit)),ecend(ecirc);
int l=0;
CGAL_For_all(ecirc,ecend) ec_num[ecirc]=l++;
CGAL_For_all(ecirc,ecend) e_num[ecirc]=l++;
}
os << 2* D.number_of_edges() << std::endl;
Halfedge_const_iterator eit;
@ -666,7 +665,7 @@ void print_as_leda_graph(std::ostream& os, const PMCDEC& D,
os << v_num[D.source(eit)] << " "
<< v_num[D.target(eit)] << " "
<< e_num[D.twin(eit)] << " ";
os << "|{" << ec_num[eit] << "}|\n";
os << "|{" << e_num[eit] << "}|\n";
}
os << std::flush;
}

View File

@ -29,6 +29,8 @@
#define CGAL_PM_DECORATOR_H
#include <CGAL/Nef_2/PM_const_decorator.h>
#include <CGAL/Nef_2/geninfo.h>
#include <CGAL/Unique_hash_map.h>
#include <vector>
#define USING(t) typedef typename Base::t t
#define HDSUSING(t) typedef typename HDS::t t
@ -179,7 +181,7 @@ Plane_map& plane_map() const
void clear() const
/*{\Mop reinitializes |P| to the empty map.}*/
{ phds->erase_all(); }
{ phds->clear(); }
Vertex_handle source(Halfedge_handle e) const
/*{\Mop returns the source of |e|.}*/
@ -715,8 +717,8 @@ void clone_skeleton(const HDS& H, const LINKDA& L) const
PM_const_decorator<HDS> DC(H);
CGAL_assertion((DC.check_integrity_and_topological_planarity(),1));
CGAL::Hash_map<Vertex_const_iterator,Vertex_handle> Vnew;
CGAL::Hash_map<Halfedge_const_iterator,Halfedge_handle> Hnew;
CGAL::Unique_hash_map<Vertex_const_iterator,Vertex_handle> Vnew;
CGAL::Unique_hash_map<Halfedge_const_iterator,Halfedge_handle> Hnew;
/* First clone all objects and store correspondance in the two maps.*/
Vertex_const_iterator vit, vend = H.vertices_end();
@ -818,9 +820,9 @@ void PM_decorator<HDS>::clone(const HDS& H) const
PM_const_decorator<HDS> DC(H);
CGAL_assertion((DC.check_integrity_and_topological_planarity(),1));
CGAL::Hash_map<Vertex_const_iterator,Vertex_handle> Vnew;
CGAL::Hash_map<Halfedge_const_iterator,Halfedge_handle> Hnew;
CGAL::Hash_map<Face_const_iterator,Face_handle> Fnew;
CGAL::Unique_hash_map<Vertex_const_iterator,Vertex_handle> Vnew;
CGAL::Unique_hash_map<Halfedge_const_iterator,Halfedge_handle> Hnew;
CGAL::Unique_hash_map<Face_const_iterator,Face_handle> Fnew;
/* First clone all objects and store correspondance in three maps.*/
Vertex_const_iterator vit, vend = H.vertices_end();
@ -887,8 +889,8 @@ clone_skeleton(const HDS& H, const LINKDA& L) const
PM_const_decorator<HDS> DC(H);
CGAL_assertion((DC.check_integrity_and_topological_planarity(),1));
CGAL::Hash_map<Vertex_const_iterator,Vertex_handle> Vnew;
CGAL::Hash_map<Halfedge_const_iterator,Halfedge_handle> Hnew;
CGAL::Unique_hash_map<Vertex_const_iterator,Vertex_handle> Vnew;
CGAL::Unique_hash_map<Halfedge_const_iterator,Halfedge_handle> Hnew;
/* First clone all objects and store correspondance in the two maps.*/
Vertex_const_iterator vit, vend = H.vertices_end();

View File

@ -30,7 +30,7 @@
#define CGAL_PM_OVERLAYER_H
#include <CGAL/basic.h>
#include <CGAL/Hash_map.h>
#include <CGAL/Unique_hash_map.h>
#include <CGAL/Partition.h>
#include <CGAL/Nef_2/Segment_overlay_traits.h>
#include <CGAL/Nef_2/geninfo.h>
@ -113,11 +113,11 @@ struct PMO_from_pm {
const Decorator& G;
const Const_decorator* pGI[2];
CGAL::Hash_map<IT,INFO>& M;
CGAL::Unique_hash_map<IT,INFO>& M;
PMO_from_pm(const Decorator& Gi,
const Const_decorator* pG0,
const Const_decorator* pG1,
CGAL::Hash_map<IT,INFO>& Mi) : G(Gi),M(Mi)
CGAL::Unique_hash_map<IT,INFO>& Mi) : G(Gi),M(Mi)
{ pGI[0]=pG0; pGI[1]=pG1; }
Vertex_handle new_vertex(const Point& p) const
@ -371,7 +371,7 @@ and |\Mvar.mark(v,1) = D1.mark(f1)|.}*/
Const_decorator PI[2];
PI[0] = Const_decorator(P0); PI[1] = Const_decorator(P1);
Seg_list Segments; int i;
CGAL::Hash_map<Seg_iterator,Seg_info> From;
CGAL::Unique_hash_map<Seg_iterator,Seg_info> From;
for (i=0; i<2; ++i) {
Vertex_const_iterator v;
for(v = PI[i].vertices_begin(); v != PI[i].vertices_end(); ++v)
@ -503,7 +503,7 @@ and the edges are unified.}*/
{
TRACEN("simplifying");
typedef typename CGAL::Partition<Face_handle>::item partition_item;
CGAL::Hash_map<Face_iterator,partition_item> Pitem;
CGAL::Unique_hash_map<Face_iterator,partition_item> Pitem;
CGAL::Partition<Face_handle> FP;
Face_iterator f, fend = faces_end();
@ -532,7 +532,7 @@ and the edges are unified.}*/
}
}
CGAL::Hash_map<Halfedge_handle,bool> linked(false);
CGAL::Unique_hash_map<Halfedge_handle,bool> linked(false);
for (e = halfedges_begin(); e != eend; ++e) {
if ( linked[e] ) continue;
Halfedge_around_face_circulator hfc(e),hend(hfc);
@ -693,7 +693,7 @@ template <class Below_info>
void create_face_objects(const Below_info& D) const
{
TRACEN("create_face_objects()");
CGAL::Hash_map<Halfedge_handle,int> FaceCycle(-1);
CGAL::Unique_hash_map<Halfedge_handle,int> FaceCycle(-1);
std::vector<Halfedge_handle> MinimalHalfedge;
int i=0;
Halfedge_iterator e, eend = halfedges_end();
@ -747,7 +747,7 @@ void create_face_objects(const Below_info& D) const
template <class Below_info>
Face_handle determine_face(Halfedge_handle e,
const std::vector<Halfedge_handle>& MinimalHalfedge,
const CGAL::Hash_map<Halfedge_handle,int>& FaceCycle,
const CGAL::Unique_hash_map<Halfedge_handle,int>& FaceCycle,
const Below_info& D) const
{ TRACEN("determine_face "<<PE(e));
Halfedge_handle e_min = MinimalHalfedge[FaceCycle[e]];

View File

@ -29,7 +29,7 @@
#define CGAL_PM_POINT_LOCATOR_H
#include <CGAL/basic.h>
#include <CGAL/Hash_map.h>
#include <CGAL/Unique_hash_map.h>
#include <CGAL/Object.h>
#include <CGAL/Nef_2/Constrained_triang_traits.h>
#undef _DEBUG
@ -221,7 +221,7 @@ public:
Halfedge_const_handle e_res;
Segment ss = s; // we shorten the segment iteratively
Direction dso = K.construct_direction(K.target(s),p), d_res;
CGAL::Hash_map<Halfedge_const_handle,bool> visited(false);
CGAL::Unique_hash_map<Halfedge_const_handle,bool> visited(false);
for(vit = vertices_begin(); vit != vertices_end(); ++vit) {
Point p_res, vp = point(vit);
if ( K.contains(ss,vp) ) {

View File

@ -37,7 +37,7 @@
#include <CGAL/Handle_for.h>
#ifndef CGAL_SIMPLE_HDS
#include <CGAL/Nef_2/HDS_items.h>
#include <CGAL/Nef_2/HalfedgeDS_default.h>
#include <CGAL/HalfedgeDS_default.h>
#else
#include <CGAL/Nef_2/HalfedgeDS_default_MSC.h>
#endif
@ -65,19 +65,19 @@ template <typename T>
std::istream& operator>>(std::istream&, Nef_polyhedron_2<T>&);
template <typename T>
class Nef_polyhedron_2_rep : public Ref_counted
{
{ typedef Nef_polyhedron_2_rep<T> Self;
friend class Nef_polyhedron_2<T>;
#ifndef CGAL_SIMPLE_HDS
struct HDS_traits {
typedef typename T::Point_2 Point;
typedef bool Mark;
};
typedef CGAL::HalfedgeDS_default<HDS_traits,HDS_items> Plane_map;
typedef CGAL::PM_const_decorator<Plane_map> Const_decorator;
typedef CGAL::PM_decorator<Plane_map> Decorator;
typedef CGAL::PM_naive_point_locator<Decorator,T> Slocator;
typedef CGAL::PM_point_locator<Decorator,T> Locator;
typedef CGAL::PM_overlayer<Decorator,T> Overlayer;
typedef CGAL_HALFEDGEDS_DEFAULT<HDS_traits,HDS_items> Plane_map;
typedef CGAL::PM_const_decorator<Plane_map> Const_decorator;
typedef CGAL::PM_decorator<Plane_map> Decorator;
typedef CGAL::PM_naive_point_locator<Decorator,T> Slocator;
typedef CGAL::PM_point_locator<Decorator,T> Locator;
typedef CGAL::PM_overlayer<Decorator,T> Overlayer;
#else
struct HDS_traits {
@ -100,8 +100,9 @@ class Nef_polyhedron_2_rep : public Ref_counted
void clear_locator()
{ if ( pl_ ) delete pl_; pl_=0; }
public:
Nef_polyhedron_2_rep() : pm_(), pl_(0) {}
~Nef_polyhedron_2_rep() { pm_.erase_all(); clear_locator(); }
Nef_polyhedron_2_rep() : Ref_counted(), pm_(), pl_(0) {}
Nef_polyhedron_2_rep(const Self& R) : pm_(), pl_(0) {}
~Nef_polyhedron_2_rep() { pm_.clear(); clear_locator(); }
};
/*{\Moptions print_title=yes }*/

File diff suppressed because it is too large Load Diff

View File

@ -285,8 +285,6 @@ int main()
CGAL_IO_TEST(N1,N2);
Nef_polyhedron::EK.print_statistics();
}
CGAL_TEST_END;