CpgMonitor

CpgMonitor — Property value monitor

Synopsis


#include <cpg-network/cpg-monitor.h>

                    CpgMonitor;
CpgMonitor *        cpg_monitor_new                     (CpgNetwork *network,
                                                         CpgObject *object,
                                                         const gchar *property_name);
const gdouble *     cpg_monitor_get_sites               (CpgMonitor *monitor,
                                                         guint *size);
const gdouble *     cpg_monitor_get_data                (CpgMonitor *monitor,
                                                         guint *size);
gboolean            cpg_monitor_get_data_resampled      (CpgMonitor *monitor,
                                                         const gdouble *sites,
                                                         guint size,
                                                         gdouble *ret);
CpgObject *         cpg_monitor_get_object              (CpgMonitor *monitor);
CpgProperty *       cpg_monitor_get_property            (CpgMonitor *monitor);

Description

A CpgMonitor can be used to monitor the value of a certain CpgProperty while simulating. The monitor will collect the value of the property at each simulation step and provides methods to access these values. Particularly useful is cpg_monitor_get_data_resampled which retrieves the data resampled at specific times.

Details

CpgMonitor

typedef struct _CpgMonitor CpgMonitor;


cpg_monitor_new ()

CpgMonitor *        cpg_monitor_new                     (CpgNetwork *network,
                                                         CpgObject *object,
                                                         const gchar *property_name);

Create a new monitor for monitoring property property_name of object object in the network network. The monitor will attach itself to the life time of the network and object.

network :

a CpgNetwork

object :

a CpgObject

property_name :

a property name

Returns :

a new CpgMonitor

cpg_monitor_get_sites ()

const gdouble *     cpg_monitor_get_sites               (CpgMonitor *monitor,
                                                         guint *size);

Returns the data sites as monitored during the simulation. See also cpg_monitor_get_data_resampled for retrieving a resampled version of the monitor data

monitor :

a CpgMonitor

size :

return value for number of values

Returns :

internal array of monitored sites. The pointer should not be freed

cpg_monitor_get_data ()

const gdouble *     cpg_monitor_get_data                (CpgMonitor *monitor,
                                                         guint *size);

Returns the data as monitored during the simulation. See also cpg_monitor_get_data_resampled for retrieving a resampled version of the monitor data

monitor :

a CpgMonitor

size :

return value for number of values

Returns :

internal array of monitored values. The pointer should not be freed

cpg_monitor_get_data_resampled ()

gboolean            cpg_monitor_get_data_resampled      (CpgMonitor *monitor,
                                                         const gdouble *sites,
                                                         guint size,
                                                         gdouble *ret);

Returns the data as monitored during the simulation, but resampled at specific data sites. ret will have to be already allocated and large enough to hold size values.

monitor :

a CpgMonitor

sites :

the data sites at which to resample the data

size :

the size of the data sites array

ret :

the return location for the resampled data

Returns :

TRUE if ret was successfully filled with data, FALSE otherwise

cpg_monitor_get_object ()

CpgObject *         cpg_monitor_get_object              (CpgMonitor *monitor);

Returns the object from which a property is being monitored.

monitor :

a CpgMonitor

Returns :

a pointer to the CpgObject

cpg_monitor_get_property ()

CpgProperty *       cpg_monitor_get_property            (CpgMonitor *monitor);

Returns the property which is being monitored.

monitor :

a CpgMonitor

Returns :

a pointer to the CpgProperty