The queue data structure

In each minor step we need to generate a list of all possible events. For this we define an abstract data type, queue>:
struct QUEUE
{
       double          rate;
       struct SITE    *target;
       int             action;
}              *queue;

target points to a site.

action is an code for what happens to the site

In action we use the following encoding:

rate is the rate of the event.

At the startup the queue-array is allocated large enough to guarantee that it cannot overflow. The current number of entries in queue is stored in the variable last.

The variable tsum accumulates the length of the minor timesteps.

tstep is the desired length of the major timestep. The simulation performs minor timesteps until tsum just exceeds tstep.


Source
Start
Back
Author Per Stoltze stoltze@fysik.dtu.dk