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();
79 return baseFileDir()/prefix_/fileObr_.time().timeName();
95 timeValue = fileObr_.time().timeToUserTime(timeValue);
107 IFstream is(outputDir/(fName +
".dat"));
133 return createFile(
name, startTime_);
141 filePtr_ = createFile(fileName_);
150 return setw(writePrecision_ + addChars + offset);
158 fileObr_(wf.fileObr_),
160 fileName_(wf.fileName_),
162 writePrecision_(wf.writePrecision_),
163 writeToFile_(wf.writeToFile_),
164 updateHeader_(wf.updateHeader_),
165 writtenHeader_(wf.writtenHeader_),
166 useUserTime_(wf.useUserTime_),
167 startTime_(wf.startTime_)
176 const bool writeToFile
184 writeToFile_(writeToFile),
186 writtenHeader_(
false),
198 const bool writeToFile
207 filePtr_ = createFile(fileName_);
217 dict.getCheckOrDefault
224 updateHeader_ =
dict.getOrDefault(
"updateHeader", updateHeader_);
231 useUserTime_ =
dict.getOrDefault(
"useUserTime",
true);
247 <<
"File pointer not allocated\n";
262 return writeToFile_ && (updateHeader_ || !writtenHeader_);
268 return writePrecision_ + addChars;
278 os <<
setw(1) <<
"#";
283 <<
setf(ios_base::left) <<
setw(charWidth() - 2) << str.c_str();
294 os <<
tab <<
setw(charWidth()) << str.c_str();
304 writeCommented(os, str);
311 const scalar timeValue =
314 ? fileObr_.time().timeOutputValue()
315 : fileObr_.time().value()
Smanip< ios_base::fmtflags > setf(const ios_base::fmtflags flags)
void reset(T *p=nullptr) noexcept
Delete managed object and set to new given pointer.
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.
const Time & time() const
Return time.
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.
virtual int precision() const =0
Get precision of output field.
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.
word name(const complex &c)
Return string representation of complex.
static word outputPrefix
Directory prefix.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
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.
ios_base::fmtflags setf(const ios_base::fmtflags f)
Set flags of stream.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual void writeCommented(Ostream &os, const string &str) const
Write a commented string to stream.
static unsigned int defaultPrecision()
Return the default precision.
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.
static bool clean(std::string &str)
Cleanup filename.
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,...
bool good() const
Return true if next operation might succeed.
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.
virtual int width() const =0
Get width of output field.