From da922300e61dd2fe10f1469437c3d53fe8904c83 Mon Sep 17 00:00:00 2001
From: mattijs <m.janssens@opencfd.co.uk>
Date: Fri, 27 Jun 2008 15:23:58 +0100
Subject: [PATCH] added normals

---
 src/meshTools/octree/treeBoundBox.C | 23 +++++++++++++++++++----
 src/meshTools/octree/treeBoundBox.H |  8 ++++++++
 2 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/src/meshTools/octree/treeBoundBox.C b/src/meshTools/octree/treeBoundBox.C
index 1f79a35c3a4..3297541d38e 100644
--- a/src/meshTools/octree/treeBoundBox.C
+++ b/src/meshTools/octree/treeBoundBox.C
@@ -27,8 +27,6 @@ License
 #include "treeBoundBox.H"
 #include "ListOps.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
 const Foam::treeBoundBox Foam::treeBoundBox::greatBox
@@ -50,6 +48,7 @@ const Foam::label facesArray[6][4] =
 };
 //! @endcond
 
+
 const Foam::faceList Foam::treeBoundBox::faces
 (
     initListList<face, label, 6, 4>(facesArray)
@@ -74,12 +73,28 @@ const Foam::label edgesArray[12][2] =
 };
 //! @endcond
 
-const Foam::edgeList Foam::treeBoundBox::edges
+
+const Foam::FixedList<Foam::vector, 6> Foam::treeBoundBox::faceNormals
 (
-    initListList<edge, label, 12, 2>(edgesArray)
+    calcFaceNormals()
 );
 
 
+// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
+
+Foam::FixedList<Foam::vector, 6> Foam::treeBoundBox::calcFaceNormals()
+{
+    FixedList<vector, 6> normals;
+    normals[LEFT]   = vector(-1,  0,  0);
+    normals[RIGHT]  = vector( 1,  0,  0);
+    normals[BOTTOM] = vector( 0, -1,  0);
+    normals[TOP]    = vector( 0,  1,  0);
+    normals[BACK]   = vector( 0,  0, -1);
+    normals[FRONT]  = vector( 0,  0,  1);
+    return normals;
+}
+
+
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
 // Construct as the bounding box of the given pointField
diff --git a/src/meshTools/octree/treeBoundBox.H b/src/meshTools/octree/treeBoundBox.H
index a946869ec6d..4ae826693cd 100644
--- a/src/meshTools/octree/treeBoundBox.H
+++ b/src/meshTools/octree/treeBoundBox.H
@@ -78,6 +78,11 @@ class treeBoundBox
     public boundBox
 {
 
+private:
+
+        //- To initialise faceNormals.
+        static FixedList<vector, 6> calcFaceNormals();
+
 public:
 
     // Static data members
@@ -142,6 +147,9 @@ public:
         //- Edge to point addressing
         static const edgeList edges;
 
+        //- Per face the unit normal
+        static const FixedList<vector, 6> faceNormals;
+
 
         //- Face on which neighbour is
         static direction neighbourFaceBits(const label&);
-- 
GitLab