CpgIntegrator

CpgIntegrator — Simulation integrator

Synopsis

#define             CPG_INTEGRATOR_CONST                (obj)
struct              CpgIntegrator;
struct              CpgIntegratorClass;
CpgIntegratorState * cpg_integrator_get_state           (CpgIntegrator *integrator);
void                cpg_integrator_set_state            (CpgIntegrator *integrator,
                                                         CpgIntegratorState *state);
void                cpg_integrator_run                  (CpgIntegrator *integrator,
                                                         gdouble from,
                                                         gdouble timestep,
                                                         gdouble to);
gdouble             cpg_integrator_step                 (CpgIntegrator *integrator,
                                                         gdouble t,
                                                         gdouble timestep);
gboolean            cpg_integrator_step_prepare         (CpgIntegrator *integrator,
                                                         gdouble t,
                                                         gdouble timestep);
void                cpg_integrator_evaluate             (CpgIntegrator *integrator,
                                                         gdouble t,
                                                         gdouble timestep);
void                cpg_integrator_reset                (CpgIntegrator *integrator);
const gchar *       cpg_integrator_get_name             (CpgIntegrator *integrator);
gdouble             cpg_integrator_get_time             (CpgIntegrator *integrator);
void                cpg_integrator_set_time             (CpgIntegrator *integrator,
                                                         gdouble t);
CpgObject *         cpg_integrator_get_object           (CpgIntegrator *integrator);
                    CpgIntegratorPrivate;

Object Hierarchy

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

Implemented Interfaces

CpgIntegrator implements CpgUsable, CpgAnnotatable, CpgLayoutable and CpgTaggable.

Properties

  "object"                   CpgObject*            : Read / Write
  "state"                    CpgIntegratorState*   : Read
  "time"                     gdouble               : Read

Signals

  "begin"                                          : Run Last
  "end"                                            : Run Last
  "step"                                           : Run Last
  "step-prepare"                                   : Run Last

Description

CpgIntegrator is a base class for implementing different integration methods.

Details

CPG_INTEGRATOR_CONST()

#define CPG_INTEGRATOR_CONST(obj)      (G_TYPE_CHECK_INSTANCE_CAST ((obj), CPG_TYPE_INTEGRATOR, CpgIntegrator const))


struct CpgIntegrator

struct CpgIntegrator;


struct CpgIntegratorClass

struct CpgIntegratorClass {
	void         (*run)          (CpgIntegrator *integrator,
	                              gdouble        from,
	                              gdouble        timestep,
	                              gdouble        to);

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

	gboolean     (*step_prepare) (CpgIntegrator *integrator,
	                              gdouble        t,
	                              gdouble        timestep);

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

	void         (*reset)        (CpgIntegrator *integrator);

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

The CpgIntegrator class

run ()

run virtual function

step ()

step virtual function

step_prepare ()

get_name ()

get_name virtual function

reset ()

reset virtual function

const gchar *integrator_id;

the integrator id

cpg_integrator_get_state ()

CpgIntegratorState * cpg_integrator_get_state           (CpgIntegrator *integrator);

Get the integrator state.

integrator :

A CpgIntegrator

Returns :

A CpgIntegratorState. [transfer none]

cpg_integrator_set_state ()

void                cpg_integrator_set_state            (CpgIntegrator *integrator,
                                                         CpgIntegratorState *state);

Set the integrator state. You should normally not need to use this function.

integrator :

A CpgIntegrator

state :

A CpgIntegratorState

cpg_integrator_run ()

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

Integrate the object for a certain period of time.

integrator :

A CpgIntegrator

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,
                                                         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

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_step_prepare ()

gboolean            cpg_integrator_step_prepare         (CpgIntegrator *integrator,
                                                         gdouble t,
                                                         gdouble timestep);


cpg_integrator_evaluate ()

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

Evaluate the system of equations comprising the object. 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

t :

The time at which to evaluate the object

timestep :

The timestep with which the current step is evaluating

cpg_integrator_reset ()

void                cpg_integrator_reset                (CpgIntegrator *integrator);

Reset the integrator. This is usually called from cpg_object_reset on the main network.

integrator :

A CpgIntegrator

cpg_integrator_get_name ()

const gchar *       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 object is being integrated.

integrator :

A CpgIntegrator

Returns :

the current integration time

cpg_integrator_set_time ()

void                cpg_integrator_set_time             (CpgIntegrator *integrator,
                                                         gdouble t);


cpg_integrator_get_object ()

CpgObject *         cpg_integrator_get_object           (CpgIntegrator *integrator);

Get the object associated with the integrator.

integrator :

A CpgIntegrator

Returns :

A CpgObject. [transfer none]

CpgIntegratorPrivate

typedef struct _CpgIntegratorPrivate CpgIntegratorPrivate;

Property Details

The "object" property

  "object"                   CpgObject*            : Read / Write

The object to integrate


The "state" property

  "state"                    CpgIntegratorState*   : Read

State.


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 *object,
                                                        gdouble        from,
                                                        gdouble        timestep,
                                                        gdouble        to,
                                                        gpointer       user_data)      : Run Last

Emitted before running an integration of several steps

object :

the integrator

from :

from where to start the simulation

timestep :

the desired timestep

to :

to where to simulate

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 *object,
                                                        gdouble        timestep,
                                                        gdouble        time,
                                                        gpointer       user_data)      : Run Last

Emitted when an integrator step has been performed

object :

the integrator

timestep :

the timestep

time :

the elapsed time

user_data :

user data set when the signal handler was connected.

The "step-prepare" signal

void                user_function                      (CpgIntegrator *cpgintegrator,
                                                        gdouble        arg1,
                                                        gdouble        arg2,
                                                        gpointer       user_data)          : Run Last

cpgintegrator :

the object which received the signal.

user_data :

user data set when the signal handler was connected.