41 namespace coordSetWriters
62 precision_(
IOstream::defaultPrecision()),
80 options.getOrDefault(
"precision",
IOstream::defaultPrecision())
98 open(coords, outputPath);
111 open(tracks, outputPath);
127 const bool old(buffering_);
140 return getExpectedPath(
"agr");
146 ofile_.reset(
nullptr);
154 ofile_.reset(
nullptr);
162 ofile_.reset(
nullptr);
170 ofile_.reset(
nullptr);
177 Foam::fileName Foam::coordSetWriters::xmgraceWriter::writeTemplate
179 const word& fieldName,
189 if (useTracks_ || !buffering_)
192 return writeTemplate(fieldName, fieldPtrs);
198 const auto& coords = coords_[0];
206 const fileName outputFile =
path();
208 if (!
isDir(outputFile.path()))
210 mkDir(outputFile.path());
213 ofile_.reset(
new OFstream(outputFile, streamOpt_));
215 os.precision(precision_);
220 <<
"@ title \"" << coords.
name() <<
'"' <<
nl 221 <<
"@ xaxis label \"" << coords.
axis() <<
'"' <<
nl;
229 os <<
"@ s" << nWritten_
230 <<
" legend \"" << fieldName <<
'"' <<
nl 231 <<
"@target G0.S" << nWritten_ <<
nl;
233 writeTable(
os, coords,
values,
" \t");
236 os <<
"# end_data" <<
nl;
240 return ofile_().name();
245 Foam::fileName Foam::coordSetWriters::xmgraceWriter::writeTemplate
247 const word& fieldName,
259 return writeTemplate(fieldName, fieldPtrs);
A class for handling file names.
const word & axis() const
The sort axis name.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
constexpr char nl
The newline '\n' character (0x0a)
static const fileName null
An empty fileName.
virtual bool buffering() const
True if the format uses internal buffering (eg, column output)
Write coordSet(s) in xmgrace format.
virtual ~xmgraceWriter()
Destructor. Calls close()
A simple container for options an IOstream can normally have.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Macros for easy insertion into run-time selection tables.
defineCoordSetWriterWriteFields(Foam::coordSetWriters::xmgraceWriter)
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
virtual void beginTime(const Time &t)
Begin a time-step.
Convenience macros for instantiating coordSetWriter methods.
virtual fileName path() const
Characteristic output file name - information only.
Holds list of sampling positions.
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
Generic templated field type.
A class for handling words, derived from Foam::string.
defineTypeName(csvWriter)
virtual void close(bool force=false)
Close and reset, clears backend.
xmgraceWriter()
Default construct.
Base class for writing coordSet(s) and tracks with fields.
const word & name() const noexcept
The coord-set name.
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
OBJstream os(runTime.globalPath()/outputName)
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
virtual void endTime()
End time step. Clears existing backend.
virtual void endTime()
End a time-step.
An instant of time. Contains the time value and name. Uses Foam::Time when formatting the name...
addToRunTimeSelectionTable(coordSetWriter, csvWriter, word)
An IOstream is an abstract base class for all input/output systems; be they streams, files, token lists etc.
virtual void beginTime(const Time &t)
Begin time step. Clears existing backend.
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T, or return the given default value. FatalIOError if it is found and the number of...
virtual void close(bool force=false)
Finish output, performing any necessary cleanup.