CpgIntegrator

CpgIntegrator — Simulation integrator

Synopsis

                    CpgIntegratorState;
                    CpgIntegratorClass;
                    CpgIntegrator;
CpgIntegratorState * cpg_integrator_state_new           (CpgProperty *property);
void                cpg_integrator_run                  (CpgIntegrator *integrator,
                                                         GSList *state,
                                                         gdouble from,
                                                         gdouble timestep,
                                                         gdouble to);
gdouble             cpg_integrator_step                 (CpgIntegrator *integrator,
                                                         GSList *state,
                                                         gdouble t,
                                                         gdouble timestep);
void                cpg_integrator_evaluate             (CpgIntegrator *integrator,
                                                         GSList *state,
                                                         gdouble t,
                                                         gdouble timestep);
gchar const			*     cpg_integrator_get_name             (CpgIntegrator *integrator);
gdouble             cpg_integrator_get_time             (CpgIntegrator *integrator);
void                cpg_integrator_reset                (CpgIntegrator *integrator,
                                                         GSList *state);
gdouble             cpg_integrator_state_get_update     (CpgIntegratorState *state);
CpgProperty *       cpg_integrator_state_get_property   (CpgIntegratorState *state);
void                cpg_integrator_state_set_update     (CpgIntegratorState *state,
                                                         gdouble value);
struct _CpgNetwork * cpg_integrator_get_network         (CpgIntegrator *integrator);

Object Hierarchy

  GObject
   +----CpgObject
         +----CpgIntegrator
               +----CpgIntegratorPredictCorrect
               +----CpgIntegratorStub
               +----CpgIntegratorEuler
               +----CpgIntegratorRungeKutta

Properties

  "network"                  CpgNetwork*           : Read / Write
  "time"                     gdouble               : Read

Signals

  "begin"                                          : Run Last
  "end"                                            : Run Last
  "step"                                           : Run Last

Description

CpgIntegrator is a base class for implementing different integration methods.

Details

CpgIntegratorState

typedef struct _CpgIntegratorState CpgIntegratorState;


CpgIntegratorClass

typedef struct {
	CpgObjectClass parent_class;

	/* virtual functions */
	void	(*run)		(CpgIntegrator *integrator,
	                     GSList        *state,
	                     gdouble        from,
	                     gdouble        timestep,
	                     gdouble        to);

	gdouble	(*step)		(CpgIntegrator *integrator,
	                     GSList        *state,
	                     gdouble        t,
	                     gdouble        timestep);

	gchar const *(*get_name)	(CpgIntegrator *integrator);

	void (*reset)        (CpgIntegrator *integrator,
	                      GSList        *state);

	/* private field */
	gchar const *integrator_id;
} CpgIntegratorClass;


CpgIntegrator

typedef struct _CpgIntegrator CpgIntegrator;


cpg_integrator_state_new ()

CpgIntegratorState * cpg_integrator_state_new           (CpgProperty *property);

Create a new integrator state.

property :

A CpgProperty

Returns :

A CpgIntegratorState

cpg_integrator_run ()

void                cpg_integrator_run                  (CpgIntegrator *integrator,
                                                         GSList *state,
                                                         gdouble from,
                                                         gdouble timestep,
                                                         gdouble to);

Integrate the network for a certain period of time.

integrator :

A CpgIntegrator

state :

A GSList of CpgIntegratorState

from :

The time at which to start integrating

timestep :

The timestep to use for integration

to :

The time until which to run the integration

cpg_integrator_step ()

gdouble             cpg_integrator_step                 (CpgIntegrator *integrator,
                                                         GSList *state,
                                                         gdouble t,
                                                         gdouble timestep);

Perform a single integration step. Use cpg_integrator_run if you want to run the integration for a period of time.

integrator :

A CpgIntegrator

state :

A GSList of CpgIntegratorState

t :

The time at which to perform the integration step

timestep :

The timestep with which to perform the integration step

Returns :

The real time step with which the integration was performed

cpg_integrator_evaluate ()

void                cpg_integrator_evaluate             (CpgIntegrator *integrator,
                                                         GSList *state,
                                                         gdouble t,
                                                         gdouble timestep);

Evaluate the system of equations comprising the network. This is a utility function for integrator implementations. Call this function to calculate all the states. After this function completes, the update values for the states can be found (see cpg_integrator_state_get_update)

integrator :

A CpgIntegrator

state :

A GSList of CpgIntegratorState

t :

The time at which to evaluate the network

timestep :

The timestep with which the current step is evaluating

cpg_integrator_get_name ()

gchar const			*     cpg_integrator_get_name             (CpgIntegrator *integrator);

The integrator name.

integrator :

A CpgIntegrator

Returns :

the integrator name

cpg_integrator_get_time ()

gdouble             cpg_integrator_get_time             (CpgIntegrator *integrator);

Get the current time at which the network is being integrated.

integrator :

A CpgIntegrator

Returns :

the current integration time

cpg_integrator_reset ()

void                cpg_integrator_reset                (CpgIntegrator *integrator,
                                                         GSList *state);

Reset the integrator. This is usually called from cpg_network_reset.

integrator :

A CpgIntegrator

state :

A list of CpgIntegratorState

cpg_integrator_state_get_update ()

gdouble             cpg_integrator_state_get_update     (CpgIntegratorState *state);

Get the update value for the state.

state :

A CpgIntegratorState

Returns :

the update value

cpg_integrator_state_get_property ()

CpgProperty *       cpg_integrator_state_get_property   (CpgIntegratorState *state);

Get the CpgProperty for the state.

state :

A CpgIntegratorState

Returns :

A CpgProperty

cpg_integrator_state_set_update ()

void                cpg_integrator_state_set_update     (CpgIntegratorState *state,
                                                         gdouble value);

Set the state update value.

state :

A # CpgIntegratorState

value :

State update value

cpg_integrator_get_network ()

struct _CpgNetwork * cpg_integrator_get_network         (CpgIntegrator *integrator);

Get the network associated with the integrator.

integrator :

A CpgIntegrator

Returns :

A CpgNetwork

Property Details

The "network" property

  "network"                  CpgNetwork*           : Read / Write

The network


The "time" property

  "time"                     gdouble               : Read

The current simulated time

Allowed values: >= 0

Default value: 0

Signal Details

The "begin" signal

void                user_function                      (CpgIntegrator *arg0,
                                                        gpointer       user_data)      : Run Last

Emitted before running an integration of several steps

user_data :

user data set when the signal handler was connected.

The "end" signal

void                user_function                      (CpgIntegrator *arg0,
                                                        gpointer       user_data)      : Run Last

Emitted after running an integration of several steps has finished

user_data :

user data set when the signal handler was connected.

The "step" signal

void                user_function                      (CpgIntegrator *arg0,
                                                        gpointer       user_data)      : Run Last

Emitted when an integrator step has been performed

user_data :

user data set when the signal handler was connected.