diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/comparator_profiler.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/comparator_profiler.h index 968681f5128..e2ddc96f518 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/comparator_profiler.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/comparator_profiler.h @@ -24,6 +24,7 @@ #define CGAL_COMPARATOR_PROFILER_H #include +#include namespace CGAL { @@ -32,23 +33,31 @@ namespace ApolloniusGraph_2 { class comparator_profiler { public: - static bool count_cases; - static unsigned long case_1_counter; - static unsigned long case_2_counter; - static unsigned long case_3a_Jpos_counter; - static unsigned long case_3a_Jneg_counter; - static unsigned long case_3b_Jpos_counter; - static unsigned long case_3b_Jneg_counter; - static unsigned long case_4_counter; - static unsigned long case_5_counter; - static unsigned long case_degenerate_counter; + +#ifdef CGAL_NO_ATOMIC + typedef bool bool_; + typedef unsigned long long_; +#else + typedef CGAL::cpp11::atomic bool_; + typedef CGAL::cpp11::atomic long_; +#endif + + static bool_ count_cases; + static long_ case_1_counter; + static long_ case_2_counter; + static long_ case_3a_Jpos_counter; + static long_ case_3a_Jneg_counter; + static long_ case_3b_Jpos_counter; + static long_ case_3b_Jneg_counter; + static long_ case_4_counter; + static long_ case_5_counter; + static long_ case_degenerate_counter; public: - static unsigned long counter_rr; - static unsigned long counter_rr_p3inf; - static unsigned long counter_rr_p4; - static unsigned long counter_rr_e; - static unsigned long counter_rr_r0; - // static unsigned long counter_rr_jneg; + static long_ counter_rr; + static long_ counter_rr_p3inf; + static long_ counter_rr_p4; + static long_ counter_rr_e; + static long_ counter_rr_r0; static void reset() { @@ -68,7 +77,6 @@ public: counter_rr_p4 = 0; counter_rr_e = 0; counter_rr_r0 = 0; - // counter_rr_jneg = 0; } template< class FT > @@ -141,6 +149,8 @@ public: } }; +#ifdef CGAL_NO_ATOMIC + bool comparator_profiler::count_cases = false; unsigned long comparator_profiler::case_1_counter = 0; unsigned long comparator_profiler::case_2_counter = 0; @@ -157,7 +167,9 @@ unsigned long comparator_profiler::counter_rr_p3inf = 0; unsigned long comparator_profiler::counter_rr_p4 = 0; unsigned long comparator_profiler::counter_rr_e = 0; unsigned long comparator_profiler::counter_rr_r0 = 0; -//unsigned long comparator_profiler::counter_rr_jneg = 0; + +#endif + } //namespace ApolloniusGraph_2 diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/predicate_profiler.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/predicate_profiler.h index 703e38303e0..d9edf9bc76f 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/predicate_profiler.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/predicate_profiler.h @@ -24,6 +24,7 @@ #define CGAL_APOLLONIUS_GRAPH_2_PREDICATE_PROFILER 1 #include +#include #define AG2_PROFILE_PREDICATES @@ -34,18 +35,24 @@ namespace ApolloniusGraph_2 { class ag2_predicate_profiler { public: +#ifdef CGAL_NO_ATOMIC + typedef unsigned long long_; +#else + typedef CGAL::cpp11::atomic long_; +#endif + // high level predicates - static unsigned long side_of_bisector_counter; - static unsigned long is_trivial_counter; - static unsigned long infinite_edge_conflict_type_counter; - static unsigned long finite_edge_conflict_type_counter; + static long_ side_of_bisector_counter; + static long_ is_trivial_counter; + static long_ infinite_edge_conflict_type_counter; + static long_ finite_edge_conflict_type_counter; // subpredicates - static unsigned long inside_circular_arc_counter; - static unsigned long distance_from_bitangent_counter; - static unsigned long shadow_region_type_counter; - static unsigned long incircle_counter; - static unsigned long order_on_bisector_counter; + static long_ inside_circular_arc_counter; + static long_ distance_from_bitangent_counter; + static long_ shadow_region_type_counter; + static long_ incircle_counter; + static long_ order_on_bisector_counter; static void reset() { side_of_bisector_counter = 0; @@ -61,6 +68,9 @@ public: } }; + +#ifdef CGAL_NO_ATOMIC + unsigned long ag2_predicate_profiler::side_of_bisector_counter = 0; unsigned long ag2_predicate_profiler::is_trivial_counter = 0; unsigned long ag2_predicate_profiler::infinite_edge_conflict_type_counter = 0; @@ -72,6 +82,8 @@ unsigned long ag2_predicate_profiler::shadow_region_type_counter = 0; unsigned long ag2_predicate_profiler::incircle_counter = 0; unsigned long ag2_predicate_profiler::order_on_bisector_counter = 0; +#endif + } //namespace ApolloniusGraph_2 } //namespace CGAL diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/uncertain/Uncertain_vertex_conflict_2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/uncertain/Uncertain_vertex_conflict_2.h index b37a11ac1a7..d941752077c 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/uncertain/Uncertain_vertex_conflict_2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/uncertain/Uncertain_vertex_conflict_2.h @@ -47,7 +47,7 @@ private: inline Uncertain is_less (const Site_2 &p0, const Site_2 &p1) const { - static Uncertain uncertain_bool = + static const Uncertain uncertain_bool = Uncertain::indeterminate(); Uncertain cr; diff --git a/Apollonius_graph_2/include/CGAL/Hyperbola_ray_2.h b/Apollonius_graph_2/include/CGAL/Hyperbola_ray_2.h index a8b03bd1ee0..bc3734eddc9 100644 --- a/Apollonius_graph_2/include/CGAL/Hyperbola_ray_2.h +++ b/Apollonius_graph_2/include/CGAL/Hyperbola_ray_2.h @@ -59,7 +59,7 @@ protected: #else static const FT& OFFSET() { - static FT offset_(10000); + static const FT offset_(10000); return offset_; } #endif diff --git a/Apollonius_graph_2/include/CGAL/Parabola_2.h b/Apollonius_graph_2/include/CGAL/Parabola_2.h index bc8bf874a74..ed804ab7fbb 100644 --- a/Apollonius_graph_2/include/CGAL/Parabola_2.h +++ b/Apollonius_graph_2/include/CGAL/Parabola_2.h @@ -48,21 +48,6 @@ public: private: typedef Algebraic_structure_traits AST; protected: - // static stuff -#if defined(__POWERPC__) && \ - defined(__GNUC__) && (__GNUC__ == 3) && (__GNUC_MINOR__ == 4) - // hack to avoid nasty warning for G++ 3.4 on Darwin - static FT STEP() - { - return FT(2); - } -#else - static const FT& STEP() - { - static FT step_(2); - return step_; - } -#endif // inline static // FT square(const FT &x) @@ -291,9 +276,9 @@ public: pleft.push_back(o); pright.push_back(o); - + const FT STEP(2); for (int i = 1; i <= 100; i++) { - p = compute_points(i * i * STEP()); + p = compute_points(i * i * STEP); W << p[0]; W << p[1]; diff --git a/Apollonius_graph_2/include/CGAL/Parabola_segment_2.h b/Apollonius_graph_2/include/CGAL/Parabola_segment_2.h index d934341e700..bff8535a565 100644 --- a/Apollonius_graph_2/include/CGAL/Parabola_segment_2.h +++ b/Apollonius_graph_2/include/CGAL/Parabola_segment_2.h @@ -68,12 +68,12 @@ public: } int compute_k(const FT& tt) const { - // return int(CGAL::to_double(CGAL::sqrt(tt / this->STEP()))); - return int(CGAL::sqrt(CGAL::to_double(tt) / CGAL::to_double(this->STEP()))); + return int(CGAL::sqrt(CGAL::to_double(tt) / 2)); } void generate_points(std::vector& p) const { + const FT STEP(2); FT s0, s1; s0 = t(p1); @@ -92,20 +92,21 @@ public: p.push_back( this->o ); k = -1; - tt = -this->STEP(); + + tt = - STEP; while ( CGAL::compare(tt, s0) == LARGER ) { p.insert( p.begin(), f(tt) ); k--; - tt = -FT(k * k) * this->STEP(); + tt = -FT(k * k) * STEP; } p.insert( p.begin(), f(s0) ); k = 1; - tt = this->STEP(); + tt = STEP; while ( CGAL::compare(tt, s1) == SMALLER ) { p.push_back( f(tt) ); k++; - tt = FT(k * k) * this->STEP(); + tt = FT(k * k) * STEP; } p.push_back( f(s1) ); } else if ( !(CGAL::is_negative(s0)) && @@ -123,7 +124,7 @@ public: if ( CGAL::compare(tt, s0) != SMALLER ) p.push_back( f(tt) ); k++; - tt = FT(k * k) * this->STEP(); + tt = FT(k * k) * STEP; } p.push_back( f(s1) ); } else { @@ -139,7 +140,7 @@ public: if ( CGAL::compare(tt, s1) != LARGER ) p.push_back( f(tt) ); k--; - tt = -FT(k * k) * this->STEP(); + tt = -FT(k * k) * STEP; } p.push_back( f(s0) ); } diff --git a/Apollonius_graph_2/include/CGAL/in_place_edge_list.h b/Apollonius_graph_2/include/CGAL/in_place_edge_list.h index 0592aba5e1c..df5e8a6e1bd 100644 --- a/Apollonius_graph_2/include/CGAL/in_place_edge_list.h +++ b/Apollonius_graph_2/include/CGAL/in_place_edge_list.h @@ -164,7 +164,7 @@ public: void remove(const Edge& e) { CGAL_precondition( is_in_list(e) ); - static Edge SENTINEL_QUEUE_EDGE = Edge(Face_handle(), -1); + static const Edge SENTINEL_QUEUE_EDGE = Edge(Face_handle(), -1); if ( is_singleton() ) { _front = SENTINEL_QUEUE_EDGE;