#include <fstream>
#include "GeneralDefine.h"
Go to the source code of this file.
|
std::string | to_string_padded (unsigned int value) |
| Pads the number This function tries to pad the number to 4 digits, which is used when you create multiple files with padded numbers. Any numbers larger than 4 digits return unmodified. More...
|
|
std::ostream & | operator<< (std::ostream &os, FileType fileType) |
| Writes the FileType as a human-readable string into the output stream 'os'. More...
|
|
std::istream & | operator>> (std::istream &is, FileType &fileType) |
| Reads the FileType from an input stream 'is'. More...
|
|
|
const unsigned | NEVER = static_cast<const unsigned int>(-1) |
|
◆ FileType
With FileType options, one is able to choose if data is to be read/written from/into no or single or multiple files.
Enumerator |
---|
NO_FILE | file will not be created/read
|
ONE_FILE | all data will be written into/ read from a single file called name_
|
MULTIPLE_FILES | each time-step will be written into/read from separate files numbered consecutively: name_.0, name_.1, .. so on
|
MULTIPLE_FILES_PADDED | each time-step will be written into/read from separate files numbered consecutively, with numbers padded by zeros to a minimum of four digits: name_.0000, name_.0001, ..
|
@ MULTIPLE_FILES
each time-step will be written into/read from separate files numbered consecutively: name_....
@ MULTIPLE_FILES_PADDED
each time-step will be written into/read from separate files numbered consecutively,...
@ NO_FILE
file will not be created/read
@ ONE_FILE
all data will be written into/ read from a single file called name_
◆ operator<<()
std::ostream& operator<< |
( |
std::ostream & |
os, |
|
|
FileType |
fileType |
|
) |
| |
Writes the FileType as a human-readable string into the output stream 'os'.
- Parameters
-
[in,out] | os | output stream to which the fileType is written |
[in] | fileType | the fileType that has to be written to the output stream |
- Returns
- the output stream "os" that is returned after adding the fileType string
63 os <<
"MULTIPLE_FILES";
65 os <<
"MULTIPLE_FILES_PADDED";
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
LL< Log::ERROR > ERROR
Error log level.
Definition: Logger.cc:53
References ERROR, logger, MULTIPLE_FILES, MULTIPLE_FILES_PADDED, NO_FILE, and ONE_FILE.
◆ operator>>()
std::istream& operator>> |
( |
std::istream & |
is, |
|
|
FileType & |
fileType |
|
) |
| |
Reads the FileType from an input stream 'is'.
- Parameters
-
[in,out] | is | The input stream from which the fileType is read |
[in] | fileType | The fileType that has to be read from the input stream |
- Returns
- the input stream "is" (that is returned after the fileType string is read out)
80 std::string fileTypeString;
82 if (!fileTypeString.compare(
"NO_FILE"))
84 else if (!fileTypeString.compare(
"ONE_FILE"))
86 else if (!fileTypeString.compare(
"MULTIPLE_FILES"))
88 else if (!fileTypeString.compare(
"MULTIPLE_FILES_PADDED"))
92 logger(
ERROR,
"operator>>: FileType % not recognized", fileTypeString);
References ERROR, logger, MULTIPLE_FILES, MULTIPLE_FILES_PADDED, NO_FILE, and ONE_FILE.
◆ to_string_padded()
std::string to_string_padded |
( |
unsigned int |
value | ) |
|
Pads the number This function tries to pad the number to 4 digits, which is used when you create multiple files with padded numbers. Any numbers larger than 4 digits return unmodified.
- Parameters
-
- Returns
- A padded string
46 std::ostringstream out;
47 out << std::setw(4) << std::setfill(
'0') << value;
Referenced by File::getFullName(), and DPMBase::removeOldFiles().
◆ NEVER
const unsigned NEVER = static_cast<const unsigned int>(-1) |
- Todo:
- IFCD: can we make this an int instead of unsigned int, as -1 as an unsigned is not good style?
Referenced by BaseCG::BaseCG(), File::File(), CGHandler::finish(), DPMBase::forceWriteOutputFiles(), main(), File::read(), DPMBase::resetFileCounter(), File::saveCurrentTimeStepNoFileTypeCheck(), Calibration::setOutput(), Wall::setupInitialConditions(), and File::writeFirstAndLastTimeStep().