44 os.setf(ios_base::scientific, ios_base::floatfield);
57 fileObr_.time().globalPath()
65 baseDir /=
meshPtr->regionName();
128 timeValue = fileObr_.time().timeToUserTime(timeValue);
133 fileName outputDir(baseFileDir()/prefix_/
timeName);
140 IFstream is(outputDir/(fName + ext_));
146 osPtr.
reset(
new OFstream(outputDir/(fName + ext_)));
192 fileObr_(wf.fileObr_),
194 fileName_(wf.fileName_),
196 writePrecision_(wf.writePrecision_),
197 writeToFile_(wf.writeToFile_),
198 updateHeader_(wf.updateHeader_),
211 const bool writeToFile,
219 writePrecision_(
IOstream::defaultPrecision()),
220 writeToFile_(writeToFile),
235 const bool writeToFile,
250 dict.getCheckOrDefault
257 updateHeader_ =
dict.getOrDefault(
"updateHeader", updateHeader_);
284 if (!filePtr_ && writeToFile_)
363 const scalar timeValue =
366 ? fileObr_.time().timeOutputValue()
Input from file stream as an ISstream, normally using std::ifstream for the actual input.
An IOstream is an abstract base class for all input/output systems; be they streams,...
bool good() const noexcept
True if next operation might succeed.
static unsigned int defaultPrecision() noexcept
Return the default precision.
static MinMax< label > ge(const label &minVal)
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,...
const word & timeName() const noexcept
The current time name.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
void reset(T *p=nullptr) noexcept
Delete managed object and set to new given pointer.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A class for handling file names.
static bool clean(std::string &str)
Cleanup filename string, possibly applies other transformations such as changing the path separator e...
static std::string name(const std::string &str)
Return basename (part beyond last /), including its extension.
static word outputPrefix
Directory prefix.
Base class for writing single files from the function objects.
string ext_
File extension; default = .dat.
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.
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.
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.
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 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 character strings derived from std::string.
A class for handling words, derived from Foam::string.
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
Foam::autoPtr< Foam::dynamicFvMesh > meshPtr
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
OBJstream os(runTime.globalPath()/outputName)
bool read(const char *buf, int32_t &val)
Same as readInt32.
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
Smanip< std::ios_base::fmtflags > setf(std::ios_base::fmtflags flags)
static void writeHeader(Ostream &os, const word &fieldName)
OFstream Snull
Global predefined null output stream "/dev/null".
Omanip< int > setw(const int i)
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).
constexpr char tab
The tab '\t' character(0x09).