From 38d068c4765652ebf02a0c1a02618f03bf18098c Mon Sep 17 00:00:00 2001 From: mattijs <mattijs> Date: Fri, 20 May 2011 17:00:30 +0100 Subject: [PATCH] ENH: createShellMesh: guarantee 0'th vertex ordered --- .../extrudeToRegionMesh/createShellMesh.C | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/createShellMesh.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/createShellMesh.C index e57db9f9b3b..c2bce48a7a3 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/createShellMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/createShellMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -453,6 +453,7 @@ void Foam::createShellMesh::setRefinement label region0 = pointRegions_[eFaces[0]][fp0]; label region1 = pointRegions_[eFaces[0]][fp1]; + // Pick up points with correct normal if (layerI == 0) { newF[0] = f[fp0]; @@ -468,6 +469,22 @@ void Foam::createShellMesh::setRefinement newF[3] = addedPoints[nLayers*region0+layerI]; } + // Optionally rotate so e[0] is always 0th vertex. Note that + // this normally is automatically done by coupled face ordering + // but with NOORDERING we have to do it ourselves. + if (f[fp0] != e[0]) + { + // rotate one back to get newF[1] (originating from e[0]) + // into newF[0] + label v0 = newF[0]; + for (label i = 0; i < newF.size()-1; i++) + { + newF[i] = newF[newF.fcIndex(i)]; + } + newF.last() = v0; + } + + label minCellI = addedCells[nLayers*eFaces[0]+layerI]; label maxCellI; label patchI; @@ -569,6 +586,21 @@ void Foam::createShellMesh::setRefinement newF[3] = addedPoints[nLayers*region0+layerI]; } + + // Optionally rotate so e[0] is always 0th vertex. Note that + // this normally is automatically done by coupled face + // ordering but with NOORDERING we have to do it ourselves. + if (f[fp0] != e[0]) + { + // rotate one back to get newF[1] (originating + // from e[0]) into newF[0]. + label v0 = newF[0]; + for (label i = 0; i < newF.size()-1; i++) + { + newF[i] = newF[newF.fcIndex(i)]; + } + newF.last() = v0; + } ////if (ePatches.size() == 0) //{ // Pout<< "Adding from MULTI face:" -- GitLab