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 75 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 90 of file foamVtkSeriesWriter.C.
References Foam::dot(), and outputName().
|
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 120 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 150 of file foamVtkSeriesWriter.C.
References fileName::ext(), fileName::nameLessExt(), Foam::nl, os(), and UList< T >::size().
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 232 of file foamVtkSeriesWriter.C.
References fileName::hasExt(), Foam::mkDir(), Time::New(), and fileName::path().
Referenced by 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 197 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 253 of file foamVtkSeriesWriter.C.
References fileName::hasExt(), Foam::mkDir(), Time::New(), and fileName::path().
|
inlinenoexcept |
True if there are no data sets.
Definition at line 30 of file foamVtkSeriesWriterI.H.
Referenced by vtkCloud::write(), and vtkWrite::write().
|
inlinenoexcept |
The number of data sets.
Definition at line 36 of file foamVtkSeriesWriterI.H.
|
inline |
Clear entries.
Definition at line 42 of file foamVtkSeriesWriterI.H.
|
inline |
Append the specified file instant.
Definition at line 49 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 56 of file foamVtkSeriesWriterI.H.
Append the specified file instant.
Definition at line 65 of file foamVtkSeriesWriterI.H.
References fileName::name().
Append the specified file instant.
Definition at line 76 of file foamVtkSeriesWriterI.H.
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 365 of file foamVtkSeriesWriter.C.
References token::BEGIN_BLOCK, token::BEGIN_SQR, clear(), token::COMMA, token::END_BLOCK, token::END_SQR, fileName::ext(), HashTable< T, Key, Hash >::found(), Foam::getToken(), Foam::getValueToken(), fileName::hasExt(), HashSet< Key, Hash >::insert(), Foam::isFile(), token::isNumber(), token::isPunctuation(), token::isString(), 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 583 of file foamVtkSeriesWriter.C.
References append(), clear(), fileName::ext(), fileName::hasExt(), Foam::Info, Foam::isDir(), Foam::lessThan(), fileName::nameLessExt(), Foam::nl, formatter::npos, fileName::path(), path(), Foam::readDir(), fileName::removeExt(), Foam::sort(), and Foam::subsetList().
bool removeNewer | ( | const scalar | timeValue | ) |
Remove entries that are greater_equal the time value.
Definition at line 715 of file foamVtkSeriesWriter.C.
References Foam::lessThan(), Instant< T >::name(), Foam::name(), and Instant< T >::value().
void sort | ( | ) |
Sort by time value and by file name.
Definition at line 745 of file foamVtkSeriesWriter.C.
References Foam::sort().
|
inline |
Print file series as (JSON format)
Definition at line 89 of file foamVtkSeriesWriterI.H.
References os(), and objectiveManager::print().
|
inline |
Write file series as (JSON format) to disk.
Definition at line 95 of file foamVtkSeriesWriterI.H.
References ObukhovLength::write().