Data Structures | |
| struct | IntegratorLookupStruct |
| struct | IntegratorReporterStruct |
| struct | IntegratorInternalsStruct |
| struct | IntegratorSystemStruct |
| struct | SampleList_struct |
Defines | |
| #define | IDA_OPTIONAL |
| #define | INTEG_LIST |
Typedefs | |
| typedef IntegratorLookupStruct | IntegratorLookup |
| typedef int | IntegratorOutputInitFn (struct IntegratorSystemStruct *) |
| typedef int | IntegratorOutputWriteFn (struct IntegratorSystemStruct *) |
| typedef int | IntegratorOutputWriteObsFn (struct IntegratorSystemStruct *) |
| typedef int | IntegratorOutputCloseFn (struct IntegratorSystemStruct *) |
| typedef IntegratorReporterStruct | IntegratorReporter |
| typedef void | IntegratorCreateFn (struct IntegratorSystemStruct *blsys) |
| typedef int | IntegratorParamsDefaultFn (struct IntegratorSystemStruct *blsys) |
| typedef int | IntegratorAnalyseFn (struct IntegratorSystemStruct *blsys) |
| typedef int | IntegratorSolveFn (struct IntegratorSystemStruct *blsys, unsigned long start_index, unsigned long finish_index) |
| typedef int | IntegratorWriteMatrixFn (const struct IntegratorSystemStruct *blsys, FILE *fp, const char *type) |
| typedef int | IntegratorDebugFn (const struct IntegratorSystemStruct *blsys, FILE *fp) |
| typedef void | IntegratorFreeFn (void *enginedata) |
| typedef IntegratorInternalsStruct | IntegratorInternals |
| typedef IntegratorSystemStruct | IntegratorSystem |
| typedef SampleList_struct | SampleList |
Enumerations | |
| enum | IntegratorEngine { N, INTEG_LIST, INTEG_UNKNOWN } |
Functions | |
| ASC_DLLSPEC IntegratorSystem * | integrator_new (slv_system_t sys, struct Instance *inst) |
| ASC_DLLSPEC int | integrator_analyse (IntegratorSystem *blsys) |
| ASC_DLLSPEC int | integrator_analyse_ode (IntegratorSystem *blsys) |
| ASC_DLLSPEC int | integrator_analyse_dae (IntegratorSystem *blsys) |
| ASC_DLLSPEC int | integrator_solve (IntegratorSystem *blsys, long i0, long i1) |
| ASC_DLLSPEC int | integrator_write_matrix (const IntegratorSystem *blsys, FILE *fp, const char *type) |
| ASC_DLLSPEC int | integrator_debug (const IntegratorSystem *blsys, FILE *fp) |
| ASC_DLLSPEC void | integrator_free (IntegratorSystem *blsys) |
| ASC_DLLSPEC struct gl_list_t * | integrator_get_engines () |
| ASC_DLLSPEC int | integrator_set_engine (IntegratorSystem *blsys, const char *name) |
| ASC_DLLSPEC const IntegratorInternals * | integrator_get_engine (const IntegratorSystem *blsys) |
| ASC_DLLSPEC int | integrator_params_get (const IntegratorSystem *blsys, slv_parameters_t *parameters) |
| ASC_DLLSPEC int | integrator_params_set (IntegratorSystem *blsys, const slv_parameters_t *parameters) |
| ASC_DLLSPEC int | integrator_set_reporter (IntegratorSystem *blsys, IntegratorReporter *r) |
| ASC_DLLSPEC int | integrator_find_indep_var (IntegratorSystem *blsys) |
| ASC_DLLSPEC int | integrator_checkstatus (slv_status_t status) |
| ASC_DLLSPEC void | integrator_set_samples (IntegratorSystem *blsys, SampleList *samples) |
| ASC_DLLSPEC void | integrator_set_stepzero (IntegratorSystem *blsys, double) |
| ASC_DLLSPEC double | integrator_get_stepzero (IntegratorSystem *blsys) |
| ASC_DLLSPEC void | integrator_set_minstep (IntegratorSystem *blsys, double) |
| ASC_DLLSPEC double | integrator_get_minstep (IntegratorSystem *blsys) |
| ASC_DLLSPEC void | integrator_set_maxstep (IntegratorSystem *blsys, double) |
| ASC_DLLSPEC double | integrator_get_maxstep (IntegratorSystem *blsys) |
| ASC_DLLSPEC void | integrator_set_maxsubsteps (IntegratorSystem *blsys, int) |
| ASC_DLLSPEC int | integrator_get_maxsubsteps (IntegratorSystem *blsys) |
| ASC_DLLSPEC long | integrator_getnsamples (IntegratorSystem *blsys) |
| ASC_DLLSPEC long | integrator_getcurrentstep (IntegratorSystem *blsys) |
| ASC_DLLSPEC double | integrator_getsample (IntegratorSystem *blsys, long i) |
| ASC_DLLSPEC void | integrator_setsample (IntegratorSystem *blsys, long i, double val) |
| const dim_type * | integrator_getsampledim (IntegratorSystem *blsys) |
| ASC_DLLSPEC double | integrator_get_t (IntegratorSystem *blsys) |
| ASC_DLLSPEC void | integrator_set_t (IntegratorSystem *blsys, double value) |
| ASC_DLLSPEC double * | integrator_get_y (IntegratorSystem *blsys, double *vector) |
| ASC_DLLSPEC void | integrator_set_y (IntegratorSystem *blsys, double *vector) |
| ASC_DLLSPEC double * | integrator_get_ydot (IntegratorSystem *blsys, double *vector) |
| ASC_DLLSPEC void | integrator_set_ydot (IntegratorSystem *blsys, double *vector) |
| ASC_DLLSPEC double * | integrator_get_observations (IntegratorSystem *blsys, double *vector) |
| ASC_DLLSPEC struct var_variable * | integrator_get_observed_var (IntegratorSystem *blsys, const long i) |
| ASC_DLLSPEC struct var_variable * | integrator_get_independent_var (IntegratorSystem *blsys) |
| ASC_DLLSPEC double * | integrator_get_atol (IntegratorSystem *blsys, double *vector) |
| ASC_DLLSPEC int | integrator_output_init (IntegratorSystem *blsys) |
| ASC_DLLSPEC int | integrator_output_write (IntegratorSystem *blsys) |
| ASC_DLLSPEC int | integrator_output_write_obs (IntegratorSystem *blsys) |
| ASC_DLLSPEC int | integrator_output_close (IntegratorSystem *blsys) |
| ASC_DLLSPEC int | integrator_register (const IntegratorInternals *integ) |
| ASC_DLLSPEC void | samplelist_free (SampleList *) |
| ASC_DLLSPEC SampleList * | samplelist_new (unsigned long n, const dim_type *d) |
| ASC_DLLSPEC int | samplelist_assign (SampleList *l, unsigned long n, double *values, const dim_type *d) |
| ASC_DLLSPEC long | samplelist_length (CONST SampleList *l) |
| ASC_DLLSPEC const dim_type * | samplelist_dim (CONST SampleList *l) |
| ASC_DLLSPEC double | samplelist_get (CONST SampleList *l, CONST long i) |
| ASC_DLLSPEC void | samplelist_set (CONST SampleList *l, CONST long i, CONST double x) |
| void | samplelist_debug (CONST SampleList *l) |
Variables | |
| IntegratorCreateFn | integrator_aww_create |
| IntegratorParamsDefaultFn | integrator_aww_params_default |
| IntegratorAnalyseFn | integrator_aww_analyse |
| IntegratorSolveFn | integrator_aww_solve |
| IntegratorFreeFn | integrator_aww_free |
| const IntegratorInternals | integrator_aww_internals |
| #define INTEG_LIST |
Value:
I(LSODE ,integrator_lsode_internals) \
IDA_OPTIONAL \
S I(AWW ,integrator_aww_internals)
| typedef int IntegratorAnalyseFn(struct IntegratorSystemStruct *blsys) |
Integrators must provide a function like this that will perform system analysis such as identifying derivative and algebraic variables.
| typedef void IntegratorCreateFn(struct IntegratorSystemStruct *blsys) |
Integrators must provide a routine here that allocates the necessary data structures.
| typedef int IntegratorDebugFn(const struct IntegratorSystemStruct *blsys, FILE *fp) |
Write debug info. This will output free text to the specified file. The intention is that this text would be read over by a developer to check that the integrator is doing what is intended. We add it here so that debugging features can accessed from the GUI if desired.
| typedef void IntegratorFreeFn(void *enginedata) |
Integrators must provide a function like this that frees internal data that they have allocated in their 'enginedata' structure.
| typedef int IntegratorOutputCloseFn(struct IntegratorSystemStruct *) |
Finalisation. This hook can be used to terminate recording of observations, close files, terminate GUI status reporting, etc.
| typedef int IntegratorOutputInitFn(struct IntegratorSystemStruct *) |
Initialisation. This hook allows initialisation of the GUI or reporting mechanism to be performed when integration begins
| typedef int IntegratorOutputWriteFn(struct IntegratorSystemStruct *) |
Status report. This hook allows raw data to be output as integration proceeds, or for a GUI to perform status updates. An integrator should check the return status on this one, as this is the suggested way to perform GUI interruption of the integrator.
| typedef int IntegratorOutputWriteObsFn(struct IntegratorSystemStruct *) |
Observation reporting. This hook should be implemented to record observations in a way that can be presented to the use, recorded in a file, etc.
| typedef int IntegratorParamsDefaultFn(struct IntegratorSystemStruct *blsys) |
Integrators must provide a function like this that can be used to retrieve the default set of parameters.
| typedef struct IntegratorReporterStruct IntegratorReporter |
This struct allows arbitrary functions to be used for the reporting of integrator progress.
| typedef int IntegratorSolveFn(struct IntegratorSystemStruct *blsys, unsigned long start_index, unsigned long finish_index) |
Integrators must provide a function like this that actually runs the integration.
| typedef int IntegratorWriteMatrixFn(const struct IntegratorSystemStruct *blsys, FILE *fp, const char *type) |
Write Matrix. This method allows the user to request output of 'a matrix' from the integrator to a file. The type of output can be requested using the type parameter. Check the implementation details of the specific integrator.
| type | type of matrix to be output. For IDA, use 'y' or 'ydot'. NULL will give the default (eg dy/dx for LSODE) | |
| fp | file to which output will be sent (still need to close the file) |
| enum IntegratorEngine |
Struct containin the list of supported integrators
| ASC_DLLSPEC int integrator_analyse | ( | IntegratorSystem * | sys | ) |
Perform whatever additional problem is required so that the system can be integrated as a dynamical system with the IntegrationEngine chosen.
We can always assume that sys->system has had analyse_make_problem called on it, so all the variable lists (etc) will be there already.
| ASC_DLLSPEC int integrator_analyse_dae | ( | IntegratorSystem * | blsys | ) |
see integrator_analyse_ode
| ASC_DLLSPEC int integrator_analyse_ode | ( | IntegratorSystem * | sys | ) |
Analyse the ODE structure. We can assume that the independent variable was already found.
| ASC_DLLSPEC int integrator_checkstatus | ( | slv_status_t | status | ) |
Decode status codes from the integrator, and output them via FPRINTF.
| ASC_DLLSPEC int integrator_debug | ( | const IntegratorSystem * | blsys, | |
| FILE * | fp | |||
| ) |
Output debug info for the present integrator to file handle indicated. What this will be depends on which integrator you are using.
| ASC_DLLSPEC int integrator_find_indep_var | ( | IntegratorSystem * | sys | ) |
Locate the independent variable.
| ASC_DLLSPEC void integrator_free | ( | IntegratorSystem * | sys | ) |
Carefully trash any data in the IntegratorSystem that we own, then destroy the IntegratorSystem struct.
Note that the integrator doesn't own the samplelist.
| sys | will be destroyed and set to NULL. |
| ASC_DLLSPEC double* integrator_get_atol | ( | IntegratorSystem * | sys, | |
| double * | atol | |||
| ) |
Retrieve the values of 'ode_atol' properties of each of y-variables, for use in setting absolute error tolerances for the Integrator.
If the pointer 'atol' is NULL, the necessary space is allocated (and must be freed somewhere else).
| ASC_DLLSPEC const IntegratorInternals* integrator_get_engine | ( | const IntegratorSystem * | sys | ) |
rename this
| ASC_DLLSPEC struct gl_list_t* integrator_get_engines | ( | ) |
Return gl_list of IntegratorInternals. C++ will use this to produce a nice little list of integrator names that can be used in Python :-/
| ASC_DLLSPEC struct var_variable* integrator_get_independent_var | ( | IntegratorSystem * | sys | ) |
| ASC_DLLSPEC double integrator_get_maxstep | ( | IntegratorSystem * | blsys | ) |
Returns the length of the shortest allowable step. or 0.0 if none was set by user.
| ASC_DLLSPEC int integrator_get_maxsubsteps | ( | IntegratorSystem * | blsys | ) |
Returns the most internal steps allowed between two time samples, or 0 if none was set by user.
| ASC_DLLSPEC double integrator_get_minstep | ( | IntegratorSystem * | blsys | ) |
Returns the length of the longest allowable step. or 0.0 if none was set by user.
| ASC_DLLSPEC double* integrator_get_observations | ( | IntegratorSystem * | sys, | |
| double * | obsi | |||
| ) |
This function takes the inst in the solver and returns the vector of observation variables that are located in the submodel d.obs array.
| ASC_DLLSPEC struct var_variable* integrator_get_observed_var | ( | IntegratorSystem * | blsys, | |
| const long | i | |||
| ) |
Returns the var_variable contained in the ith position in the observed variable list.
| ASC_DLLSPEC double integrator_get_stepzero | ( | IntegratorSystem * | blsys | ) |
Returns the length of the initial step user specified, or 0.0 if none was set.
| ASC_DLLSPEC double integrator_get_t | ( | IntegratorSystem * | sys | ) |
Retrieve the value of the independent variable (time) from ASCEND and return it as a double.
| ASC_DLLSPEC double* integrator_get_y | ( | IntegratorSystem * | sys, | |
| double * | y | |||
| ) |
Retrieve the current values of the derivatives of the y-variables and stick them in the/an array that the integrator will use.
If the pointer 'y' is NULL, the necessary space is allocated (and must be freed somewhere else).
| ASC_DLLSPEC double* integrator_get_ydot | ( | IntegratorSystem * | sys, | |
| double * | dydx | |||
| ) |
Send the values of the derivatives of the 'y' variables to the solver. Allocate space for an array if necessary.
Any element in sys->ydot that is NULL will be passed over (the value won't be modified in dydx).
| ASC_DLLSPEC long integrator_getcurrentstep | ( | IntegratorSystem * | blsys | ) |
Returns the current step number (blsys->currentstep). Should be reset to zero inside your solver's integrator_*_solve method.
| ASC_DLLSPEC long integrator_getnsamples | ( | IntegratorSystem * | blsys | ) |
Returns the number of values currently stored in xsamples.
| ASC_DLLSPEC double integrator_getsample | ( | IntegratorSystem * | blsys, | |
| long | i | |||
| ) |
The following functions fetch and set parts with names specific to the type definitions in ivp.lib, the ASCEND initial value problem model file. They are for use by any ivp solver interface. All names are given at the scope of ivp.
Returns the value stored in xsamples[i]. Will whine if if xsample[i] does not exist. No, there is no way to get back the pointer to the xsamples vector.
| const dim_type* integrator_getsampledim | ( | IntegratorSystem * | blsys | ) |
Returns a pointer to the dimensionality of the samples currently stored, or NULL if none are stored. Do not free this pointer: we own it.
| ASC_DLLSPEC IntegratorSystem* integrator_new | ( | slv_system_t | slvsys, | |
| struct Instance * | inst | |||
| ) |
Create a new IntegratorSystem and assign a slv_system_t to it.
| ASC_DLLSPEC int integrator_output_close | ( | IntegratorSystem * | blsys | ) |
This call will close file stream and perhaps perform some kind of user notification or screen update, etc.
| ASC_DLLSPEC int integrator_output_init | ( | IntegratorSystem * | blsys | ) |
This call should be used to get the file streams ready, output column headings etc.
| ASC_DLLSPEC int integrator_output_write | ( | IntegratorSystem * | blsys | ) |
This call should be used to output the immediate integration results from a single timestep. For an ODE solver, this means just the 'y' values but perhaps not the values of the algebraic varaibles, which must be calculated separately. They'll be stored in the Integ_system_t somehow (not yet known how)
| ASC_DLLSPEC int integrator_output_write_obs | ( | IntegratorSystem * | blsys | ) |
Write out the 'observed values' for the integration. In the case of ODE integration, we assume that the values of all the algabraic variables are also now calculated.
| ASC_DLLSPEC int integrator_params_get | ( | const IntegratorSystem * | blsys, | |
| slv_parameters_t * | parameters | |||
| ) |
Copies the current set of Integrator parameters into the indicated parameter set, 'parameters'.
test these, not sure if the memory copy stuff is right or not.
| ASC_DLLSPEC int integrator_params_set | ( | IntegratorSystem * | blsys, | |
| const slv_parameters_t * | parameters | |||
| ) |
Copies the the given parameter set into the Integrator's data structure, which immediately makes the new values available to the integrator engine.
test these, not sure if the memory copy stuff is right or not.
| ASC_DLLSPEC int integrator_set_engine | ( | IntegratorSystem * | blsys, | |
| const char * | name | |||
| ) |
Sets the engine for this integrator. Checks that the integrator can be used on the given system.
tests for applicability of this engine...
| ASC_DLLSPEC int integrator_set_reporter | ( | IntegratorSystem * | blsys, | |
| IntegratorReporter * | r | |||
| ) |
Use this function from your interface to tell the integrator how it needs to make its output. You need to pass in a struct containing the required function pointers. (We will wrap IntegratorReporter and access it from Python, eventually)
| ASC_DLLSPEC void integrator_set_samples | ( | IntegratorSystem * | blsys, | |
| SampleList * | samples | |||
| ) |
Sets values of time samples to the values given (ns of them) and keeps both the dim pointer and vector given. The vector and dimp given may be freed by calling this again, but xsamples owns them until then. If called with ns<1 or values==NULL, will free any previously captured values/dimp. If called with dimp==NULL, will assume WildDimension. Don't call this with a dimp we can't free later. Return is 1 if for some reason we can't set as expected, 0 otherwise.
| ASC_DLLSPEC void integrator_set_t | ( | IntegratorSystem * | sys, | |
| double | value | |||
| ) |
Set the value of the independent variable (time) in ASCEND.
| ASC_DLLSPEC void integrator_set_y | ( | IntegratorSystem * | sys, | |
| double * | y | |||
| ) |
Take the values of the differential variables from the array that the integrator uses, and use them to update the values of the corresponding variables in ASCEND.
| ASC_DLLSPEC void integrator_set_ydot | ( | IntegratorSystem * | blsys, | |
| double * | vector | |||
| ) |
Sets d.dydx[] to values in vector.
| ASC_DLLSPEC void integrator_setsample | ( | IntegratorSystem * | blsys, | |
| long | i, | |||
| double | val | |||
| ) |
Sets the value stored in xsamples[i] to val. Will whine if if xsample[i] does not exist. No, there is no way to get back the pointer to the xsamples vector.
| ASC_DLLSPEC int integrator_solve | ( | IntegratorSystem * | blsys, | |
| long | i0, | |||
| long | i1 | |||
| ) |
Takes the type of integrator and sets up the global variables into the current integration instance.
| ASC_DLLSPEC int integrator_write_matrix | ( | const IntegratorSystem * | blsys, | |
| FILE * | fp, | |||
| const char * | type | |||
| ) |
Output 'the matrix' for the present integrator to file handle indicated. What this will be depends on which integrator you are using.
| ASC_DLLSPEC void samplelist_free | ( | SampleList * | l | ) |
Free memory allocated by a SampleList.
| ASC_DLLSPEC double samplelist_get | ( | CONST SampleList * | l, | |
| CONST long | i | |||
| ) |
Get an element from the samplelist. Value of the index i should be in [0,ns).
| ASC_DLLSPEC SampleList* samplelist_new | ( | unsigned long | n, | |
| const dim_type * | d | |||
| ) |
Create an empty samplelist, and allocate memory for the required number of data points.
1.5.1