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,
150 currTime_ =
instant(timeValue);
156 currTime_.value() = timeValue;
163 currTime_.value() = 0;
164 currTime_.name().clear();
197 outputPath_ = outputPath;
209 setCoordinates(coords);
230 if (verbose_)
Info<<
"Flush buffered data:" <<
nl;
264 coords_.set(0, coords);
276 setCoordinates(&coords);
287 coords_.resize(tracks.
size());
290 coords_.set(tracki, tracks.
get(tracki));
299 if (times.size() == coords_.size())
316 const auto* ptr = coords_.get(tracki);
317 if (ptr) nTotal += ptr->size();
326 return coords_.size();
344 const bool changed = upToDate_;
360 return !coords_.empty();
366 return coords_.empty();
376 if (!outputPath_.empty())
378 if (useTimeDir() && !
timeName().empty())
381 file = outputPath_.
path() /
timeName() / outputPath_.name();
397 const word& fieldName,
401 if (outputPath_.empty() || fieldName.empty())
403 return getExpectedPath(fileExt);
409 if (useTimeDir() && !
timeName().empty())
416 file = outputPath_.path();
420 file /= (fieldName +
'_' + outputPath_.name());
432 <<
type() <<
" : Attempted to write without a path" <<
nl 440 bool changed =
false;
464 const InfoProxy<coordSetWriter>& ip
467 const coordSetWriter& w = ip.t_;
469 os <<
"coordSetWriter:" 470 <<
" upToDate: " << w.upToDate_
471 <<
" nFields: " << w.nFields_
472 <<
" time: " << w.currTime_
473 <<
" 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 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 .)
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 elements in the list.
Base class for writing coordSet(s) and tracks with fields.
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.
void setTime(const instant &inst)
Set the current time.
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 time name of given scalar time 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)
virtual void endTime()
End a time-step.
List< word > wordList
A List of words.
An instant of time. Contains the time value and name. Uses Foam::Time when formatting the name...
virtual bool needsUpdate() const
Does the writer need an update (eg, lagging behind other changes)
virtual void setTrackTimes(const UList< scalarField > ×)
Set track times.
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.
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.