Generic event

Name

Generic event -- Any action to be performed at a given time

Synopsis


#include <gfs.h>


#define     GFS_EVENT_CLASS                 (klass)
#define     GFS_EVENT                       (obj)
#define     GFS_IS_EVENT                    (obj)

            GfsEventClass;
            GfsEvent;

GfsEventClass* gfs_event_class              (void);
GfsEvent*   gfs_event_new                   (GfsEventClass *klass);
void        gfs_event_set                   (GfsEvent *e,
                                             gdouble start,
                                             gdouble end,
                                             gdouble step,
                                             gint istart,
                                             gint iend,
                                             gint istep);
#define     gfs_event_is_repetitive         (e)

Description

Events are used to control any action which needs to be performed at a given time during a simulation. This includes one off actions as well as periodically repeated actions.

The syntax in parameter files is as follows:

GfsEvent { start = 0.1 istart = 10 ( step = 1.2 | istep = 10 ) end = 0.4 iend = 123 }

with

startPhysical starting time (default is zero). The end keyword can be used to indicate the end of the simulation.
istartTime step starting time (default is zero).
stepRepeat every step physical time units (default is infinity).
istepRepeat every istep time steps (default is infinity).
endStop at or before this physical time (default is infinity).
iendStop at or before this number of time steps (default is infinity).

Details

GFS_EVENT_CLASS()

#define     GFS_EVENT_CLASS(klass)

klass :


GFS_EVENT()

#define     GFS_EVENT(obj)

obj :


GFS_IS_EVENT()

#define     GFS_IS_EVENT(obj)

obj :


GfsEventClass

typedef struct {
  GtsSListContaineeClass parent_class;

  gboolean (* event)      (GfsEvent * event, GfsSimulation * sim);
  void     (* post_event) (GfsEvent * event, GfsSimulation * sim);
  void     (* event_half) (GfsEvent * event, GfsSimulation * sim);
} GfsEventClass;


GfsEvent

typedef struct {
  GtsSListContainee parent;

  gdouble t, start, end, step;
  guint i, istart, iend, istep;
  
  guint n;
  gboolean end_event, realised;
} GfsEvent;


gfs_event_class ()

GfsEventClass* gfs_event_class              (void);

Returns :


gfs_event_new ()

GfsEvent*   gfs_event_new                   (GfsEventClass *klass);

klass :

Returns :


gfs_event_set ()

void        gfs_event_set                   (GfsEvent *e,
                                             gdouble start,
                                             gdouble end,
                                             gdouble step,
                                             gint istart,
                                             gint iend,
                                             gint istep);

Sets the properties of event e.

If any of the arguments is negative, the corresponding value in e is unchanged.

e :

a GfsEvent.

start :

start time.

end :

end time.

step :

time step.

istart :

start iteration.

iend :

end iteration.

istep :

iteration step.


gfs_event_is_repetitive()

#define         gfs_event_is_repetitive(e) ((e)->step < G_MAXDOUBLE || (e)->istep < G_MAXINT)

e :