From f00de09e8a5397915e604f14aaa31f5620afb36e Mon Sep 17 00:00:00 2001
From: Hassan Kassem <hassan.kassem@gmail.com>
Date: Tue, 4 Aug 2015 15:53:13 +0100
Subject: [PATCH] functionObjectFile: Modified names type from wordHashSet to
 wordList Resolves bug-report
 http://www.openfoam.org/mantisbt/view.php?id=1796

---
 .../functionObjectFile/functionObjectFile.C          | 20 ++++++++------------
 .../functionObjectFile/functionObjectFile.H          |  4 ++--
 2 files changed, 10 insertions(+), 14 deletions(-)
 mode change 100644 => 100755 src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C
 mode change 100644 => 100755 src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.H

diff --git a/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C b/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C
old mode 100644
new mode 100755
index 77a9b00..4f20adf
--- a/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C
+++ b/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C
@@ -85,8 +85,7 @@ void Foam::functionObjectFile::createFiles()
         const word startTimeName =
             obr_.time().timeName(obr_.time().startTime().value());
 
-        label i = 0;
-        forAllConstIter(wordHashSet, names_, iter)
+        forAll(names_, i)
         {
             if (!filePtrs_.set(i))
             {
@@ -94,7 +93,7 @@ void Foam::functionObjectFile::createFiles()
 
                 mkDir(outputDir);
 
-                word fName(iter.key());
+                word fName = names_[i];
 
                 // check if file already exists
                 IFstream is(outputDir/(fName + ".dat"));
@@ -109,7 +108,6 @@ void Foam::functionObjectFile::createFiles()
 
                 writeFileHeader(i);
 
-                i++;
             }
         }
     }
@@ -131,12 +129,12 @@ void Foam::functionObjectFile::write()
 void Foam::functionObjectFile::resetNames(const wordList& names)
 {
     names_.clear();
-    names_.insert(names);
+    names_.append(names);
 
     if (Pstream::master())
     {
         filePtrs_.clear();
-        filePtrs_.setSize(names_.toc().size());
+        filePtrs_.setSize(names_.size());
 
         createFiles();
     }
@@ -146,7 +144,7 @@ void Foam::functionObjectFile::resetNames(const wordList& names)
 void Foam::functionObjectFile::resetName(const word& name)
 {
     names_.clear();
-    names_.insert(name);
+    names_.append(name);
 
     if (Pstream::master())
     {
@@ -192,8 +190,7 @@ Foam::functionObjectFile::functionObjectFile
     filePtrs_()
 {
     names_.clear();
-    names_.insert(name);
-
+    names_.append(name);
     if (Pstream::master())
     {
         filePtrs_.clear();
@@ -217,8 +214,7 @@ Foam::functionObjectFile::functionObjectFile
     filePtrs_()
 {
     names_.clear();
-    names_.insert(names);
-
+    names_.append(names);
     if (Pstream::master())
     {
         filePtrs_.clear();
@@ -237,7 +233,7 @@ Foam::functionObjectFile::~functionObjectFile()
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-const Foam::wordHashSet& Foam::functionObjectFile::names() const
+const Foam::wordList& Foam::functionObjectFile::names() const
 {
     return names_;
 }
diff --git a/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.H b/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.H
old mode 100644
new mode 100755
index 405e6eb..b3b64dd
--- a/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.H
+++ b/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.H
@@ -68,7 +68,7 @@ private:
         const word prefix_;
 
         //- File names
-        wordHashSet names_;
+        wordList names_;
 
         //- File pointer
         PtrList<OFstream> filePtrs_;
@@ -149,7 +149,7 @@ public:
     // Member Functions
 
         //- Return const access to the names
-        const wordHashSet& names() const;
+        const wordList& names() const;
 
         //- Return access to the file (if only 1)
         OFstream& file();
-- 
1.9.1

