Robotran C Documentation
mbs_dopri5.h
Go to the documentation of this file.
1 
13  #ifndef MBS_DOPRI5_H_INCLUDED
14 #define MBS_DOPRI5_H_INCLUDED
15 
16 
17 #include "mbs_data.h"
18 #include "integrator.h"
19 #include "mbs_dirdyn.h"
20 #include "useful_functions.h"
21 #include "mbs_dirdyn_struct.h"
22 #include "mbs_project_interface.h"
23 #include "dopri5.h"
24 #include "MBSfun.h"
25 #include "mbs_message.h"
26 
30 typedef struct MbsDirdynDopri5
31 {
32  int flag_save;
33 
34  double solout_last_t;
35 
36  double *dydt_save;
37 
38  double **alloc_tab;
39 
41 
42 
48 void initialize_dopri5(MbsData *mbs_data, MbsDirdyn *mbs_dd);
49 
59 int loop_dopri5(double t0, double tf, MbsData *mbs_data, MbsDirdyn *mbs_dd);
60 
66 void finish_dopri5(MbsData *mbs_data, MbsDirdyn *mbs_dd);
67 
80 int fcn_dopri5(unsigned int n, long nr, double tsim, double y[], double dydt[], MbsData *s, MbsDirdyn *mbs_dd);
81 
96 int solout_dopri5(long nr, double tsim_old, double tsim, double y[], unsigned n, int* irtrn, int init_flag, MbsData *s, MbsDirdyn *mbs_dd);
97 
98 
106 void error_dopri5(MbsData *mbs_data, MbsDirdyn *dd, int err);
107 
108 #endif // MBS_DOPRI5_H_INCLUDED
fcn_dopri5
int fcn_dopri5(unsigned int n, long nr, double tsim, double y[], double dydt[], MbsData *s, MbsDirdyn *mbs_dd)
dopri5 derivative function
Definition: mbs_dopri5.c:89
MbsData::dt0
double dt0
Initial value of the integration step size [s]. For dirdyn and invdyn only. This parameter is set fro...
Definition: mbs_data.h:212
useful_functions.h
MbsDirdynDopri5
Dopri5 structure for dirdyn.
Definition: mbs_dopri5.h:30
mbs_dirdyn.h
MbsData::tsim
double tsim
The time value.
Definition: mbs_data.h:208
MbsDirdyn::y
double * y
Pointer to the state vector, this is a dvec_0 of size nState.
Definition: mbs_dirdyn_struct.h:153
DOPRI5_NB_ALLOC_VEC
#define DOPRI5_NB_ALLOC_VEC
number of vectors to allocate for dopri5
Definition: mbs_dirdyn_struct.h:22
mbs_data.h
error_dopri5
void error_dopri5(MbsData *mbs_data, MbsDirdyn *dd, int err)
If an error occurs during time integration, this function prints the error message and call finish_do...
Definition: mbs_dopri5.c:161
MbsDirdyn::nState
int nState
size of the state vector
Definition: mbs_dirdyn_struct.h:152
mbs_dirdyn_struct.h
get_dvec_0
double * get_dvec_0(int l_v)
create (with memory allocation) a vector (length l_v) of doubles, starting at index 0
Definition: mbs_1D_array.c:880
MbsDirdynOptions::dt_max
double dt_max
maximal time step [s], default = 1.0e-3
Definition: mbs_dirdyn_struct.h:130
mbs_project_interface.h
MbsDirdynOptions::nmax
int nmax
maximal number of steps [-], default = 1e9
Definition: mbs_dirdyn_struct.h:126
solout_dopri5
int solout_dopri5(long nr, double tsim_old, double tsim, double y[], unsigned n, int *irtrn, int init_flag, MbsData *s, MbsDirdyn *mbs_dd)
dopri5 simulation own gestion at each succesful step
Definition: mbs_dopri5.c:128
mbs_fct_dirdyn
int mbs_fct_dirdyn(double tsim, double y[], double dydt[], MbsData *s, MbsDirdyn *dd)
direct dynamics derivative computation
Definition: mbs_dirdyn.c:1067
initialize_dopri5
void initialize_dopri5(MbsData *mbs_data, MbsDirdyn *mbs_dd)
Initialize all needed fields in MbsDirdyn for Dopri5 integrator.
Definition: mbs_dopri5.c:20
MBSfun.h
loop_dopri5
int loop_dopri5(double t0, double tf, MbsData *mbs_data, MbsDirdyn *mbs_dd)
Integrate the motion from t0 to tf.
Definition: mbs_dopri5.c:43
MbsDirdyn::integrator_struct
void * integrator_struct
pointer to store integrator structure
Definition: mbs_dirdyn_struct.h:183
dopri5.h
This header defines function for dopri5 in C. based on an external source (see below)
MbsDirdynOptions::dt0
double dt0
initial value of the integration step size, default = 0.001
Definition: mbs_dirdyn_struct.h:45
user_dirdyn_loop
void user_dirdyn_loop(MbsData *mbs_data, MbsDirdyn *mbs_dd)
user own loop functions
Definition: user_dirdyn.c:46
mbs_msg
void mbs_msg(char *msg,...)
Send a message.
Definition: mbs_message.c:76
finish_dopri5
void finish_dopri5(MbsData *mbs_data, MbsDirdyn *mbs_dd)
Finalize and clear memory allocated for dopri5 integrator.
Definition: mbs_dopri5.c:64
initialize_dopri5
void initialize_dopri5(MbsData *mbs_data, MbsDirdyn *mbs_dd)
Initialize all needed fields in MbsDirdyn for Dopri5 integrator.
Definition: mbs_dopri5.c:20
error_dopri5
void error_dopri5(MbsData *mbs_data, MbsDirdyn *dd, int err)
If an error occurs during time integration, this function prints the error message and call finish_do...
Definition: mbs_dopri5.c:161
hout
static double hout
Definition: dopri5.c:30
save_realtime_update
int save_realtime_update(MbsDirdyn *dd, MbsData *mbs_data)
update the real-time and saving modules if requested
Definition: mbs_dirdyn.c:1146
dopri5
int dopri5(unsigned n, FcnEqDiff fcn, double x, double *y, double xend, double *rtoler, double *atoler, int itoler, SolTrait solout, int iout, double uround, double safe, double fac1, double fac2, double beta, double hmax, double h, long nmax, int meth, long nstiff, unsigned nrdens, unsigned *icont, unsigned licont, double **dopri5_alloc_tab, MbsData *s, MbsDirdyn *dd, double *last_h)
See the source file for more informations.
Definition: dopri5.c:530
mbs_message.h
finish_dopri5
void finish_dopri5(MbsData *mbs_data, MbsDirdyn *mbs_dd)
Finalize and clear memory allocated for dopri5 integrator.
Definition: mbs_dopri5.c:64
MbsDirdynDopri5::dydt_save
double * dydt_save
save dydt of the last time step
Definition: mbs_dopri5.h:36
MbsDirdynDopri5::flag_save
int flag_save
1 if first dydt save done, 0 otherwise
Definition: mbs_dopri5.h:32
MbsData
Definition: mbs_data.h:149
MbsDirdynOptions::rtoler
double rtoler
relative error tolerances [-], default = 1.0e-3
Definition: mbs_dirdyn_struct.h:128
MbsDirdynOptions
Structure defining the option of a direct dynamic.
Definition: mbs_dirdyn_struct.h:38
MbsData::t0
double t0
Initial time of the simulation [s]. For dirdyn and invdyn only. This parameter is set from dirdyn/inv...
Definition: mbs_data.h:210
integrator.h
This header defines specific integrators functions in C.
MbsData::flag_stop
int flag_stop
stop the simulation. For dirdyn, equil, invdyn and solvekin only.
Definition: mbs_data.h:298
MbsDirdynDopri5::solout_last_t
double solout_last_t
last time solout was called
Definition: mbs_dopri5.h:34
solout_dopri5
int solout_dopri5(long nr, double tsim_old, double tsim, double y[], unsigned n, int *irtrn, int init_flag, MbsData *s, MbsDirdyn *mbs_dd)
dopri5 simulation own gestion at each succesful step
Definition: mbs_dopri5.c:128
fcn_dopri5
int fcn_dopri5(unsigned int n, long nr, double tsim, double y[], double dydt[], MbsData *s, MbsDirdyn *mbs_dd)
dopri5 derivative function
Definition: mbs_dopri5.c:89
mbs_dopri5.h
MbsDirdynOptions::flag_solout_wp
int flag_solout_wp
1 to call solout only at required waypoints (only if flag_waypoint activated), default = 0
Definition: mbs_dirdyn_struct.h:122
MbsDirdynDopri5::alloc_tab
double ** alloc_tab
allocated state vectors
Definition: mbs_dopri5.h:38
MbsDirdynOptions::atoler
double atoler
absolute error tolerances [-], default = 1.0e-6
Definition: mbs_dirdyn_struct.h:129
MbsDirdyn
General structure of the direct dynamic module.
Definition: mbs_dirdyn_struct.h:144
MbsDirdynOptions::flag_waypoint
int flag_waypoint
1 to use waypoints, 0 otherwise, default =0
Definition: mbs_dirdyn_struct.h:121
loop_dopri5
int loop_dopri5(double t0, double tf, MbsData *mbs_data, MbsDirdyn *mbs_dd)
Integrate the motion from t0 to tf.
Definition: mbs_dopri5.c:43
MbsDirdyn::options
MbsDirdynOptions * options
structure defining the option of a direct dynamic
Definition: mbs_dirdyn_struct.h:146