54 result +=
'_' + fldName;
57 return result.
ext(fileExt);
69 for (
const word& fldName : fieldNames)
73 result +=
'_' + fldName;
77 return result.
ext(fileExt);
126 currTime_ =
instant(timeValue);
132 currTime_.value() = timeValue;
139 currTime_.value() = 0;
140 currTime_.name().clear();
173 outputPath_ = outputPath;
185 setCoordinates(coords);
206 if (verbose_)
Info<<
"Flush buffered data:" <<
nl;
240 coords_.set(0, coords);
252 setCoordinates(&coords);
263 coords_.resize(tracks.
size());
266 coords_.set(tracki, tracks.
get(tracki));
275 if (times.
size() == coords_.size())
292 const auto* ptr = coords_.get(tracki);
293 if (ptr) nTotal += ptr->size();
302 return coords_.size();
320 const bool changed = upToDate_;
336 return !coords_.empty();
342 return coords_.empty();
352 if (!outputPath_.empty())
354 if (useTimeDir() && !
timeName().empty())
357 file = outputPath_.
path() /
timeName() / outputPath_.name();
373 const word& fieldName,
377 if (outputPath_.empty() || fieldName.empty())
379 return getExpectedPath(fileExt);
385 if (useTimeDir() && !
timeName().empty())
392 file = outputPath_.
path();
396 file /= (fieldName +
'_' + outputPath_.name());
408 <<
type() <<
" : Attempted to write without a path" <<
nl
416 bool changed =
false;
445 os <<
"coordSetWriter:"
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_)
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...
label size() const noexcept
The number of elements in the list.
Base class for writing coordSet(s) and tracks with fields.
fileName getExpectedPath(const word &fileExt=word::null) const
Get expected (characteristic) output file name - information only.
virtual void endTime()
End a time-step.
coordSetWriter()
Default construct.
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.
bool empty() const
Writer is not associated with content.
bool upToDate_
The content is up-to-date?
label numPoints() const
The number of associated points (local processor)
void setTime(const instant &inst)
Set the current time.
virtual bool merge() const
bool verbose_
Additional output verbosity.
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.
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.
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 ~coordSetWriter()
Destructor. Calls close()
fileName outputPath_
The full output directory and file (coords) name.
label numTracks() const
The number of coordinate tracks.
Holds list of sampling positions.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
const Type & value() const
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)
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.
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.
static constexpr char close
static constexpr char open