From cd01c8f1a26f6ec45920590861b5e1e4a6b3fa55 Mon Sep 17 00:00:00 2001
From: mattijs <mattijs>
Date: Fri, 3 Feb 2012 15:53:37 +0000
Subject: [PATCH] BUG: mergePolyMesh: merging zones

---
 .../manipulation/mergeMeshes/mergePolyMesh.C  | 74 +++++++++++++++++--
 .../mesh/manipulation/setSet/setSet.C         |  4 +-
 .../mesh/manipulation/topoSet/topoSet.C       |  2 +-
 3 files changed, 70 insertions(+), 10 deletions(-)

diff --git a/applications/utilities/mesh/manipulation/mergeMeshes/mergePolyMesh.C b/applications/utilities/mesh/manipulation/mergeMeshes/mergePolyMesh.C
index 6f44ddae8f6..8c63dcaf9f3 100644
--- a/applications/utilities/mesh/manipulation/mergeMeshes/mergePolyMesh.C
+++ b/applications/utilities/mesh/manipulation/mergeMeshes/mergePolyMesh.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -425,14 +425,74 @@ void Foam::mergePolyMesh::merge()
     }
 
     // Add the zones if necessary
-    if
-    (
-        pointZoneNames_.size() != pointZones().size()
-     || faceZoneNames_.size() != faceZones().size()
-     || cellZoneNames_.size() != cellZones().size()
-    )
+    if (pointZoneNames_.size() > pointZones().size())
     {
+        Info<< "Adding new pointZones. " << endl;
+        label nZones = pointZones().size();
 
+        pointZones().setSize(pointZoneNames_.size());
+
+        for (label zoneI = nZones; zoneI < pointZoneNames_.size(); zoneI++)
+        {
+            pointZones().set
+            (
+                zoneI,
+                new pointZone
+                (
+                    pointZoneNames_[zoneI],
+                    labelList(),
+                    zoneI,
+                    pointZones()
+                )
+            );
+        }
+    }
+    if (cellZoneNames_.size() > cellZones().size())
+    {
+        Info<< "Adding new cellZones. " << endl;
+
+        label nZones = cellZones().size();
+
+        cellZones().setSize(cellZoneNames_.size());
+
+        for (label zoneI = nZones; zoneI < cellZoneNames_.size(); zoneI++)
+        {
+            cellZones().set
+            (
+                zoneI,
+                new cellZone
+                (
+                    cellZoneNames_[zoneI],
+                    labelList(),
+                    zoneI,
+                    cellZones()
+                )
+            );
+        }
+    }
+    if (faceZoneNames_.size() > faceZones().size())
+    {
+        Info<< "Adding new faceZones. " << endl;
+
+        label nZones = faceZones().size();
+
+        faceZones().setSize(faceZoneNames_.size());
+
+        for (label zoneI = nZones; zoneI < faceZoneNames_.size(); zoneI++)
+        {
+            faceZones().set
+            (
+                zoneI,
+                new faceZone
+                (
+                    faceZoneNames_[zoneI],
+                    labelList(),
+                    boolList(),
+                    zoneI,
+                    faceZones()
+                )
+            );
+        }
     }
 
     // Change mesh. No inflation
diff --git a/applications/utilities/mesh/manipulation/setSet/setSet.C b/applications/utilities/mesh/manipulation/setSet/setSet.C
index 1a47854895e..5619897041a 100644
--- a/applications/utilities/mesh/manipulation/setSet/setSet.C
+++ b/applications/utilities/mesh/manipulation/setSet/setSet.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -853,7 +853,7 @@ int main(int argc, char *argv[])
 
     // Read history if interactive
 #   ifdef HAS_READLINE
-    if (!batch && !read_history(historyFile))
+    if (!batch && !read_history(runTime.path()/historyFile))
     {
         Info<< "Successfully read history from " << historyFile << endl;
     }
diff --git a/applications/utilities/mesh/manipulation/topoSet/topoSet.C b/applications/utilities/mesh/manipulation/topoSet/topoSet.C
index cd2a96fc12e..29a5d075338 100644
--- a/applications/utilities/mesh/manipulation/topoSet/topoSet.C
+++ b/applications/utilities/mesh/manipulation/topoSet/topoSet.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
-- 
GitLab