From 86982f5eb7f055255b965f3ed73e224701540245 Mon Sep 17 00:00:00 2001
From: Andrew Heather <a.heather@opencfd.co.uk>
Date: Tue, 29 Nov 2016 14:45:45 +0000
Subject: [PATCH] ENH: writeFile - return bool on successful read

---
 .../db/functionObjects/writeFile/writeFile.C     |  4 +++-
 .../db/functionObjects/writeFile/writeFile.H     | 16 ++++++++--------
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/OpenFOAM/db/functionObjects/writeFile/writeFile.C b/src/OpenFOAM/db/functionObjects/writeFile/writeFile.C
index 3d7b6d707a3..02a7261bfa5 100644
--- a/src/OpenFOAM/db/functionObjects/writeFile/writeFile.C
+++ b/src/OpenFOAM/db/functionObjects/writeFile/writeFile.C
@@ -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;
 }
 
 
diff --git a/src/OpenFOAM/db/functionObjects/writeFile/writeFile.H b/src/OpenFOAM/db/functionObjects/writeFile/writeFile.H
index 269504d9c9f..c05a1ffe4de 100644
--- a/src/OpenFOAM/db/functionObjects/writeFile/writeFile.H
+++ b/src/OpenFOAM/db/functionObjects/writeFile/writeFile.H
@@ -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>
-- 
GitLab