Commit 86982f5e authored by Andrew Heather's avatar Andrew Heather
Browse files

ENH: writeFile - return bool on successful read

parent 89b1b644
......@@ -182,7 +182,7 @@ Foam::functionObjects::writeFile::~writeFile()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::functionObjects::writeFile::read(const dictionary& dict)
bool Foam::functionObjects::writeFile::read(const dictionary& dict)
{
writePrecision_ =
dict.lookupOrDefault("writePrecision", IOstream::defaultPrecision());
......@@ -190,6 +190,8 @@ void Foam::functionObjects::writeFile::read(const dictionary& dict)
// Only write on master process
writeToFile_ = dict.lookupOrDefault("writeToFile", true);
writeToFile_ = writeToFile_ && Pstream::master();
return true;
}
......
......@@ -148,28 +148,28 @@ public:
// Member Functions
//- Read
void read(const dictionary& dict);
virtual bool read(const dictionary& dict);
//- Return access to the file (if only 1)
OFstream& file();
virtual OFstream& file();
//- Flag to allow writing to file
bool writeToFile() const;
virtual bool writeToFile() const;
//- Return width of character stream output
label charWidth() const;
virtual label charWidth() const;
//- Write a commented string to stream
void writeCommented(Ostream& os, const string& str) const;
virtual void writeCommented(Ostream& os, const string& str) const;
//- Write a tabbed string to stream
void writeTabbed(Ostream& os, const string& str) const;
virtual void writeTabbed(Ostream& os, const string& str) const;
//- Write a commented header to stream
void writeHeader(Ostream& os, const string& str) const;
virtual void writeHeader(Ostream& os, const string& str) const;
//- Write the current time to stream
void writeTime(Ostream& os) const;
virtual void writeTime(Ostream& os) const;
//- Write a (commented) header property and value pair
template<class Type>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment