54#ifndef Foam_coordSetWriter_H
55#define Foam_coordSetWriter_H
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,
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 \
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
A helper class for outputting values to Ostream.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Base class for writing coordSet(s) and tracks with fields.
coordSystem::cartesian geometryTransform_
Local coordinate system transformation.
void getBufferLine(DynamicList< scalar > &buf, const coordSet &coords, const label pointi) const
Get buffered data line (components).
virtual void open(const fileName &outputPath)
Write separate geometry to file.
fileName getExpectedPath(const word &fileExt=word::null) const
Get expected (characteristic) output file name - information only.
virtual void endTime()
End a time-step.
virtual bool enabled() const
The writer is enabled. If the writer is not enabled, it may be possible for the caller to skip variou...
scalar geometryScale_
Output geometry scaling after rotate/translate.
void writeBufferContents(Ostream &os, const coordSet &coords, const char *sep) const
Write buffered data.
bool useTimeDir_
Insert additional time sub-directory in the output path.
coordSetWriter()
Default construct.
label nDataColumns() const
The number of buffer data columns, after splitting into components.
bool wroteGeom_
Track if geometry has been written since the last open.
bool useTracks() const noexcept
Prefer tracks to points during single set writing.
bool useTimeDir() const noexcept
Should a time directory be spliced into the output path?
bool buffering_
Writer with buffering output.
virtual bool buffering() const
True if the format uses internal buffering (eg, column output).
static UPtrList< const Field< Type > > repackageFields(const Field< Type > &field)
Repackage field into a UPtrList.
declareRunTimeSelectionTable(autoPtr, coordSetWriter, word,(),())
static autoPtr< coordSetWriter > New(const word &writeFormat)
Return a reference to the selected writer.
const word & timeName() const
The current time value/name.
void checkOpen() const
Verify that the outputPath_ has been set or FatalError.
void unsetTime()
Clear the current time.
virtual void beginTime(const Time &t)
Begin a time-step.
bool hasCoords() const
Writer is associated with content.
label nFields_
The number of fields.
static UPtrList< const Field< Type > > repackageFields(const UList< Field< Type > > &fieldValues)
Repackage multiple fields into a UPtrList.
coordSetWriter(const coordSetWriter &)=delete
No copy construct.
bool empty() const
Writer is not associated with content.
void operator=(const coordSetWriter &)=delete
No copy assignment.
bool upToDate_
The content is up-to-date?
virtual bool writeBuffered()
Write buffered data.
label numPoints() const
The number of associated points (local processor).
dictionary fieldLevel_
Field level to remove (on output).
static bool supportedType(const word &writeType)
True if New is likely to succeed for this writeType.
bool is_open() const noexcept
Test if outputPath has been set.
void setTime(const instant &inst)
Set the current time.
bool useTracks_
Prefer tracks to points during single set writing.
virtual bool merge() const
Perform any merging if not already upToDate (parallel) or simply mark as being up-to-date.
static void writeTable(Ostream &os, const coordSet &coords, const UList< Type > &values, const char *sep)
Write coordinates and values.
bool verbose_
Additional output verbosity.
void clearBuffers()
Clear out buffering.
tmp< Field< Type > > adjustFieldTemplate(const word &fieldName, const tmp< Field< Type > > &tfield) const
dictionary fieldScale_
Field scaling (on output).
virtual bool expire()
Mark that content changed and the writer will need an update, and set nFields = 0.
declareRunTimeSelectionTable(autoPtr, coordSetWriter, wordDict,(const dictionary &writeOptions),(writeOptions))
UPtrList< const coordSet > coords_
Reference to coordinate set(s).
virtual bool needsUpdate() const
Does the writer need an update (eg, lagging behind other changes).
static word suffix(const word &fldName, const word &fileExt=word::null)
Name suffix based on fieldName (underscore separator).
instant currTime_
The current time value/name.
bool verbose() const noexcept
Get output verbosity.
List< scalarField > trackTimes_
Track times (eg, streamlines), one per coords_ entry.
virtual fileName path() const =0
Expected (characteristic) output file name - information only. Return empty when is_open() is false.
TypeName("coordSetWriter")
Runtime type information.
virtual void clear()
Close any open output, remove coordSet associations and expire the writer.
virtual void setCoordinates(const coordSet *coords)
Set coordinates, can also be nullptr.
fileName getFieldPrefixedPath(const word &fieldName, const word &fileExt=word::null) const
Get field-prefixed output file name.
point geometryCentre_
The centre of rotation (untranslate, translate).
scalar timeValue() const
The current time value/name.
virtual bool wroteData() const
Geometry or fields written since the last open?
virtual void setTrackTimes(const UList< scalarField > ×)
Set track times.
virtual void setTracks(const UPtrList< coordSet > &tracks)
Set track coordinates.
virtual InfoProxy< coordSetWriter > info() const
Return info proxy, used to print information to a stream.
bool hasTime() const
True if there is a known time.
static void writeLine(Ostream &, const UList< word > &, const char *sep)
Write line contents (eg, buffered).
fileName writeTemplate(const word &fieldName, const Field< Type > &values)
Dummy templated write operation.
fileName writeTemplate(const word &fieldName, const List< Field< Type > > &fieldValues)
Dummy templated write operation. Multiple tracks.
virtual void close(bool force=false)
Finish output, performing any necessary cleanup.
virtual ~coordSetWriter()
Destructor. Calls close().
fileName outputPath_
The full output directory and file (coords) name.
label numTracks() const
The number of coordinate tracks.
label nFields() const noexcept
The number of expected output fields.
static dictionary formatOptions(const dictionary &dict, const word &formatName, const word &entryName="formatOptions")
Same as fileFormats::getFormatOptions.
Holds list of sampling positions.
A Cartesian coordinate system.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A class for handling file names.
static const fileName null
An empty fileName.
An instant of time. Contains the time value and name. Uses Foam::Time when formatting the name.
A class for managing temporary objects.
A class for handling words, derived from Foam::string.
static const word null
An empty word.
#define declareCoordSetWriterWriteMethod(Type)
#define defineBufferMethod(Type)
OBJstream os(runTime.globalPath()/outputName)
runTimeSource setTime(sourceTimes[sourceTimeIndex], sourceTimeIndex)
List< word > wordList
List of word.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
vector point
Point is a vector.
SphericalTensor< scalar > sphericalTensor
SphericalTensor of scalars, i.e. SphericalTensor<scalar>.
SymmTensor< scalar > symmTensor
SymmTensor of scalars, i.e. SymmTensor<scalar>.
Macros to ease declaration of run-time selection tables.
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes).
Basic run-time type information using word as the type's name. Used to enhance the standard RTTI to c...
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.