[Developers] automatic notification of parameter steering requests
Thomas Radke
tradke at aei.mpg.de
Mon Sep 18 09:40:50 CDT 2006
Hi,
making a parameter steerable during runtime currently requires a thorn
writer to add extra logic to the code which periodically checks if the
parameter has changed, and takes appropriate action in that case. It
would be good if interested thorns could be notified automatically when
a parameter gets steered.
I propose to add a new flesh function CCTK_ParameterSetNotify() to let
thorns register a callback function which in turn is automatically
invoked by CCTK_ParameterSet() whenever a parameter is being steered.
Each callback function gets passed the triple of thorn name, parameter
name, and (stringified) new parameter value as passed to
CCTK_ParameterSet(), plus an optional callback data pointer defined by
the user at registration time. When a callback function is registered
with CCTK_ParameterSetNotify(), the calling routine may also pass an
optional regular expression string for both a thorn name and a parameter
name to match against in a parameter set notification; leave them empty
or pass a NULL pointer to get notified about changes of _any_ parameter.
Registered notification callbacks would be invoked by
CCTK_ParameterSet() only _after_ initial parameter setup from the
parfile, and - in case of recovery - only _after_ all parameters have
been restored from the checkpoint file. The callbacks are then invoked
just _before_ the parameter is set to its new value so that they can
still query its old value if necessary.
The C prototype would look like this:
int CCTK_ParameterSetNotify (void (callback) (CCTK_POINTER cb_data,
CCTK_STRING thorn,
CCTK_STRING parameter,
CCTK_STRING new_value),
CCTK_POINTER cb_data,
CCTK_STRING thorn_regex,
CCTK_STRING parameter_regex);
Comments, suggestions ?
--
Cheers, Thomas.
More information about the Developers
mailing list