From 8c23f5423cacfaeacc599bc69051c9c851d2722b Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@Germany>
Date: Fri, 10 Oct 2008 10:22:08 +0200
Subject: [PATCH] add xfer constructors to cell/face/point Zone and
 (Static)HashTable

---
 .../HashTables/HashTable/HashTable.C          | 13 +++++
 .../HashTables/HashTable/HashTable.H          |  4 ++
 .../StaticHashTable/StaticHashTable.C         | 18 +++++++
 .../StaticHashTable/StaticHashTable.H         |  3 ++
 .../meshes/polyMesh/zones/cellZone/cellZone.C | 31 ++++++++++++
 .../meshes/polyMesh/zones/cellZone/cellZone.H | 31 +++++++++---
 .../meshes/polyMesh/zones/faceZone/faceZone.C | 48 +++++++++++++++++++
 .../meshes/polyMesh/zones/faceZone/faceZone.H | 33 ++++++++++---
 .../polyMesh/zones/pointZone/pointZone.C      | 32 +++++++++++++
 .../polyMesh/zones/pointZone/pointZone.H      | 31 +++++++++---
 10 files changed, 226 insertions(+), 18 deletions(-)

diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.C b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.C
index 97cb2b321b0..676d579bb8f 100644
--- a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.C
+++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.C
@@ -83,6 +83,19 @@ HashTable<T, Key, Hash>::HashTable(const HashTable<T, Key, Hash>& ht)
     }
 }
 
+template<class T, class Key, class Hash>
+HashTable<T, Key, Hash>::HashTable(const xfer<HashTable<T, Key, Hash> >& ht)
+:
+    HashTableName(),
+    tableSize_(0),
+    table_(NULL),
+    nElmts_(0),
+    endIter_(*this, NULL, 0),
+    endConstIter_(*this, NULL, 0)
+{
+    transfer(*ht);
+}
+
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H
index 2f3913d2e2c..701d8456156 100644
--- a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H
+++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H
@@ -41,6 +41,7 @@ SourceFiles
 #include "label.H"
 #include "word.H"
 #include "className.H"
+#include "xfer.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -155,6 +156,9 @@ public:
         //- Construct as copy
         HashTable(const HashTable<T, Key, Hash>&);
 
+        //- Construct by transferring the parameter contents
+        HashTable(const xfer<HashTable<T, Key, Hash> >&);
+
 
     // Destructor
 
diff --git a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.C b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.C
index e5e47778140..688abd467dc 100644
--- a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.C
+++ b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.C
@@ -76,6 +76,24 @@ StaticHashTable<T, Key, Hash>::StaticHashTable
 {}
 
 
+
+template<class T, class Key, class Hash>
+StaticHashTable<T, Key, Hash>::StaticHashTable
+(
+    const xfer<StaticHashTable<T, Key, Hash> >& ht
+)
+:
+    StaticHashTableName(),
+    keys_(0),
+    objects_(0),
+    nElmts_(0),
+    endIter_(*this, 0, 0),
+    endConstIter_(*this, 0, 0)
+{
+    transfer(*ht);
+}
+
+
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
 template<class T, class Key, class Hash>
diff --git a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.H b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.H
index 9eadf37b5e2..558519d8138 100644
--- a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.H
+++ b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTable.H
@@ -46,6 +46,7 @@ SourceFiles
 #include "label.H"
 #include "word.H"
 #include "className.H"
+#include "xfer.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -146,6 +147,8 @@ public:
         //- Construct as copy
         StaticHashTable(const StaticHashTable<T, Key, Hash>&);
 
+        //- Construct as copy
+        StaticHashTable(const xfer<StaticHashTable<T, Key, Hash> >&);
 
     // Destructor
 
diff --git a/src/OpenFOAM/meshes/polyMesh/zones/cellZone/cellZone.C b/src/OpenFOAM/meshes/polyMesh/zones/cellZone/cellZone.C
index d85cc939360..ab3639362b6 100644
--- a/src/OpenFOAM/meshes/polyMesh/zones/cellZone/cellZone.C
+++ b/src/OpenFOAM/meshes/polyMesh/zones/cellZone/cellZone.C
@@ -114,6 +114,22 @@ Foam::cellZone::cellZone
 {}
 
 
+Foam::cellZone::cellZone
+(
+    const word& name,
+    const xfer<labelList>& addr,
+    const label index,
+    const cellZoneMesh& zm
+)
+:
+    labelList(addr),
+    name_(name),
+    index_(index),
+    zoneMesh_(zm),
+    cellLookupMapPtr_(NULL)
+{}
+
+
 // Construct from dictionary
 Foam::cellZone::cellZone
 (
@@ -148,6 +164,21 @@ Foam::cellZone::cellZone
     cellLookupMapPtr_(NULL)
 {}
 
+Foam::cellZone::cellZone
+(
+    const cellZone& cz,
+    const xfer<labelList>& addr,
+    const label index,
+    const cellZoneMesh& zm
+)
+:
+    labelList(addr),
+    name_(cz.name()),
+    index_(index),
+    zoneMesh_(zm),
+    cellLookupMapPtr_(NULL)
+{}
+
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
diff --git a/src/OpenFOAM/meshes/polyMesh/zones/cellZone/cellZone.H b/src/OpenFOAM/meshes/polyMesh/zones/cellZone/cellZone.H
index 799e810e2a3..a239992cde0 100644
--- a/src/OpenFOAM/meshes/polyMesh/zones/cellZone/cellZone.H
+++ b/src/OpenFOAM/meshes/polyMesh/zones/cellZone/cellZone.H
@@ -128,26 +128,45 @@ public:
             const word& name,
             const labelList& addr,
             const label index,
-            const cellZoneMesh& zm
+            const cellZoneMesh&
+        );
+
+        //- Construct from components, transferring contents
+        cellZone
+        (
+            const word& name,
+            const xfer<labelList>& addr,
+            const label index,
+            const cellZoneMesh&
         );
 
         //- Construct from dictionary
         cellZone
         (
             const word& name,
-            const dictionary& dict,
+            const dictionary&,
             const label index,
-            const cellZoneMesh& zm
+            const cellZoneMesh&
         );
 
         //- Construct given the original zone and resetting the
         //  cell list and zone mesh information
         cellZone
         (
-            const cellZone& cz,
+            const cellZone&,
             const labelList& addr,
             const label index,
-            const cellZoneMesh& zm
+            const cellZoneMesh&
+        );
+
+        //- Construct given the original zone, resetting the
+        //  cell list and zone mesh information
+        cellZone
+        (
+            const cellZone&,
+            const xfer<labelList>& addr,
+            const label index,
+            const cellZoneMesh&
         );
 
         //- Construct and return a clone, resetting the zone mesh
@@ -182,7 +201,7 @@ public:
         static autoPtr<cellZone> New
         (
             const word& name,
-            const dictionary& dict,
+            const dictionary&,
             const label index,
             const cellZoneMesh&
         );
diff --git a/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C b/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C
index acc3b0dcf99..0a478f8c88e 100644
--- a/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C
+++ b/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C
@@ -242,6 +242,30 @@ Foam::faceZone::faceZone
 }
 
 
+Foam::faceZone::faceZone
+(
+    const word& name,
+    const xfer<labelList>& addr,
+    const xfer<boolList>& fm,
+    const label index,
+    const faceZoneMesh& zm
+)
+:
+    labelList(addr),
+    name_(name),
+    flipMap_(fm),
+    index_(index),
+    zoneMesh_(zm),
+    patchPtr_(NULL),
+    masterCellsPtr_(NULL),
+    slaveCellsPtr_(NULL),
+    mePtr_(NULL),
+    faceLookupMapPtr_(NULL)
+{
+    checkAddressing();
+}
+
+
 // Construct from dictionary
 Foam::faceZone::faceZone
 (
@@ -292,6 +316,30 @@ Foam::faceZone::faceZone
 }
 
 
+Foam::faceZone::faceZone
+(
+    const faceZone& fz,
+    const xfer<labelList>& addr,
+    const xfer<boolList>& fm,
+    const label index,
+    const faceZoneMesh& zm
+)
+:
+    labelList(addr),
+    name_(fz.name()),
+    flipMap_(fm),
+    index_(index),
+    zoneMesh_(zm),
+    patchPtr_(NULL),
+    masterCellsPtr_(NULL),
+    slaveCellsPtr_(NULL),
+    mePtr_(NULL),
+    faceLookupMapPtr_(NULL)
+{
+    checkAddressing();
+}
+
+
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
 Foam::faceZone::~faceZone()
diff --git a/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.H b/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.H
index c299361cf69..7d489da273c 100644
--- a/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.H
+++ b/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.H
@@ -163,24 +163,45 @@ public:
             const faceZoneMesh& zm
         );
 
+        //- Construct from components, transferring contents
+        faceZone
+        (
+            const word& name,
+            const xfer<labelList>& addr,
+            const xfer<boolList>& fm,
+            const label index,
+            const faceZoneMesh&
+        );
+
         //- Construct from dictionary
         faceZone
         (
             const word& name,
-            const dictionary& dict,
+            const dictionary&,
             const label index,
-            const faceZoneMesh& zm
+            const faceZoneMesh&
         );
 
         //- Construct given the original zone and resetting the
         //  face list and zone mesh information
         faceZone
         (
-            const faceZone& fz,
+            const faceZone&,
             const labelList& addr,
             const boolList& fm,
             const label index,
-            const faceZoneMesh& zm
+            const faceZoneMesh&
+        );
+
+        //- Construct given the original zone, resetting the
+        //  face list and zone mesh information
+        faceZone
+        (
+            const faceZone&,
+            const xfer<labelList>& addr,
+            const xfer<boolList>& fm,
+            const label index,
+            const faceZoneMesh&
         );
 
         //- Construct and return a clone, resetting the zone mesh
@@ -216,9 +237,9 @@ public:
         static autoPtr<faceZone> New
         (
             const word& name,
-            const dictionary& dict,
+            const dictionary&,
             const label index,
-            const faceZoneMesh& zm
+            const faceZoneMesh&
         );
 
 
diff --git a/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.C b/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.C
index 972588686d6..e93bb69ae6b 100644
--- a/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.C
+++ b/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.C
@@ -112,6 +112,22 @@ Foam::pointZone::pointZone
 {}
 
 
+Foam::pointZone::pointZone
+(
+    const word& name,
+    const xfer<labelList>& addr,
+    const label index,
+    const pointZoneMesh& zm
+)
+:
+    labelList(addr),
+    name_(name),
+    index_(index),
+    zoneMesh_(zm),
+    pointLookupMapPtr_(NULL)
+{}
+
+
 // Construct from dictionary
 Foam::pointZone::pointZone
 (
@@ -147,6 +163,22 @@ Foam::pointZone::pointZone
 {}
 
 
+Foam::pointZone::pointZone
+(
+    const pointZone& pz,
+    const xfer<labelList>& addr,
+    const label index,
+    const pointZoneMesh& zm
+)
+:
+    labelList(addr),
+    name_(pz.name()),
+    index_(index),
+    zoneMesh_(zm),
+    pointLookupMapPtr_(NULL)
+{}
+
+
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
 
 Foam::pointZone::~pointZone()
diff --git a/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.H b/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.H
index 18370e2672b..afc48da717d 100644
--- a/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.H
+++ b/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.H
@@ -130,26 +130,45 @@ public:
             const word& name,
             const labelList& addr,
             const label index,
-            const pointZoneMesh& zm
+            const pointZoneMesh&
+        );
+
+        //- Construct from components, transferring contents
+        pointZone
+        (
+            const word& name,
+            const xfer<labelList>& addr,
+            const label index,
+            const pointZoneMesh&
         );
 
         //- Construct from dictionary
         pointZone
         (
             const word& name,
-            const dictionary& dict,
+            const dictionary&,
             const label index,
-            const pointZoneMesh& zm
+            const pointZoneMesh&
         );
 
         //- Construct given the original zone and resetting the
         //  point list and zone mesh information
         pointZone
         (
-            const pointZone& pz,
+            const pointZone&,
             const labelList& addr,
             const label index,
-            const pointZoneMesh& zm
+            const pointZoneMesh&
+        );
+
+        //- Construct given the original zone, resetting the
+        //  face list and zone mesh information
+        pointZone
+        (
+            const pointZone&,
+            const xfer<labelList>& addr,
+            const label index,
+            const pointZoneMesh&
         );
 
         //- Construct and return a clone, resetting the zone mesh
@@ -184,7 +203,7 @@ public:
         static autoPtr<pointZone> New
         (
             const word& name,
-            const dictionary& dict,
+            const dictionary&,
             const label index,
             const pointZoneMesh&
         );
-- 
GitLab