55 result +=
'_' + fldName;
58 return result.
ext(fileExt);
70 for (
const word& fldName : fieldNames)
74 result +=
'_' + fldName;
78 return result.
ext(fileExt);
85 const word& formatName,
97 const word& formatName,
256 if (verbose_)
Info<<
"Flush buffered data:" <<
nl;
290 coords_.set(0, coords);
313 coords_.resize(tracks.
size());
325 if (times.size() == coords_.size())
342 const auto* ptr = coords_.get(tracki);
343 if (ptr) nTotal += ptr->size();
370 const bool changed = upToDate_;
402 if (!outputPath_.empty())
404 if (useTimeDir() && !
timeName().empty())
407 file = outputPath_.
path() /
timeName() / outputPath_.name();
423 const word& fieldName,
427 if (outputPath_.empty() || fieldName.empty())
429 return getExpectedPath(fileExt);
435 if (useTimeDir() && !
timeName().empty())
438 file = outputPath_.path() /
timeName();
442 file = outputPath_.path();
458 <<
type() <<
" : Attempted to write without a path" <<
nl
466 bool changed =
false;
490 const InfoProxy<coordSetWriter>& iproxy
493 const auto& w = *iproxy;
495 os <<
"coordSetWriter:"
496 <<
" upToDate: " << w.upToDate_
497 <<
" nFields: " << w.nFields_
498 <<
" time: " << w.currTime_
499 <<
" path: " << w.outputPath_ <<
endl;
@ LAZY_READ
Reading is optional [identical to READ_IF_PRESENT].
A helper class for outputting values to Ostream.
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.
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void size(const label n)
Older name for setAddressableSize.
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
const T * get(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie,...
label size() const noexcept
The number of entries in the list.
Base class for writing coordSet(s) and tracks with fields.
coordSystem::cartesian geometryTransform_
Local coordinate system transformation.
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.
scalar geometryScale_
Output geometry scaling after rotate/translate.
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 useTimeDir() const noexcept
Should a time directory be spliced into the output path?
bool buffering_
Writer with buffering output.
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.
coordSetWriter(const coordSetWriter &)=delete
No copy construct.
bool empty() const
Writer is not associated with content.
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).
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.
bool verbose_
Additional output verbosity.
void clearBuffers()
Clear out buffering.
dictionary fieldScale_
Field scaling (on output).
virtual bool expire()
Mark that content changed and the writer will need an update, and set nFields = 0.
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.
List< scalarField > trackTimes_
Track times (eg, streamlines), one per coords_ entry.
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 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.
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.
virtual void clear()
Reset origin and rotation to an identity coordinateSystem.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
dictionary subOrEmptyDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX, const bool mandatory=false) const
Find and return a sub-dictionary as a copy, otherwise return an empty dictionary.
const dictionary * findDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary pointer if present (and it is a dictionary) otherwise return nullptr...
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry if present, and assign to T val. FatalIOError if it is found and the number of tokens i...
const Type & value() const noexcept
Return const reference to value.
A class for handling file names.
word ext() const
Return file name extension (part after last .).
static std::string path(const std::string &str)
Return directory path name (part before last /).
An instant of time. Contains the time value and name. Uses Foam::Time when formatting the name.
A class for handling words, derived from Foam::string.
word ext() const
Return file name extension (part after last .).
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
runTimeSource setTime(sourceTimes[sourceTimeIndex], sourceTimeIndex)
List< word > wordList
List of word.
messageStream Info
Information stream (stdout output on master, null elsewhere).
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).
#define defineRunTimeSelectionTable(baseType, argNames)
Define run-time selection table.
#define forAll(list, i)
Loop across all elements in list.