Commit ad8d82a1 authored by Nicolas Docquier's avatar Nicolas Docquier

Merge branch 'fixing_bug_merge_cosmetic_equil_and_one_warning' into 'dev'

Fixing bug merge cosmetic equil and one warning

See merge request !223
parents 7ed6c2a3 7515b0c9
Pipeline #4442 passed with stage
in 9 minutes and 24 seconds
......@@ -226,7 +226,7 @@ tutorial_4_monolithic:
- make
- ./exe_Driven_variable
- cd ../../
- python ../../Compare_results.py resultsR/ 1e-4 1e-6
- python ../../../Compare_results.py resultsR/ 1e-4 1e-6
only:
- dev
......@@ -363,7 +363,7 @@ tutorial_8_monolithic:
- make
- ./exe_Userderivatives
- cd ../../
- python ../../Compare_results.py resultsR/ 1e-4 1e-6
- python ../../../Compare_results.py resultsR/ 1e-4 1e-6
only:
- dev
......
## Changes for next release
* ... to be completed
* [New] error management in mbs load, part and dirdyn (not yet in Real Time, equil and modal)
See the wiki in gitlab for the corresponding pptx
* [New] CI automatic tests added for equil module + file tree of example project remodeled.
* ? Coupling VPM branch merge : Filtering is active if the flag dirdyn->filt=1. Otherwise, we do as usual.
## Robotran v1.11.0
......
......@@ -286,7 +286,21 @@ void mbs_print_user_models(MDS_gen_strct* gen, char *fileoutC, char *fileoutH)
fprintf(fidC," void mbs_load_user_model_xml(MDS_gen_strct* gen, UserModel* um) \n");
fprintf(fidC,"{\n");
fprintf(fidC,"\n");
fprintf(fidC," int ind;\n");
// int ind is used only in two cases ("vector" and "state")
for(i=0; i< gen->user_models->n_user_model; i++)
{
for(j=0; j< gen->user_models->user_model_list[i]->n_parameter; j++)
{
switch( gen->user_models->user_model_list[i]->parameter_list[j]->type)
{
case 2: //vector
fprintf(fidC," int ind;\n");
case 5: // state
fprintf(fidC," int ind;\n");
}
}
}
fprintf(fidC," int ind_state_value = 1;\n");
fprintf(fidC,"\n");
......
......@@ -21,6 +21,7 @@
#include "mbs_linalg.h"
#include "mbs_message.h"
#include "nrfct.h"
#include "useful_functions.h"
#define MAX_NB_BUFFER (3 + 1) // maximal number of buffer 3 for equilibrium, 1 for q (animation)
......@@ -121,7 +122,7 @@ void mbs_delete_equil(MbsEquil* eq, MbsData* mbs_data)
if (eq->options->nquch != 0)
{
free(eq->options->xch_ptr);
free(eq->options->quch);
free_ivec_0(eq->options->quch);
free(eq->xch);
} // corresponding to malloc in mbs_equil_exchange
if (eq->options->nxe != 0)
......@@ -542,7 +543,7 @@ void mbs_equil_finish(MbsEquil* eq, MbsData* s)
void mbs_equil_exchange(MbsEquilOptions *options)
{
int i;
options->quch = (int*)malloc((options->nquch + 1) *sizeof(int));
options->quch = get_ivec_0(options->nquch+1);
options->xch_ptr = (double**)malloc((options->nquch + 1) *sizeof(double*));
for (i = 0; i <= options->nquch; i++)
......@@ -1036,7 +1037,15 @@ void mbs_print_equil(MbsEquil* eq)
}
mbs_msg(" nquch . . . . = %d \n", eq->options->nquch);
mbs_msg("quch = "); print_ivec_1(eq->options->quch);
if (eq->options->nquch != 0)
{
mbs_msg("quch = "); print_ivec_0(eq->options->quch, eq->options->nquch + 1);
}
else
{
mbs_msg("quch = [] \n");
}
mbs_msg(" nxe . . . . = %d \n", eq->options->nxe);
mbs_msg("Variables \n");
......
......@@ -49,7 +49,7 @@ void mbs_print_data(MbsData* s){
mbs_msg("qv = "); print_ivec_1(s->qv);
mbs_msg("hu = "); print_ivec_1(s->hu);
mbs_msg("dpt = "); print_dmat_0(s->dpt,s->npt, s->npt);
mbs_msg("dpt = "); print_dmat_0(s->dpt,3, s->npt);
mbs_msg("m = "); print_dvec_1(s->m);
mbs_msg("In = "); print_dmat_0(s->In, 9, s->njoint);
mbs_msg("l = "); print_dmat_0(s->l,3, s->njoint);
......
......@@ -305,46 +305,67 @@ void copy_imat_0(int **tab1, int **tab2, int x , int y)
void print_ivec_0(int *vec, int x)
{
int i;
mbs_msg("[");
for(i=0; i<x; i++)
if (vec == NULL || x ==0)
{
mbs_msg("%d ",vec[i]);
mbs_msg("[ ]\n");
}
else
{
int i;
mbs_msg("[");
for (i = 0; i < x; i++)
{
mbs_msg("%d ", vec[i]);
}
mbs_msg("]\n");
mbs_msg("]\n");
}
}
void print_ivec_1(int *vec)
{
int i;
mbs_msg("[");
for(i=1; i<=vec[0]; i++)
if (vec == NULL)
{
mbs_msg("%d ",vec[i]);
mbs_msg("[ ]\n");
}
else
{
int i;
mbs_msg("[");
for (i = 1; i <= vec[0]; i++)
{
mbs_msg("%d ", vec[i]);
}
mbs_msg("]\n");
mbs_msg("]\n");
}
}
void print_imat_0(int **mat, int x , int y)
{
int i,j;
for(i=0; i<x; i++)
if (mat == NULL)
{
mbs_msg("| |\n");
}
else
{
mbs_msg("|");
int i, j;
for(j=0; j<y; j++)
for (i = 0; i < x; i++)
{
mbs_msg("%d ", mat[i][j]);
}
mbs_msg("|");
for (j = 0; j < y; j++)
{
mbs_msg("%d ", mat[i][j]);
}
mbs_msg("|\n");
mbs_msg("|\n");
}
}
}
......@@ -673,53 +694,74 @@ void transpose_dmat_0(double **tab1, double **tab2, int x, int y)
void print_dvec_0(double *vec, int x)
{
int i;
mbs_msg("[");
for(i=0; i<x; i++)
if (vec == NULL || x == 0)
{
mbs_msg("%f ",vec[i]);
mbs_msg("[ ]\n");
}
else
{
int i;
mbs_msg("]\n");
mbs_msg("[");
for (i = 0; i < x; i++)
{
mbs_msg("%f ", vec[i]);
}
mbs_msg("]\n");
}
}
void print_dvec_1(double *vec)
{
int i;
int vec_size;
vec_size = (int) vec[0];
if (vec_size <= 0)
if (vec == NULL)
{
mbs_msg("print_dvec_1 warning: vec[0] is %d !\n", vec_size);
return;
mbs_msg("[ ]\n");
}
else
{
int i;
int vec_size;
mbs_msg("[");
vec_size = (int)vec[0];
for(i=1; i<=vec_size; i++)
{
mbs_msg("%f ",vec[i]);
}
if (vec_size <= 0)
{
mbs_msg("print_dvec_1 warning: vec[0] is %d !\n", vec_size);
return;
}
mbs_msg("[");
for (i = 1; i <= vec_size; i++)
{
mbs_msg("%f ", vec[i]);
}
mbs_msg("]\n");
mbs_msg("]\n");
}
}
void print_dmat_0(double **mat, int x , int y)
{
int i,j;
for(i=0; i<x; i++)
if (mat == NULL)
{
mbs_msg("|");
for(j=0; j<y; j++)
mbs_msg("| |\n");
}
else
{
int i, j;
for (i = 0; i < x; i++)
{
mbs_msg("%f ", mat[i][j]);
mbs_msg("|");
for (j = 0; j < y; j++)
{
mbs_msg("%f ", mat[i][j]);
}
mbs_msg("|\n");
}
mbs_msg("|\n");
}
}
......@@ -962,19 +1004,19 @@ void zeros_dmat_0(double **mat, int x, int y)
void readmatrix(double** mat, int* n)
{
int i, j;
int err = 0;
mbs_msg("\tEnter the no: rows in the matrix : ");
scanf("%d", &n[0]);
err = scanf("%d", &n[0]);
mbs_msg("\tEnter the no: columns in the matrix : ");
scanf("%d", &n[1]);
err = scanf("%d", &n[1]);
mbs_msg("\tEnter The Matrix Elements Row wise ");
scanf("\n");
err = scanf("\n");
for (i = 0; i < n[0]; ++i)
{
for (j = 0; j < n[1]; ++j)
{
scanf("%lf", &mat[i][j]);
err = scanf("%lf", &mat[i][j]);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment