From c178021ebc57b130529a96347d7c5a964d9982b7 Mon Sep 17 00:00:00 2001
From: mattijs <mattijs>
Date: Tue, 29 Sep 2009 20:32:08 +0100
Subject: [PATCH] sorted addressing

---
 src/meshTools/sets/topoSets/cellZoneSet.C  | 4 ++++
 src/meshTools/sets/topoSets/cellZoneSet.H  | 5 +----
 src/meshTools/sets/topoSets/faceZoneSet.C  | 7 ++++++-
 src/meshTools/sets/topoSets/faceZoneSet.H  | 2 +-
 src/meshTools/sets/topoSets/pointZoneSet.C | 4 ++++
 src/meshTools/sets/topoSets/pointZoneSet.H | 2 +-
 6 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/src/meshTools/sets/topoSets/cellZoneSet.C b/src/meshTools/sets/topoSets/cellZoneSet.C
index 061cecb4753..613a23bc8c7 100644
--- a/src/meshTools/sets/topoSets/cellZoneSet.C
+++ b/src/meshTools/sets/topoSets/cellZoneSet.C
@@ -50,6 +50,10 @@ addToRunTimeSelectionTable(topoSet, cellZoneSet, set);
 
 void cellZoneSet::updateSet()
 {
+    labelList order;
+    sortedOrder(addressing_, order);
+    inplaceReorder(order, addressing_);
+
     cellSet::clearStorage();
     cellSet::resize(2*addressing_.size());
     forAll(addressing_, i)
diff --git a/src/meshTools/sets/topoSets/cellZoneSet.H b/src/meshTools/sets/topoSets/cellZoneSet.H
index 40f0334f905..7ddb48d1146 100644
--- a/src/meshTools/sets/topoSets/cellZoneSet.H
+++ b/src/meshTools/sets/topoSets/cellZoneSet.H
@@ -58,9 +58,6 @@ class cellZoneSet
 
         labelList addressing_;
 
-   // Private Member Functions
-
-
 public:
 
     //- Runtime type information
@@ -115,7 +112,7 @@ public:
             return addressing_;
         }
 
-        //- Make cellSet part consistent with addressing
+        //- Sort addressing and make cellSet part consistent with addressing
         void updateSet();
 
         //- Invert contents. (insert all members 0..maxLen-1 which were not in
diff --git a/src/meshTools/sets/topoSets/faceZoneSet.C b/src/meshTools/sets/topoSets/faceZoneSet.C
index 4e215a1ee2b..85069a83ae2 100644
--- a/src/meshTools/sets/topoSets/faceZoneSet.C
+++ b/src/meshTools/sets/topoSets/faceZoneSet.C
@@ -50,6 +50,11 @@ addToRunTimeSelectionTable(topoSet, faceZoneSet, set);
 
 void faceZoneSet::updateSet()
 {
+    labelList order;
+    sortedOrder(addressing_, order);
+    inplaceReorder(order, addressing_);
+    inplaceReorder(order, flipMap_);
+
     faceSet::clearStorage();
     faceSet::resize(2*addressing_.size());
     forAll(addressing_, i)
@@ -145,7 +150,7 @@ void faceZoneSet::invert(const label maxLen)
         if (!found(faceI))
         {
             addressing_[n] = faceI;
-            flipMap_[n] = true;         //? or false?
+            flipMap_[n] = false;         //? or true?
             n++;
         }
     }
diff --git a/src/meshTools/sets/topoSets/faceZoneSet.H b/src/meshTools/sets/topoSets/faceZoneSet.H
index cefe642e44e..335bd9edead 100644
--- a/src/meshTools/sets/topoSets/faceZoneSet.H
+++ b/src/meshTools/sets/topoSets/faceZoneSet.H
@@ -129,7 +129,7 @@ public:
         }
 
 
-        //- Make faceSet part consistent with addressing
+        //- Sort addressing and make faceSet part consistent with addressing
         void updateSet();
 
         //- Invert contents. (insert all members 0..maxLen-1 which were not in
diff --git a/src/meshTools/sets/topoSets/pointZoneSet.C b/src/meshTools/sets/topoSets/pointZoneSet.C
index acab1e51a9f..32f447d1447 100644
--- a/src/meshTools/sets/topoSets/pointZoneSet.C
+++ b/src/meshTools/sets/topoSets/pointZoneSet.C
@@ -50,6 +50,10 @@ addToRunTimeSelectionTable(topoSet, pointZoneSet, set);
 
 void pointZoneSet::updateSet()
 {
+    labelList order;
+    sortedOrder(addressing_, order);
+    inplaceReorder(order, addressing_);
+
     pointSet::clearStorage();
     pointSet::resize(2*addressing_.size());
     forAll(addressing_, i)
diff --git a/src/meshTools/sets/topoSets/pointZoneSet.H b/src/meshTools/sets/topoSets/pointZoneSet.H
index 9518c5e71d5..7f93886e0bc 100644
--- a/src/meshTools/sets/topoSets/pointZoneSet.H
+++ b/src/meshTools/sets/topoSets/pointZoneSet.H
@@ -115,7 +115,7 @@ public:
             return addressing_;
         }
 
-        //- Make pointSet part consistent with addressing
+        //- Sort addressing and make pointSet part consistent with addressing
         void updateSet();
 
         //- Invert contents. (insert all members 0..maxLen-1 which were not in
-- 
GitLab