From 7b3fbb0279ef09e003ef03d24e76e09a1aba8ff7 Mon Sep 17 00:00:00 2001
From: Andrew Heather <a.heather@opencfd.co.uk>
Date: Thu, 17 Nov 2016 13:35:35 +0000
Subject: [PATCH] ENH: Porosity model - output cellZone bounds in the local
 co-ordinate system.  Fixes #300

---
 .../porosityModel/porosityModel.C             | 33 ++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.C b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.C
index 0338e35154..77d28f589c 100644
--- a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.C
+++ b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2012-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -122,6 +122,37 @@ Foam::porosityModel::porosityModel
             << "cannot find porous cellZone " << zoneName_
             << exit(FatalError);
     }
+
+    Info<< incrIndent << indent << coordSys_ << decrIndent << endl;
+
+    const pointField& points = mesh_.points();
+    const cellList& cells = mesh_.cells();
+    const faceList& faces = mesh_.faces();
+    DynamicList<point> localPoints;
+    forAll(cellZoneIDs_, zoneI)
+    {
+        const cellZone& cZone = mesh_.cellZones()[cellZoneIDs_[zoneI]];
+        localPoints.setCapacity(10*cells.size());
+
+        forAll(cZone, i)
+        {
+            const label cellI = cZone[i];
+            const cell& c = mesh_.cells()[cellI];
+            const pointField cellPoints(c.points(faces, points));
+
+            forAll(cellPoints, pointI)
+            {
+                const point& pt = cellPoints[pointI];
+                localPoints.append(coordSys_.localPosition(pt));
+            }
+        }
+
+        boundBox bb(localPoints, true);
+
+        Info<< "    local bounds: " << bb << endl;
+
+        localPoints.clear();
+    }
 }
 
 
-- 
GitLab