36 const word startTimeName =
41 if (!filePtrs_.set(i))
46 word fName(names_[i]);
49 IFstream is(outputDir/(fName +
".dat"));
55 filePtrs_.set(i,
new OFstream(outputDir/(fName +
".dat")));
75 filePtrs_.setSize(names_.
size());
142 <<
"Request for file() can only be done by the master process" 146 if (filePtrs_.size() != 1)
149 <<
"Requested single file, but multiple files are present" 153 if (!filePtrs_.set(0))
156 <<
"File pointer at index " << 0 <<
" not allocated" 169 <<
"Request for files() can only be done by the master process" 182 <<
"Request for file(i) can only be done by the master process" 186 if (!filePtrs_.set(i))
189 <<
"File pointer at index " << i <<
" not allocated" const Time & time() const
Return time.
virtual void initStream(Ostream &os) const
Initialise the output stream for writing.
virtual void resetNames(const wordList &names)
Reset the list of names from a wordList.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
A class for handling file names.
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void size(const label)
Override size to be inconsistent with allocated storage.
bool good() const
Return true if next operation might succeed.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual dimensionedScalar startTime() const
Return start time.
static bool master(const label communicator=0)
Am I the master process.
const Type & value() const
Return const reference to value.
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
virtual ~writeFiles()
Destructor.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
virtual fileName baseFileDir() const
Return the base directory for output.
virtual void writeFileHeader(const label i=0)
File header information.
virtual void createFiles()
Create the output file.
void clear()
Clear the list, i.e. set size to zero.
A class for handling words, derived from string.
void append(const T &)
Append an element at the end of the list.
const wordList & names() const
Return const access to the names.
writeFile(const writeFile &)
Disallow default bitwise copy construct.
OFstream & file()
Return access to the file (if only 1)
PtrList< OFstream > & files()
Return access to the files.
errorManip< error > abort(error &err)
const word prefix_
Prefix.
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
#define WarningInFunction
Report a warning using Foam::Warning.
const objectRegistry & obr_
Reference to the region objectRegistry.
virtual bool write()
Write function.
writeFiles(const writeFiles &)
Disallow default bitwise copy construct.
Registry of regIOobjects.
virtual void resetName(const word &name)
Reset the list of names to a single name entry.