MercuryDPM
0.10
|
Here are the rounties to use a counter file to store run numbers. More...
#include <STD_save.h>
Public Member Functions | |
STD_save () | |
Default constructor: sets the counter to 0 (i.e. no number will be included). More... | |
STD_save (STD_save &other) | |
Copy constructor. More... | |
void | constructor () |
void | inc_counter_in_file () |
Increament the counter value stored in the file_counter by 1 and store the new value. More... | |
int | read_run_num_from_file () |
Read rom the counter file the counter. More... | |
void | set_counter_from_file () |
Sets the counter based on the current number stored in the counter file. More... | |
void | save_info_to_disk () |
Saves the information generated by info to disk in a file. More... | |
void | set_counter (int new_counter) |
This set the counter, overriding the defaults. More... | |
int | get_counter () |
This returns the current value of the counter. More... | |
virtual void | info () |
Set up a virtual info this will be provided from the inhertiance. More... | |
bool | FileExists (std::string strFilename) |
Function to check if a file exists, is used to check if a run has already need done. More... | |
void | auto_number () |
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:size_y where as the study number starts at 0. More... | |
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. More... | |
void | set_name (const char *name) |
Sets the name of the problem, used for the same data files. More... | |
std::string | get_name () |
Allows the problem_name to be accessed. More... | |
std::fstream & | get_data_file () |
Allows the problem_name to be accessed. More... | |
std::fstream & | get_stat_file () |
Allows the problem_name to be accessed. More... | |
std::fstream & | get_fstat_file () |
Allows the problem_name to be accessed. More... | |
std::fstream & | get_ene_file () |
Allows the problem_name to be accessed. More... | |
void | set_fstat_filename (std::string filename) |
void | set_data_filename (std::string filename) |
void | set_stat_filename (std::string filename) |
void | set_ene_filename (std::string filename) |
void | set_fstat_filename () |
void | set_data_filename () |
void | set_stat_filename () |
void | set_ene_filename () |
std::string | get_fstat_filename () |
std::string | get_data_filename () |
std::string | get_stat_filename () |
std::string | get_ene_filename () |
void | set_step_size (unsigned int new_) |
unsigned int | get_step_size () |
void | set_options_fstat (unsigned int new_) |
set and get for file options More... | |
unsigned int | get_options_fstat (void) |
void | set_options_data (unsigned int new_) |
unsigned int | get_options_data (void) |
void | set_options_stat (unsigned int new_) |
unsigned int | get_options_stat (void) |
void | set_options_restart (unsigned int new_) |
unsigned int | get_options_restart (void) |
void | set_options_ene (unsigned int new_) |
unsigned int | get_options_ene (void) |
bool | open_file (std::fstream &file, std::string filename, unsigned int options, std::fstream::openmode mode) |
bool | open_fstat_file (std::fstream::openmode mode=std::fstream::out) |
bool | open_data_file (std::fstream::openmode mode=std::fstream::out) |
bool | open_stat_file (std::fstream::openmode mode=std::fstream::out) |
bool | open_ene_file (std::fstream::openmode mode=std::fstream::out) |
bool | open_counted_file (std::fstream &file, std::string filenameNoCount, std::fstream::openmode mode) |
opens file needed if data is written in multiple files More... | |
bool | increase_counter_fstat (std::fstream::openmode mode) |
bool | increase_counter_data (std::fstream::openmode mode) |
bool | increase_counter_stat (std::fstream::openmode mode) |
bool | increase_counter_ene (std::fstream::openmode mode) |
void | set_file_counter (int new_) |
int | get_file_counter () |
Protected Attributes | |
std::stringstream | problem_name |
Stores the problem_name. More... | |
std::stringstream | data_filename |
These store the save file names, by default they are derived from problem_name. More... | |
std::stringstream | stat_filename |
std::stringstream | fstat_filename |
std::stringstream | ene_filename |
std::fstream | data_file |
Stream used for data files. More... | |
std::fstream | stat_file |
std::fstream | fstat_file |
std::fstream | ene_file |
unsigned int | options_fstat |
Indicators if files are created or not 0: file will not be created 1: file will be written in one file 2: file will be written in multiple files. More... | |
unsigned int | options_data |
unsigned int | options_stat |
unsigned int | options_ene |
unsigned int | options_restart |
unsigned int | file_counter |
Counter needed if file will be written in multiple files. More... | |
unsigned int | step_size |
Private Attributes | |
int | counter |
The stores the run number for saving. More... | |
Here are the rounties to use a counter file to store run numbers.
All my codes do this so I expect this rounties will be used often. So this saves my coping the same routine over and over again
Definition at line 48 of file STD_save.h.
|
inline |
Default constructor: sets the counter to 0 (i.e. no number will be included).
Definition at line 53 of file STD_save.h.
References constructor().
|
inline |
Copy constructor.
Definition at line 61 of file STD_save.h.
References constructor(), counter, get_counter(), get_name(), get_options_data(), get_options_ene(), get_options_fstat(), get_options_restart(), get_options_stat(), problem_name, set_options_data(), set_options_ene(), set_options_fstat(), set_options_restart(), and set_options_stat().
|
inline |
Definition at line 116 of file STD_save.h.
References inc_counter_in_file(), and set_counter_from_file().
Referenced by MD::readNextArgument().
|
inline |
Definition at line 75 of file STD_save.h.
References counter, data_file, ene_file, file_counter, fstat_file, set_options_data(), set_options_ene(), set_options_fstat(), set_options_restart(), set_options_stat(), stat_file, and step_size.
Referenced by STD_save().
bool STD_save::FileExists | ( | std::string | strFilename | ) |
Function to check if a file exists, is used to check if a run has already need done.
This is a FileExist routine, which is used to test if a run have already need preformed, allows me to plug holes in parm studies.
Definition at line 163 of file STD_save.cc.
int STD_save::get_counter | ( | ) |
This returns the current value of the counter.
Definition at line 85 of file STD_save.cc.
References counter.
Referenced by get_numbers(), MD::solve(), and STD_save().
|
inline |
Allows the problem_name to be accessed.
Definition at line 130 of file STD_save.h.
References data_file.
|
inline |
Definition at line 149 of file STD_save.h.
References data_filename.
Referenced by MD::find_next_data_file().
|
inline |
Allows the problem_name to be accessed.
Definition at line 136 of file STD_save.h.
References ene_file.
|
inline |
|
inline |
Definition at line 234 of file STD_save.h.
References file_counter.
Referenced by MD::find_next_data_file().
|
inline |
Allows the problem_name to be accessed.
Definition at line 134 of file STD_save.h.
References fstat_file.
|
inline |
|
inline |
Allows the problem_name to be accessed.
Definition at line 127 of file STD_save.h.
References problem_name.
Referenced by MD::readNextArgument(), and STD_save().
This turns a counter into two indexs for doing parmater studies. The indexs run from 1:size_x and 1:size_y where as the study number starts at 0.
This turns the counter into a two index numbers for doing parmeter studies///.
Definition at line 194 of file STD_save.cc.
References counter, and get_counter().
|
inline |
Definition at line 162 of file STD_save.h.
References options_data.
Referenced by MD::create_xballs_script(), MD::find_next_data_file(), MD::load_from_data_file(), open_data_file(), MD::read_next_from_data_file(), MD::solve(), and STD_save().
|
inline |
Definition at line 171 of file STD_save.h.
References options_ene.
Referenced by open_ene_file(), MD::solve(), and STD_save().
|
inline |
Definition at line 159 of file STD_save.h.
References options_fstat.
Referenced by open_fstat_file(), MD::solve(), and STD_save().
|
inline |
Definition at line 168 of file STD_save.h.
References options_restart.
Referenced by MD::solve(), and STD_save().
|
inline |
Definition at line 165 of file STD_save.h.
References options_stat.
Referenced by open_stat_file(), MD::solve(), and STD_save().
|
inline |
Allows the problem_name to be accessed.
Definition at line 132 of file STD_save.h.
References stat_file.
|
inline |
|
inline |
void STD_save::inc_counter_in_file | ( | ) |
Increament the counter value stored in the file_counter by 1 and store the new value.
Definition at line 100 of file STD_save.cc.
Referenced by auto_number().
|
inline |
Definition at line 221 of file STD_save.h.
References data_file, data_filename, and open_counted_file().
Referenced by MD::find_next_data_file(), MD::read_next_from_data_file(), and MD::solve().
|
inline |
Definition at line 228 of file STD_save.h.
References ene_file, ene_filename, file_counter, open_counted_file(), and step_size.
Referenced by MD::solve().
|
inline |
Definition at line 217 of file STD_save.h.
References file_counter, fstat_file, fstat_filename, open_counted_file(), and step_size.
Referenced by MD::solve().
|
inline |
Definition at line 224 of file STD_save.h.
References file_counter, open_counted_file(), stat_file, stat_filename, and step_size.
Referenced by MD::solve().
|
inlinevirtual |
Set up a virtual info this will be provided from the inhertiance.
Reimplemented in MD.
Definition at line 111 of file STD_save.h.
Referenced by save_info_to_disk().
int STD_save::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.
This launch a new program with the name passed///.
todo{Do something with the resulting integer (to remove compilation warning)}
Definition at line 219 of file STD_save.cc.
|
inline |
opens file needed if data is written in multiple files
Definition at line 198 of file STD_save.h.
References file_counter, and step_size.
Referenced by increase_counter_data(), increase_counter_ene(), increase_counter_fstat(), and increase_counter_stat().
|
inline |
Definition at line 187 of file STD_save.h.
References data_file, data_filename, get_options_data(), and open_file().
Referenced by MD::solve().
|
inline |
Definition at line 193 of file STD_save.h.
References ene_file, ene_filename, get_options_ene(), and open_file().
Referenced by MD::solve().
|
inline |
Definition at line 174 of file STD_save.h.
Referenced by open_data_file(), open_ene_file(), open_fstat_file(), and open_stat_file().
|
inline |
Definition at line 184 of file STD_save.h.
References fstat_file, fstat_filename, get_options_fstat(), and open_file().
Referenced by MD::solve().
|
inline |
Definition at line 190 of file STD_save.h.
References get_options_stat(), open_file(), stat_file, and stat_filename.
int STD_save::read_run_num_from_file | ( | ) |
Read rom the counter file the counter.
Definition at line 37 of file STD_save.cc.
References counter.
Referenced by set_counter_from_file().
void STD_save::save_info_to_disk | ( | ) |
Saves the information generated by info to disk in a file.
This save the information file to disk my redirection the std::cout stream and calling the normal info call///.
Definition at line 139 of file STD_save.cc.
References counter, and info().
void STD_save::set_counter | ( | int | new_counter | ) |
This set the counter, overriding the defaults.
Definition at line 78 of file STD_save.cc.
References counter.
Referenced by MD::readNextArgument(), and set_counter_from_file().
void STD_save::set_counter_from_file | ( | ) |
Sets the counter based on the current number stored in the counter file.
Definition at line 92 of file STD_save.cc.
References read_run_num_from_file(), and set_counter().
Referenced by auto_number().
|
inline |
Definition at line 139 of file STD_save.h.
References data_filename.
|
inline |
Definition at line 144 of file STD_save.h.
References data_filename, and problem_name.
Referenced by MD::solve().
|
inline |
|
inline |
Definition at line 146 of file STD_save.h.
References ene_filename, and problem_name.
Referenced by MD::solve().
|
inline |
Definition at line 233 of file STD_save.h.
References file_counter.
Referenced by MD::find_next_data_file().
|
inline |
|
inline |
Definition at line 143 of file STD_save.h.
References fstat_filename, and problem_name.
Referenced by MD::solve().
|
inline |
Sets the name of the problem, used for the same data files.
Definition at line 125 of file STD_save.h.
References problem_name.
|
inline |
Definition at line 161 of file STD_save.h.
References options_data.
Referenced by ChuteBottom::constructor(), constructor(), MD::load_from_data_file(), MD::readNextArgument(), and STD_save().
|
inline |
Definition at line 170 of file STD_save.h.
References options_ene.
Referenced by constructor(), MD::readNextArgument(), and STD_save().
|
inline |
set and get for file options
Definition at line 158 of file STD_save.h.
References options_fstat.
Referenced by ChuteBottom::constructor(), constructor(), MD::readNextArgument(), and STD_save().
|
inline |
Definition at line 167 of file STD_save.h.
References options_restart.
Referenced by ChuteBottom::constructor(), constructor(), MD::readNextArgument(), and STD_save().
|
inline |
Definition at line 164 of file STD_save.h.
References options_stat.
Referenced by constructor(), MD::readNextArgument(), and STD_save().
|
inline |
|
inline |
Definition at line 145 of file STD_save.h.
References problem_name, and stat_filename.
|
inline |
|
private |
The stores the run number for saving.
Definition at line 238 of file STD_save.h.
Referenced by constructor(), get_counter(), get_numbers(), read_run_num_from_file(), save_info_to_disk(), set_counter(), and STD_save().
|
protected |
Stream used for data files.
Definition at line 252 of file STD_save.h.
Referenced by constructor(), MD::find_next_data_file(), get_data_file(), increase_counter_data(), MD::load_from_data_file(), open_data_file(), MD::output_xballs_data(), MD::output_xballs_data_particle(), MD::read_dim_from_data_file(), MD::read_next_from_data_file(), MD::solve(), and MD::statistics_from_restart_data().
|
protected |
These store the save file names, by default they are derived from problem_name.
Definition at line 246 of file STD_save.h.
Referenced by MD::create_xballs_script(), get_data_filename(), increase_counter_data(), open_data_file(), MD::read_dim_from_data_file(), set_data_filename(), and MD::statistics_from_restart_data().
|
protected |
Definition at line 255 of file STD_save.h.
Referenced by constructor(), get_ene_file(), increase_counter_ene(), open_ene_file(), MD::output_ene(), MD::solve(), and MD::start_ene().
|
protected |
Definition at line 249 of file STD_save.h.
Referenced by get_ene_filename(), increase_counter_ene(), open_ene_file(), and set_ene_filename().
|
protected |
Counter needed if file will be written in multiple files.
Definition at line 269 of file STD_save.h.
Referenced by constructor(), get_file_counter(), increase_counter_ene(), increase_counter_fstat(), increase_counter_stat(), open_counted_file(), and set_file_counter().
|
protected |
Definition at line 254 of file STD_save.h.
Referenced by MD::compute_internal_forces(), MD::compute_plastic_internal_forces(), MD::compute_walls(), constructor(), MD::fstat_header(), get_fstat_file(), increase_counter_fstat(), open_fstat_file(), and MD::solve().
|
protected |
Definition at line 248 of file STD_save.h.
Referenced by get_fstat_filename(), increase_counter_fstat(), open_fstat_file(), and set_fstat_filename().
|
protected |
Definition at line 263 of file STD_save.h.
Referenced by get_options_data(), MD::load_from_data_file(), MD::print(), MD::read(), MD::read_v1(), MD::read_v2(), set_options_data(), MD::write(), and MD::write_v1().
|
protected |
Definition at line 265 of file STD_save.h.
Referenced by get_options_ene(), MD::print(), MD::read(), MD::read_v1(), MD::read_v2(), set_options_ene(), MD::write(), and MD::write_v1().
|
protected |
Indicators if files are created or not 0: file will not be created 1: file will be written in one file 2: file will be written in multiple files.
Definition at line 262 of file STD_save.h.
Referenced by get_options_fstat(), MD::print(), MD::read(), MD::read_v1(), MD::read_v2(), set_options_fstat(), MD::write(), and MD::write_v1().
|
protected |
Definition at line 266 of file STD_save.h.
Referenced by get_options_restart(), MD::print(), MD::read(), MD::read_v2(), MD::save_restart_data(), set_options_restart(), and MD::write().
|
protected |
Definition at line 264 of file STD_save.h.
Referenced by get_options_stat(), and set_options_stat().
|
protected |
Stores the problem_name.
Definition at line 242 of file STD_save.h.
Referenced by MD::constructor(), MD::create_xballs_script(), get_name(), MD::load_restart_data(), MD::print(), MD::read(), MD::read_v1(), MD::save_restart_data(), set_data_filename(), set_ene_filename(), set_fstat_filename(), set_name(), MD::set_name(), set_stat_filename(), MD::solve(), STD_save(), MD::write(), and MD::write_v1().
|
protected |
Definition at line 253 of file STD_save.h.
Referenced by constructor(), get_stat_file(), increase_counter_stat(), open_stat_file(), and MD::statistics_from_restart_data().
|
protected |
Definition at line 247 of file STD_save.h.
Referenced by get_stat_filename(), increase_counter_stat(), open_stat_file(), set_stat_filename(), and MD::statistics_from_restart_data().
|
protected |
Definition at line 270 of file STD_save.h.
Referenced by constructor(), get_step_size(), increase_counter_ene(), increase_counter_fstat(), increase_counter_stat(), open_counted_file(), and set_step_size().