From ee367b4b0ea38a79e020064ff8a38faa8cb24da3 Mon Sep 17 00:00:00 2001 From: Daniel Russel Date: Mon, 19 Mar 2007 04:09:27 +0000 Subject: [PATCH] try to make gcc 4.3 happy by direct reference to masked class --- .../Delaunay_triangulation_2.cpp | 2 +- .../CGAL/Kinetic/Delaunay_triangulation_3.h | 2 +- .../Delaunay_triangulation_cell_base_3.h | 88 +++++++++++++++---- .../include/sort_test.h | 4 +- .../Kinetic_data_structures/numeric_kds.cpp | 4 +- Kinetic_data_structures/todo | 6 +- 6 files changed, 82 insertions(+), 24 deletions(-) diff --git a/Kinetic_data_structures/demo/Kinetic_data_structures/Delaunay_triangulation_2.cpp b/Kinetic_data_structures/demo/Kinetic_data_structures/Delaunay_triangulation_2.cpp index 655b4f2c95a..bc386a2a79c 100644 --- a/Kinetic_data_structures/demo/Kinetic_data_structures/Delaunay_triangulation_2.cpp +++ b/Kinetic_data_structures/demo/Kinetic_data_structures/Delaunay_triangulation_2.cpp @@ -42,7 +42,7 @@ int run(int argc, char *argv[], int n, int d, int seed, std::string file) { if (file.empty()) { - typename CGAL::Random rand(seed); + typename CGAL::Random rand= CGAL::Random(seed); typename Traits::Active_points_2_table::Key lk; std::vector pts; diff --git a/Kinetic_data_structures/include/CGAL/Kinetic/Delaunay_triangulation_3.h b/Kinetic_data_structures/include/CGAL/Kinetic/Delaunay_triangulation_3.h index 49ac286bbb5..8bb210a6ca4 100644 --- a/Kinetic_data_structures/include/CGAL/Kinetic/Delaunay_triangulation_3.h +++ b/Kinetic_data_structures/include/CGAL/Kinetic/Delaunay_triangulation_3.h @@ -167,7 +167,7 @@ public: /*! There is one notifaction type, TRIANGULATION. */ - typedef Listener Listener; + typedef CGAL::Kinetic::Listener Listener; void write(std::ostream &out) const { diff --git a/Kinetic_data_structures/include/CGAL/Kinetic/Delaunay_triangulation_cell_base_3.h b/Kinetic_data_structures/include/CGAL/Kinetic/Delaunay_triangulation_cell_base_3.h index 64d4eb12e60..b9c9daf9c68 100644 --- a/Kinetic_data_structures/include/CGAL/Kinetic/Delaunay_triangulation_cell_base_3.h +++ b/Kinetic_data_structures/include/CGAL/Kinetic/Delaunay_triangulation_cell_base_3.h @@ -27,7 +27,8 @@ CGAL_KINETIC_BEGIN_NAMESPACE //! A class to track labels of edges of faces in a triangulation -template > +template > class Delaunay_triangulation_cell_base_3: public Cell_base { private: @@ -38,19 +39,28 @@ public: typedef typename TDS::Vertex_handle Vertex_handle; typedef typename Cell_base::Geom_traits Traits; + void clear_elabels() { + for (unsigned int i=0; i< 4; ++i) { + elabels_[i]=false; + } + } + typedef typename SimulationTraits::Simulator::Event_key Edge_label; typedef Edge_label Facet_label; Delaunay_triangulation_cell_base_3(): Cell_base() { + clear_elabels(); } Delaunay_triangulation_cell_base_3(Vertex_handle v0, Vertex_handle v1, Vertex_handle v2, Vertex_handle v3): Cell_base(v0, v1, v2, v3) { + clear_elabels(); } Delaunay_triangulation_cell_base_3(Vertex_handle v0, Vertex_handle v1, Vertex_handle v2, Vertex_handle v3, Cell_handle f0, Cell_handle f1, Cell_handle f2, Cell_handle f3): Cell_base(v0,v1,v2, v3, f0,f1,f2, f3) { + clear_elabels(); } template < typename TDS3 > @@ -61,45 +71,93 @@ public: }; //! Set the label for edge i - void set_edge_label(unsigned int i, unsigned int j, const Edge_label l) { - elabels_[edge_index(i,j)]=l; + void set_edge_certificate(unsigned int i, unsigned int j, const Edge_label l) { + std::pair lp= both_edge_indices(i,j); + CGAL_precondition(flabels_[lp.first]== Facet_label() || elabels_[lp.first]); + elabels_[lp.first]=true; + flabels_[lp.first]=l; + CGAL_precondition(flabels_[lp.second]== Facet_label() || elabels_[lp.second]); + elabels_[lp.second]=true; + flabels_[lp.second]=l; } + bool has_edge_certificate(unsigned int i, unsigned int j) const { + std::pair l= both_edge_indices(i,j); + return elabels_[l.first] && elabels_.[l.second]; + } + + //! Get the label Edge_label edge_label(unsigned int i, unsigned int j) const { - return elabels_[edge_index(i,j)]; + CGAL_precondition(has_edge_label(i,j)); + CGAL_precondition(elabels_[first_edge_index(i,j)]); + CGAL_precondition(flabels_[first_edge_index(i,j) ] + == flabels_[second_edge_index(i,j)]); + return flabels_[first_edge_index(i,j)]; } //! Set the label for edge i void set_facet_label(unsigned int i, const Facet_label l) { + CGAL_assertion(elabels_[i]== false || flabels_[i] == Edge_label()); CGAL_assertion(i<4); flabels_[i]=l; + elabels_[i]=false; } //! Get the label Facet_label facet_label(unsigned int i) const { + CGAL_assertion(elabels_[i]== false || flabels_[i] == Edge_label()); CGAL_assertion(i<4); return flabels_[i]; } protected: - int edge_index(unsigned int i, unsigned int j) const - { - CGAL_precondition(i<4); - CGAL_precondition(j<4); - CGAL_precondition(i!= j); - //if (i both_edge_indices(unsigned int i, unsigned int j) const { + CGAL_precondition(i != j); + int a= first_edge_index(i,j); + int b= second_edge_index(i,j); + CGAL_postcondition(a != -1); + CGAL_postcondition(b != -1); + CGAL_postcondition(a != b); + return std::make_pair(a,b); + } + + //Edge_label elabels_[6]; Facet_label flabels_[4]; + bool elabels_[4]; }; template diff --git a/Kinetic_data_structures/test/Kinetic_data_structures/include/sort_test.h b/Kinetic_data_structures/test/Kinetic_data_structures/include/sort_test.h index 49f54a29d0e..f31078ff5fe 100644 --- a/Kinetic_data_structures/test/Kinetic_data_structures/include/sort_test.h +++ b/Kinetic_data_structures/test/Kinetic_data_structures/include/sort_test.h @@ -19,9 +19,9 @@ bool sort_test(Traits &tr, double max_events=std::numeric_limits::infini { std::string etag="WARNING: "; - CGAL_exactness_assertion_code(bool fail=false); + //CGAL_exactness_assertion_code(bool fail=false); CGAL_exactness_assertion_code(etag="ERROR: "); - CGAL_exactness_assertion_code(fail=true); + //CGAL_exactness_assertion_code(fail=true); //CGAL_exactness_assertion_code(bool test_compiled_with_exact_checks;); typedef CGAL::Kinetic::Sort Sort; diff --git a/Kinetic_data_structures/test/Kinetic_data_structures/numeric_kds.cpp b/Kinetic_data_structures/test/Kinetic_data_structures/numeric_kds.cpp index 4b6b96fa96f..3924c1e0ef4 100644 --- a/Kinetic_data_structures/test/Kinetic_data_structures/numeric_kds.cpp +++ b/Kinetic_data_structures/test/Kinetic_data_structures/numeric_kds.cpp @@ -20,8 +20,6 @@ int main(int argc, char *argv[]) degree= std::atoi(argv[2]); } - bool error; - std::cout << "Using " << num_points << " degree " << degree << " points." << std::endl; //CGAL_KINETIC_SET_LOG_LEVEL(CGAL::Kinetic::LOG_SOME); @@ -49,7 +47,7 @@ int main(int argc, char *argv[]) tr.active_points_1_table_handle())); } - error= sort_test(tr, 3000); + bool error= sort_test(tr, 3000); /*if (error || CGAL::Kinetic::internal::audit_failures__ != 0) { diff --git a/Kinetic_data_structures/todo b/Kinetic_data_structures/todo index 58b8a6c570e..aeff00286a3 100644 --- a/Kinetic_data_structures/todo +++ b/Kinetic_data_structures/todo @@ -9,9 +9,11 @@ sired. Make the tables simply an event manager rather than owning the points (so - make sorting general- solve linking first - times can generate certificate func and solve. Queue checks if they are dirty (a point changed--when check? that is hard--maybe collapse to front of interval if need exact and is dirty) and reinserts them if they are. Points are ref counted pointers. With interval rep and way to generate exact. Then just insert notifications. Dirty is keept by generation count per point. Time is k ints, k points, inexact func, interval--broken-what if time moves up? Need linear scans. - Delaunay/Regular 3D does all sorts of extra walking around the mesh. -- pull edge data into faces (since those must be empty and it is just as easy - to walk around them) - resolve IK using sign_after. probably should be sign_at with a flag +- pull edge data into faces (since those must be empty and it is just as easy + to walk around them)-- this does not work trivially, perhaps not +at all as there can be more than one edge certificate per cell, and they +mostly collide Easy: - pull static_pred/IP into kinetic pred to get result types right and things