diff --git a/Kinetic_data_structures/include/CGAL/Kinetic/Simulator.h b/Kinetic_data_structures/include/CGAL/Kinetic/Simulator.h index f3f6a4eaf7d..cc6b6a1ea15 100644 --- a/Kinetic_data_structures/include/CGAL/Kinetic/Simulator.h +++ b/Kinetic_data_structures/include/CGAL/Kinetic/Simulator.h @@ -22,7 +22,7 @@ #define CGAL_KINETIC_SIMULATOR_BASE_H_ #include #include -#include +#include #include #include #include @@ -141,13 +141,14 @@ public: //! Create a simulator passing the start time and the end time. Simulator(const Time &start_time=Time(0.0), - const Time &end_time= internal::infinity_or_max(Time())):queue_(start_time, end_time, kernel_, 100), - cur_time_(start_time), - end_time_(end_time), - last_event_time_(-internal::infinity_or_max(Time())), - mp_(kernel_.rational_between_roots_object()), - ir_(kernel_.is_rational_object()), - tr_(kernel_.to_rational_object()) { + const Time &end_time= internal::infinity_or_max(Time()), + Function_kernel fk=Function_kernel()):queue_(start_time, end_time, fk, 100), + cur_time_(start_time), + last_event_time_(-internal::infinity_or_max(Time())), + mp_(fk.rational_between_roots_object()), + ir_(fk.is_rational_object()), + tr_(fk.to_rational_object()), + is_forward_(true) { number_of_events_=0; #ifdef CGAL_KINETIC_SIMULATOR_AUDITING // make it less than the current time. @@ -157,34 +158,6 @@ public: #endif }; - //! Create a root enumerator for a particular function. - /*! If the polynomial passed in is currently 0, then the failure - time will be the current time, otherwise, it will be the first - root after the current time. - */ - /*Root_stack root_stack_object(const typename Function_kernel::Function &mf) const - { - CGAL_KINETIC_LOG(LOG_LOTS, "Solving " << mf << std::endl); - CGAL_exactness_assertion_code(typename Function_kernel::Sign_at sar=kernel_.sign_at_object(mf)); - CGAL_exactness_assertion_code(if (sar(current_time())== CGAL::NEGATIVE) { - std::cerr << "Invalid certificate with function " - << std::endl << "In interval from " - << current_time() << std::endl <<"to " << end_time() - << std::endl; - }); - CGAL_exactness_assertion(sar(current_time())!= CGAL::NEGATIVE); - - return Root_stack(mf, current_time(), end_time(), kernel_.root_stack_traits_object()); - }*/ - //! return the polynomial kernel - /*! - I am not sure this is useful and it possibly should be removed. - */ - const Function_kernel &function_kernel_object() const - { - return kernel_; - } - //! Return the current time /*! If an event is currently being processed, then this is the failure time of that event. Otherwise it is between the last event @@ -220,6 +193,12 @@ public: cur_time_=std::min(t, end_time()); } + //! Not clear if I want two methods + void set_back_current_time(const Time &t) { + CGAL_precondition(t <=cur_time_); + cur_time_=t; + } + //! Return a rational number for current time. /*! This returns a ration number representing the current time. This only returns a valid time if @@ -244,8 +223,8 @@ public: return NT(ub); } else { - typename Function_kernel::Rational_between_roots bet= kernel_.rational_between_roots_object(); - return bet(last_event_time(), next_event_time()); + //typename Function_kernel::Rational_between_roots bet= kernel_.rational_between_roots_object(); + return mp_(last_event_time(), next_event_time()); } } @@ -298,8 +277,8 @@ public: */ Time end_time() const { - if (end_time_ > cur_time_) { - return end_time_; + if (is_forward_) { + return queue_.end_priority(); } else { return std::numeric_limits