From 03d98b6d22478c81eaae5635de2148dbc543f1f4 Mon Sep 17 00:00:00 2001
From: mattijs <mattijs>
Date: Fri, 27 Aug 2010 18:31:54 +0100
Subject: [PATCH] ENH: decompositionMethod : move storage of dictionary to
 those classes that need it

---
 .../decompositionMethod/decompositionMethod.H |  2 +-
 .../multiLevelDecomp/multiLevelDecomp.C       |  9 +++---
 .../multiLevelDecomp/multiLevelDecomp.H       |  2 ++
 .../structuredDecomp/structuredDecomp.C       | 10 +++----
 .../structuredDecomp/structuredDecomp.H       | 28 ++-----------------
 5 files changed, 14 insertions(+), 37 deletions(-)

diff --git a/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.H b/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.H
index e0355c19835..e5995a403d5 100644
--- a/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.H
+++ b/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.H
@@ -53,7 +53,7 @@ protected:
 
     // Protected data
 
-        const dictionary decompositionDict_;
+        const dictionary& decompositionDict_;
         label nProcessors_;
 
 
diff --git a/src/parallel/decompose/decompositionMethods/multiLevelDecomp/multiLevelDecomp.C b/src/parallel/decompose/decompositionMethods/multiLevelDecomp/multiLevelDecomp.C
index 5822d6a6710..cb9ec502c5c 100644
--- a/src/parallel/decompose/decompositionMethods/multiLevelDecomp/multiLevelDecomp.C
+++ b/src/parallel/decompose/decompositionMethods/multiLevelDecomp/multiLevelDecomp.C
@@ -312,13 +312,12 @@ void Foam::multiLevelDecomp::decompose
 
 Foam::multiLevelDecomp::multiLevelDecomp(const dictionary& decompositionDict)
 :
-    decompositionMethod(decompositionDict)
+    decompositionMethod(decompositionDict),
+    methodsDict_(decompositionDict_.subDict(typeName + "Coeffs"))
 {
-    const dictionary& myDict = decompositionDict_.subDict(typeName + "Coeffs");
-
-    methods_.setSize(myDict.size());
+    methods_.setSize(methodsDict_.size());
     label i = 0;
-    forAllConstIter(dictionary, myDict, iter)
+    forAllConstIter(dictionary, methodsDict_, iter)
     {
         methods_.set(i++, decompositionMethod::New(iter().dict()));
     }
diff --git a/src/parallel/decompose/decompositionMethods/multiLevelDecomp/multiLevelDecomp.H b/src/parallel/decompose/decompositionMethods/multiLevelDecomp/multiLevelDecomp.H
index 7a41da06fb8..a805bfacf87 100644
--- a/src/parallel/decompose/decompositionMethods/multiLevelDecomp/multiLevelDecomp.H
+++ b/src/parallel/decompose/decompositionMethods/multiLevelDecomp/multiLevelDecomp.H
@@ -50,6 +50,8 @@ class multiLevelDecomp
 {
     // Private data
 
+        dictionary methodsDict_;
+
         PtrList<decompositionMethod> methods_;
 
 
diff --git a/src/parallel/decompose/decompositionMethods/structuredDecomp/structuredDecomp.C b/src/parallel/decompose/decompositionMethods/structuredDecomp/structuredDecomp.C
index 9843b4550b7..32f86c82c83 100644
--- a/src/parallel/decompose/decompositionMethods/structuredDecomp/structuredDecomp.C
+++ b/src/parallel/decompose/decompositionMethods/structuredDecomp/structuredDecomp.C
@@ -49,12 +49,12 @@ namespace Foam
 
 Foam::structuredDecomp::structuredDecomp(const dictionary& decompositionDict)
 :
-    decompositionMethod(decompositionDict)
+    decompositionMethod(decompositionDict),
+    methodDict_(decompositionDict_.subDict(typeName + "Coeffs"))
 {
-    dictionary myDict = decompositionDict_.subDict(typeName + "Coeffs");
-    myDict.set("numberOfSubdomains", nDomains());
-    method_ = decompositionMethod::New(myDict);
-    patches_ = wordList(myDict.lookup("patches"));
+    methodDict_.set("numberOfSubdomains", nDomains());
+    method_ = decompositionMethod::New(methodDict_);
+    patches_ = wordList(methodDict_.lookup("patches"));
 }
 
 
diff --git a/src/parallel/decompose/decompositionMethods/structuredDecomp/structuredDecomp.H b/src/parallel/decompose/decompositionMethods/structuredDecomp/structuredDecomp.H
index d3f17687c6a..dc316e7a4dd 100644
--- a/src/parallel/decompose/decompositionMethods/structuredDecomp/structuredDecomp.H
+++ b/src/parallel/decompose/decompositionMethods/structuredDecomp/structuredDecomp.H
@@ -50,6 +50,8 @@ class structuredDecomp
 {
     // Private data
 
+        dictionary methodDict_;
+
         autoPtr<decompositionMethod> method_;
 
         wordList patches_;
@@ -57,32 +59,6 @@ class structuredDecomp
 
     // Private Member Functions
 
-        //- Given connectivity across processors work out connectivity
-        //  for a (consistent) subset
-        void subsetGlobalCellCells
-        (
-            const label nDomains,
-            const label domainI,
-            const labelList& dist,
-
-            const labelListList& cellCells,
-            const labelList& set,
-            labelListList& subCellCells,
-            labelList& cutConnections
-        ) const;
-
-        //- Decompose level methodI without addressing
-        void decompose
-        (
-            const labelListList& pointPoints,
-            const pointField& points,
-            const scalarField& pointWeights,
-            const labelList& pointMap,  // map back to original points
-            const label levelI,
-
-            labelField& finalDecomp
-        );
-
         //- Disallow default bitwise copy construct and assignment
         void operator=(const structuredDecomp&);
         structuredDecomp(const structuredDecomp&);
-- 
GitLab