69#ifndef functionObjects_writeFile_H
70#define functionObjects_writeFile_H
215 const string& ext =
".dat"
227 const string& ext =
".dat"
244 virtual const string&
setExt(
const string& ext);
284 const string& property,
Istream and Ostream manipulators taking arguments.
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
An Ostream manipulator taking arguments.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A class for handling file names.
Base class for writing single files from the function objects.
string ext_
File extension; default = .dat.
void operator=(const writeFile &)=delete
No copy assignment.
fileName baseFileDir() const
Return the base directory for output.
bool updateHeader_
Flag to update the header, e.g. on mesh changes. Default is true.
label writePrecision_
Write precision.
virtual autoPtr< OFstream > newFileAtStartTime(const word &name) const
Return autoPtr to a new file using the simulation start time.
virtual void writeTabbed(Ostream &os, const string &str) const
Write a tabbed string to stream.
word fileName_
Name of file.
void writeHeaderValue(Ostream &os, const string &property, const Type &value) const
Write a (commented) header property and value pair.
virtual label charWidth() const
Return width of character stream output.
virtual bool canWriteToFile() const
Flag to allow writing to the file.
writeFile(const objectRegistry &obr, const fileName &prefix, const word &name="undefined", const bool writeToFile=true, const string &ext=".dat")
Construct from objectRegistry, prefix, fileName.
virtual autoPtr< OFstream > createFile(const word &name, scalar timeValue) const
Deprecated(2022-09) Return autoPtr to a new file for a given time.
Omanip< int > valueWidth(const label offset=0) const
Return the value width when writing to stream with optional offset.
virtual void writeHeader(Ostream &os, const string &str) const
Write a commented header to stream.
virtual bool read(const dictionary &dict)
Read.
bool useUserTime_
Flag to use the specified user time, e.g. CA deg instead of seconds. Default = true.
virtual void writeBreak(Ostream &os) const
Write a break marker to the stream.
const fileName prefix_
Prefix.
void initStream(Ostream &os) const
Initialise the output stream for writing.
virtual autoPtr< OFstream > newFile(const fileName &fName) const
Return autoPtr to a new file using file name.
bool writeToFile_
Flag to enable/disable writing to file.
bool writtenHeader_
Flag to identify whether the header has been written.
void writeValue(Ostream &os, const Type &val) const
Write a given value to stream with the space delimiter.
virtual OFstream & file()
Return access to the file (if only 1).
static label addChars
Additional characters for writing.
autoPtr< OFstream > filePtr_
File pointer.
virtual void writeCommented(Ostream &os, const string &str) const
Write a commented string to stream.
virtual void writeCurrentTime(Ostream &os) const
Write the current time to stream.
virtual bool writeToFile() const
Flag to allow writing to file.
virtual autoPtr< OFstream > newFileAtTime(const word &name, scalar timeValue) const
Return autoPtr to a new file for a given time.
fileName baseTimeDir() const
Return the base directory for the current time value.
virtual ~writeFile()=default
Destructor.
virtual const string & setExt(const string &ext)
Set extension.
scalar startTime_
Start time value.
fileName filePath(const fileName &fName) const
Return the full path for the supplied file name.
virtual void resetFile(const word &name)
Reset internal file pointer to new file with new name.
const objectRegistry & fileObr_
Reference to the region objectRegistry.
virtual bool canWriteHeader() const
Flag to allow writing the header.
virtual bool canResetFile() const
Flag to allow resetting the file.
Registry of regIOobjects.
A class for handling words, derived from Foam::string.
OBJstream os(runTime.globalPath()/outputName)
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
#define FOAM_DEPRECATED_FOR(since, replacement)