fix face direction
authormattijs <mattijs>
Thu, 9 Jul 2009 15:30:40 +0000 (9 16:30 +0100)
committermattijs <mattijs>
Thu, 9 Jul 2009 15:30:40 +0000 (9 16:30 +0100)
applications/utilities/mesh/generation/extrudeMesh/extrudeModel/linearNormal/linearNormal.C
applications/utilities/mesh/generation/extrudeMesh/extrudeModel/wedge/wedge.C
applications/utilities/mesh/generation/extrudeMesh/extrudedMesh/extrudedMesh.C

index 74bb7ef..49fd1a5 100644 (file)
@@ -47,7 +47,14 @@ linearNormal::linearNormal(const dictionary& dict)
 :
     extrudeModel(typeName, dict),
     thickness_(readScalar(coeffDict_.lookup("thickness")))
-{}
+{
+    if (thickness_ <= 0)
+    {
+        FatalErrorIn("linearNormal(const dictionary&)")
+            << "thickness should be positive : " << thickness_
+            << exit(FatalError);
+    }
+}
 
 
 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
index 589d044..487be63 100644 (file)
@@ -88,7 +88,8 @@ point wedge::operator()
     }
     else
     {
-        sliceAngle = angle_*(layer + 1)/nLayers_;
+        //sliceAngle = angle_*(layer + 1)/nLayers_;
+        sliceAngle = angle_*layer/nLayers_;
     }
 
     // Find projection onto axis (or rather decompose surfacePoint
index b650224..1e84cfa 100644 (file)
@@ -108,15 +108,33 @@ Foam::faceList Foam::extrudedMesh::extrudedFaces
         label currentLayerOffset = layer*surfacePoints.size();
         label nextLayerOffset = currentLayerOffset + surfacePoints.size();
 
-        // Side faces from layer to layer+1
-        for (label i=0; i<nInternalEdges; i++)
+        // Vertical faces from layer to layer+1
+        for (label edgeI=0; edgeI<nInternalEdges; edgeI++)
         {
-            quad[0] = surfaceEdges[i][1] + currentLayerOffset;
-            quad[1] = surfaceEdges[i][0] + currentLayerOffset;
-            quad[2] = surfaceEdges[i][0] + nextLayerOffset;
-            quad[3] = surfaceEdges[i][1] + nextLayerOffset;
+            const edge& e = surfaceEdges[edgeI];
+            const labelList& edgeFaces = extrudePatch.edgeFaces()[edgeI];
 
-            eFaces[facei++] = face(quad);
+            face& f = eFaces[facei++];
+            f.setSize(4);
+
+            if
+            (
+                (edgeFaces[0] < edgeFaces[1])
+             == sameOrder(surfaceFaces[edgeFaces[0]], e)
+            )
+            {
+                f[0] = e[0] + currentLayerOffset;
+                f[1] = e[1] + currentLayerOffset;
+                f[2] = e[1] + nextLayerOffset;
+                f[3] = e[0] + nextLayerOffset;
+            }
+            else
+            {
+                f[0] = e[1] + currentLayerOffset;
+                f[1] = e[0] + currentLayerOffset;
+                f[2] = e[0] + nextLayerOffset;
+                f[3] = e[1] + nextLayerOffset;
+            }
         }
 
         // Faces between layer and layer+1
@@ -127,7 +145,7 @@ Foam::faceList Foam::extrudedMesh::extrudedFaces
                 eFaces[facei++] =
                     face
                     (
-                        surfaceFaces[i].reverseFace()
+                        surfaceFaces[i] //.reverseFace()
                       + nextLayerOffset
                     );
             }
@@ -141,38 +159,44 @@ Foam::faceList Foam::extrudedMesh::extrudedFaces
         label nextLayerOffset = currentLayerOffset + surfacePoints.size();
 
         // Side faces across layer
-        for (label i=nInternalEdges; i<surfaceEdges.size(); i++)
+        for (label edgeI=nInternalEdges; edgeI<surfaceEdges.size(); edgeI++)
         {
-            const edge& e = surfaceEdges[i];
-            quad[0] = e[1] + currentLayerOffset;
-            quad[1] = e[0] + currentLayerOffset;
-            quad[2] = e[0] + nextLayerOffset;
-            quad[3] = e[1] + nextLayerOffset;
+            const edge& e = surfaceEdges[edgeI];
+            const labelList& edgeFaces = extrudePatch.edgeFaces()[edgeI];
 
-            label ownerFace = extrudePatch.edgeFaces()[i][0];
+            face& f = eFaces[facei++];
+            f.setSize(4);
 
-            if (!sameOrder(surfaceFaces[ownerFace], e))
+            if (sameOrder(surfaceFaces[edgeFaces[0]], e))
             {
-                reverse(quad);
+                f[0] = e[0] + currentLayerOffset;
+                f[1] = e[1] + currentLayerOffset;
+                f[2] = e[1] + nextLayerOffset;
+                f[3] = e[0] + nextLayerOffset;
+            }
+            else
+            {
+                f[0] = e[1] + currentLayerOffset;
+                f[1] = e[0] + currentLayerOffset;
+                f[2] = e[0] + nextLayerOffset;
+                f[3] = e[1] + nextLayerOffset;
             }
-
-            eFaces[facei++] = face(quad);
         }
     }
 
-    // Top faces
+    // Bottom faces
     forAll(surfaceFaces, i)
     {
-        eFaces[facei++] = face(surfaceFaces[i]);
+        eFaces[facei++] = face(surfaceFaces[i]).reverseFace();
     }
 
-    // Bottom faces
+    // Top faces
     forAll(surfaceFaces, i)
     {
         eFaces[facei++] =
             face
             (
-                surfaceFaces[i].reverseFace()
+                surfaceFaces[i]
               + nLayers*surfacePoints.size()
             );
     }