54 #ifndef Foam_coordSetWriter_H 55 #define Foam_coordSetWriter_H 80 Ostream& operator<<(Ostream& os, const InfoProxy<coordSetWriter>&);
131 #undef defineBufferMethod 132 #define defineBufferMethod(Type) \ 135 DynamicList<word> Type##Names_; \ 138 PtrDynList<Field<Type>> Type##Fields_; \ 141 void appendField(const word& fieldName, const Field<Type>& vals) \ 143 Type##Names_.append(fieldName); \ 144 Type##Fields_.append(vals.clone()); \ 154 #undef defineBufferMethod 161 static void writeLine(Ostream&,
const UList<word>&,
const char* sep);
201 const word& fieldName,
210 virtual bool merge()
const;
248 const word& fieldName,
263 const word& fieldName,
311 const word& formatName,
312 const word& entryName =
"formatOptions" 320 const word& formatName,
321 const word& entryName =
"formatOptions" 337 const word& writeFormat,
407 virtual void clear();
536 virtual
void close(
bool force = false);
558 #undef declareCoordSetWriterWriteMethod 559 #define declareCoordSetWriterWriteMethod(Type) \ 562 virtual fileName write \ 564 const word& fieldName, \ 565 const Field<Type>& field \ 569 virtual fileName write \ 571 const word& fieldName, \ 572 const List<Field<Type>>& fieldValues \ 583 #undef declareCoordSetWriterWriteMethod 584 #define declareCoordSetWriterWriteMethod(Type) \ 587 virtual fileName write \ 589 const word& fieldName, \ 590 const Field<Type>& values \ 594 virtual fileName write \ 596 const word& fieldName, \ 597 const List<Field<Type>>& fieldValues \
virtual void open(const fileName &outputPath)
Write separate geometry to file.
virtual bool writeBuffered()
Write buffered data.
virtual void setCoordinates(const coordSet *coords)
Set coordinates, can also be nullptr.
static void writeLine(Ostream &, const UList< word > &, const char *sep)
Write line contents (eg, buffered)
A class for handling file names.
virtual bool expire()
Mark that content changed and the writer will need an update, and set nFields = 0.
TypeName("coordSetWriter")
Runtime type information.
bool wroteGeom_
Track if geometry has been written since the last open.
void checkOpen() const
Verify that the outputPath_ has been set or FatalError.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
label nDataColumns() const
The number of buffer data columns, after splitting into components.
bool useTracks_
Prefer tracks to points during single set writing.
static const fileName null
An empty fileName.
void writeBufferContents(Ostream &os, const coordSet &coords, const char *sep) const
Write buffered data.
virtual bool buffering() const
True if the format uses internal buffering (eg, column output)
virtual ~coordSetWriter()
Destructor. Calls close()
bool useTracks() const noexcept
Prefer tracks to points during single set writing.
bool hasTime() const
True if there is a known time.
virtual bool enabled() const
The writer is enabled. If the writer is not enabled, it may be possible for the caller to skip variou...
void unsetTime()
Clear the current time.
bool hasCoords() const
Writer is associated with content.
fileName outputPath_
The full output directory and file (coords) name.
virtual void setTracks(const UPtrList< coordSet > &tracks)
Set track coordinates.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
List< scalarField > trackTimes_
Track times (eg, streamlines), one per coords_ entry.
virtual bool wroteData() const
Geometry or fields written since the last open?
bool useTimeDir_
Insert additional time sub-directory in the output path.
static word suffix(const word &fldName, const word &fileExt=word::null)
Name suffix based on fieldName (underscore separator)
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
virtual void beginTime(const Time &t)
Begin a time-step.
#define defineBufferMethod(Type)
static autoPtr< coordSetWriter > New(const word &writeFormat)
Return a reference to the selected writer.
static UPtrList< const Field< Type > > repackageFields(const Field< Type > &field)
Repackage field into a UPtrList.
Holds list of sampling positions.
Generic templated field type.
SymmTensor< scalar > symmTensor
SymmTensor of scalars, i.e. SymmTensor<scalar>.
A class for handling words, derived from Foam::string.
fileName writeTemplate(const word &fieldName, const Field< Type > &values)
Dummy templated write operation.
bool useTimeDir() const noexcept
Should a time directory be spliced into the output path?
bool is_open() const noexcept
Test if outputPath has been set.
Base class for writing coordSet(s) and tracks with fields.
static const word null
An empty word.
scalar timeValue() const
The current time value/name.
void clearBuffers()
Clear out buffering.
bool buffering_
Writer with buffering output.
declareRunTimeSelectionTable(autoPtr, coordSetWriter, word,(),())
void operator=(const coordSetWriter &)=delete
No copy assignment.
virtual fileName path() const =0
Expected (characteristic) output file name - information only. Return empty when is_open() is false...
static dictionary formatOptions(const dictionary &dict, const word &formatName, const word &entryName="formatOptions")
Same as fileFormats::getFormatOptions.
bool empty() const
Writer is not associated with content.
label nFields_
The number of fields.
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
coordSetWriter()
Default construct.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
instant currTime_
The current time value/name.
void setTime(const instant &inst)
Set the current time.
label nFields() const noexcept
The number of expected output fields.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
label numTracks() const
The number of coordinate tracks.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
virtual void clear()
Close any open output, remove coordSet associations and expire the writer.
bool upToDate_
The content is up-to-date?
OBJstream os(runTime.globalPath()/outputName)
static void writeTable(Ostream &os, const coordSet &coords, const UList< Type > &values, const char *sep)
Write coordinates and values.
fileName getFieldPrefixedPath(const word &fieldName, const word &fileExt=word::null) const
Get field-prefixed output file name.
UPtrList< const coordSet > coords_
Reference to coordinate set(s)
const word & timeName() const
The current time value/name.
virtual void endTime()
End a time-step.
static bool supportedType(const word &writeType)
True if New is likely to succeed for this writeType.
An instant of time. Contains the time value and name. Uses Foam::Time when formatting the name...
bool verbose_
Additional output verbosity.
virtual bool needsUpdate() const
Does the writer need an update (eg, lagging behind other changes)
A helper class for outputting values to Ostream.
virtual void setTrackTimes(const UList< scalarField > ×)
Set track times.
label numPoints() const
The number of associated points (local processor)
virtual bool merge() const
Perform any merging if not already upToDate (parallel) or simply mark as being up-to-date.
#define declareCoordSetWriterWriteMethod(Type)
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
bool verbose() const noexcept
Get output verbosity.
Macros to ease declaration of run-time selection tables.
SphericalTensor< scalar > sphericalTensor
SphericalTensor of scalars, i.e. SphericalTensor<scalar>.
fileName getExpectedPath(const word &fileExt=word::null) const
Get expected (characteristic) output file name - information only.
virtual void close(bool force=false)
Finish output, performing any necessary cleanup.
Tensor of scalars, i.e. Tensor<scalar>.
void getBufferLine(DynamicList< scalar > &buf, const coordSet &coords, const label pointi) const
Get buffered data line (components)
virtual InfoProxy< coordSetWriter > info() const
Return info proxy, used to print information to a stream.