Provides a means of accumulating and generating VTK file series. More...
Public Member Functions | |
seriesWriter ()=default | |
Construct an empty series. More... | |
seriesWriter (const seriesWriter &)=default | |
Copy construct. More... | |
seriesWriter (seriesWriter &&)=default | |
Move construct. More... | |
seriesWriter & | operator= (const seriesWriter &)=default |
Copy assignment. More... | |
seriesWriter & | operator= (seriesWriter &&)=default |
Move assignment. More... | |
~seriesWriter ()=default | |
Destructor. More... | |
bool | empty () const noexcept |
True if there are no data sets. More... | |
label | size () const noexcept |
The number of data sets. More... | |
void | clear () |
Clear entries. More... | |
bool | append (const fileNameInstant &inst) |
Append the specified file instant. More... | |
bool | append (fileNameInstant &&inst) |
Append the specified file instant. More... | |
bool | append (scalar timeValue, const fileName &file) |
Append the specified file instant. More... | |
bool | append (scalar timeValue, fileName &&file) |
Append the specified file instant. More... | |
label | load (const fileName &seriesName, const bool checkFiles=false, const scalar restartTime=ROOTVGREAT) |
Clear contents and reload by parsing the specified file. More... | |
label | scan (const fileName &seriesName, const scalar restartTime=ROOTVGREAT) |
Clear contents and scan directory for files. More... | |
bool | removeNewer (const scalar timeValue) |
Remove entries that are greater_equal the time value. More... | |
void | sort () |
Sort by time value and by file name. More... | |
void | print (Ostream &os) const |
Print file series as (JSON format) More... | |
void | write (const fileName &seriesName) const |
Write file series as (JSON format) to disk. More... | |
Static Public Member Functions | |
static fileName | base (const fileName &outputName, char sep='_') |
Extract the base name for a file series. More... | |
static word | suffix (const fileName &file, char sep='_') |
Extract the time-varying ending of files. More... | |
static Ostream & | print (Ostream &os, const fileName &seriesName, const UList< instant > &series, const char sep='_') |
Print file series (JSON format) for specified time instances. More... | |
static void | write (const fileName &base, const UList< instant > &series, const char sep='_') |
Write file series (JSON format) to disk, for specified instances. More... | |
static Ostream & | print (Ostream &os, const UList< fileNameInstant > &series) |
Print file series (JSON format) for specified time instances. More... | |
static void | write (const fileName &seriesName, const UList< fileNameInstant > &series) |
Write file series (JSON format) to disk, for specified instances. More... | |
Provides a means of accumulating and generating VTK file series.
The VTK file series format is a simple JSON format with the following type of content:
{ "file-series-version" : "1.0", "files": [ { "name" : "file1.vtk", "time" : 10 }, { "name" : "file2.vtk", "time" : 20 }, { "name" : "file3.vtk", "time" : 30 }, ] }
The append() operations include various sanity checks. Entries with an empty name are ignored. If an entry with an identical name already exists, its place will be overwritten with the new time value.
Definition at line 71 of file foamVtkSeriesWriter.H.
|
default |
Construct an empty series.
|
default |
Copy construct.
|
default |
Move construct.
|
default |
Destructor.
|
default |
Copy assignment.
|
default |
Move assignment.
|
static |
Extract the base name for a file series.
outputName | The name of the data output file Eg, "somefile_0001.vtk" would extract to "somefile.vtk" |
sep | The separator used between file stem and suffix. |
Definition at line 84 of file foamVtkSeriesWriter.C.
References Foam::dot(), and outputName().
Referenced by vtkCloud::write(), and vtkWrite::write().
|
static |
Extract the time-varying ending of files.
file | The name of the file Eg, "somefile_0001.vtk" would extract to "0001" |
sep | The separator used between file stem and suffix. |
Definition at line 114 of file foamVtkSeriesWriter.C.
References Foam::dot().
|
static |
Print file series (JSON format) for specified time instances.
os | The output stream |
base | The name for the series (eg, "path/file.vtk") |
series | The list of suffix/value entries |
sep | The separator used between file stem and suffix. |
Definition at line 144 of file foamVtkSeriesWriter.C.
References fileName::ext(), Foam::nl, os(), UList< T >::size(), and fileName::stem().
Referenced by seriesWriter::print().
Write file series (JSON format) to disk, for specified instances.
base | The name for the series (eg, "path/file.vtk") |
series | The list of suffix/value entries |
sep | The separator used between file stem and suffix. |
Definition at line 226 of file foamVtkSeriesWriter.C.
References fileName::has_ext(), Foam::mkDir(), Foam::New(), fileName::path(), and Foam::BitOps::print().
Referenced by seriesWriter::write(), vtkCloud::write(), and vtkWrite::write().
|
static |
Print file series (JSON format) for specified time instances.
Since the VTK file series does not currently (OCT-2018) support sub-directories, these will be stripped on output.
os | The output stream |
series | The list of filename/value entries |
Definition at line 191 of file foamVtkSeriesWriter.C.
References Foam::nl, os(), and UList< T >::size().
|
static |
Write file series (JSON format) to disk, for specified instances.
seriesName | The name for the series (eg, "path/file.vtk") |
series | The list of filename/value entries |
Definition at line 247 of file foamVtkSeriesWriter.C.
References fileName::has_ext(), Foam::mkDir(), Foam::New(), fileName::path(), and Foam::BitOps::print().
|
inlinenoexcept |
True if there are no data sets.
Definition at line 23 of file foamVtkSeriesWriterI.H.
Referenced by vtkCloud::write(), and vtkWrite::write().
|
inlinenoexcept |
The number of data sets.
Definition at line 29 of file foamVtkSeriesWriterI.H.
|
inline |
Clear entries.
Definition at line 35 of file foamVtkSeriesWriterI.H.
|
inline |
Append the specified file instant.
Definition at line 42 of file foamVtkSeriesWriterI.H.
References Instant< T >::name(), and Instant< T >::value().
Referenced by vtkCloud::write(), and vtkWrite::write().
|
inline |
Append the specified file instant.
Definition at line 49 of file foamVtkSeriesWriterI.H.
|
inline |
Append the specified file instant.
Definition at line 59 of file foamVtkSeriesWriterI.H.
References fileName::name().
|
inline |
Append the specified file instant.
Definition at line 70 of file foamVtkSeriesWriterI.H.
References fileName::remove_path().
Foam::label load | ( | const fileName & | seriesName, |
const bool | checkFiles = false , |
||
const scalar | restartTime = ROOTVGREAT |
||
) |
Clear contents and reload by parsing the specified file.
seriesName | the base name of the series to scan, without the ".series" ending. |
checkFiles | verify that the files also exist |
restartTime | ignore entries with a time greater/equal to the specified restart time. |
Definition at line 359 of file foamVtkSeriesWriter.C.
References token::BEGIN_BLOCK, token::BEGIN_SQR, clear(), token::COMMA, token::END_BLOCK, token::END_SQR, fileName::ext(), HashTable< Foam::zero, Key, Hash >::found(), Foam::getToken(), Foam::getValueToken(), fileName::has_ext(), HashSet< Key, Hash >::insert(), Foam::isFile(), token::isNumber(), token::isPunctuation(), token::isString(), Foam::glTF::key(), Foam::lessThan(), Instant< T >::name(), token::number(), fileName::path(), token::pToken(), Foam::readDir(), token::stringToken(), and Instant< T >::value().
Referenced by vtkCloud::write(), and vtkWrite::write().
Foam::label scan | ( | const fileName & | seriesName, |
const scalar | restartTime = ROOTVGREAT |
||
) |
Clear contents and scan directory for files.
The expected xml header content is a comment with the following:
* <!-- ... time='3.14159' ... --> *
seriesName | the base name of the series to scan, without the ".series" ending. |
restartTime | ignore entries with a time greater/equal to the specified restart time. |
Definition at line 577 of file foamVtkSeriesWriter.C.
References append(), clear(), fileName::ext(), fileName::has_ext(), Foam::Info, Foam::isDir(), Foam::lessThan(), Foam::nl, path(), fileName::path(), Foam::readDir(), fileName::remove_ext(), Foam::sort(), string::starts_with(), fileName::stem(), and Foam::subsetList().
bool removeNewer | ( | const scalar | timeValue | ) |
Remove entries that are greater_equal the time value.
Definition at line 708 of file foamVtkSeriesWriter.C.
References Foam::lessThan(), Foam::name(), Instant< T >::name(), and Instant< T >::value().
void sort | ( | ) |
Sort by time value and by file name.
Definition at line 738 of file foamVtkSeriesWriter.C.
References Foam::sort().
|
inline |
Print file series as (JSON format)
Definition at line 82 of file foamVtkSeriesWriterI.H.
References os(), and seriesWriter::print().
|
inline |
Write file series as (JSON format) to disk.
Definition at line 88 of file foamVtkSeriesWriterI.H.
References seriesWriter::write().
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.