Robotran C Documentation
Functions
set_output.h File Reference

set_output function called by the user to output his own variables More...

Go to the source code of this file.

Functions

int define_output_vector (char *label, int size)
 set needed information to handle the specified vector name in the auto_output structure. More...
 
int set_output (double value, char *label)
 function called by the user to output the time evolution of a value More...
 
int set_output_vector (double *vector, char *label)
 function called by the user to output the time evolution of a whole vector. More...
 
int set_output_vector_from_id (double *vector, char *label, int output_id)
 function called by the user to output the time evolution of a whole vector. It is very similar to set_output_vector, with the output_id (starting at zero) of the vector that is known This allow to run the set_output function faster. By calling this function with an unknown vector (i.e. output_id = -1, the function will search for the correct index by itself - slower) More...
 
int set_output_value (double value, int val_index, char *label)
 function called by the user to output the time evolution of a value in a vector. More...
 
int set_output_value_from_id (double value, int val_index, char *label, int output_id)
 
void init_set_output (int max_nb_curves)
 initialize the static auto_output structure More...
 
void free_set_output ()
 release memory of auto_output More...
 
double get_output_value (int index)
 get the output value corresponding to the requested index More...
 
char * get_output_label (int index)
 get the output label corresponding to the requested index More...
 
char * get_output_vector_label (int index)
 get the output vector label corresponding to the requested index More...
 
int get_output_vector_size (int index)
 get the output vector size corresponding to the requested index More...
 
int get_output_nb ()
 get the number of user inputs More...
 
int get_output_nb_new ()
 get the number of new user inputs More...
 
int get_output_vector_nb ()
 get the number of user vector inputs More...
 
double * get_output_vector_ptr (int index)
 get the pointer to the output vector at the requested index More...
 
void set_output_nb_new (int nb)
 set the number of new user inputs More...
 
void reset_flag_output ()
 reset the flag_output to 0. Useful when running several simulation in a row with different save2file settings. More...
 

Detailed Description

set_output function called by the user to output his own variables

Author
Nicolas Van der Noot

Function Documentation

◆ define_output_vector()

int define_output_vector ( char *  label,
int  size 
)

set needed information to handle the specified vector name in the auto_output structure.

In the default MBsysC behavior, if the vector definition fails, the current module will stop.

If you redirected the mbs_error_msg() via mbs_set_error_msg_fct_ptr() to a function that does not stop the process you are responsible to set MbsData::flag_stop to 1 to prevent further execution.

Parameters
[in]labelthe label of the vector
[in]sizethe number of element to save in the vector (or the size of the saved vector)
Returns
The status, negative in case of error.

◆ free_set_output()

void free_set_output ( )

release memory of auto_output

◆ get_output_label()

char* get_output_label ( int  index)

get the output label corresponding to the requested index

Parameters
[in]indexrequested index
Returns
requested label or "no_output" if there is no output for the requested index

◆ get_output_nb()

int get_output_nb ( )

get the number of user inputs

Returns
number of user inputs

◆ get_output_nb_new()

int get_output_nb_new ( )

get the number of new user inputs

Returns
number of new user inputs

◆ get_output_value()

double get_output_value ( int  index)

get the output value corresponding to the requested index

Parameters
[in]indexrequested index
Returns
requested value or -1 if there is no output for the requested index

◆ get_output_vector_label()

char* get_output_vector_label ( int  index)

get the output vector label corresponding to the requested index

Parameters
[in]indexrequested index
Returns
requested vector label or "no_output" if there is no output for the requested index

◆ get_output_vector_nb()

int get_output_vector_nb ( )

get the number of user vector inputs

Returns
number of user vector inputs

◆ get_output_vector_ptr()

double* get_output_vector_ptr ( int  index)

get the pointer to the output vector at the requested index

Parameters
[in]indexrequested index
Returns
requested vector pointer for the requested index or NULL.

◆ get_output_vector_size()

int get_output_vector_size ( int  index)

get the output vector size corresponding to the requested index

Parameters
[in]indexrequested index
Returns
requested vector size for the requested index or -1 in case of error.

◆ init_set_output()

void init_set_output ( int  max_nb_curves)

initialize the static auto_output structure

◆ reset_flag_output()

void reset_flag_output ( )

reset the flag_output to 0. Useful when running several simulation in a row with different save2file settings.

◆ set_output()

int set_output ( double  value,
char *  label 
)

function called by the user to output the time evolution of a value

If the output fails, a warning message is raised. If you want to stop the computation set MbsData::flag_stop to 1.

Parameters
[in]valuecurrent value to output
[in]labellabel of the value
Returns
The status, negative in case of error.

◆ set_output_nb_new()

void set_output_nb_new ( int  nb)

set the number of new user inputs

Parameters
[in]nbnumber of new outputs to set

◆ set_output_value()

int set_output_value ( double  value,
int  val_index,
char *  label 
)

function called by the user to output the time evolution of a value in a vector.

Parameters
[in]valuecurrent output value
[in]val_indexindex of the value in the saved vector, first index is 1
[in]labelcurrent output label
Returns
The status, negative in case of error.

◆ set_output_value_from_id()

int set_output_value_from_id ( double  value,
int  val_index,
char *  label,
int  output_id 
)

◆ set_output_vector()

int set_output_vector ( double *  vector,
char *  label 
)

function called by the user to output the time evolution of a whole vector.

In the default MBsysC behavior, if the function fails, the current module will stop.

If you redirected the mbs_error_msg() via mbs_set_error_msg_fct_ptr() to a function that does not stop the process you can set MbsData::flag_stop to 1 to prevent further computation. If you let it continue, the vector is not saved.

Parameters
[in]vectorpointer to the current outputs vector
[in]labelcurrent output label
Returns
The status, negative in case of error.

◆ set_output_vector_from_id()

int set_output_vector_from_id ( double *  vector,
char *  label,
int  output_id 
)

function called by the user to output the time evolution of a whole vector. It is very similar to set_output_vector, with the output_id (starting at zero) of the vector that is known This allow to run the set_output function faster. By calling this function with an unknown vector (i.e. output_id = -1, the function will search for the correct index by itself - slower)

In the default MBsysC behavior, if the function fails, the current module will stop.

If you redirected the mbs_error_msg() via mbs_set_error_msg_fct_ptr() to a function that does not stop the process you can set MbsData::flag_stop to 1 to prevent further computation. If you let it continue, the vector is not saved.

Parameters
[in]vectorpointer to the current outputs vector
[in]labelcurrent output label (NULL if not known)
[in]output_idid of the output vector, starting at zero (if not known, -1)
Returns
The status, negative in case of error.