55 result +=
'_' + fldName;
58 return result.
ext(fileExt);
70 for (
const word& fldName : fieldNames)
74 result +=
'_' + fldName;
78 return result.
ext(fileExt);
84 const dictionary&
dict,
85 const word& formatName,
97 const word& formatName,
123 geometryTransform_(),
176 currTime_ =
instant(timeValue);
182 currTime_.value() = timeValue;
189 currTime_.value() = 0;
190 currTime_.name().clear();
223 outputPath_ = outputPath;
235 setCoordinates(coords);
256 if (verbose_)
Info<<
"Flush buffered data:" <<
nl;
290 coords_.set(0, coords);
302 setCoordinates(&coords);
313 coords_.resize(tracks.
size());
316 coords_.set(tracki, tracks.
get(tracki));
325 if (times.size() == coords_.size())
342 const auto* ptr = coords_.get(tracki);
343 if (ptr) nTotal += ptr->size();
352 return coords_.size();
370 const bool changed = upToDate_;
386 return !coords_.empty();
392 return coords_.empty();
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())
442 file = outputPath_.path();
446 file /= (fieldName +
'_' + outputPath_.name());
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;
virtual void open(const fileName &outputPath)
Write separate geometry to file.
const Type & value() const noexcept
Return const reference to value.
virtual void setCoordinates(const coordSet *coords)
Set coordinates, can also be nullptr.
A class for handling file names.
virtual bool expire()
Mark that content changed and the writer will need an update, and set nFields = 0.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void checkOpen() const
Verify that the outputPath_ has been set or FatalError.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual ~coordSetWriter()
Destructor. Calls close()
runTimeSource setTime(sourceTimes[sourceTimeIndex], sourceTimeIndex)
void unsetTime()
Clear the current time.
static std::string path(const std::string &str)
Return directory path name (part before last /)
const T * get(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie...
bool hasCoords() const
Writer is associated with content.
virtual void setTracks(const UPtrList< coordSet > &tracks)
Set track coordinates.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
word ext() const
Return file name extension (part after last .)
virtual void clear()
Reset origin and rotation to an identity coordinateSystem.
virtual bool wroteData() const
Geometry or fields written since the last open?
#define forAll(list, i)
Loop across all elements in list.
word ext() const
Return file name extension (part after last .)
A Cartesian coordinate system.
static word suffix(const word &fldName, const word &fileExt=word::null)
Name suffix based on fieldName (underscore separator)
virtual void beginTime(const Time &t)
Begin a time-step.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Holds list of sampling positions.
A class for handling words, derived from Foam::string.
label size() const noexcept
The number of entries in the list.
Base class for writing coordSet(s) and tracks with fields.
dictionary fieldScale_
Field scaling (on output)
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.
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)
void setTime(const instant &inst)
Set the current time.
scalar geometryScale_
Output geometry scaling after rotate/translate.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
label numTracks() const
The number of coordinate tracks.
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.
virtual void clear()
Close any open output, remove coordSet associations and expire the writer.
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
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...
OBJstream os(runTime.globalPath()/outputName)
fileName getFieldPrefixedPath(const word &fieldName, const word &fileExt=word::null) const
Get field-prefixed output file name.
defineTypeNameAndDebug(combustionModel, 0)
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. ...
virtual void endTime()
End a time-step.
coordSystem::cartesian geometryTransform_
Local coordinate system transformation.
List< word > wordList
List of word.
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)
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)
messageStream Info
Information stream (stdout output on master, null elsewhere)
virtual bool merge() const
Perform any merging if not already upToDate (parallel) or simply mark as being up-to-date.
Reading is optional [identical to READ_IF_PRESENT].
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.
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...
static constexpr const zero Zero
Global zero (0)