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_project_interface.h"
19 
23 typedef struct MbsDirdynRosenbrock
24 {
25  int flag_save;
26 
27  double solout_last_t;
28 
29  double *dydt_save;
30 
31  int *indx;
32  double **a, *dfdx, **dfdy, *dysav, *err;
33  double *g1, *g2, *g3, *g4, *ysav;
34 
37 
38  int(*derivs)(double, double[], double[], MbsData *, MbsDirdyn *);
40  void (*loop_fct)(MbsData *, MbsDirdyn *);
42  int (*save_realtime_update)(MbsDirdyn* dd, MbsData* mbs_data);
43 
45 
53 void initialize_rosenbrock(MbsData *mbs_data, MbsDirdyn *mbs_dd,
54  int (*derivs)(double, double[], double[], MbsData *, MbsDirdyn *),
55  void (*loop_fct)(MbsData *, MbsDirdyn *),
56  int (*save_realtime_update)(MbsDirdyn* dd, MbsData* mbs_data));
57 
67 int loop_rosenbrock(double t0, double tf, MbsData *mbs_data, MbsDirdyn *mbs_dd);
68 
74 void finish_rosenbrock(MbsData *mbs_data, MbsDirdyn *mbs_dd);
75 
83 void error_rosenbrock(MbsData *mbs_data, MbsDirdyn *dd, int err);
84 
85 #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:27
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:118
MbsDirdynRosenbrock::derivs
int(* derivs)(double, double[], double[], MbsData *, MbsDirdyn *)
The function computing the derivative of the system.
Definition: mbs_rosenbrock.h:38
mbs_msg
void mbs_msg(const char *msg,...)
Send a message.
Definition: mbs_message.c:87
MbsDirdynRosenbrock::indx
int * indx
Definition: mbs_rosenbrock.h:31
MbsDirdynRosenbrock::ysav
double * ysav
Definition: mbs_rosenbrock.h:33
MbsDirdynRosenbrock::loop_fct
void(* loop_fct)(MbsData *, MbsDirdyn *)
The function to be called at the end of each time step, or waypoints.
Definition: mbs_rosenbrock.h:40
MbsData::tsim
double tsim
The time value.
Definition: mbs_data.h:305
MbsDirdyn::y
double * y
Pointer to the state vector, this is a dvec_0 of size nState.
Definition: mbs_dirdyn_struct.h:175
MbsDirdynRosenbrock::dydt_save
double * dydt_save
save dydt of the last time step
Definition: mbs_rosenbrock.h:29
MbsDirdyn::nState
int nState
size of the state vector
Definition: mbs_dirdyn_struct.h:174
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:955
MbsDirdynRosenbrock::flag_save
int flag_save
1 if first dydt save done, 0 otherwise
Definition: mbs_rosenbrock.h:25
MbsDirdynOptions::dt_max
double dt_max
maximal time step [s], default = 1.0e-3
Definition: mbs_dirdyn_struct.h:136
MbsDirdyn::yd
double * yd
Pointers to the derivative vector (dvec_0) of size nState.
Definition: mbs_dirdyn_struct.h:182
MbsDirdynRosenbrock::Freeze_dydx
double * Freeze_dydx
Definition: mbs_rosenbrock.h:35
mbs_project_interface.h
Declaration of functions that are project dependent.
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:490
MbsDirdynOptions::nmax
int nmax
maximal number of steps [-], default = 1e9
Definition: mbs_dirdyn_struct.h:132
MbsDirdynRosenbrock::Freeze_dfdx
double * Freeze_dfdx
Definition: mbs_rosenbrock.h:35
free_dmat_0
void free_dmat_0(double **mat)
release memory for a matrix of doubles, starting at index 0
Definition: mbs_matrix.c:332
mbs_matrix.h
mbs_warning_msg
void mbs_warning_msg(const char *msg,...)
Send a warning message.
Definition: mbs_message.c:100
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:74
initialize_rosenbrock
void initialize_rosenbrock(MbsData *mbs_data, MbsDirdyn *mbs_dd, int(*derivs)(double, double[], double[], MbsData *, MbsDirdyn *), void(*loop_fct)(MbsData *, MbsDirdyn *), int(*save_realtime_update)(MbsDirdyn *dd, MbsData *mbs_data))
Initialize all needed fields in MbsDirdyn for Rosenbrock integrator.
Definition: mbs_rosenbrock.c:31
mbs_1D_array.h
MbsDirdyn::integrator_struct
void * integrator_struct
pointer to store integrator structure
Definition: mbs_dirdyn_struct.h:205
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:277
MbsDirdynOptions::dt0
double dt0
initial value of the integration step size, default = 0.001
Definition: mbs_dirdyn_struct.h:45
MbsDirdyn::tsim
double tsim
current simulation time
Definition: mbs_dirdyn_struct.h:171
MbsDirdynRosenbrock
Rosenbrock integration structure for dirdyn.
Definition: mbs_rosenbrock.h:23
MbsDirdynRosenbrock::a
double ** a
Definition: mbs_rosenbrock.h:32
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:198
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:198
MbsDirdynRosenbrock::g3
double * g3
Definition: mbs_rosenbrock.h:33
MbsDirdynRosenbrock::Freeze_dfdy
double ** Freeze_dfdy
Definition: mbs_rosenbrock.h:35
MbsDirdynRosenbrock::g4
double * g4
Definition: mbs_rosenbrock.h:33
MbsDirdynOptions::toler
double toler
mixed error tolerances [-], default = 1.0e-3
Definition: mbs_dirdyn_struct.h:133
finish_rosenbrock
void finish_rosenbrock(MbsData *mbs_data, MbsDirdyn *dd)
Finalize and clear memory allocated for Rosenbrock integrator.
Definition: mbs_rosenbrock.c:158
MbsDirdynRosenbrock::save_realtime_update
int(* save_realtime_update)(MbsDirdyn *dd, MbsData *mbs_data)
Definition: mbs_rosenbrock.h:42
MbsDirdynRosenbrock::dfdy
double ** dfdy
Definition: mbs_rosenbrock.h:32
MbsDirdynRosenbrock::dfdx
double * dfdx
Definition: mbs_rosenbrock.h:32
MbsDirdynRosenbrock::err
double * err
Definition: mbs_rosenbrock.h:32
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:1252
MbsDirdynRosenbrock::Freeze_jacobian_index
int Freeze_jacobian_index
Definition: mbs_rosenbrock.h:36
mbs_message.h
MbsDirdynRosenbrock::g2
double * g2
Definition: mbs_rosenbrock.h:33
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:474
MbsData
Definition: mbs_data.h:246
DIRDYN_INTEGRATOR_WAYPOINT_TIME_ERROR_max
#define DIRDYN_INTEGRATOR_WAYPOINT_TIME_ERROR_max
Definition: mbs_dirdyn_struct.h:32
finish_rosenbrock
void finish_rosenbrock(MbsData *mbs_data, MbsDirdyn *mbs_dd)
Finalize and clear memory allocated for Rosenbrock integrator.
Definition: mbs_rosenbrock.c:158
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:74
initialize_rosenbrock
void initialize_rosenbrock(MbsData *mbs_data, MbsDirdyn *mbs_dd, int(*derivs)(double, double[], double[], MbsData *, MbsDirdyn *), void(*loop_fct)(MbsData *, MbsDirdyn *), int(*save_realtime_update)(MbsDirdyn *dd, MbsData *mbs_data))
Initialize all needed fields in MbsDirdyn for Rosenbrock integrator.
Definition: mbs_rosenbrock.c:31
MbsData::flag_stop
int flag_stop
stop the simulation. For dirdyn, equil, invdyn and solvekin only.
Definition: mbs_data.h:397
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:971
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:128
MbsDirdyn
General structure of the direct dynamic module.
Definition: mbs_dirdyn_struct.h:166
MbsDirdynRosenbrock::dysav
double * dysav
Definition: mbs_rosenbrock.h:32
MbsDirdynRosenbrock::g1
double * g1
Definition: mbs_rosenbrock.h:33
MbsDirdyn::options
MbsDirdynOptions * options
structure defining the option of a direct dynamic
Definition: mbs_dirdyn_struct.h:168
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:105