Robotran C Documentation
mbs_rosenbrock.h
Go to the documentation of this file.
1 
15  #ifndef MBS_ROSENBROCK_H_INCLUDED
16 #define MBS_ROSENBROCK_H_INCLUDED
17 
18 #include "mbs_data.h"
19 #include "integrator.h"
20 #include "mbs_dirdyn.h"
21 #include "useful_functions.h"
22 #include "mbs_dirdyn_struct.h"
23 #include "mbs_project_interface.h"
24 #include "MBSfun.h"
25 
29 typedef struct MbsDirdynRosenbrock
30 {
31  int flag_save;
32 
33  double solout_last_t;
34 
35  double *dydt_save;
36 
37  int *indx;
38  double **a, *dfdx, **dfdy, *dysav, *err;
39  double *g1, *g2, *g3, *g4, *ysav;
40 
43 
45 
51 void initialize_rosenbrock(MbsData *mbs_data, MbsDirdyn *mbs_dd);
52 
62 int loop_rosenbrock(double t0, double tf, MbsData *mbs_data, MbsDirdyn *mbs_dd);
63 
69 void finish_rosenbrock(MbsData *mbs_data, MbsDirdyn *mbs_dd);
70 
78 void error_rosenbrock(MbsData *mbs_data, MbsDirdyn *dd, int err);
79 
80 #endif // MBS_ROSENBROCK_H_INCLUDED
MbsDirdynRosenbrock::solout_last_t
double solout_last_t
last time solout was called (0.0 by default)
Definition: mbs_rosenbrock.h:33
MbsDirdynOptions::flag_precise_dynamics
int flag_precise_dynamics
= 1 to call the direct dynamics at the beginning of each time step of integration.
Definition: mbs_dirdyn_struct.h:112
MbsDirdynRosenbrock::indx
int * indx
Definition: mbs_rosenbrock.h:37
MbsDirdynRosenbrock::ysav
double * ysav
Definition: mbs_rosenbrock.h:39
useful_functions.h
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
MbsDirdynRosenbrock::dydt_save
double * dydt_save
save dydt of the last time step
Definition: mbs_rosenbrock.h:35
mbs_data.h
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
MbsDirdynRosenbrock::flag_save
int flag_save
1 if first dydt save done, 0 otherwise
Definition: mbs_rosenbrock.h:31
MbsDirdynOptions::dt_max
double dt_max
maximal time step [s], default = 1.0e-3
Definition: mbs_dirdyn_struct.h:130
MbsDirdyn::yd
double * yd
Pointers to the derivative vector (dvec_0) of size nState.
Definition: mbs_dirdyn_struct.h:160
MbsDirdynRosenbrock::Freeze_dydx
double * Freeze_dydx
Definition: mbs_rosenbrock.h:41
mbs_project_interface.h
free_ivec_0
void free_ivec_0(int *vec)
release memory for a vector of integers, starting with index 0
Definition: mbs_1D_array.c:415
MbsDirdynOptions::nmax
int nmax
maximal number of steps [-], default = 1e9
Definition: mbs_dirdyn_struct.h:126
MbsDirdynRosenbrock::Freeze_dfdx
double * Freeze_dfdx
Definition: mbs_rosenbrock.h:41
free_dmat_0
void free_dmat_0(double **mat)
release memory for a matrix of doubles, starting at index 0
Definition: mbs_matrix.c:293
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
mbs_rosenbrock.h
This header defines global functions for rosenbrock integrator in C.
loop_rosenbrock
int loop_rosenbrock(double t0, double tf, MbsData *mbs_data, MbsDirdyn *mbs_dd)
Integrate the motion from t0 to tf.
Definition: mbs_rosenbrock.c:63
MBSfun.h
MbsDirdyn::integrator_struct
void * integrator_struct
pointer to store integrator structure
Definition: mbs_dirdyn_struct.h:183
get_dmat_0
double ** get_dmat_0(int nb_r, int nb_c)
create (with memory allocation) a [nb_r times nb_c] matrix of doubles, starting at index 0
Definition: mbs_matrix.c:238
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
MbsDirdyn::tsim
double tsim
current simulation time
Definition: mbs_dirdyn_struct.h:149
mbs_msg
void mbs_msg(char *msg,...)
Send a message.
Definition: mbs_message.c:76
MbsDirdynRosenbrock
Rosenbrock integration structure for dirdyn.
Definition: mbs_rosenbrock.h:29
MbsDirdynRosenbrock::a
double ** a
Definition: mbs_rosenbrock.h:38
error_rosenbrock
void error_rosenbrock(MbsData *mbs_data, MbsDirdyn *dd, int err)
If an error occurs during time integration, this function prints the error message and call finish_ro...
Definition: mbs_rosenbrock.c:183
initialize_rosenbrock
void initialize_rosenbrock(MbsData *mbs_data, MbsDirdyn *mbs_dd)
Initialize all needed fields in MbsDirdyn for Rosenbrock integrator.
Definition: mbs_rosenbrock.c:26
error_rosenbrock
void error_rosenbrock(MbsData *mbs_data, MbsDirdyn *dd, int err)
If an error occurs during time integration, this function prints the error message and call finish_ro...
Definition: mbs_rosenbrock.c:183
MbsDirdynRosenbrock::g3
double * g3
Definition: mbs_rosenbrock.h:39
MbsDirdynRosenbrock::Freeze_dfdy
double ** Freeze_dfdy
Definition: mbs_rosenbrock.h:41
initialize_rosenbrock
void initialize_rosenbrock(MbsData *mbs_data, MbsDirdyn *mbs_dd)
Initialize all needed fields in MbsDirdyn for Rosenbrock integrator.
Definition: mbs_rosenbrock.c:26
MbsDirdynRosenbrock::g4
double * g4
Definition: mbs_rosenbrock.h:39
MbsDirdynOptions::toler
double toler
mixed error tolerances [-], default = 1.0e-3
Definition: mbs_dirdyn_struct.h:127
finish_rosenbrock
void finish_rosenbrock(MbsData *mbs_data, MbsDirdyn *dd)
Finalize and clear memory allocated for Rosenbrock integrator.
Definition: mbs_rosenbrock.c:143
MbsDirdynRosenbrock::dfdy
double ** dfdy
Definition: mbs_rosenbrock.h:38
MbsDirdynRosenbrock::dfdx
double * dfdx
Definition: mbs_rosenbrock.h:38
MbsDirdynRosenbrock::err
double * err
Definition: mbs_rosenbrock.h:38
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
MbsDirdynRosenbrock::Freeze_jacobian_index
int Freeze_jacobian_index
Definition: mbs_rosenbrock.h:42
mbs_message.h
MbsDirdynRosenbrock::g2
double * g2
Definition: mbs_rosenbrock.h:39
get_ivec_0
int * get_ivec_0(int l_v)
create (with memory allocation) a vector (length l_v) of integers, starting at index 0
Definition: mbs_1D_array.c:399
MbsData
Definition: mbs_data.h:149
DIRDYN_INTEGRATOR_WAYPOINT_TIME_ERROR_max
#define DIRDYN_INTEGRATOR_WAYPOINT_TIME_ERROR_max
Definition: mbs_dirdyn_struct.h:32
MbsDirdynOptions
Structure defining the option of a direct dynamic.
Definition: mbs_dirdyn_struct.h:38
finish_rosenbrock
void finish_rosenbrock(MbsData *mbs_data, MbsDirdyn *mbs_dd)
Finalize and clear memory allocated for Rosenbrock integrator.
Definition: mbs_rosenbrock.c:143
integrator.h
This header defines specific integrators functions in C.
loop_rosenbrock
int loop_rosenbrock(double t0, double tf, MbsData *mbs_data, MbsDirdyn *mbs_dd)
Integrate the motion from t0 to tf.
Definition: mbs_rosenbrock.c:63
MbsData::flag_stop
int flag_stop
stop the simulation. For dirdyn, equil, invdyn and solvekin only.
Definition: mbs_data.h:298
free_dvec_0
void free_dvec_0(double *vec)
release memory for a vector of doubles, starting at index 0
Definition: mbs_1D_array.c:896
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
MbsDirdyn
General structure of the direct dynamic module.
Definition: mbs_dirdyn_struct.h:144
MbsDirdynRosenbrock::dysav
double * dysav
Definition: mbs_rosenbrock.h:38
MbsDirdynRosenbrock::g1
double * g1
Definition: mbs_rosenbrock.h:39
MbsDirdyn::options
MbsDirdynOptions * options
structure defining the option of a direct dynamic
Definition: mbs_dirdyn_struct.h:146
mbs_warning_msg
void mbs_warning_msg(char *msg,...)
Send a warning message.
Definition: mbs_message.c:89
rosenbrock
int rosenbrock(int n, int(*derivs)(double, double[], double[], MbsData *, MbsDirdyn *), double *x, double y[], double eps, double hmax, double htry, long nmax, double dydx[], double yscal[], double *hnext, MbsData *s, MbsDirdyn *dd, double *hdid)
Fourth-order Rosenbrock step for integrating stiff problems, with monitoring of local truncation erro...
Definition: rosenbrock.c:103