From 59821d60941eb9fe5d629f621812586a919e47b3 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@Germany>
Date: Tue, 28 Oct 2008 17:25:59 +0100
Subject: [PATCH] added optional notes to coordinate systems porousZone
 constructor in the same order as sampling

---
 .../cfdTools/general/porousMedia/porousZone.C |  4 +--
 .../cfdTools/general/porousMedia/porousZone.H | 10 +++---
 .../general/porousMedia/porousZones.C         | 10 ++++--
 .../coordinateSystems/coordinateSystem.C      | 24 ++++++++++++-
 .../coordinateSystems/coordinateSystem.H      | 16 +++++++++
 .../coordinateSystems/coordinateSystems.C     | 34 ++++++++++---------
 .../coordinateSystems/coordinateSystems.H     | 22 ++++--------
 7 files changed, 77 insertions(+), 43 deletions(-)

diff --git a/src/finiteVolume/cfdTools/general/porousMedia/porousZone.C b/src/finiteVolume/cfdTools/general/porousMedia/porousZone.C
index a27a48286a3..b6a07da2265 100644
--- a/src/finiteVolume/cfdTools/general/porousMedia/porousZone.C
+++ b/src/finiteVolume/cfdTools/general/porousMedia/porousZone.C
@@ -63,13 +63,13 @@ void Foam::porousZone::adjustNegativeResistance(dimensionedVector& resist)
 
 Foam::porousZone::porousZone
 (
-    const fvMesh& mesh,
     const word& name,
+    const fvMesh& mesh,
     const dictionary& dict
 )
 :
-    mesh_(mesh),
     name_(name),
+    mesh_(mesh),
     dict_(dict),
     cellZoneID_(mesh_.cellZones().findZoneID(name)),
     coordSys_(dict),
diff --git a/src/finiteVolume/cfdTools/general/porousMedia/porousZone.H b/src/finiteVolume/cfdTools/general/porousMedia/porousZone.H
index e4be5899a26..2355f69e741 100644
--- a/src/finiteVolume/cfdTools/general/porousMedia/porousZone.H
+++ b/src/finiteVolume/cfdTools/general/porousMedia/porousZone.H
@@ -92,12 +92,12 @@ class porousZone
 {
     // Private data
 
-        //- Reference to the finite volume mesh this zone is part of
-        const fvMesh& mesh_;
-
         //- Name of this zone
         word name_;
 
+        //- Reference to the finite volume mesh this zone is part of
+        const fvMesh& mesh_;
+
         //- Dictionary containing the parameters
         dictionary dict_;
 
@@ -189,7 +189,7 @@ public:
     // Constructors
 
         //- Construct from components
-        porousZone(const fvMesh&, const word& name, const dictionary&);
+        porousZone(const word&, const fvMesh&, const dictionary&);
 
         //- Return clone
         autoPtr<porousZone> clone() const
@@ -229,7 +229,7 @@ public:
                 dictionary dict(is);
                 rewriteDict(dict, true);
 
-                return autoPtr<porousZone>(new porousZone(mesh_, name, dict));
+                return autoPtr<porousZone>(new porousZone(name, mesh_, dict));
             }
         };
 
diff --git a/src/finiteVolume/cfdTools/general/porousMedia/porousZones.C b/src/finiteVolume/cfdTools/general/porousMedia/porousZones.C
index f7c4ef5f92e..84cc827916e 100644
--- a/src/finiteVolume/cfdTools/general/porousMedia/porousZones.C
+++ b/src/finiteVolume/cfdTools/general/porousMedia/porousZones.C
@@ -35,6 +35,10 @@ namespace Foam
     defineTemplateTypeNameAndDebug(IOPtrList<porousZone>, 0);
 }
 
+//! @cond localscope
+const Foam::word typeName("porousZones");
+//! @endcond localscope
+
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 Foam::porousZones::porousZones
@@ -47,7 +51,7 @@ Foam::porousZones::porousZones
     (
         IOobject
         (
-            "porousZones",
+            typeName,
             mesh.time().constant(),
             mesh,
             IOobject::READ_IF_PRESENT,
@@ -69,7 +73,7 @@ Foam::porousZones::porousZones
     (
         IOobject
         (
-            "porousZones",
+            typeName,
             mesh.time().constant(),
             mesh,
             IOobject::NO_READ,
@@ -138,7 +142,7 @@ bool Foam::porousZones::readData(Istream& is)
     (
         IOobject
         (
-            "porousZones",
+            typeName,
             mesh_.time().constant(),
             mesh_,
             IOobject::MUST_READ,
diff --git a/src/meshTools/coordinateSystems/coordinateSystem.C b/src/meshTools/coordinateSystems/coordinateSystem.C
index a89a507b8e8..d852b59cf88 100644
--- a/src/meshTools/coordinateSystems/coordinateSystem.C
+++ b/src/meshTools/coordinateSystems/coordinateSystem.C
@@ -43,6 +43,7 @@ namespace Foam
 Foam::coordinateSystem::coordinateSystem()
 :
     name_(type()),
+    note_(),
     origin_(point::zero),
     R_(),
     Rtr_(sphericalTensor::I)
@@ -58,6 +59,7 @@ Foam::coordinateSystem::coordinateSystem
 )
 :
     name_(name),
+    note_(),
     origin_(origin),
     R_(axis, dir),
     Rtr_(R_.T())
@@ -72,6 +74,7 @@ Foam::coordinateSystem::coordinateSystem
 )
 :
     name_(name),
+    note_(),
     origin_(origin),
     R_(cr),
     Rtr_(R_.T())
@@ -84,6 +87,7 @@ Foam::coordinateSystem::coordinateSystem
 )
 :
     name_(type()),
+    note_(),
     origin_(point::zero),
     R_(),
     Rtr_(sphericalTensor::I)
@@ -99,6 +103,7 @@ Foam::coordinateSystem::coordinateSystem
 )
 :
     name_(name),
+    note_(),
     origin_(point::zero),
     R_(),
     Rtr_(sphericalTensor::I)
@@ -110,6 +115,7 @@ Foam::coordinateSystem::coordinateSystem
 Foam::coordinateSystem::coordinateSystem(Istream& is)
 :
     name_(is),
+    note_(),
     origin_(point::zero),
     R_(),
     Rtr_(sphericalTensor::I)
@@ -140,6 +146,12 @@ Foam::dictionary Foam::coordinateSystem::dict(bool ignoreType) const
         dict.add("type", type());
     }
 
+    // The note entry is optional
+    if (note_.size())
+    {
+        dict.add("note", note_);
+    }
+
     dict.add("origin", origin_);
     dict.add("e1", e1());
     dict.add("e3", e3());
@@ -238,6 +250,12 @@ void Foam::coordinateSystem::writeDict(Ostream& os, bool subDict) const
         os.writeKeyword("type")  << type()      << token::END_STATEMENT << nl;
     }
 
+    // The note entry is optional
+    if (note_.size())
+    {
+        os.writeKeyword("note") << note_ << token::END_STATEMENT << nl;
+    }
+
     os.writeKeyword("origin") << origin_  << token::END_STATEMENT << nl;
     os.writeKeyword("e1")     << e1()     << token::END_STATEMENT << nl;
     os.writeKeyword("e3")     << e3()     << token::END_STATEMENT << nl;
@@ -267,9 +285,13 @@ void Foam::coordinateSystem::operator=(const dictionary& rhs)
     );
 
     // unspecified origin is (0 0 0)
-    origin_ = vector::zero;
+    origin_ = point::zero;
     dict.readIfPresent("origin", origin_);
 
+    // The note entry is optional
+    note_.clear();
+    rhs.readIfPresent("note", note_);
+
     // specify via coordinateRotation
     if (dict.found("coordinateRotation"))
     {
diff --git a/src/meshTools/coordinateSystems/coordinateSystem.H b/src/meshTools/coordinateSystems/coordinateSystem.H
index f61c6412d2a..f96a4f67307 100644
--- a/src/meshTools/coordinateSystems/coordinateSystem.H
+++ b/src/meshTools/coordinateSystems/coordinateSystem.H
@@ -132,6 +132,9 @@ class coordinateSystem
         //- Name of coordinate system
         mutable word name_;
 
+        //- Optional note
+        mutable string note_;
+
         //- Origin
         mutable point origin_;
 
@@ -309,6 +312,19 @@ public:
             return name_;
         }
 
+        //- Return non-constant access to the optional note
+        string& note()
+        {
+            return note_;
+        }
+
+        //- Return the optional note
+        const string& note() const
+        {
+            return note_;
+        }
+
+
         //- Return origin
         const point& origin() const
         {
diff --git a/src/meshTools/coordinateSystems/coordinateSystems.C b/src/meshTools/coordinateSystems/coordinateSystems.C
index e8dce6bcf4c..b656d11f85f 100644
--- a/src/meshTools/coordinateSystems/coordinateSystems.C
+++ b/src/meshTools/coordinateSystems/coordinateSystems.C
@@ -34,7 +34,11 @@ namespace Foam
     defineTemplateTypeNameAndDebug(IOPtrList<coordinateSystem>, 0);
 }
 
-const Foam::word Foam::coordinateSystems::dataType("coordinateSystem");
+//! @cond localscope
+const Foam::word typeName("coordinateSystems");
+const Foam::word dataType("coordinateSystem");
+//! @endcond localscope
+
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
@@ -44,17 +48,25 @@ Foam::coordinateSystems::coordinateSystems()
 
 Foam::coordinateSystems::coordinateSystems
 (
-    const objectRegistry& registry,
-    const word& name,
-    const fileName& instance
+    const IOobject& io
+)
+{
+    IOPtrList<coordinateSystem> newList(io);
+    transfer(newList);
+}
+
+
+Foam::coordinateSystems::coordinateSystems
+(
+    const objectRegistry& registry
 )
 {
     IOPtrList<coordinateSystem> newList
     (
         IOobject
         (
-            name,
-            instance,
+            typeName,
+            "constant",
             registry,
             IOobject::READ_IF_PRESENT,
             IOobject::NO_WRITE,
@@ -66,16 +78,6 @@ Foam::coordinateSystems::coordinateSystems
 }
 
 
-Foam::coordinateSystems::coordinateSystems
-(
-    const IOobject& io
-)
-{
-    IOPtrList<coordinateSystem> newList(io);
-    transfer(newList);
-}
-
-
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 
diff --git a/src/meshTools/coordinateSystems/coordinateSystems.H b/src/meshTools/coordinateSystems/coordinateSystems.H
index cc738af9991..e60eed2739f 100644
--- a/src/meshTools/coordinateSystems/coordinateSystems.H
+++ b/src/meshTools/coordinateSystems/coordinateSystems.H
@@ -59,11 +59,6 @@ class coordinateSystems
 
 public:
 
-    // Static data members
-
-        //- Type name of list contents
-        static const word dataType;
-
     // Public Member Functions
 
 
@@ -72,16 +67,11 @@ public:
         //- Construct null
         coordinateSystems();
 
-        //- Read construct from registry, name. instance
-        coordinateSystems
-        (
-            const objectRegistry& registry,
-            const word& name = "coordinateSystems",
-            const fileName& instance = "constant"
-        );
-
         //- Read construct from IOobject
-        coordinateSystems(const IOobject&);
+        explicit coordinateSystems(const IOobject&);
+
+        //- Read construct from registry from "constant" instance
+        coordinateSystems(const objectRegistry&);
 
     // Member Functions
 
@@ -132,10 +122,10 @@ public:
         //  @endverbatim
         //  When this form of re-writing is used, the coordinateRotation is
         //  reduced to the axes specification.
-        bool rewriteDict(dictionary& dict, bool noType = false) const;
+        bool rewriteDict(dictionary&, bool noType=false) const;
 
         //- write data
-        bool writeData(Ostream&, bool subDict = true) const;
+        bool writeData(Ostream&, bool subDict=true) const;
 };
 
 
-- 
GitLab