Robotran C Documentation
mbs_bader.h
Go to the documentation of this file.
1 
15  #ifndef MBS_BADER_H_INCLUDED
16 #define MBS_BADER_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"
28 typedef struct MbsDirdynBader
29 {
30  int dummy;
31  double *err, *yerr, *ysav, *yseq;
32  double *x, **d;
33 
36 
38  int *indx;
39  double **a, *del, *ytemp, *dfdx, **dfdy;
40 
42  double *c, *fx;
43 
44 
46 
52 void initialize_bader(MbsData *mbs_data, MbsDirdyn *mbs_dd);
53 
63 int loop_bader(double t0, double tf, MbsData *mbs_data, MbsDirdyn *mbs_dd);
64 
70 void finish_bader(MbsData *mbs_data, MbsDirdyn *mbs_dd);
71 
79 void error_bader(MbsData *mbs_data, MbsDirdyn *dd, int err);
80 
81 #endif // MBS_BADER_H_INCLUDED
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
KMAXX
#define KMAXX
Definition: bader.h:30
loop_bader
int loop_bader(double t0, double tf, MbsData *mbs_data, MbsDirdyn *mbs_dd)
Integrate the motion from t0 to tf.
Definition: mbs_bader.c:61
mbs_estim_jac_acc
int mbs_estim_jac_acc(double x, double htry, double y[], double dydx[], int compute_dfdx, double dfdx[], double **dfdy, int n, int(*derivs)(double, double[], double[], MbsData *, MbsDirdyn *), MbsData *s, MbsDirdyn *dd)
Evaluate the Jacobian of a function accelerations using finite difference.
Definition: integrator.c:30
mbs_euler_implicit.h
This header defines global functions for Euler Implicit integrator in C.
useful_functions.h
lubksb_0
void lubksb_0(double **a, int n, int *indx, double b[])
Definition: lubksb.c:31
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
MbsDirdynBader::yerr
double * yerr
Definition: mbs_bader.h:31
mbs_data.h
MbsDirdyn::nState
int nState
size of the state vector
Definition: mbs_dirdyn_struct.h:152
mbs_bader.h
This header defines global functions for Bader integrator in C.
mbs_dirdyn_struct.h
MbsDirdynBader::Freeze_dfdy
double ** Freeze_dfdy
Definition: mbs_bader.h:34
MbsData::nqu
int nqu
Number of independent articulations.
Definition: mbs_data.h:165
error_bader
void error_bader(MbsData *mbs_data, MbsDirdyn *dd, int err)
If an error occurs during time integration, this function prints the error message and call finish_ba...
Definition: mbs_bader.c:204
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
MbsDirdyn::yd
double * yd
Pointers to the derivative vector (dvec_0) of size nState.
Definition: mbs_dirdyn_struct.h:160
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
MbsDirdynBader::ytemp
double * ytemp
Definition: mbs_bader.h:39
MbsDirdynBader::c
double * c
pzextr and rzextr pointors
Definition: mbs_bader.h:42
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
finish_bader
void finish_bader(MbsData *mbs_data, MbsDirdyn *mbs_dd)
Finalize and clear memory allocated for Bader integrator.
Definition: mbs_bader.c:158
mbs_freeze_jac
int mbs_freeze_jac(int freeze_index, int *next_freeze_index, double x, double h, double y[], double dydx[], int compute_dfdx, double dfdx[], double **dfdy, double dydx_freeze[], double dfdx_freeze[], double **dfdy_freeze, int n, int(*derivs)(double, double[], double[], MbsData *, MbsDirdyn *), MbsData *s, MbsDirdyn *mbs_dd)
Freeze the Jacobian of an integrator structure until mbs_dd->options->n_freeze.
Definition: integrator.c:107
MbsDirdynBader::err
double * err
Definition: mbs_bader.h:31
MbsDirdynBader::dummy
int dummy
Definition: mbs_bader.h:30
MBSfun.h
MbsDirdyn::integrator_struct
void * integrator_struct
pointer to store integrator structure
Definition: mbs_dirdyn_struct.h:183
MbsDirdynBader::d
double ** d
Definition: mbs_bader.h:32
ludcmp_0
int ludcmp_0(double **a, int n, int *indx, double *d)
LU decomposition of a matrix with index starting at 0.
Definition: ludcmp.c:82
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
MbsDirdynBader::yseq
double * yseq
Definition: mbs_bader.h:31
user_dirdyn_loop
void user_dirdyn_loop(MbsData *mbs_data, MbsDirdyn *mbs_dd)
user own loop functions
Definition: user_dirdyn.c:46
MbsDirdynBader::indx
int * indx
simpr specific pointors
Definition: mbs_bader.h:38
MbsDirdyn::tsim
double tsim
current simulation time
Definition: mbs_dirdyn_struct.h:149
MbsDirdynBader::dfdy
double ** dfdy
Definition: mbs_bader.h:39
mbs_msg
void mbs_msg(char *msg,...)
Send a message.
Definition: mbs_message.c:76
MbsDirdynBader::Freeze_dfdx
double * Freeze_dfdx
Definition: mbs_bader.h:34
MbsDirdynBader::del
double * del
Definition: mbs_bader.h:39
MbsDirdynOptions::n_freeze
int n_freeze
number of time step when the jacobian is freezed (computed once at the start of the n_freeze time ste...
Definition: mbs_dirdyn_struct.h:134
free_dvec_1
void free_dvec_1(double *vec)
release memory for a vector of doubles, starting at index 1
Definition: mbs_1D_array.c:901
finish_bader
void finish_bader(MbsData *mbs_data, MbsDirdyn *dd)
Finalize and clear memory allocated for Bader integrator.
Definition: mbs_bader.c:158
MbsDirdynOptions::toler
double toler
mixed error tolerances [-], default = 1.0e-3
Definition: mbs_dirdyn_struct.h:127
MbsDirdynBader::dfdx
double * dfdx
Definition: mbs_bader.h:39
error_bader
void error_bader(MbsData *mbs_data, MbsDirdyn *dd, int err)
If an error occurs during time integration, this function prints the error message and call finish_ba...
Definition: mbs_bader.c:204
_MBS_ERR_MOD_SPEC_16
#define _MBS_ERR_MOD_SPEC_16
Generic error number Module specific errors range from -11 to -19 please read the error message a...
Definition: mbs_errors_names.h:192
nrfct.h
bader.h
This header defines function for bader integrators in C. based on an external source.
MbsDirdynBader::fx
double * fx
Definition: mbs_bader.h:42
MbsDirdynBader::Freeze_dydx
double * Freeze_dydx
Definition: mbs_bader.h:34
initialize_bader
void initialize_bader(MbsData *mbs_data, MbsDirdyn *mbs_dd)
Initialize all needed fields in MbsDirdyn for Bader integrator.
Definition: mbs_bader.c:23
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
mbs_message.h
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
bader
int bader(double y[], double dydx[], int nv, double *xx, double htry, double eps, double yscal[], double *hdid, double *hnext, double h_max, int(*derivs)(double, double[], double[], MbsData *, MbsDirdyn *), MbsData *s, MbsDirdyn *dd)
Semi - implicit extrapolation step for integrating stiffo.d.e.
Definition: bader.c:31
DIRDYN_INTEGRATOR_WAYPOINT_TIME_ERROR_max
#define DIRDYN_INTEGRATOR_WAYPOINT_TIME_ERROR_max
Definition: mbs_dirdyn_struct.h:32
MbsDirdynBader::x
double * x
Definition: mbs_bader.h:32
MbsDirdynOptions
Structure defining the option of a direct dynamic.
Definition: mbs_dirdyn_struct.h:38
euler_implicit
int euler_implicit(double y[], double dydx[], int n, double *x, double h, double yout[], int(*derivs)(double, double[], double[], MbsData *, MbsDirdyn *), MbsData *s, MbsDirdyn *mbs_dd)
Euler Implicit integrator implementation.
Definition: euler_implicit.c:27
integrator.h
This header defines specific integrators functions in C.
MbsDirdynBader::a
double ** a
Definition: mbs_bader.h:39
MbsData::flag_stop
int flag_stop
stop the simulation. For dirdyn, equil, invdyn and solvekin only.
Definition: mbs_data.h:298
get_dvec_1
double * get_dvec_1(int l_v)
create (with memory allocation) a vector (length l_v) of doubles, starting at index 1
Definition: mbs_1D_array.c:885
MbsDirdynBader::Freeze_jacobian_index
int Freeze_jacobian_index
Definition: mbs_bader.h:35
free_dmat_1
void free_dmat_1(double **mat)
release memory for a matrix of doubles, starting at index 1
Definition: mbs_matrix.c:301
copy_dvec_0
void copy_dvec_0(double *vec_src, double *vec_dest, int l_v)
Copy the content of a vector (of sizel_v) of doubles to a second vector, starting with index 0.
Definition: mbs_1D_array.c:906
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
loop_bader
int loop_bader(double t0, double tf, MbsData *mbs_data, MbsDirdyn *mbs_dd)
Integrate the motion from t0 to tf.
Definition: mbs_bader.c:61
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
get_dmat_1
double ** get_dmat_1(int nb_r, int nb_c)
create (with memory allocation) a [nb_r times nb_c] matrix of doubles, starting at index 1
Definition: mbs_matrix.c:255
initialize_bader
void initialize_bader(MbsData *mbs_data, MbsDirdyn *mbs_dd)
Initialize all needed fields in MbsDirdyn for Bader integrator.
Definition: mbs_bader.c:23
MbsDirdyn
General structure of the direct dynamic module.
Definition: mbs_dirdyn_struct.h:144
MbsDirdynBader::ysav
double * ysav
Definition: mbs_bader.h:31
MbsDirdynEulerIm
Euler Implicit structure for dirdyn.
Definition: mbs_euler_implicit.h:31
MbsDirdynBader
bader structure for dirdyn
Definition: mbs_bader.h:28
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
mbs_errors_names.h