SPH
|
Helper file generating file names for output files. More...
#include <Output.h>
Public Member Functions | |
OutputFile ()=default | |
OutputFile (const Path &pathMask, const Size firstDumpIdx=0) | |
Creates a new filename generator using provided path mask. More... | |
Path | getNextPath (const Statistics &stats) const |
Returns path to the next output file. More... | |
bool | hasWildcard () const |
Returns true if the file mask contains (at least one) wildcard. More... | |
Path | getMask () const |
Returns the file mask as given in constructor. More... | |
Static Public Member Functions | |
static Optional< Size > | getDumpIdx (const Path &path) |
Extracts the dump index from given path generated by OutputFile. More... | |
static Optional< OutputFile > | getMaskFromPath (const Path &path, const Size firstDumpIdx=0) |
Attemps to get the OutputFile from one of the path generated from it. More... | |
Helper file generating file names for output files.
This class only operates with paths and path masks. It does not perform any I/O operations to check for files, nor it creates any files, similarly to class Path.
|
default |
NAMESPACE_SPH_BEGIN OutputFile::OutputFile | ( | const Path & | pathMask, |
const Size | firstDumpIdx = 0 |
||
) |
Creates a new filename generator using provided path mask.
If the input mask is a regular path, all calls to getNextPath will simply return the input path. Note that output generated using such OutputFile will override the previous one. To avoid this, the pathMask can contain following wildcards:
pathMask | Path possibly containing wildcards, used to determine the actual path for the dump. |
firstDumpIdx | Index of the first dump. Can be non-zero if the simulation is resumed from previously generated snapshot, in order to continue in the sequence. |
Definition at line 22 of file Output.cpp.
Extracts the dump index from given path generated by OutputFile.
This is mainly useful when continuing simulation from previously saved snapshot, to determine the next index of dump.
Definition at line 49 of file Output.cpp.
Path OutputFile::getMask | ( | ) | const |
Returns the file mask as given in constructor.
Definition at line 94 of file Output.cpp.
|
static |
Attemps to get the OutputFile from one of the path generated from it.
The dump index of the returned object is set to 0. Note that this function currently does not work for masks containing the time wildcard.
Definition at line 72 of file Output.cpp.
Path OutputFile::getNextPath | ( | const Statistics & | stats | ) | const |
Returns path to the next output file.
This increments the internal counter. Function is const so that it can be used in const functions. No file is created by this.
Definition at line 28 of file Output.cpp.
bool OutputFile::hasWildcard | ( | ) | const |
Returns true if the file mask contains (at least one) wildcard.
If not, getNextPath will always return the same path.
Definition at line 89 of file Output.cpp.