54 #ifndef Foam_coordSetWriter_H 55 #define Foam_coordSetWriter_H 81 Ostream& operator<<(Ostream& os, const InfoProxy<coordSetWriter>&);
147 #undef defineBufferMethod 148 #define defineBufferMethod(Type) \ 151 DynamicList<word> Type##Names_; \ 154 PtrDynList<Field<Type>> Type##Fields_; \ 157 void appendField(const word& fieldName, const Field<Type>& vals) \ 159 Type##Names_.append(fieldName); \ 160 Type##Fields_.append(vals.clone()); \ 170 #undef defineBufferMethod 177 static void writeLine(Ostream&,
const UList<word>&,
const char* sep);
180 static void writeLine(Ostream&,
const UList<scalar>&,
const char* sep);
217 const word& fieldName,
226 virtual bool merge()
const;
234 const word& fieldName,
271 const word& fieldName,
286 const word& fieldName,
322 const dictionary& writeOptions
334 const word& formatName,
335 const word& entryName =
"formatOptions" 343 const word& formatName,
344 const word& entryName =
"formatOptions" 360 const word& writeFormat,
430 virtual void clear();
559 virtual
void close(
bool force = false);
581 #undef declareCoordSetWriterWriteMethod 582 #define declareCoordSetWriterWriteMethod(Type) \ 585 virtual fileName write \ 587 const word& fieldName, \ 588 const Field<Type>& field \ 592 virtual fileName write \ 594 const word& fieldName, \ 595 const List<Field<Type>>& fieldValues \ 606 #undef declareCoordSetWriterWriteMethod 607 #define declareCoordSetWriterWriteMethod(Type) \ 610 virtual fileName write \ 612 const word& fieldName, \ 613 const Field<Type>& values \ 617 virtual fileName write \ 619 const word& fieldName, \ 620 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.
A Cartesian coordinate system.
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.
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.
dictionary fieldScale_
Field scaling (on output)
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.
dictionary fieldLevel_
Field level to remove (on output)
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.
scalar geometryScale_
Output geometry scaling after rotate/translate.
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.
coordSystem::cartesian geometryTransform_
Local coordinate system transformation.
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.
point geometryCentre_
The centre of rotation (untranslate, translate)
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.
fileName getExpectedPath(const word &fileExt=word::null) const
Get expected (characteristic) output file name - information only.
A class for managing temporary objects.
virtual void close(bool force=false)
Finish output, performing any necessary cleanup.
Tensor of scalars, i.e. Tensor<scalar>.
tmp< Field< Type > > adjustFieldTemplate(const word &fieldName, const tmp< Field< Type >> &tfield) const
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.