Go to the documentation of this file.
57 fileObr_.time().globalPath()
62 if (isA<polyMesh>(fileObr_))
64 const polyMesh&
mesh = refCast<const polyMesh>(fileObr_);
67 baseDir /=
mesh.name();
78 return baseFileDir()/prefix_/fileObr_.time().timeName();
94 timeValue = fileObr_.time().timeToUserTime(timeValue);
106 IFstream is(outputDir/(fName +
".dat"));
132 return createFile(
name, startTime_);
140 filePtr_ = createFile(fileName_);
149 return setw(writePrecision_ + addChars + offset);
157 fileObr_(wf.fileObr_),
159 fileName_(wf.fileName_),
161 writePrecision_(wf.writePrecision_),
162 writeToFile_(wf.writeToFile_),
163 updateHeader_(wf.updateHeader_),
164 writtenHeader_(wf.writtenHeader_),
165 useUserTime_(wf.useUserTime_),
166 startTime_(wf.startTime_)
175 const bool writeToFile
183 writeToFile_(writeToFile),
185 writtenHeader_(
false),
197 const bool writeToFile
206 filePtr_ = createFile(fileName_);
216 dict.getCheckOrDefault
223 updateHeader_ =
dict.getOrDefault(
"updateHeader", updateHeader_);
230 useUserTime_ =
dict.getOrDefault(
"useUserTime",
true);
246 <<
"File pointer not allocated\n";
261 return writeToFile_ && (updateHeader_ || !writtenHeader_);
267 return writePrecision_ + addChars;
282 <<
setf(ios_base::left) <<
setw(charWidth() - 2) << str.c_str();
293 os <<
tab <<
setw(charWidth()) << str.c_str();
303 writeCommented(
os, str);
310 const scalar timeValue =
313 ? fileObr_.time().timeOutputValue()
314 : fileObr_.time().value()
Smanip< ios_base::fmtflags > setf(const ios_base::fmtflags flags)
virtual void writeCurrentTime(Ostream &os) const
Write the current time to stream.
A class for handling words, derived from Foam::string.
virtual OFstream & file()
Return access to the file (if only 1)
A class for handling file names.
static word defaultRegion
Return the default region name.
Input from file stream, using an ISstream.
bool read(const char *buf, int32_t &val)
Same as readInt32.
static label addChars
Additional characters for writing.
label writePrecision_
Write precision.
virtual bool canWriteHeader() const
Flag to allow writing the header.
static bool master(const label communicator=worldComm)
Am I the master process.
fileName baseFileDir() const
Return the base directory for output.
const Type & value() const
Return const reference to value.
static void writeHeader(Ostream &os, const word &fieldName)
Mesh consisting of general polyhedral cells.
bool good() const noexcept
True if next operation might succeed.
virtual void writeHeader(Ostream &os, const string &str) const
Write a commented header to stream.
Registry of regIOobjects.
virtual void writeBreak(Ostream &os) const
Write a break marker to the stream.
virtual bool read(const dictionary &dict)
Read.
virtual word timeName() const
Return current time name.
Omanip< int > valueWidth(const label offset=0) const
Return the value width when writing to stream with optional offset.
bool good() const noexcept
True if the managed pointer is non-null.
static word outputPrefix
Directory prefix.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
OBJstream os(runTime.globalPath()/outputName)
void initStream(Ostream &os) const
Initialise the output stream for writing.
Omanip< int > setw(const int i)
IOstream & scientific(IOstream &io)
errorManipArg< error, int > exit(error &err, const int errNo=1)
Output to file stream, using an OSstream.
void reset(autoPtr< T > &&other) noexcept
Delete managed object and set to new given pointer.
static unsigned int defaultPrecision() noexcept
Return the default precision.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual void writeCommented(Ostream &os, const string &str) const
Write a commented string to stream.
virtual autoPtr< OFstream > createFile(const word &name, scalar timeValue) const
Return autoPtr to a new file for a given time.
An Ostream manipulator taking arguments.
static MinMax< T > ge(const T &minVal)
A semi-infinite range from minVal to the type max.
writeFile(const objectRegistry &obr, const fileName &prefix, const word &name="undefined", const bool writeToFile=true)
Construct from objectRegistry, prefix, fileName.
virtual void resetFile(const word &name)
Reset internal file pointer to new file with new name.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Base class for writing single files from the function objects.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
virtual bool writeToFile() const
Flag to allow writing to file.
OFstream Snull
Global predefined null output stream "/dev/null".
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
fileName baseTimeDir() const
Return the base directory for the current time value.
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
virtual label charWidth() const
Return width of character stream output.
virtual dimensionedScalar startTime() const
Return start time.
virtual void writeTabbed(Ostream &os, const string &str) const
Write a tabbed string to stream.
const Time & time() const noexcept
Return time registry.