Base class for writing coordSet(s) and tracks with fields. More...
Public Member Functions | |
TypeName ("coordSetWriter") | |
Runtime type information. More... | |
declareRunTimeSelectionTable (autoPtr, coordSetWriter, word,(),()) | |
declareRunTimeSelectionTable (autoPtr, coordSetWriter, wordDict,(const dictionary &writeOptions),(writeOptions)) | |
coordSetWriter () | |
Default construct. More... | |
coordSetWriter (const dictionary &options) | |
Default construct with specified options. More... | |
virtual | ~coordSetWriter () |
Destructor. Calls close() More... | |
virtual bool | buffering () const |
True if the format uses internal buffering (eg, column output) More... | |
virtual bool | buffering (const bool on) |
Turn internal buffering on/off (only if supported by the writer) More... | |
virtual bool | enabled () const |
virtual bool | needsUpdate () const |
Does the writer need an update (eg, lagging behind other changes) More... | |
virtual bool | wroteData () const |
Geometry or fields written since the last open? More... | |
virtual bool | expire () |
virtual void | clear () |
virtual void | setCoordinates (const coordSet *coords) |
Set coordinates, can also be nullptr. More... | |
virtual void | setCoordinates (const coordSet &coords) |
Set coordinates. More... | |
virtual void | setTracks (const UPtrList< coordSet > &tracks) |
Set track coordinates. More... | |
virtual void | setTrackTimes (const UList< scalarField > ×) |
Set track times. More... | |
label | numPoints () const |
The number of associated points (local processor) More... | |
label | numTracks () const |
The number of coordinate tracks. More... | |
bool | hasCoords () const |
Writer is associated with content. More... | |
bool | empty () const |
Writer is not associated with content. More... | |
bool | is_open () const noexcept |
Test if outputPath has been set. More... | |
label | nFields () const noexcept |
The number of expected output fields. More... | |
label | nFields (const label n) noexcept |
Set the number of expected output fields. More... | |
bool | useTracks () const noexcept |
Prefer tracks to points during single set writing. More... | |
bool | useTracks (const bool on) noexcept |
Enable/disable tracks preference. More... | |
bool | useTimeDir () const noexcept |
Should a time directory be spliced into the output path? More... | |
bool | useTimeDir (const bool on) noexcept |
Enable/disable use of spliced output path. More... | |
bool | verbose () const noexcept |
Get output verbosity. More... | |
bool | verbose (bool on) noexcept |
Enable/disable verbose output. More... | |
bool | hasTime () const |
True if there is a known time. More... | |
const word & | timeName () const |
The current time value/name. More... | |
scalar | timeValue () const |
The current time value/name. More... | |
void | setTime (const instant &inst) |
Set the current time. More... | |
void | setTime (scalar timeValue) |
Set current time from timeValue, auto generating the name. More... | |
void | setTime (scalar timeValue, const word &timeName) |
Set current time from timeValue and timeName. More... | |
void | unsetTime () |
Clear the current time. More... | |
virtual void | beginTime (const Time &t) |
Begin a time-step. More... | |
virtual void | beginTime (const instant &inst) |
Begin a time-step. More... | |
virtual void | endTime () |
End a time-step. More... | |
virtual fileName | path () const =0 |
virtual void | open (const fileName &outputPath) |
Write separate geometry to file. More... | |
virtual void | open (const coordSet &coords, const fileName &outputPath) |
Open from components. More... | |
virtual void | open (const UPtrList< coordSet > &tracks, const fileName &outputPath) |
Open from components. More... | |
virtual void | close (bool force=false) |
Finish output, performing any necessary cleanup. More... | |
virtual InfoProxy< coordSetWriter > | info () const |
Return info proxy. More... | |
virtual fileName | write (const word &fieldName, const Field< label > &field)=0 |
Write field of label (point data) More... | |
virtual fileName | write (const word &fieldName, const List< Field< label > > &fieldValues)=0 |
Write track fields of label (point data) More... | |
virtual fileName | write (const word &fieldName, const Field< scalar > &field)=0 |
Write field of scalar (point data) More... | |
virtual fileName | write (const word &fieldName, const List< Field< scalar > > &fieldValues)=0 |
Write track fields of scalar (point data) More... | |
virtual fileName | write (const word &fieldName, const Field< vector > &field)=0 |
Write field of vector (point data) More... | |
virtual fileName | write (const word &fieldName, const List< Field< vector > > &fieldValues)=0 |
Write track fields of vector (point data) More... | |
virtual fileName | write (const word &fieldName, const Field< sphericalTensor > &field)=0 |
Write field of sphericalTensor (point data) More... | |
virtual fileName | write (const word &fieldName, const List< Field< sphericalTensor > > &fieldValues)=0 |
Write track fields of sphericalTensor (point data) More... | |
virtual fileName | write (const word &fieldName, const Field< symmTensor > &field)=0 |
Write field of symmTensor (point data) More... | |
virtual fileName | write (const word &fieldName, const List< Field< symmTensor > > &fieldValues)=0 |
Write track fields of symmTensor (point data) More... | |
virtual fileName | write (const word &fieldName, const Field< tensor > &field)=0 |
Write field of tensor (point data) More... | |
virtual fileName | write (const word &fieldName, const List< Field< tensor > > &fieldValues)=0 |
Write track fields of tensor (point data) More... | |
template<class Type > | |
Foam::UPtrList< const Foam::Field< Type > > | repackageFields (const Field< Type > &field) |
template<class Type > | |
Foam::UPtrList< const Foam::Field< Type > > | repackageFields (const UList< Field< Type > > &fieldValues) |
Static Public Member Functions | |
static bool | supportedType (const word &writeType) |
True if New is likely to succeed for this writeType. More... | |
static autoPtr< coordSetWriter > | New (const word &writeFormat) |
Return a reference to the selected writer. More... | |
static autoPtr< coordSetWriter > | New (const word &writeFormat, const dictionary &writeOptions) |
Return a reference to the selected writer. More... | |
static word | suffix (const word &fldName, const word &fileExt=word::null) |
Name suffix based on fieldName (underscore separator) More... | |
static word | suffix (const wordList &fieldNames, const word &fileExt=word::null) |
Name suffix based on fieldNames (underscore separator) More... | |
Protected Member Functions | |
void | appendField (const word &fieldName, const Field< label > &vals) |
void | appendField (const word &fieldName, const Field< scalar > &vals) |
void | appendField (const word &fieldName, const Field< vector > &vals) |
void | appendField (const word &fieldName, const Field< sphericalTensor > &vals) |
void | appendField (const word &fieldName, const Field< symmTensor > &vals) |
void | appendField (const word &fieldName, const Field< tensor > &vals) |
void | clearBuffers () |
Clear out buffering. More... | |
label | nDataColumns () const |
The number of buffer data columns, after splitting into components. More... | |
virtual bool | writeBuffered () |
Write buffered data. More... | |
void | writeBufferContents (Ostream &os, const coordSet &coords, const char *sep) const |
Write buffered data. More... | |
void | getBufferLine (DynamicList< scalar > &buf, const coordSet &coords, const label pointi) const |
Get buffered data line (components) More... | |
fileName | getExpectedPath (const word &fileExt=word::null) const |
Get expected (characteristic) output file name - information only. More... | |
fileName | getFieldPrefixedPath (const word &fieldName, const word &fileExt=word::null) const |
Get field-prefixed output file name. More... | |
void | checkOpen () const |
Verify that the outputPath_ has been set or FatalError. More... | |
virtual bool | merge () const |
template<class Type > | |
fileName | writeTemplate (const word &fieldName, const Field< Type > &values) |
Dummy templated write operation. More... | |
template<class Type > | |
fileName | writeTemplate (const word &fieldName, const List< Field< Type > > &fieldValues) |
Dummy templated write operation. Multiple tracks. More... | |
coordSetWriter (const coordSetWriter &)=delete | |
No copy construct. More... | |
void | operator= (const coordSetWriter &)=delete |
No copy assignment. More... | |
Static Protected Member Functions | |
static void | writeLine (Ostream &, const UList< word > &, const char *sep) |
Write line contents (eg, buffered) More... | |
static void | writeLine (Ostream &, const UList< scalar > &, const char *sep) |
Write line contents (eg, buffered) More... | |
template<class Type > | |
static UPtrList< const Field< Type > > | repackageFields (const Field< Type > &field) |
Repackage field into a UPtrList. More... | |
template<class Type > | |
static UPtrList< const Field< Type > > | repackageFields (const UList< Field< Type > > &fieldValues) |
Repackage multiple fields into a UPtrList. More... | |
template<class Type > | |
static void | writeTable (Ostream &os, const coordSet &coords, const UList< Type > &values, const char *sep) |
Write coordinates and values. More... | |
Friends | |
Ostream & | operator<< (Ostream &os, const InfoProxy< coordSetWriter > &ip) |
Output info proxy. More... | |
Base class for writing coordSet(s) and tracks with fields.
Example:
coordSet coords(...); // Construct writer of xmgr type autoPtr<coordSetWriter> writer(coordSetWriter::New("vtk")); writer.open(coords, path/name); writer.write("density", rho); writer.write("velocity", U);
Definition at line 85 of file coordSetWriter.H.
|
protecteddelete |
No copy construct.
coordSetWriter | ( | ) |
Default construct.
Definition at line 83 of file coordSetWriter.C.
|
explicit |
Default construct with specified options.
Definition at line 100 of file coordSetWriter.C.
References dictionary::readIfPresent(), and coordSetWriter::verbose_.
|
virtual |
Destructor. Calls close()
Definition at line 110 of file coordSetWriter.C.
Definition at line 146 of file coordSetWriter.H.
Definition at line 147 of file coordSetWriter.H.
Definition at line 148 of file coordSetWriter.H.
|
inlineprotected |
Definition at line 149 of file coordSetWriter.H.
|
inlineprotected |
Definition at line 150 of file coordSetWriter.H.
Definition at line 151 of file coordSetWriter.H.
Write line contents (eg, buffered)
Definition at line 32 of file coordSetWriterBuffers.C.
References forAll, Foam::nl, and os().
Write line contents (eg, buffered)
Definition at line 51 of file coordSetWriterBuffers.C.
References forAll, Foam::nl, and os().
|
protected |
|
protected |
The number of buffer data columns, after splitting into components.
Definition at line 89 of file coordSetWriterBuffers.C.
References doLocalCode.
|
protectedvirtual |
Write buffered data.
Reimplemented in csvWriter, gnuplotWriter, and rawWriter.
Definition at line 156 of file coordSetWriterBuffers.C.
|
protected |
Write buffered data.
Definition at line 162 of file coordSetWriterBuffers.C.
References os(), and UList< T >::size().
|
protected |
Get buffered data line (components)
Definition at line 109 of file coordSetWriterBuffers.C.
References DynamicList< T, SizeMin >::append(), DynamicList< T, SizeMin >::clear(), doLocalCode, coordSet::hasVectorAxis(), p, coordSet::scalarCoord(), and coordSet::vectorCoord().
|
protected |
Get expected (characteristic) output file name - information only.
Definition at line 345 of file coordSetWriter.C.
References fileName::ext(), fileName::path(), and timeName.
|
protected |
Get field-prefixed output file name.
Eg, dir/U_name.raw
Definition at line 371 of file coordSetWriter.C.
References fileName::ext(), fileName::path(), and timeName.
Referenced by csvWriter::writeTemplate(), gnuplotWriter::writeTemplate(), rawWriter::writeTemplate(), and xmgraceWriter::writeTemplate().
|
protected |
Verify that the outputPath_ has been set or FatalError.
Definition at line 403 of file coordSetWriter.C.
References Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::nl, and Foam::type().
|
protectedvirtual |
Perform any merging if not already upToDate (parallel) or simply mark as being up-to-date
Definition at line 414 of file coordSetWriter.C.
|
staticprotected |
Repackage field into a UPtrList.
|
staticprotected |
Repackage multiple fields into a UPtrList.
|
staticprotected |
Write coordinates and values.
Definition at line 56 of file coordSetWriterTemplates.C.
References Foam::component(), forAll, coordSet::hasVectorAxis(), Foam::nl, os(), p, coordSet::scalarCoord(), and coordSet::vectorCoord().
Referenced by csvWriter::writeTemplate(), gnuplotWriter::writeTemplate(), rawWriter::writeTemplate(), and xmgraceWriter::writeTemplate().
Dummy templated write operation.
if (!wroteGeom_) { return this->write(); }
fieldName | Name of field |
values | Local field values to write |
Definition at line 245 of file coordSetWriter.H.
References fileName::null.
|
inlineprotected |
Dummy templated write operation. Multiple tracks.
Definition at line 260 of file coordSetWriter.H.
References fileName::null.
|
protecteddelete |
No copy assignment.
TypeName | ( | "coordSetWriter" | ) |
Runtime type information.
declareRunTimeSelectionTable | ( | autoPtr | , |
coordSetWriter | , | ||
word | , | ||
() | , | ||
() | |||
) |
declareRunTimeSelectionTable | ( | autoPtr | , |
coordSetWriter | , | ||
wordDict | , | ||
(const dictionary &writeOptions) | , | ||
(writeOptions) | |||
) |
True if New is likely to succeed for this writeType.
Definition at line 33 of file coordSetWriterNew.C.
|
static |
Return a reference to the selected writer.
Definition at line 43 of file coordSetWriterNew.C.
References Foam::exit(), Foam::FatalError, and FatalErrorInLookup.
|
static |
Return a reference to the selected writer.
Select with extra write option
Definition at line 64 of file coordSetWriterNew.C.
References Foam::exit(), Foam::FatalError, and FatalErrorInLookup.
|
static |
Name suffix based on fieldName (underscore separator)
Definition at line 44 of file coordSetWriter.C.
References word::ext().
Referenced by histogram::write().
|
static |
Name suffix based on fieldNames (underscore separator)
Definition at line 61 of file coordSetWriter.C.
References word::ext().
|
virtual |
True if the format uses internal buffering (eg, column output)
Reimplemented in nullWriter.
Definition at line 184 of file coordSetWriterBuffers.C.
Turn internal buffering on/off (only if supported by the writer)
Reimplemented in csvWriter, gnuplotWriter, rawWriter, and xmgraceWriter.
Definition at line 191 of file coordSetWriterBuffers.C.
|
inlinevirtual |
The writer is enabled. If the writer is not enabled, it may be possible for the caller to skip various preparatory operations.
This method is primarily useful for the null writer
Reimplemented in nullWriter.
Definition at line 364 of file coordSetWriter.H.
Referenced by Foam::byDt(), laminar< ReactionThermo >::correct(), cloudSolution::read(), multiphaseSystem::sigma(), and twoPhaseSystem::solve().
|
virtual |
Does the writer need an update (eg, lagging behind other changes)
Reimplemented in nullWriter.
Definition at line 306 of file coordSetWriter.C.
|
virtual |
Geometry or fields written since the last open?
Reimplemented in nullWriter.
Definition at line 312 of file coordSetWriter.C.
|
virtual |
Mark that content changed and the writer will need an update, and set nFields = 0.
May also free up unneeded data. Return false if it was previously already expired.
Definition at line 318 of file coordSetWriter.C.
|
virtual |
Close any open output, remove coordSet associations and expire the writer.
Definition at line 222 of file coordSetWriter.C.
|
virtual |
Set coordinates, can also be nullptr.
Reimplemented in nullWriter.
Definition at line 232 of file coordSetWriter.C.
|
virtual |
Set track coordinates.
Reimplemented in nullWriter.
Definition at line 256 of file coordSetWriter.C.
References forAll, UPtrList< T >::get(), and UPtrList< T >::size().
|
virtual |
Set track times.
Definition at line 273 of file coordSetWriter.C.
References UList< T >::size().
Foam::label numPoints | ( | ) | const |
The number of associated points (local processor)
Definition at line 286 of file coordSetWriter.C.
References forAll.
Foam::label numTracks | ( | ) | const |
The number of coordinate tracks.
Definition at line 300 of file coordSetWriter.C.
bool hasCoords | ( | ) | const |
Writer is associated with content.
Definition at line 334 of file coordSetWriter.C.
bool empty | ( | ) | const |
Writer is not associated with content.
Definition at line 340 of file coordSetWriter.C.
|
inlinenoexcept |
Test if outputPath has been set.
Definition at line 30 of file coordSetWriterI.H.
References coordSetWriter::outputPath_.
|
inlinenoexcept |
The number of expected output fields.
Currently only used by the legacy VTK format.
Definition at line 36 of file coordSetWriterI.H.
|
inlinenoexcept |
Set the number of expected output fields.
Currently only used by the legacy VTK format.
Definition at line 42 of file coordSetWriterI.H.
References n.
|
inlinenoexcept |
Prefer tracks to points during single set writing.
Definition at line 50 of file coordSetWriterI.H.
|
inlinenoexcept |
Should a time directory be spliced into the output path?
Definition at line 64 of file coordSetWriterI.H.
Enable/disable use of spliced output path.
Definition at line 70 of file coordSetWriterI.H.
|
inlinenoexcept |
Get output verbosity.
Definition at line 78 of file coordSetWriterI.H.
|
inline |
True if there is a known time.
Definition at line 92 of file coordSetWriterI.H.
|
inline |
The current time value/name.
Definition at line 98 of file coordSetWriterI.H.
|
inline |
The current time value/name.
Definition at line 104 of file coordSetWriterI.H.
void setTime | ( | const instant & | inst | ) |
Set the current time.
Definition at line 118 of file coordSetWriter.C.
void setTime | ( | scalar | timeValue | ) |
Set current time from timeValue, auto generating the name.
Definition at line 124 of file coordSetWriter.C.
void setTime | ( | scalar | timeValue, |
const word & | timeName | ||
) |
Set current time from timeValue and timeName.
Definition at line 130 of file coordSetWriter.C.
References timeName.
void unsetTime | ( | ) |
Clear the current time.
Definition at line 137 of file coordSetWriter.C.
|
virtual |
Begin a time-step.
Reimplemented in gltfWriter, vtkWriter, and xmgraceWriter.
Definition at line 144 of file coordSetWriter.C.
References setTime(), Time::timeName(), and dimensioned< Type >::value().
Referenced by gltfWriter::beginTime(), vtkWriter::beginTime(), and xmgraceWriter::beginTime().
|
virtual |
Begin a time-step.
Reimplemented in gltfWriter, vtkWriter, and xmgraceWriter.
Definition at line 150 of file coordSetWriter.C.
References setTime().
|
virtual |
End a time-step.
Reimplemented in gltfWriter, vtkWriter, and xmgraceWriter.
Definition at line 156 of file coordSetWriter.C.
Referenced by gltfWriter::endTime(), vtkWriter::endTime(), and xmgraceWriter::endTime().
|
pure virtual |
Expected (characteristic) output file name - information only. Return empty when is_open() is false.
Implemented in csvWriter, ensightWriter, gltfWriter, gnuplotWriter, nastranWriter, nullWriter, rawWriter, vtkWriter, and xmgraceWriter.
|
virtual |
Write separate geometry to file.
/ TBD: virtual fileName write() = 0; Open for output on specified path, using existing content
Reimplemented in nullWriter.
Definition at line 171 of file coordSetWriter.C.
Referenced by csvWriter::csvWriter(), ensightWriter::ensightWriter(), gltfWriter::gltfWriter(), gnuplotWriter::gnuplotWriter(), nastranWriter::nastranWriter(), rawWriter::rawWriter(), vtkWriter::vtkWriter(), and xmgraceWriter::xmgraceWriter().
Open from components.
Definition at line 178 of file coordSetWriter.C.
Open from components.
Definition at line 190 of file coordSetWriter.C.
|
virtual |
Finish output, performing any necessary cleanup.
Optional force disassociation with any coordSet(s)
Reimplemented in ensightWriter, gltfWriter, vtkWriter, and xmgraceWriter.
Definition at line 202 of file coordSetWriter.C.
References Foam::Info, and Foam::nl.
|
inlinevirtual |
Return info proxy.
Definition at line 521 of file coordSetWriter.H.
Write field of label (point data)
fieldName | Name of field |
field | Field values |
|
pure virtual |
Write track fields of label (point data)
fieldName | Name of field |
fieldValues | Per-track values |
Write field of scalar (point data)
fieldName | Name of field |
field | Field values |
|
pure virtual |
Write track fields of scalar (point data)
fieldName | Name of field |
fieldValues | Per-track values |
Write field of vector (point data)
fieldName | Name of field |
field | Field values |
|
pure virtual |
Write track fields of vector (point data)
fieldName | Name of field |
fieldValues | Per-track values |
|
pure virtual |
Write field of sphericalTensor (point data)
fieldName | Name of field |
field | Field values |
|
pure virtual |
Write track fields of sphericalTensor (point data)
fieldName | Name of field |
fieldValues | Per-track values |
|
pure virtual |
Write field of symmTensor (point data)
fieldName | Name of field |
field | Field values |
|
pure virtual |
Write track fields of symmTensor (point data)
fieldName | Name of field |
fieldValues | Per-track values |
Write field of tensor (point data)
fieldName | Name of field |
field | Field values |
|
pure virtual |
Write track fields of tensor (point data)
fieldName | Name of field |
fieldValues | Per-track values |
Foam::UPtrList< const Foam::Field< Type > > repackageFields | ( | const Field< Type > & | field | ) |
Definition at line 32 of file coordSetWriterTemplates.C.
References field(), and UPtrList< T >::set().
Foam::UPtrList< const Foam::Field< Type > > repackageFields | ( | const UList< Field< Type > > & | fieldValues | ) |
Definition at line 43 of file coordSetWriterTemplates.C.
References forAll, and UPtrList< T >::set().
|
friend |
Output info proxy.
Reference to coordinate set(s)
Definition at line 92 of file coordSetWriter.H.
Referenced by csvWriter::writeTemplate(), gnuplotWriter::writeTemplate(), rawWriter::writeTemplate(), and xmgraceWriter::writeTemplate().
|
protected |
Track times (eg, streamlines), one per coords_ entry.
Definition at line 95 of file coordSetWriter.H.
|
mutableprotected |
The content is up-to-date?
Definition at line 98 of file coordSetWriter.H.
Referenced by Foam::operator<<().
|
mutableprotected |
Track if geometry has been written since the last open.
Definition at line 101 of file coordSetWriter.H.
Referenced by csvWriter::writeTemplate(), gnuplotWriter::writeTemplate(), rawWriter::writeTemplate(), and xmgraceWriter::writeTemplate().
|
mutableprotected |
Writer with buffering output.
//- Writing in parallel (via master) bool parallel_;
Definition at line 107 of file coordSetWriter.H.
Referenced by csvWriter::csvWriter(), gnuplotWriter::gnuplotWriter(), rawWriter::rawWriter(), and xmgraceWriter::xmgraceWriter().
|
protected |
Prefer tracks to points during single set writing.
Definition at line 110 of file coordSetWriter.H.
|
protected |
Insert additional time sub-directory in the output path.
Definition at line 113 of file coordSetWriter.H.
|
protected |
Additional output verbosity.
Definition at line 116 of file coordSetWriter.H.
Referenced by coordSetWriter::coordSetWriter(), csvWriter::writeTemplate(), gnuplotWriter::writeTemplate(), rawWriter::writeTemplate(), and xmgraceWriter::writeTemplate().
|
protected |
The number of fields.
Definition at line 119 of file coordSetWriter.H.
Referenced by Foam::operator<<().
|
protected |
The current time value/name.
Definition at line 122 of file coordSetWriter.H.
Referenced by Foam::operator<<().
|
protected |
The full output directory and file (coords) name.
Definition at line 125 of file coordSetWriter.H.
Referenced by coordSetWriter::is_open(), and Foam::operator<<().
|
protected |
Definition at line 146 of file coordSetWriter.H.
|
protected |
Definition at line 146 of file coordSetWriter.H.
|
protected |
Definition at line 147 of file coordSetWriter.H.
|
protected |
Definition at line 147 of file coordSetWriter.H.
|
protected |
Definition at line 148 of file coordSetWriter.H.
|
protected |
Definition at line 148 of file coordSetWriter.H.
|
protected |
Definition at line 149 of file coordSetWriter.H.
|
protected |
Definition at line 149 of file coordSetWriter.H.
|
protected |
Definition at line 150 of file coordSetWriter.H.
|
protected |
Definition at line 150 of file coordSetWriter.H.
|
protected |
Definition at line 151 of file coordSetWriter.H.
|
protected |
Definition at line 151 of file coordSetWriter.H.