EcoliSimulator  2.0.1a
mainFunctions.h File Reference
#include <thread>

Go to the source code of this file.

Functions

void initial_page ()
 
void seed ()
 
void GestioneArgv (int argc, const char *argv[], string &versione_Matlab)
 
int GestioneArgvV2 (int argc, const char *argv[], string &versione_Matlab, int &readfromfile)
 New version of gestion Arg. More...
 
int import_path (string versione_MATLAB)
 
void ErrorImportPath ()
 
int set_MODE_Program (string &versione_Matlab, int &demo_mode, int readfromfile)
 
int SetMainFolder (int demo_mode)
 
void ReadableFileRisp (int &stat_sim, int demo_mode)
 
int FunzBiginEnd (int &number_routine, int &cont_gen_sim, int &read_par_file, string &versione_Matlab, vector< string > *pt_name_file_satistics, vector< string > *pt_name_info_satistics, int &demo_mode, int &stat_sim)
 
int ConditionEnd (int &read_par_file, int &stat_sim, int &BiginEnd)
 
void last_deleting ()
 
int save_path (string versione_MATLAB)
 
void CopyEcoliFiles ()
 
int Congedo (int number_routine)
 
void seedRandomObj (int n_this_thread, std::thread::id hash_code)
 
int writeLog (string topic, string message)
 this function write to the Log file. More...
 

Function Documentation

int ConditionEnd ( int &  read_par_file,
int &  stat_sim,
int &  BiginEnd 
)

This function check if we quit from the routine loop.

Parameters
read_par_file==121we just save the answer. We can decide if we want to save the parameters.
Returns
an int !=0 if an error occured, otherwise 0
int Congedo ( int  number_routine)

This function tells you where you find the results of the simulation: the folder and its organization.

This function summarizes where you can find the files and how they are organized.

void CopyEcoliFiles ( )

The function save the file .Ecoli (which are .txt files) in the main folder. In Windows, the main folder is on the Desktop: Modify it following the Unix version

void ErrorImportPath ( )

If a problem occued while reading the file 'EcoliPath.Ecoli', it display the path and relative information of default: you can modify them afterwords

int FunzBiginEnd ( int &  number_routine,
int &  cont_gen_sim,
int &  read_par_file,
string &  versione_Matlab,
vector< string > *  pt_name_file_satistics,
vector< string > *  pt_name_info_satistics,
int &  demo_mode,
int &  stat_sim 
)

This function makes more readable the main: it contains all the internal part from the beginning of a routine of simulation to its end it pass all the parameers we set.

Parameters
theparameters stat_sim is used to check if we want to perform another routine or not: it is used in the function int ConditionEnd(int &read_par_file, int &stat_sim, int &BiginEnd)

This function makes more readable the main: it contains all the internal part from the beginning of a routine of simulation to its end it pass all the parameers we set.

Parameters
theparameters stat_sim is used to check if we want to perform another routine or not: it is used in the function int ConditionEnd(int &read_par_file, int &stat_sim, int &BiginEnd)
Returns
a negative number if something went wrong, otherwise it can return number of bacteria, 0 etc.
void GestioneArgv ( int  argc,
const char *  argv[],
string &  versione_Matlab 
)

It take possible input from command line and deals with it It also set the Desktop as location for the folder. if you pass "file", only the simulation is guided by the file "EcoliRisposte.Ecoli" in the same folder

Parameters
versione_Matlabsave whioch version of matlab the program, when asked, has to lunch
argv[]can be of the following: clear, delete all file .dat, .gnu, .eps, .txt, .avi, .png (see void last_deleting()) it can be followed by versione_Matlab, otherwise versione_Matlab is the first argument to pass no versione_Matlab, pass 'n'. the 3nd argument can be the location of gnuplot. You can always set it afterwords, or read it from file
int GestioneArgvV2 ( int  argc,
const char *  argv[],
string &  versione_Matlab,
int &  readfromfile 
)

New version of gestion Arg.

The new way to give option is –"option=" valore option. 1- –matlab=x // set version matlab x 2- –gnuplot=y // set path to gnuplot y, n to set default 3- –file=namefile // set file risposte to namefile [] TODO

  • default, i.e. only –file //EcoliRisposte ... 4- –clear // clear all possible trash data 5- –reset // rest cleaning all files and settings 6- –j=n // max number of core to use, default is all available 7- –clclog // clear the file Ecoli.LogEcoli 8- –apngasm // use or not apngasm 9- –script // if we do not want the initial page 10- –dir=x // set saving directory
int import_path ( string  version_MATLAB)

The function read the file 'EcoliPath.Ecoli', where there are saved path and option for the programs gnuplot, agapng and matlab

void initial_page ( )

This function drow the initial page for the command line program. note: for windows it is without colors. To change modify the definition of color in Color.h It set the initial page size: if it doesn't fit, work on it. There's one definition for Windows, one for Mac (it should works also for Unix system, but I didn't test it)

This function drow the initial page for the command line program. note: for windows it is without colors.

void last_deleting ( )

delete all file .dat, .gnu, .eps, .txt, .avi, .png

void ReadableFileRisp ( int &  stat_sim,
int  demo_mode 
)

If we open the file of the answer ok, otherwise we have to insert input manually see func. int read_file_par()

int save_path ( string  versione_MATLAB)

The function saves in "EcoliPath.Ecoli" the parameters and path about the program Matlab, gnuplot etc.

void seed ( )

This function set the seed of the pseudo-random variable in the file FunzRand.h in the uniform distribution function it is written a possible reseed when enough random number are generated: check variable con_rand.

void seedRandomObj ( int  n_this_thread,
std::thread::id  hash_code 
)
int set_MODE_Program ( string &  versione_Matlab,
int &  demo_mode,
int  read_from_file 
)

This function set the MODE of the program: read from file, step-by-step or DEMO pressing 121 you can enter the menu to set the parameters of the ausiliary programs see function: set_gnuplot_Matlab_apngas(versione_Matlab)

This function set the MODE of the program: read from file, step-by-step or DEMO pressing 121 you can enter the menu to set the parameters of the ausiliary programs see function: set_gnuplot_Matlab_apngas(versione_Matlab) NEW:

Parameters
read_from_filethis is a new feature: not 100% optimal solution, allows the user to pass file to the argument of the progarm and it run anly the "script"
int SetMainFolder ( int  demo_mode)

This function create MAIN_FOLDER

  • create Folder in the desired location where we save and collect all the data.
    Parameters
    demo_mode== 1, the folder name is DEMO_etc... the name is obtain from the current data.
int writeLog ( string  topic,
string  message 
)

this function write to the Log file.