From f8991db92d68495466d2b120d097661728da78c9 Mon Sep 17 00:00:00 2001
From: andy <andy>
Date: Thu, 9 Jan 2014 12:57:40 +0000
Subject: [PATCH] ENH: dimensionSet - added copy/clone functionality

---
 src/OpenFOAM/dimensionSet/dimensionSet.C |  8 +++++++-
 src/OpenFOAM/dimensionSet/dimensionSet.H | 14 ++++++++++++--
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/src/OpenFOAM/dimensionSet/dimensionSet.C b/src/OpenFOAM/dimensionSet/dimensionSet.C
index 86868610188..de1b547681f 100644
--- a/src/OpenFOAM/dimensionSet/dimensionSet.C
+++ b/src/OpenFOAM/dimensionSet/dimensionSet.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2014 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -78,6 +78,12 @@ Foam::dimensionSet::dimensionSet
 }
 
 
+Foam::dimensionSet::dimensionSet(const dimensionSet& ds)
+{
+    reset(ds);
+}
+
+
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 bool Foam::dimensionSet::dimensionless() const
diff --git a/src/OpenFOAM/dimensionSet/dimensionSet.H b/src/OpenFOAM/dimensionSet/dimensionSet.H
index 1b03e9e27d1..105ea879a53 100644
--- a/src/OpenFOAM/dimensionSet/dimensionSet.H
+++ b/src/OpenFOAM/dimensionSet/dimensionSet.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2014 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -158,6 +158,7 @@ private:
 
                 label size_;
 
+
             // Private Member Functions
 
                 void push(const token&);
@@ -172,6 +173,7 @@ private:
 
                  tokeniser(Istream&);
 
+
             // Member Functions
 
                 Istream& stream()
@@ -190,7 +192,6 @@ private:
                 static bool valid(char c);
 
                 static label priority(const token& t);
-
         };
 
 
@@ -244,6 +245,15 @@ public:
             const scalar moles
         );
 
+        //- Copy constructor
+        dimensionSet(const dimensionSet& ds);
+
+        //- Construct and return a clone
+        autoPtr<dimensionSet> clone() const
+        {
+            return autoPtr<dimensionSet>(new dimensionSet(*this));
+        }
+
         //- Construct from Istream
         dimensionSet(Istream&);
 
-- 
GitLab