MercuryDPM
Alpha
|
Every simulation requires data files to store all the information necessary for visualisation and analysis. The class File provides an fstream variable for reading/writing i.e. input and output. More...
#include <Files.h>
Public Member Functions | |
Files () | |
A constructor. More... | |
virtual | ~Files () |
A destructor, watch out its a virtual destructor. More... | |
Files (const Files &other) | |
Copy constructor. More... | |
MERCURY_DEPRECATED File & | getDataFile () |
The non const version. Allows one to edit the File::dataFile. More... | |
MERCURY_DEPRECATED File & | getEneFile () |
The non const version. Allows to edit the File::eneFile. More... | |
MERCURY_DEPRECATED File & | getFStatFile () |
The non const version. Allows to edit the File::fStatFile. More... | |
MERCURY_DEPRECATED File & | getRestartFile () |
The non const version. Allows to edit the File::restartFile. More... | |
MERCURY_DEPRECATED File & | getStatFile () |
The non const version. Allows to edit the File::statFile. More... | |
MERCURY_DEPRECATED const File & | getDataFile () const |
The const version. Does not allow for any editing of the File::dataFile. More... | |
MERCURY_DEPRECATED const File & | getEneFile () const |
The const version. Does not allow for any editing of the File::eneFile. More... | |
MERCURY_DEPRECATED const File & | getFStatFile () const |
The const version. Does not allow for any editing of the File::fStatFile. More... | |
MERCURY_DEPRECATED const File & | getRestartFile () const |
The const version. Does not allow for any editing of the File::restartFile. More... | |
MERCURY_DEPRECATED const File & | getStatFile () const |
The const version. Does not allow for any editing of the File::statFile. More... | |
const std::string & | getName () const |
Returns the name of the file. Does not allow to change it though. More... | |
void | setName (const std::string &name) |
Allows to set the name of all the files (ene, data, fstat, restart, stat) More... | |
void | setName (const char *name) |
Calls setName(std::string) More... | |
void | setSaveCount (unsigned int saveCount) |
Sets File::saveCount_ for all files (ene, data, fstat, restart, stat) More... | |
void | setFileType (FileType fileType) |
Sets File::fileType_ for all files (ene, data, fstat, restart, stat) More... | |
void | setOpenMode (std::fstream::openmode openMode) |
Sets File::openMode_ for all files (ene, data, fstat, restart, stat) More... | |
void | resetFileCounter () |
Resets the file counter for each file i.e. for ene, data, fstat, restart, stat) More... | |
void | read (std::istream &is) |
Extracts data from the input stream (which is basically a file you want to read from) into name_, restartFile .... More... | |
void | write (std::ostream &os) const |
Writes data into a file from the member variables name_, restartFile, dataFile etc. More... | |
void | openFiles () |
Opens all the files (ene, data, fstat, restart, stat) for reading and writing purposes. More... | |
void | closeFiles () |
Closes all files (ene, data, fstat, restart, stat) that were opened to read or write. More... | |
void | setNextSavedTimeStep (unsigned int nextSavedTimeStep) |
Sets the next time step for all the files (ene, data, fstat, restart, stat) at which the data is to be written or saved. More... | |
Public Attributes | |
File | dataFile |
An instance of class File to handle in- and output into a .data file. More... | |
File | fStatFile |
An instance of class File to handle in- and output into a .fstat file. More... | |
File | eneFile |
An instance of class File to handle in- and output into a .ene file. More... | |
File | restartFile |
An instance of class File to handle in- and output into a .restart file. More... | |
File | statFile |
An instance of class File to handle in- and output into a .stat file. More... | |
Private Attributes | |
std::string | name_ |
the name of the problem, used, e.g., for the files More... | |
Every simulation requires data files to store all the information necessary for visualisation and analysis. The class File provides an fstream variable for reading/writing i.e. input and output.
Files is defined in the header Files.h, which includes definitions from another header called "File.h"
The class also allows one to store additional information like
Files::Files | ( | ) |
A constructor.
The constructor which sets the file precision for DataFile, FStatFile, EneFile, RestartFile, StatFile.
Definition at line 33 of file Files.cc.
References dataFile, eneFile, fStatFile, File::getFstream(), name_, restartFile, and statFile.
|
virtual |
Files::Files | ( | const Files & | other | ) |
Copy constructor.
Also sets the name of Files to be the same as the one from which one makes a copy.
[in] | other | (A const reference of the object to be copied) |
Definition at line 53 of file Files.cc.
References getName(), and setName().
void Files::closeFiles | ( | ) |
Closes all files (ene, data, fstat, restart, stat) that were opened to read or write.
Definition at line 252 of file Files.cc.
References File::close(), dataFile, eneFile, fStatFile, restartFile, and statFile.
Referenced by DPMBase::solve(), and Mercury3DRestart::writeOutputFiles().
File & Files::getDataFile | ( | ) |
The non const version. Allows one to edit the File::dataFile.
Definition at line 61 of file Files.cc.
References dataFile.
const File & Files::getDataFile | ( | ) | const |
The const version. Does not allow for any editing of the File::dataFile.
Definition at line 96 of file Files.cc.
References dataFile.
File & Files::getEneFile | ( | ) |
The non const version. Allows to edit the File::eneFile.
Definition at line 68 of file Files.cc.
References eneFile.
const File & Files::getEneFile | ( | ) | const |
The const version. Does not allow for any editing of the File::eneFile.
Definition at line 104 of file Files.cc.
References eneFile.
File & Files::getFStatFile | ( | ) |
The non const version. Allows to edit the File::fStatFile.
Definition at line 75 of file Files.cc.
References fStatFile.
const File & Files::getFStatFile | ( | ) | const |
The const version. Does not allow for any editing of the File::fStatFile.
Definition at line 111 of file Files.cc.
References fStatFile.
const std::string & Files::getName | ( | ) | const |
Returns the name of the file. Does not allow to change it though.
Definition at line 132 of file Files.cc.
References name_.
Referenced by Files(), main(), Mercury3DRestart::readNextArgument(), DPMBase::readNextArgument(), Chute::setupInitialConditions(), DPMBase::solve(), Mercury3DRestart::writeOutputFiles(), InteractionHandler::writeVTK(), ParticleHandler::writeVTK(), DPMBase::writeVTK(), WallHandler::writeVTKBoundingBox(), and WallHandler::writeVTKFile().
File & Files::getRestartFile | ( | ) |
The non const version. Allows to edit the File::restartFile.
Definition at line 82 of file Files.cc.
References restartFile.
const File & Files::getRestartFile | ( | ) | const |
The const version. Does not allow for any editing of the File::restartFile.
Definition at line 118 of file Files.cc.
References restartFile.
File & Files::getStatFile | ( | ) |
The non const version. Allows to edit the File::statFile.
Definition at line 89 of file Files.cc.
References statFile.
const File & Files::getStatFile | ( | ) | const |
The const version. Does not allow for any editing of the File::statFile.
Definition at line 125 of file Files.cc.
References statFile.
void Files::openFiles | ( | ) |
Opens all the files (ene, data, fstat, restart, stat) for reading and writing purposes.
Definition at line 241 of file Files.cc.
References dataFile, eneFile, fStatFile, File::open(), and restartFile.
void Files::read | ( | std::istream & | is | ) |
Extracts data from the input stream (which is basically a file you want to read from) into name_, restartFile ....
[in,out] | is | (a reference of the input stream) |
Definition at line 212 of file Files.cc.
References dataFile, eneFile, fStatFile, name_, restartFile, setName(), and statFile.
Referenced by FilesAndRunNumber::read().
void Files::resetFileCounter | ( | ) |
Resets the file counter for each file i.e. for ene, data, fstat, restart, stat)
This implicitly calls the setCounter() function defined in File.h
Definition at line 190 of file Files.cc.
References dataFile, eneFile, fStatFile, restartFile, File::setCounter(), and statFile.
Referenced by DPMBase::solve().
void Files::setFileType | ( | FileType | fileType | ) |
Sets File::fileType_ for all files (ene, data, fstat, restart, stat)
Calls the setFileType() function from the File.h, which basically sets the File::fileType_
[in] | fileType | (an object of enum class FileType) |
Definition at line 170 of file Files.cc.
References dataFile, eneFile, fStatFile, restartFile, File::setFileType(), and statFile.
Referenced by helpers::loadingTest(), helpers::normalAndTangentialLoadingTest(), helpers::objectivenessTest(), and DPMBase::readNextArgument().
void Files::setName | ( | const std::string & | name | ) |
Allows to set the name of all the files (ene, data, fstat, restart, stat)
[in] | name |
Definition at line 150 of file Files.cc.
References dataFile, eneFile, fStatFile, name_, restartFile, File::setName(), and statFile.
Referenced by DPMBase::constructor(), ChuteBottom::constructor(), FileReader::FileReader(), Files(), main(), read(), Mercury3DRestart::readNextArgument(), DPMBase::readNextArgument(), DPMBase::readOld(), setName(), and DPMBase::solve().
void Files::setName | ( | const char * | name | ) |
Calls setName(std::string)
[in] | name |
Definition at line 162 of file Files.cc.
References setName().
void Files::setNextSavedTimeStep | ( | unsigned int | nextSavedTimeStep | ) |
Sets the next time step for all the files (ene, data, fstat, restart, stat) at which the data is to be written or saved.
[in] | nextSavedTimeStep |
Definition at line 263 of file Files.cc.
References dataFile, eneFile, fStatFile, restartFile, File::setNextSavedTimeStep(), and statFile.
Referenced by FileReader::read(), DPMBase::readNextArgument(), and DPMBase::solve().
void Files::setOpenMode | ( | std::fstream::openmode | openMode | ) |
Sets File::openMode_ for all files (ene, data, fstat, restart, stat)
[in] | openmode |
Definition at line 201 of file Files.cc.
References dataFile, eneFile, fStatFile, restartFile, File::setOpenMode(), and statFile.
Referenced by DPMBase::solve().
void Files::setSaveCount | ( | unsigned int | saveCount | ) |
Sets File::saveCount_ for all files (ene, data, fstat, restart, stat)
sets the number of time steps skipped between each save for ALL data files.
Definition at line 139 of file Files.cc.
References dataFile, eneFile, fStatFile, restartFile, File::setSaveCount(), and statFile.
Referenced by DPMBase::constructor(), helpers::loadingTest(), ChuteBottom::makeRoughBottom(), helpers::normalAndTangentialLoadingTest(), helpers::objectivenessTest(), DPMBase::readNextArgument(), and DPMBase::readParAndIniFiles().
void Files::write | ( | std::ostream & | os | ) | const |
Writes data into a file from the member variables name_, restartFile, dataFile etc.
[in,out] | os | We pass the std::ostream& os (which is basically the file into which you want the data to be written into) as an input argument, As the output stream is modified in the write function below, it is also the output variable (do not confuse |
[out] | with | the return variable) |
Definition at line 229 of file Files.cc.
References dataFile, eneFile, fStatFile, name_, restartFile, and statFile.
Referenced by FilesAndRunNumber::write().
File Files::dataFile |
An instance of class File to handle in- and output into a .data file.
Definition at line 204 of file Files.h.
Referenced by closeFiles(), ChuteBottom::constructor(), Files(), DPMBase::findNextExistingDataFile(), getDataFile(), main(), openFiles(), read(), DPMBase::readDataFile(), DPMBase::readNextArgument(), DPMBase::readNextDataFile(), DPMBase::readOld(), DPMBase::readParAndIniFiles(), resetFileCounter(), setFileType(), setName(), setNextSavedTimeStep(), setOpenMode(), setSaveCount(), write(), and DPMBase::writeOutputFiles().
File Files::eneFile |
An instance of class File to handle in- and output into a .ene file.
Definition at line 214 of file Files.h.
Referenced by closeFiles(), Files(), getEneFile(), openFiles(), read(), DPMBase::readNextArgument(), DPMBase::readOld(), resetFileCounter(), setFileType(), setName(), setNextSavedTimeStep(), setOpenMode(), setSaveCount(), write(), and DPMBase::writeOutputFiles().
File Files::fStatFile |
An instance of class File to handle in- and output into a .fstat file.
Definition at line 209 of file Files.h.
Referenced by closeFiles(), ChuteBottom::constructor(), Files(), getFStatFile(), main(), openFiles(), read(), DPMBase::readNextArgument(), DPMBase::readOld(), DPMBase::readParAndIniFiles(), resetFileCounter(), setFileType(), setName(), setNextSavedTimeStep(), setOpenMode(), setSaveCount(), write(), and DPMBase::writeOutputFiles().
|
private |
File Files::restartFile |
An instance of class File to handle in- and output into a .restart file.
Definition at line 219 of file Files.h.
Referenced by closeFiles(), ChuteBottom::constructor(), Files(), getRestartFile(), main(), openFiles(), read(), Mercury3DRestart::readNextArgument(), DPMBase::readNextArgument(), DPMBase::readOld(), DPMBase::readRestartFile(), resetFileCounter(), setFileType(), setName(), setNextSavedTimeStep(), setOpenMode(), setSaveCount(), DPMBase::solve(), write(), DPMBase::writeOutputFiles(), and DPMBase::writeRestartFile().
File Files::statFile |
An instance of class File to handle in- and output into a .stat file.
Definition at line 224 of file Files.h.
Referenced by closeFiles(), Files(), getStatFile(), read(), DPMBase::readNextArgument(), DPMBase::readOld(), resetFileCounter(), setFileType(), setName(), setNextSavedTimeStep(), setOpenMode(), setSaveCount(), and write().