From 139c22716d7897e8c0f651048260ff0e45ddc8ab Mon Sep 17 00:00:00 2001
From: mattijs <mattijs>
Date: Wed, 22 Feb 2012 16:34:58 +0000
Subject: [PATCH] ENH: renumberMesh: make frontwidth calculation an option

---
 .../manipulation/renumberMesh/Make/options    |  2 +-
 .../manipulation/renumberMesh/renumberMesh.C  | 29 ++++++++++++++-----
 .../renumberMesh/renumberMeshDict             |  1 +
 3 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/applications/utilities/mesh/manipulation/renumberMesh/Make/options b/applications/utilities/mesh/manipulation/renumberMesh/Make/options
index 72eeafc9d18..23661b3e95d 100644
--- a/applications/utilities/mesh/manipulation/renumberMesh/Make/options
+++ b/applications/utilities/mesh/manipulation/renumberMesh/Make/options
@@ -1,5 +1,5 @@
 EXE_INC = \
-    -DFULLDEBUG -g -O0 \
+    /* -DFULLDEBUG -g -O0 */ \
     -I$(LIB_SRC)/meshTools/lnInclude \
     -I$(LIB_SRC)/dynamicMesh/lnInclude \
     -I$(LIB_SRC)/finiteVolume/lnInclude \
diff --git a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C
index 4120f8c67ad..9c5d0b8de2f 100644
--- a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C
+++ b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C
@@ -108,6 +108,7 @@ label getBand(const labelList& owner, const labelList& neighbour)
 // Calculate band of matrix
 void getBand
 (
+    const bool calculateIntersect,
     const label nCells,
     const labelList& owner,
     const labelList& neighbour,
@@ -129,17 +130,22 @@ void getBand
         cellBandwidth[nei] = max(cellBandwidth[nei], diff);
     }
 
-    forAll(nIntersect, cellI)
+    bandwidth = max(cellBandwidth);
+    profile = sum(1.0*cellBandwidth);
+
+    sumSqrIntersect = 0.0;
+    if (calculateIntersect)
     {
-        for (label colI = cellI-cellBandwidth[cellI]; colI <= cellI; colI++)
+        forAll(nIntersect, cellI)
         {
-            nIntersect[colI]++;
+            for (label colI = cellI-cellBandwidth[cellI]; colI <= cellI; colI++)
+            {
+                nIntersect[colI] += 1.0;
+            }
         }
-    }
 
-    bandwidth = max(cellBandwidth);
-    profile = sum(cellBandwidth);
-    sumSqrIntersect = sum(Foam::sqr(nIntersect));
+        sumSqrIntersect = sum(Foam::sqr(nIntersect));
+    }
 }
 
 
@@ -565,6 +571,11 @@ int main(int argc, char *argv[])
         "dict",
         "renumber according to system/renumberMeshDict"
     );
+    argList::addBoolOption
+    (
+        "frontWidth",
+        "calculate the rms of the frontwidth"
+    );
 
 #   include "setRootCase.H"
 #   include "createTime.H"
@@ -582,7 +593,7 @@ int main(int argc, char *argv[])
     const word oldInstance = mesh.pointsInstance();
 
     const bool readDict = args.optionFound("dict");
-
+    const bool doFrontWidth = args.optionFound("frontWidth");
     const bool overwrite = args.optionFound("overwrite");
 
     label band;
@@ -590,6 +601,7 @@ int main(int argc, char *argv[])
     scalar sumSqrIntersect;
     getBand
     (
+        doFrontWidth,
         mesh.nCells(),
         mesh.faceOwner(),
         mesh.faceNeighbour(),
@@ -1028,6 +1040,7 @@ int main(int argc, char *argv[])
         scalar sumSqrIntersect;
         getBand
         (
+            doFrontWidth,
             mesh.nCells(),
             mesh.faceOwner(),
             mesh.faceNeighbour(),
diff --git a/applications/utilities/mesh/manipulation/renumberMesh/renumberMeshDict b/applications/utilities/mesh/manipulation/renumberMesh/renumberMeshDict
index 8878469010e..7430ea34414 100644
--- a/applications/utilities/mesh/manipulation/renumberMesh/renumberMeshDict
+++ b/applications/utilities/mesh/manipulation/renumberMesh/renumberMeshDict
@@ -41,6 +41,7 @@ method          CuthillMcKee;
 //method          manual;
 //method          random;
 //method          spring;
+//method          boundaryFirst;
 
 //CuthillMcKeeCoeffs
 //{
-- 
GitLab