removed time from process

This commit is contained in:
Daniel Russel 2006-07-14 09:33:05 +00:00
parent c8b5db64c9
commit 22813e7ce8
12 changed files with 53 additions and 27 deletions

View File

@ -4,6 +4,10 @@
9 March 2006 Andreas Fabri
- Made heading of user and reference manual to be the same
July 2006 Daniel Russel
- removed time in process function calls
- changed Simulator to Default_simulator
Future Daniel Russel
- change non-failing root to be NaN or Root() rather than infinity?
- when using numeric solvers, evaluate the static predicates first before solving?

View File

@ -32,6 +32,13 @@ scheduling events which will in turn pass them to the
scheduled and the event will be removed from the queue immediately
afterwards.}
\ccMethod{void* kds();}{Return a \ccc{void *} which represents the KDS
which this event belongs to. The pointer is used solely to tell if
two events come from the same KDS for the purposes of handling
degeneracy.}
%\ccMethod{void degenerate_events(Event_key this_event, Event_key other_event);}{This event and the event referenced by \ccc{k} belong to the same KDS and occur simultaneously. This function call gives the KDS a chance to handle }
\ccGlobalFunction{std::ostream& operator<<(std::ostream&, Event);}{Write a text description of the event to a standard stream.}
\ccHasModels

View File

@ -40,6 +40,12 @@ then verify that their structure is correct.
Typically, the simulator is created by the Kinetic:SimulationTraits
class and kinetic data structures request a handle to it from there.
Events that occur at or after \ccc{Kinetic::Simulator::end_time()}
will may not be processed. The exception are events which are
scheduled using the \ccc{new_final_event(Event)} call which are
guaranteed to occur after all other events (but have no particular
order amongst themselves).
\ccTypes
@ -89,6 +95,8 @@ Returns true if the current time is a rational number and there are no events at
\ccMethod{ template <class Event> Event_key new_event(Time t, const Event event);}{Schedule a new event at time \ccc{t}. The object \ccc{event} must implement the concept \ccc{Event}. The \ccc{Event_key} returned can be used to access or deschedule the event.}
\ccMethod{ template <class Event> Event_key new_final_event(const Event event);}{Schedule a new event that will occur at the end of the simulation. This type of event is useful if, for example, you want to run for a while, change all motions, and then run some more.}
\ccMethod{Event_key null_event() const;}{This method returns an \ccc{Event_key} which is guaranteed never to be assigned to any real event.}
\ccMethod{void delete_event(const Event_key k);}{Remove the event referenced by \ccc{k} from the event queue.}

View File

@ -53,7 +53,7 @@ struct Delaunay_2_event_base {
KDel* kdel() {
return d_;
}
void process(const typename KDel::Time&) {
void process() {
d_->flip(e_, c_);
}
typename KDel::Certificate c_;

View File

@ -37,11 +37,12 @@ public:
Erase_event(Key k,
Handle mot):mot_(mot),
k_(k){}
template <class T>
void process(const T&) {
void process() {
CGAL_KINETIC_LOG(LOG_SOME,"Deleting object.\n");
mot_->erase(k_);
}
void* kds() const {return NULL;}
void write(std::ostream &out) const
{
out << "E" << k_;

View File

@ -43,7 +43,7 @@ public:
virtual void write(std::ostream &out) const =0;
const Priority& time() const {return time_;};
virtual void process(const Priority &t) =0;
virtual void process() =0;
void set_bin(int bin) const { bin_=bin;}
int bin() const {return bin_;};
virtual ~Heap_pointer_event_queue_item(){}
@ -70,7 +70,7 @@ class Heap_pointer_event_queue_dummy_item: public Heap_pointer_event_queue_item<
{
public:
Heap_pointer_event_queue_dummy_item(): Heap_pointer_event_queue_item<Priority>(-2, internal::infinity_or_max(Priority())){}
virtual void process(const Priority &) {
virtual void process() {
}
virtual void write(std::ostream &out) const
{
@ -96,8 +96,8 @@ public:
Heap_pointer_event_queue_item_rep(const Priority &t, const Event &e,
unsigned int bin): internal::Heap_pointer_event_queue_item<Priority>(bin, t),
event_(e){}
virtual void process(const Priority &t) {
event_.process(t);
virtual void process() {
event_.process();
}
virtual void write(std::ostream &out) const
{
@ -325,7 +325,7 @@ public:
Item_handle ih= queue_.front();
pop_front();
//std::pop_heap(queue_.begin(), queue_.end());
ih->process(ih->time());
ih->process();
CGAL_expensive_postcondition(is_valid());
/*}
else {

View File

@ -37,11 +37,11 @@ public:
Insert_event(const Object &obj,
Pointer mot):mot_(mot),
obj_(obj){}
template <class T>
void process(const T&) {
void process() {
CGAL_KINETIC_LOG(LOG_SOME, "Inserting object.\n");
mot_->insert(obj_);
}
void* kds() const {return NULL;}
void write(std::ostream &out) const
{

View File

@ -46,7 +46,7 @@ public:
KD *kd): P(s, kd), vh_(vh) {
}
void process(const typename KD::Simulator::Time&) {
void process() {
P::kdel_->pop(vh_);
}
@ -130,7 +130,7 @@ public:
KD *kd): P(s,k, c, kd), dir_(dir) {
}
void process(const typename KD::Simulator::Time&) {
void process() {
P::kdel_->move(P::k_, P::cell_, dir_);
}
@ -172,7 +172,7 @@ public:
KD *kd): P(s,k, c, kd) {
}
void process(const typename KD::Simulator::Time&) {
void process() {
P::kdel_->push(P::k_, P::cell_);
}

View File

@ -314,7 +314,7 @@ class Swap_event
public:
Swap_event(Id o, Sort* sorter,
const Solver &s): left_object_(o), sorter_(sorter), s_(s){}
void process(const typename Solver::Time &) {
void process() {
sorter_->swap(left_object_, s_);
}
Id left_object_; Sort* sorter_; Solver s_;

View File

@ -72,7 +72,7 @@ public:
}
virtual void write(std::ostream &out) const =0;
virtual void process(const Priority &t) =0;
virtual void process() =0;
bool operator<(const This &o) const
{
@ -111,7 +111,7 @@ public:
Two_list_event_queue_dummy_item(){}
Two_list_event_queue_dummy_item(const Two_list_event_queue_dummy_item &):
Two_list_event_queue_item<Priority>(){}
virtual void process(const Priority &) {
virtual void process() {
std::cerr << "Trying to process a NULL event.\n";
CGAL_assertion(0);
}
@ -142,8 +142,8 @@ public:
{
out << event_ << " at " << P::time();
}
virtual void process(const Priority &t) {
event_.process(t);
virtual void process() {
event_.process();
}
// Access the actual event
const Event &event() const
@ -505,7 +505,7 @@ public:
front_.pop_front();
CGAL_expensive_postcondition(audit());
if (front_.empty() && !back_.empty()) grow_front();
i->process(i->time());
i->process();
if (!front_.empty() && i->time() == front_.front().time()) {
CGAL_KINETIC_LOG(LOG_SOME, "Degeneracy at time "

View File

@ -53,7 +53,7 @@ public:
Delaunay_event_base_3() {
}
void process(const typename Root_stack::Time&) {
void process() {
// for some reason VC insists that this be there
CGAL_assertion(0 && "Process called in Delaunay_event_base_3");
}
@ -91,7 +91,7 @@ public:
d_= edge_point(e_,1);
#endif
}
void process(const typename Root_stack::Time&) {
void process() {
P::kdel_->flip(e_);
}
@ -142,7 +142,7 @@ public:
c_= vertex_of_facet(e_,2)->point();
#endif
}
void process(const typename Root_stack::Time&) {
void process() {
P::kdel_->flip(e_);
}
void write(std::ostream &out) const

View File

@ -25,13 +25,13 @@ struct Test_event
Test_event(){}
void process(const Time& t) {
if (tt_->expected_next_event_time() != t) {
void process() {
if (tt_->expected_next_event_time() != tt_->current_time()) {
std::cerr << "ERROR Wrong event occurred. Expecting time " << tt_->expected_next_event_time()
<< " got time " << t << std::endl;
<< " got time " << tt_->current_time() << std::endl;
}
if (t != t_) {
std::cerr << "ERROR Event occured at wrong time. Expecting time " << t_ << " got time " << t << std::endl;
if (tt_->current_time() != t_) {
std::cerr << "ERROR Event occured at wrong time. Expecting time " << t_ << " got time " << tt_->current_time() << std::endl;
}
tt_->process_one_event();
}
@ -75,6 +75,12 @@ struct Test
}
}
Time current_time() const
{
return sim->current_time();
}
void process_one_event() {
if (!time_map.empty()) {
event_map.erase(time_map.begin()->second);