33 const Foam::word Foam::functionObjectFile::outputPrefix =
"postProcessing";
62 if (isA<polyMesh>(obr_))
67 baseDir = baseDir/mesh.
name();
85 const word startTimeName =
90 if (!filePtrs_.set(i))
95 word fName(names_[i]);
98 IFstream is(outputDir/(fName +
".dat"));
104 filePtrs_.set(i,
new OFstream(outputDir/(fName +
".dat")));
134 filePtrs_.setSize(names_.
size());
149 filePtrs_.setSize(1);
194 filePtrs_.setSize(1);
218 filePtrs_.setSize(names_.
size());
243 FatalErrorIn(
"Foam::OFstream& Foam::functionObjectFile::file()")
244 <<
"Request for file() can only be done by the master process" 248 if (filePtrs_.size() != 1)
250 WarningIn(
"Foam::Ostream& Foam::functionObjectFile::file()")
251 <<
"Requested single file, but multiple files are present" 255 if (!filePtrs_.set(0))
257 FatalErrorIn(
"Foam::OFstream& Foam::functionObjectFile::file()")
258 <<
"File pointer at index " << 0 <<
" not allocated" 270 FatalErrorIn(
"Foam::OFstream& Foam::functionObjectFile::files()")
271 <<
"Request for files() can only be done by the master process" 285 "Foam::OFstream& Foam::functionObjectFile::file(const label)" 287 <<
"Request for file(i) can only be done by the master process" 291 if (!filePtrs_.set(i))
293 FatalErrorIn(
"Foam::OFstream& Foam::functionObjectFile::file()")
294 <<
"File pointer at index " << i <<
" not allocated" 314 os <<
setw(1) <<
"#" <<
setw(1) <<
' ' 335 os <<
setw(1) <<
"#" <<
setw(1) <<
' '
static bool & parRun()
Is this a parallel run?
OFstream & file()
Return access to the file (if only 1)
Smanip< ios_base::fmtflags > setf(const ios_base::fmtflags flags)
const wordList & names() const
Return const access to the names.
fileName path() const
Return path.
functionObjectFile(const functionObjectFile &)
Disallow default bitwise copy construct.
virtual int width() const =0
Get width of output field.
virtual void resetName(const word &name)
Reset the list of names to a single name entry.
A class for handling words, derived from string.
virtual void resetNames(const wordList &names)
Reset the list of names from a wordList.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
void size(const label)
Override size to be inconsistent with allocated storage.
virtual void initStream(Ostream &os) const
Initialise the output stream for writing.
static label addChars
Additional characters for writing.
virtual dimensionedScalar startTime() const
Return start time.
void clear()
Clear the list, i.e. set size to zero.
Ostream & endl(Ostream &os)
Add newline and flush stream.
#define WarningIn(functionName)
Report a warning using Foam::Warning.
bool good() const
Return true if next operation might succeed.
virtual void createFiles()
Create the output file.
Omanip< int > setw(const int i)
static const word outputPrefix
Directory prefix.
errorManip< error > abort(error &err)
void writeCommented(Ostream &os, const string &str) const
Write a commented string to stream.
const word & name() const
Return name.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
virtual void write()
Write function.
virtual void writeFileHeader(const label i=0)
File header information.
static word defaultRegion
Return the default region name.
Mesh consisting of general polyhedral cells.
Registry of regIOobjects.
A class for handling file names.
ios_base::fmtflags setf(const ios_base::fmtflags f)
Set flags of stream.
label charWidth() const
Return width of character stream output.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
static bool master(const label communicator=0)
Am I the master process.
IOstream & scientific(IOstream &io)
void writeTabbed(Ostream &os, const string &str) const
Write a tabbed string to stream.
void append(const T &)
Append an element at the end of the list.
const Time & time() const
Return time.
virtual ~functionObjectFile()
Destructor.
virtual fileName baseFileDir() const
Return the base directory for output.
virtual Omanip< int > valueWidth(const label offset=0) const
Return the value width when writing to stream with optional offset.
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
static unsigned int defaultPrecision()
Return the default precision.
virtual fileName baseTimeDir() const
Return the base directory for the current time value.
PtrList< OFstream > & files()
Return access to the files.
const Type & value() const
Return const reference to value.
void writeHeader(Ostream &os, const string &str) const
Write a commented header to stream.