Robotran C Documentation
mbs_matrix.h
Go to the documentation of this file.
1 
14 #ifndef mbs_matrix_h
15 #define mbs_matrix_h
16 #include <stdio.h>
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 /*--------------------*/
29 void transpose(double M[4][4], double Mt[4][4]);
30 
39 void matrix_product(double M[4][4], double v[4], double Mv[4]);
40 
51 void matrix_product_0(double **M, double *v, double *Mv, int nr, int nc);
52 
63 void matrix_product_1(double **M, double *v, double *v_out, int nr, int nc);
64 
73 void doublematrix_product(double M1[4][4], double M2[4][4], double M[4][4]);
74 
87 void doublematrix_product_0(double **M1, int nb_row_M1, int nb_col_M1, double **M2, int nb_col_M2, double **M);
88 
101 void doublematrix_product_1(double **M1, int nb_row_M1, int nb_col_M1, double **M2, int nb_col_M2, double **M);
102 
109 void rotation_matrix(int type, double angle, double R[4][4]);
110 
117 int** get_imat_0(int nb_r, int nb_c);
124 int** get_imat_1(int nb_r, int nb_c);
125 
130 void free_imat_0(int** mat);
135 void free_imat_1(int** mat);
136 
144 void copy_imat_0(int** tab_src, int** tab_dest, int nb_r, int nb_c);
145 
146 
153 void print_imat_0(int** mat, int nb_r, int nb_c);
154 
155 
162 double** get_dmat_0(int nb_r, int nb_c);
169 double** get_dmat_1(int nb_r, int nb_c);
176 double** get_contdmat_1(int nb_r, int nb_c);
177 
182 void free_dmat_0(double** mat);
187 void free_dmat_1(double** mat);
195 void copy_dmat_0(double** tab_src, double** tab_dest, int nb_r, int nb_c);
196 
204 void copy_dmat_1(double** src, double** dest, int x, int y);
205 
220 double **re_copy_dmat_0(double **src, int s_nx, int s_ny, double **dest, int d_nx, int d_ny);
221 
237 double **re_copy_dmat_1(double **src, int s_nx, int s_ny, double **dest, int d_nx, int d_ny);
238 
246 void transpose_dmat_0(double** tab_src, double** tab_dest, int nb_r, int nb_c);
247 
255 void transpose_dmat_1(double** tab_src, double** tab_dest, int x, int y);
256 
265 void print_dmat_0(double** mat, int nb_r, int nb_c);
273 void print_format_dmat_0(double** mat, int nb_r, int nb_c, char* format);
274 
285 int read_dmat_0(double** mat, int nb_r, int nb_c, const char* name);
286 
293 double** load_dmat_0(int nb_r, int nb_c, char* name);
294 
305 void save_dmat_0(double** mat, int nb_r, int nb_c, char* name);
306 
316 void save_format_dmat_0(double** mat, int nb_r, int nb_c, char* name, char* format);
317 
329 int code_dmat_0(FILE *file_out, double **values, const char *name, int n_row, int n_col);
330 
342 int code_dmat_1(FILE *file_out, double **values, const char *name, int n_row, int n_col);
343 
355 int slct_dmat_0(double** tab_src, int nb_r, int nb_c, double** tab_out, int l_vec, int* vec);
356 
368 int slctr_dmat_0(double** tab_src, int nb_r, int nb_c, double** tab_dest, int l_vec, int* vec);
369 
376 void zeros_dmat_0(double** mat, int nb_r, int nb_c);
377 
388 void mult_dmat_0(double** A, double** B, double** C, int n1, int n2, int n3);
389 
398 void sum_dmat_0(double** A, double** B, double** C, int n1, int n2);
399 
408 void diff_dmat_0(double** A, double** B, double** C, int n1, int n2);
409 
416 void opposite_dmat_0(double** A, int n1, int n2);
417 
423 void readmatrix(double** matrix, int* n);
424 
435 int get_dmatfiles_size(const char* fileName, int* n_row, int* n_col);
436 
443 void update_initzeros(int* initzeros, double** matrix, int* n);
444 
445 
452 void arrange_matrix(double** matrix, int* n, int* initzeros);
453 
460 void scale_matrix(double** matrix, int* n, int* initzeros);
461 
462 
471 void copy_array_dmat_1(double src[4][4], double** dest);
472 
483 int same_dmat_0(double **a, double **b, int x, int y);
484 
485 #ifdef __cplusplus
486 }
487 #endif
488 
489 /*--------------------*/
490 #endif
MbsData::qrot
int * qrot
Array with the indices of the rotational articulations (incremental values)
Definition: mbs_data.h:184
update_initzeros
void update_initzeros(int *initzeros, double **matrix, int *n)
function to update the initzeros array (obsolete?)
Definition: mbs_matrix.c:903
get_imat_0
int ** get_imat_0(int nb_r, int nb_c)
create (with memory allocation) a [nb_r times nb_c] matrix of integers, starting at index 0
Definition: mbs_matrix.c:198
re_copy_dvec_0
double * re_copy_dvec_0(double *src, int s_nx, double *dest, int d_nx)
Copy an array of double into another, reallocate the destination if required.
Definition: mbs_1D_array.c:969
arrange_matrix
void arrange_matrix(double **matrix, int *n, int *initzeros)
function to arrange matrix (obsolete?)
Definition: mbs_matrix.c:920
MbsData::xfidpt
int * xfidpt
Array of the points defined as force application points.
Definition: mbs_data.h:264
print_dvec_0
void print_dvec_0(double *vec, int l_v)
print a (x sized) vector of doubles in console, starting with index 0
Definition: mbs_1D_array.c:1018
MbsData::Ncons
int Ncons
Number of algebraic constraints.
Definition: mbs_data.h:218
MbsData::qd
double * qd
Array with the current values of the generalized velocities.
Definition: mbs_data.h:188
MbsData::qa
int * qa
Array with the indices of actuated articulations (only for inverse dynamic).
Definition: mbs_data.h:180
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
MbsData::m
double * m
Array containing the mass of each body.
Definition: mbs_data.h:155
MbsData::DonePart
int DonePart
Flag that indicates if the coordinate partitioning module has been executed (default: 0=not done; 1=d...
Definition: mbs_data.h:293
MbsData::user_IO
UserIO * user_IO
Definition: mbs_data.h:279
useful_functions.h
MbsData::tsim
double tsim
The time value.
Definition: mbs_data.h:208
MbsData::nqrot
int nqrot
Number of rotational joint (R1, R2 or R3)
Definition: mbs_data.h:172
MbsData::Nlink3D
int Nlink3D
Number of 3D links.
Definition: mbs_data.h:238
MbsData::mbs_filename
char * mbs_filename
Path to mbs file including the file with the extension (.mbs)
Definition: mbs_data.h:310
mbs_error_msg
void mbs_error_msg(char *msg,...)
Send an error message.
Definition: mbs_message.c:102
mbs_compute_sin_cos_q_all
void mbs_compute_sin_cos_q_all(MbsData *s)
Compute the sine and cosine of the q_sin and q_cos, for all the rotational joints.
Definition: mbs_trigo.c:94
MbsData::nqv
int nqv
Number of dependent articulations.
Definition: mbs_data.h:170
Functions::mbs_new_user_model
mbs_new_user_model_ptr mbs_new_user_model
Definition: mbs_data.h:112
MbsData::DoneEquil
int DoneEquil
Flag that indicates if the equilibrium module has been executed (default: 0=not done; 1=done).
Definition: mbs_data.h:294
mbs_data.h
MbsData::qc
int * qc
Array with the indices of driven (locked and driven) articulations.
Definition: mbs_data.h:175
matrix_product_0
void matrix_product_0(double **M, double *v, double *Mv, int nr, int nc)
Compute the product of a matrix by a vector. The first index is 0.
Definition: mbs_matrix.c:43
MbsData::ux0
double * ux0
Array with the initial values of the user variables.
Definition: mbs_data.h:287
scale_matrix
void scale_matrix(double **matrix, int *n, int *initzeros)
function to scale matrix (obsolete?)
Definition: mbs_matrix.c:965
doublematrix_product_0
void doublematrix_product_0(double **M1, int nb_row_M1, int nb_col_M1, double **M2, int nb_col_M2, double **M)
Compute the product of two matrices of given shape. The first index is 0.
Definition: mbs_matrix.c:83
mbs_copy_data
void mbs_copy_data(MbsData *s, MbsData *s_copy)
Copy all fields between two MBSdata structures.
Definition: mbs_data.c:88
MbsData::nqu
int nqu
Number of independent articulations.
Definition: mbs_data.h:165
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
rotation_matrix
void rotation_matrix(int type, double angle, double R[4][4])
Compute the rotation matrix for a specified angle around a specific axis. The first index is 1.
Definition: mbs_matrix.c:117
_MBS_ERR_LOW_FILES
#define _MBS_ERR_LOW_FILES
Low Level error number Error during opening/writing files = -9.
Definition: mbs_errors_names.h:147
get_imat_1
int ** get_imat_1(int nb_r, int nb_c)
create (with memory allocation) a [nb_r times nb_c] matrix of integers, starting at index 1
Definition: mbs_matrix.c:215
MbsData::njoint
int njoint
Number of joints in the system.
Definition: mbs_data.h:162
copy_dmat_0
void copy_dmat_0(double **tab_src, double **tab_dest, int nb_r, int nb_c)
Copy the content of a [nb_r times nb_c] matrix of doubles to a second matrix, starting with index 0.
Definition: mbs_matrix.c:363
MbsData::tf
double tf
Final time of the simulation [s]. For dirdyn and invdyn only. This parameter is set from dirdyn/invyn...
Definition: mbs_data.h:211
MbsData::npt
int npt
Number of anchor points.
Definition: mbs_data.h:152
arrange_matrix
void arrange_matrix(double **matrix, int *n, int *initzeros)
function to arrange matrix (obsolete?)
Definition: mbs_matrix.c:920
save_format_dmat_0
void save_format_dmat_0(double **mat, int nb_r, int nb_c, char *name, char *format)
save a [nb_r times nb_c] matrix of doubles to a second matrix, starting with index 0 The file is open...
Definition: mbs_matrix.c:556
print_ivec_1
void print_ivec_1(int *vec)
print a vector (of size specified in vec[0]) of integers in console, starting with index 1
Definition: mbs_1D_array.c:515
print_dmat_0
void print_dmat_0(double **mat, int nb_r, int nb_c)
print a [nb_r times nb_c] matrix of doubles in console, starting with index 0
Definition: mbs_matrix.c:467
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
sum_dmat_0
void sum_dmat_0(double **A, double **B, double **C, int n1, int n2)
function to sum two matrices: A + B = C
Definition: mbs_matrix.c:784
Functions::mbs_save_um
mbs_save_um_ptr mbs_save_um
Definition: mbs_data.h:121
slct_dmat_0
int slct_dmat_0(double **tab_src, int nb_r, int nb_c, double **tab_out, int l_vec, int *vec)
fill the second [nb_r times l_vec] matrix by selecting the columns of the first [nb_r times nb_c] mat...
Definition: mbs_matrix.c:710
matrix_product_0
void matrix_product_0(double **M, double *v, double *Mv, int nr, int nc)
Compute the product of a matrix by a vector. The first index is 0.
Definition: mbs_matrix.c:43
mbs_compare_data
int mbs_compare_data(MbsData *s1, MbsData *s2, int accelred)
Compare two MbsData.
Definition: mbs_data.c:533
transpose
void transpose(double M[4][4], double Mt[4][4])
Compute the transpose of a matrix with first index is 1.
Definition: mbs_matrix.c:22
slctr_dmat_0
int slctr_dmat_0(double **tab_src, int nb_r, int nb_c, double **tab_dest, int l_vec, int *vec)
fill the second [l_vec times nb_c] matrix by selecting the rows of the first [nb_r times nb_c] matrix...
Definition: mbs_matrix.c:732
get_dmatfiles_size
int get_dmatfiles_size(const char *fileName, int *n_row, int *n_col)
Function to load a file and calculate the number of rows and columns.
Definition: mbs_matrix.c:858
mbs_matrix.h
re_copy_dmat_0
double ** re_copy_dmat_0(double **src, int s_nx, int s_ny, double **dest, int d_nx, int d_ny)
Copy a 2D array of double into another, reallocate the destination if required.
Definition: mbs_matrix.c:389
zeros_dmat_0
void zeros_dmat_0(double **mat, int nb_r, int nb_c)
set all the element of a [nb_r times nb_c] matrix of doubles to zero, starting with index 0
Definition: mbs_matrix.c:754
MbsData::Nux
int Nux
Number of user variable.
Definition: mbs_data.h:288
copy_dvec_1
void copy_dvec_1(double *vec_src, double *vec_dest)
Copy the content of a vector (of size specified in vec_src[0]) of doubles to a second vector,...
Definition: mbs_1D_array.c:916
MbsData::flag_jac_position
int flag_jac_position
Flag to compute the Jacobian of the constraint for position or velocity solution.
Definition: mbs_data.h:299
MbsData::jac_user
double ** jac_user
Jacobian of constraints [nqv x njoint] (starting at 1), only used in symbolic accelred,...
Definition: mbs_data.h:229
MbsData::zero_division_thrs
double zero_division_thrs
Value from which a warning is raised if a division by zero (or close to) occurs. Default=1....
Definition: mbs_data.h:308
MbsData::DoneModal
int DoneModal
Flag that indicates if the modal module has been executed (default: 0=not done; 1=done).
Definition: mbs_data.h:295
code_dmat_1
int code_dmat_1(FILE *file_out, double **values, const char *name, int n_row, int n_col)
Write C-code to allocate and fill an array of arrays of doubles.
Definition: mbs_matrix.c:654
mbs_1D_array.h
MbsData::flag_optim_symb_sin_cos
int flag_optim_symb_sin_cos
allow the "optimisation" of the computation of the sine/cosine in the symbolic files....
Definition: mbs_data.h:198
code_dmat_1
int code_dmat_1(FILE *file_out, double **values, const char *name, int n_row, int n_col)
Write C-code to allocate and fill an array of arrays of doubles.
Definition: mbs_matrix.c:654
MbsData::SWr
double ** SWr
Array of Swr vector for each external forces.
Definition: mbs_data.h:265
readmatrix
void readmatrix(double **mat, int *n)
function to read a matrix (obsolete?)
Definition: mbs_matrix.c:826
scale_matrix
void scale_matrix(double **matrix, int *n, int *initzeros)
function to scale matrix (obsolete?)
Definition: mbs_matrix.c:965
MbsData::q_cos
double * q_cos
Array with the cosine values of the generalized coordinates, if rotational (if translational,...
Definition: mbs_data.h:197
MbsData::hu
int * hu
Array with the indices of independent constraints.
Definition: mbs_data.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
MbsData::Nxfrc
int Nxfrc
Number of points where an external force is applied into a body.
Definition: mbs_data.h:263
mbs_print_user_model
#define mbs_print_user_model(um)
Definition: mbs_data.c:14
print_dmat_0
void print_dmat_0(double **mat, int nb_r, int nb_c)
print a [nb_r times nb_c] matrix of doubles in console, starting with index 0
Definition: mbs_matrix.c:467
matrix_product
void matrix_product(double M[4][4], double v[4], double Mv[4])
Compute the product of a matrix by a vector. The first index is 1.
Definition: mbs_matrix.c:35
MbsData::qd0
double * qd0
Array with the initial values of the generalized velocities.
Definition: mbs_data.h:192
same_ivec_0
int same_ivec_0(int *v1, int *v2, int size)
Compare if two vector are the same.
Definition: mbs_1D_array.c:847
mbs_reset_data
void mbs_reset_data(MbsData *s)
Reset all fields of a MbsData structure to initial values.
Definition: mbs_data.c:208
load_dmat_0
double ** load_dmat_0(int nb_r, int nb_c, char *name)
load a [nb_r times nb_c] matrix of doubles from a file starting with index 0. The matrix is created (...
Definition: mbs_matrix.c:544
MbsData::Nlink
int Nlink
Number of forces acting between two points of the system (force law implemented in user_LinkForces())...
Definition: mbs_data.h:237
copy_dmat_1
void copy_dmat_1(double **src, double **dest, int x, int y)
Copy the content of a [x times y] matrix of doubles to a second matrix, starting with index 1.
Definition: mbs_matrix.c:376
mbs_save_um
#define mbs_save_um(file, um)
Definition: mbs_data.c:15
doublematrix_product_1
void doublematrix_product_1(double **M1, int nb_row_M1, int nb_col_M1, double **M2, int nb_col_M2, double **M)
Compute the product of two matrices of given shape. The first index is 1.
Definition: mbs_matrix.c:100
update_initzeros
void update_initzeros(int *initzeros, double **matrix, int *n)
function to update the initzeros array (obsolete?)
Definition: mbs_matrix.c:903
code_dmat_0
int code_dmat_0(FILE *file_out, double **values, const char *name, int n_row, int n_col)
Write C-code to allocate and fill an array of arrays of doubles.
Definition: mbs_matrix.c:588
slct_dmat_0
int slct_dmat_0(double **tab_src, int nb_r1, int nb_c1, double **tab_out, int l2, int *vec)
fill the second [nb_r times l_vec] matrix by selecting the columns of the first [nb_r times nb_c] mat...
Definition: mbs_matrix.c:710
MbsData::flag_safety_checks
int flag_safety_checks
Flag to activate safety checks everywhere in mbsysc core. Faster computation if this flag is put to 0...
Definition: mbs_data.h:307
mbs_msg
void mbs_msg(char *msg,...)
Send a message.
Definition: mbs_message.c:76
print_format_dmat_0
void print_format_dmat_0(double **mat, int nb_r, int nb_c, char *format)
print a [nb_r times nb_c] matrix of doubles in console, starting with index 0
Definition: mbs_matrix.c:472
code_dvec_1
int code_dvec_1(FILE *file_out, double *values, const char *name, int size)
Write C-code to allocate and fill an array of double.
Definition: mbs_1D_array.c:1115
MbsData::MAX_NR_ITER
int MAX_NR_ITER
Maximal number of iterations for NR procedure, default 100.
Definition: mbs_data.h:221
MbsData::Nuserc
int Nuserc
Number of user constraints.
Definition: mbs_data.h:219
MbsData::Fl
double * Fl
Array with the current values of the forces on each link (see: user_LinkForces()).
Definition: mbs_data.h:241
free_imat_1
void free_imat_1(int **mat)
release memory for a matrix of integers, starting with index 1
Definition: mbs_matrix.c:317
MbsData::qu
int * qu
Array with the indices of the independent articulations (free)
Definition: mbs_data.h:174
re_copy_dmat_1
double ** re_copy_dmat_1(double **src, int s_nx, int s_ny, double **dest, int d_nx, int d_ny)
Copy a 2D array of double into another, reallocate the destination if required.
Definition: mbs_matrix.c:421
transpose_dmat_0
void transpose_dmat_0(double **tab_src, double **tab_dest, int nb_r, int nb_c)
Transpose a [nb_r times nb_c] matrix of doubles and store the results in a [y times nb_r] matrix,...
Definition: mbs_matrix.c:440
MbsData::NRerr
double NRerr
Maximal error on constraint allowed in Newton-Raphson algorithm, default 1.0e-9.
Definition: mbs_data.h:220
free_imat_0
void free_imat_0(int **mat)
release memory for a matrix of integers, starting with index 0
Definition: mbs_matrix.c:309
MbsData::trq
double ** trq
Matrix with the components of the resultant external torques (pure torque and couple produced by forc...
Definition: mbs_data.h:203
print_dvec_1
void print_dvec_1(double *vec)
print a vector (of size specified in vec[0]) of doubles in console, starting with index 1
Definition: mbs_1D_array.c:1175
MbsData::qv
int * qv
Array with the indices of the dependent articulations .
Definition: mbs_data.h:182
sum_dmat_0
void sum_dmat_0(double **A, double **B, double **C, int n1, int n2)
function to sum two matrices: A + B = C
Definition: mbs_matrix.c:784
MbsData::Qc
double * Qc
Array with the value of joint force introduced in driven joint to respect the user function.
Definition: mbs_data.h:233
MbsData::Nloopc
int Nloopc
Number of loop constraints.
Definition: mbs_data.h:217
diff_dmat_0
void diff_dmat_0(double **A, double **B, double **C, int n1, int n2)
function to sum two matrices: A - B = C
Definition: mbs_matrix.c:797
save_dmat_0
void save_dmat_0(double **mat, int nb_r, int nb_c, char *name)
save a [nb_r times nb_c] matrix of doubles to a second matrix, starting with index 0 The file is open...
Definition: mbs_matrix.c:551
MbsData::Zd
double * Zd
Array with the current values of the speed (spreading) between of the points of a link (see: user_Lin...
Definition: mbs_data.h:240
get_dmatfiles_size
int get_dmatfiles_size(const char *fileName, int *n_row, int *n_col)
Function to load a file and calculate the number of rows and columns.
Definition: mbs_matrix.c:858
matrix_product_1
void matrix_product_1(double **M, double *v, double *v_out, int nr, int nc)
Compute the product of a matrix by a vector. The first index is 1.
Definition: mbs_matrix.c:55
code_ivec_1
int code_ivec_1(FILE *file_out, int *values, const char *name, int size)
Write C-code to allocate and fill an array of integers.
Definition: mbs_1D_array.c:581
matrix_product_1
void matrix_product_1(double **M, double *v, double *v_out, int nr, int nc)
Compute the product of a matrix by a vector. The first index is 1.
Definition: mbs_matrix.c:55
MbsData::Qq
double * Qq
Array with the values of the joint forces.
Definition: mbs_data.h:204
read_dmat_0
int read_dmat_0(double **mat, int nb_r, int nb_c, const char *name)
read a [nb_r times nb_c] matrix of doubles from a file starting with index 0 and store the values in ...
Definition: mbs_matrix.c:495
MbsData::q
double * q
Array with the current values of the generalized coordinates.
Definition: mbs_data.h:187
MbsData::In
double ** In
Array containing the inertia tensor component of each body (in the body fixed frame,...
Definition: mbs_data.h:156
copy_dmat_1
void copy_dmat_1(double **src, double **dest, int x, int y)
Copy the content of a [x times y] matrix of doubles to a second matrix, starting with index 1.
Definition: mbs_matrix.c:376
MbsData::Nsensor
int Nsensor
< Array of l3DWr vector for each 3D link forces.
Definition: mbs_data.h:260
free_imat_1
void free_imat_1(int **mat)
release memory for a matrix of integers, starting with index 1
Definition: mbs_matrix.c:317
MbsData::project_path
char * project_path
Path to the mbs project folder.
Definition: mbs_data.h:312
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
same_dmat_0
int same_dmat_0(double **a, double **b, int x, int y)
Compare if two 2D arrays of floats are the same.
Definition: mbs_matrix.c:990
mbs_basename
char * mbs_basename(const char *path)
mbs_basename return sthe trailing part of the path (UNIX and MAC).
Definition: mbs_path.c:95
get_imat_0
int ** get_imat_0(int nb_r, int nb_c)
create (with memory allocation) a [nb_r times nb_c] matrix of integers, starting at index 0
Definition: mbs_matrix.c:198
re_copy_dmat_1
double ** re_copy_dmat_1(double **src, int s_nx, int s_ny, double **dest, int d_nx, int d_ny)
Copy a 2D array of double into another, reallocate the destination if required.
Definition: mbs_matrix.c:421
print_format_dmat_0
void print_format_dmat_0(double **mat, int nb_r, int nb_c, char *format)
print a [nb_r times nb_c] matrix of doubles in console, starting with index 0
Definition: mbs_matrix.c:472
MbsData::nqdriven
int nqdriven
Number of driven articulations.
Definition: mbs_data.h:168
zeros_dmat_0
void zeros_dmat_0(double **mat, int nb_r, int nb_c)
set all the element of a [nb_r times nb_c] matrix of doubles to zero, starting with index 0
Definition: mbs_matrix.c:754
mbs_trigo.h
This header defines the functions for trigonometric handling in MBsysC integrator in C.
readmatrix
void readmatrix(double **matrix, int *n)
function to read a matrix (obsolete?)
Definition: mbs_matrix.c:826
copy_imat_0
void copy_imat_0(int **tab_src, int **tab_dest, int nb_r, int nb_c)
Copy the content of a [nb_r times nb_c] matrix of integers to a second matrix, starting with index 0.
Definition: mbs_matrix.c:325
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
MbsData::fct
Functions fct
Structure to store the pointer to the project-specific functions.
Definition: mbs_data.h:316
mult_dmat_0
void mult_dmat_0(double **A, double **B, double **C, int n1, int n2, int n3)
function to multiply two matrices: A * B = C [n1 n2] [n2 n3] = [n1 n3]
Definition: mbs_matrix.c:767
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
opposite_dmat_0
void opposite_dmat_0(double **A, int n1, int n2)
function to take the opposite of a given matrix (minus in front of each entry)
Definition: mbs_matrix.c:810
MbsData::frc
double ** frc
Matrix with the components of the resultant external forces (in the body fixed frame) applied to the ...
Definition: mbs_data.h:202
code_dmat_0
int code_dmat_0(FILE *file_out, double **values, const char *name, int n_row, int n_col)
Write C-code to allocate and fill an array of arrays of doubles.
Definition: mbs_matrix.c:588
transpose_dmat_0
void transpose_dmat_0(double **tab_src, double **tab_dest, int nb_r, int nb_c)
Transpose a [nb_r times nb_c] matrix of doubles and store the results in a [y times nb_r] matrix,...
Definition: mbs_matrix.c:440
print_imat_0
void print_imat_0(int **mat, int x, int y)
print a [nb_r times nb_c] matrix of integers in console, starting with index 0
Definition: mbs_matrix.c:338
diff_dmat_0
void diff_dmat_0(double **A, double **B, double **C, int n1, int n2)
function to sum two matrices: A - B = C
Definition: mbs_matrix.c:797
free_imat_0
void free_imat_0(int **mat)
release memory for a matrix of integers, starting with index 0
Definition: mbs_matrix.c:309
get_imat_1
int ** get_imat_1(int nb_r, int nb_c)
create (with memory allocation) a [nb_r times nb_c] matrix of integers, starting at index 1
Definition: mbs_matrix.c:215
MbsData::nqc
int nqc
Number of driven articulations, it includes qlocked and qdriven.
Definition: mbs_data.h:166
MbsData::l3DWr
double ** l3DWr
Definition: mbs_data.h:243
doublematrix_product
void doublematrix_product(double M1[4][4], double M2[4][4], double M[4][4])
Compute the product of two matrices. The first index is 1.
Definition: mbs_matrix.c:68
MbsData::user_model
UserModel * user_model
Structure containing all user model, this structure is specific for each project.
Definition: mbs_data.h:276
mbs_message.h
re_copy_ivec_0
int * re_copy_ivec_0(int *src, int s_nx, int *dest, int d_nx)
Copy an array of int into another, reallocate the destination if required.
Definition: mbs_1D_array.c:445
same_dvec_0
int same_dvec_0(double *v1, double *v2, int size)
Compare if two vector of floats are the same.
Definition: mbs_1D_array.c:1373
Functions::mbs_print_user_model
mbs_print_user_model_ptr mbs_print_user_model
Definition: mbs_data.h:118
MbsData::dpt
double ** dpt
Array containing the coordinate of all anchor points (3+1 lines, npt+1 columns).
Definition: mbs_data.h:153
rotation_matrix
void rotation_matrix(int type, double angle, double R[4][4])
Compute the rotation matrix for a specified angle around a specific axis. The first index is 1.
Definition: mbs_matrix.c:117
slctr_dmat_0
int slctr_dmat_0(double **tab_src, int nb_r1, int nb_c1, double **tab_out, int l2, int *vec)
fill the second [l_vec times nb_c] matrix by selecting the rows of the first [nb_r times nb_c] matrix...
Definition: mbs_matrix.c:732
print_imat_0
void print_imat_0(int **mat, int nb_r, int nb_c)
print a [nb_r times nb_c] matrix of integers in console, starting with index 0
Definition: mbs_matrix.c:338
MbsData::mbs_name
char * mbs_name
Name of the mbs project as it is stored in the xml file.
Definition: mbs_data.h:313
MbsData::q0
double * q0
Array with the initial values of the generalized coordinates.
Definition: mbs_data.h:191
mbs_print_data
void mbs_print_data(MbsData *s)
Definition: mbs_data.c:21
MbsData
Definition: mbs_data.h:149
copy_array_dmat_1
void copy_array_dmat_1(double src[4][4], double **dest)
Copy the content of an array of doubles to a pointer of matrix, starting with index 1.
Definition: mbs_matrix.c:980
MbsData::n_rod
int n_rod
Number of rod constraint in the system.
Definition: mbs_data.h:215
transpose_dmat_1
void transpose_dmat_1(double **tab_src, double **tab_dest, int x, int y)
Transpose a [x times y] matrix of doubles and store the results in a [y times x] matrix,...
Definition: mbs_matrix.c:454
MbsData::qlocked
int * qlocked
Array with the indices of locked articulations.
Definition: mbs_data.h:176
MbsData::Qa
double * Qa
Array of active joint forces (in case of simulink,invdyna,equil,linearization,...)
Definition: mbs_data.h:205
re_copy_dmat_0
double ** re_copy_dmat_0(double **src, int s_nx, int s_ny, double **dest, int d_nx, int d_ny)
Copy a 2D array of double into another, reallocate the destination if required.
Definition: mbs_matrix.c:389
Functions::user
struct Functions::@8 user
MbsData::Nuser_model
int Nuser_model
Number of declared user models in MBsysPad.
Definition: mbs_data.h:275
MbsData::build_path
char * build_path
Path to the build folder.
Definition: mbs_data.h:311
zeros_dvec_1
void zeros_dvec_1(double *vec)
set all the element of a vector of doubles to zero, starting with index 1
Definition: mbs_1D_array.c:1353
save_dmat_0
void save_dmat_0(double **mat, int nb_r, int nb_c, char *name)
save a [nb_r times nb_c] matrix of doubles to a second matrix, starting with index 0 The file is open...
Definition: mbs_matrix.c:551
MbsData::process
int process
Flag that indicate which module is currently running (1=partitioning, 2=equilibrium,...
Definition: mbs_data.h:297
doublematrix_product_1
void doublematrix_product_1(double **M1, int nb_row_M1, int nb_col_M1, double **M2, int nb_col_M2, double **M)
Compute the product of two matrices of given shape. The first index is 1.
Definition: mbs_matrix.c:100
MbsData::nbody
int nbody
Number of bodies in the system.
Definition: mbs_data.h:160
matrix_product
void matrix_product(double M[4][4], double v[4], double Mv[4])
Compute the product of a matrix by a vector. The first index is 1.
Definition: mbs_matrix.c:35
MbsData::l
double ** l
Array containing the center of mass coordinates (in the body fixed frame, one column per body includi...
Definition: mbs_data.h:154
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
mbs_write_data
int mbs_write_data(MbsData *s, char *filename, char *function_name)
Write a source with a function allocating and setting a MbsData copy of the provided.
Definition: mbs_data.c:231
mult_dmat_0
void mult_dmat_0(double **A, double **B, double **C, int n1, int n2, int n3)
function to multiply two matrices: A * B = C [n1 n2] [n2 n3] = [n1 n3]
Definition: mbs_matrix.c:767
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
doublematrix_product_0
void doublematrix_product_0(double **M1, int nb_row_M1, int nb_col_M1, double **M2, int nb_col_M2, double **M)
Compute the product of two matrices of given shape. The first index is 0.
Definition: mbs_matrix.c:83
MbsData::Z
double * Z
Array with the current values of the distances between of the points of a link (see: user_LinkForces(...
Definition: mbs_data.h:239
MbsData::g
double g[3+1]
The 3 gravity components.
Definition: mbs_data.h:158
MbsData::flag_stop
int flag_stop
stop the simulation. For dirdyn, equil, invdyn and solvekin only.
Definition: mbs_data.h:298
mbs_user_interface.h
mbs_path.h
doublematrix_product
void doublematrix_product(double M1[4][4], double M2[4][4], double M[4][4])
Compute the product of two matrices. The first index is 1.
Definition: mbs_matrix.c:68
opposite_dmat_0
void opposite_dmat_0(double **A, int n1, int n2)
function to take the opposite of a given matrix (minus in front of each entry)
Definition: mbs_matrix.c:810
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
MbsData::qdriven
int * qdriven
Array with the indices of driven articulations.
Definition: mbs_data.h:178
MbsData::lambda
double * lambda
Array with the values of the Lagrange Multipliers related to the constraints.
Definition: mbs_data.h:222
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
MbsData::uxd
double * uxd
Array with the values of the time derivatives of the user variables.
Definition: mbs_data.h:286
MbsData::q_sin
double * q_sin
Array with the sine values of the generalized coordinates, if rotational (if translational,...
Definition: mbs_data.h:196
MbsData::qdd0
double * qdd0
Array with the initial values of the generalized acceleration.
Definition: mbs_data.h:193
mbs_save_user_IO
#define mbs_save_user_IO(file, um)
Definition: mbs_data.c:16
save_format_dmat_0
void save_format_dmat_0(double **mat, int nb_r, int nb_c, char *name, char *format)
save a [nb_r times nb_c] matrix of doubles to a second matrix, starting with index 0 The file is open...
Definition: mbs_matrix.c:556
MbsData::nqa
int nqa
Number of actuated articulations.
Definition: mbs_data.h:169
same_dmat_0
int same_dmat_0(double **a, double **b, int x, int y)
Compare if two 2D arrays of floats are the same.
Definition: mbs_matrix.c:990
MbsData::nqlocked
int nqlocked
Number of locked articulations.
Definition: mbs_data.h:167
transpose
void transpose(double M[4][4], double Mt[4][4])
Compute the transpose of a matrix with first index is 1.
Definition: mbs_matrix.c:22
Functions::mbs_save_user_IO
mbs_save_user_IO_ptr mbs_save_user_IO
Definition: mbs_data.h:123
get_contdmat_1
double ** get_contdmat_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:275
MbsData::qdd
double * qdd
Array with the current values of the generalized acceleration.
Definition: mbs_data.h:189
copy_dmat_0
void copy_dmat_0(double **tab_src, double **tab_dest, int nb_r, int nb_c)
Copy the content of a [nb_r times nb_c] matrix of doubles to a second matrix, starting with index 0.
Definition: mbs_matrix.c:363
MbsData::jdqd_user
double * jdqd_user
Vector of jdqd for user constraints [nqv] (starting at 1), only used in symbolic accelred,...
Definition: mbs_data.h:230
load_dmat_0
double ** load_dmat_0(int nb_r, int nb_c, char *name)
load a [nb_r times nb_c] matrix of doubles from a file starting with index 0. The matrix is created (...
Definition: mbs_matrix.c:544
rotation_matrix_0
void rotation_matrix_0(int type, double angle, double R[3][3])
Definition: mbs_matrix.c:158
MbsData::udd
double * udd
For axelle red: array with the values of the acceleration of independent coordinate.
Definition: mbs_data.h:291
MbsData::ux
double * ux
Array with the values of the user variables.
Definition: mbs_data.h:285
read_dmat_0
int read_dmat_0(double **mat, int nb_r, int nb_c, const char *name)
read a [nb_r times nb_c] matrix of doubles from a file starting with index 0 and store the values in ...
Definition: mbs_matrix.c:495
mbs_warning_msg
void mbs_warning_msg(char *msg,...)
Send a warning message.
Definition: mbs_message.c:89
get_contdmat_1
double ** get_contdmat_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:275
transpose_dmat_1
void transpose_dmat_1(double **tab_src, double **tab_dest, int x, int y)
Transpose a [x times y] matrix of doubles and store the results in a [y times x] matrix,...
Definition: mbs_matrix.c:454
MbsData::nhu
int nhu
Number of independent constraints.
Definition: mbs_data.h:171
MbsData::lrod
double * lrod
Array with the length of each rod.
Definition: mbs_data.h:216
MbsData::n_user_IO
int n_user_IO
Definition: mbs_data.h:278
mbs_errors_names.h
copy_array_dmat_1
void copy_array_dmat_1(double src[4][4], double **dest)
Copy the content of an array of doubles to a pointer of matrix, starting with index 1.
Definition: mbs_matrix.c:980
copy_imat_0
void copy_imat_0(int **tab1, int **tab2, int x, int y)
Copy the content of a [nb_r times nb_c] matrix of integers to a second matrix, starting with index 0.
Definition: mbs_matrix.c:325