55 #ifdef CONSTUCTOR_OUTPUT
56 std::cerr <<
"STD_save() finished"<<std::endl;
70 #ifdef CONSTUCTOR_OUTPUT
71 std::cerr <<
"STD_save(STD_save& other) finished"<<std::endl;
119 std::vector<int>
get_numbers(
int size_x,
int size_y);
122 int launch_new(
const char* name,
bool quick=
false);
174 bool open_file (std::fstream& file, std::string filename,
unsigned int options, std::fstream::openmode mode)
178 file.open( filename.c_str(), mode);
179 if (file.fail())
return false;
198 bool open_counted_file(std::fstream& file, std::string filenameNoCount, std::fstream::openmode mode){
200 std::stringstream filename;
201 filename << filenameNoCount <<
".";
207 if (file.is_open()) file.close();
209 file.open(filename.str().c_str(), mode);
210 if (!file.is_open()) {std::cerr <<
"Error in opening " << filename.str() << std::endl;
return false;}
STD_save()
Default constructor: sets the counter to 0 (i.e. no number will be included).
unsigned int file_counter
Counter needed if file will be written in multiple files.
std::stringstream stat_filename
unsigned int options_restart
bool open_fstat_file(std::fstream::openmode mode=std::fstream::out)
void set_counter(int new_counter)
This set the counter, overriding the defaults.
bool open_file(std::fstream &file, std::string filename, unsigned int options, std::fstream::openmode mode)
void save_info_to_disk()
Saves the information generated by info to disk in a file.
Here are the rounties to use a counter file to store run numbers.
int counter
The stores the run number for saving.
std::stringstream data_filename
These store the save file names, by default they are derived from problem_name.
unsigned int get_step_size()
bool FileExists(std::string strFilename)
Function to check if a file exists, is used to check if a run has already need done.
std::string get_ene_filename()
virtual void info()
Set up a virtual info this will be provided from the inhertiance.
void set_options_data(unsigned int new_)
void set_options_restart(unsigned int new_)
void set_fstat_filename()
unsigned int options_fstat
Indicators if files are created or not 0: file will not be created 1: file will be written in one fil...
bool open_counted_file(std::fstream &file, std::string filenameNoCount, std::fstream::openmode mode)
opens file needed if data is written in multiple files
std::string get_fstat_filename()
std::vector< int > get_numbers(int size_x, int size_y)
This turns a counter into two indexs for doing parmater studies. The indexs run from 1:size_x and 1:s...
STD_save(STD_save &other)
Copy constructor.
unsigned int get_options_fstat(void)
int read_run_num_from_file()
Read rom the counter file the counter.
std::stringstream problem_name
Stores the problem_name.
void set_name(const char *name)
Sets the name of the problem, used for the same data files.
void set_options_fstat(unsigned int new_)
set and get for file options
std::fstream data_file
Stream used for data files.
int launch_new(const char *name, bool quick=false)
This launch a code from within this code. Please pass the name of the code to run.
std::fstream & get_data_file()
Allows the problem_name to be accessed.
void set_fstat_filename(std::string filename)
void set_ene_filename(std::string filename)
void set_stat_filename(std::string filename)
unsigned int options_stat
void set_step_size(unsigned int new_)
unsigned int get_options_data(void)
std::fstream & get_stat_file()
Allows the problem_name to be accessed.
void set_data_filename(std::string filename)
bool increase_counter_fstat(std::fstream::openmode mode)
std::stringstream ene_filename
void set_counter_from_file()
Sets the counter based on the current number stored in the counter file.
std::fstream & get_fstat_file()
Allows the problem_name to be accessed.
bool open_data_file(std::fstream::openmode mode=std::fstream::out)
unsigned int get_options_ene(void)
unsigned int get_options_stat(void)
unsigned int get_options_restart(void)
std::stringstream fstat_filename
int get_counter()
This returns the current value of the counter.
void set_file_counter(int new_)
std::string get_stat_filename()
std::string get_data_filename()
std::fstream & get_ene_file()
Allows the problem_name to be accessed.
bool increase_counter_ene(std::fstream::openmode mode)
bool increase_counter_data(std::fstream::openmode mode)
std::string get_name()
Allows the problem_name to be accessed.
unsigned int options_data
void set_options_stat(unsigned int new_)
bool increase_counter_stat(std::fstream::openmode mode)
bool open_ene_file(std::fstream::openmode mode=std::fstream::out)
void inc_counter_in_file()
Increament the counter value stored in the file_counter by 1 and store the new value.
bool open_stat_file(std::fstream::openmode mode=std::fstream::out)
void set_options_ene(unsigned int new_)