From de200baf7d94418a210a6a766695e0276984139c Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 22 Jun 2011 14:30:03 +0100 Subject: [PATCH] BUG: orientedSurface: multiple parts of surfaces not visited --- .../orientedSurface/orientedSurface.C | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/src/meshTools/triSurface/orientedSurface/orientedSurface.C b/src/meshTools/triSurface/orientedSurface/orientedSurface.C index 9cc473f3a3..7026f01ec1 100644 --- a/src/meshTools/triSurface/orientedSurface/orientedSurface.C +++ b/src/meshTools/triSurface/orientedSurface/orientedSurface.C @@ -102,7 +102,7 @@ Foam::labelList Foam::orientedSurface::edgeToFace { if (flip[face1] == UNVISITED) { - FatalErrorIn("orientedSurface::edgeToFace") << "Problem" + FatalErrorIn("orientedSurface::edgeToFace(..)") << "Problem" << abort(FatalError); } else @@ -283,8 +283,10 @@ bool Foam::orientedSurface::flipSurface } } // Recalculate normals - s.clearOut(); - + if (hasFlipped) + { + s.clearOut(); + } return hasFlipped; } @@ -352,8 +354,28 @@ bool Foam::orientedSurface::orient // FLIP: need to flip labelList flipState(s.size(), UNVISITED); - flipState[0] = NOFLIP; - walkSurface(s, 0, flipState); + label faceI = 0; + while (true) + { + label startFaceI = -1; + while (faceI < s.size()) + { + if (flipState[faceI] == UNVISITED) + { + startFaceI = faceI; + break; + } + faceI++; + } + + if (startFaceI == -1) + { + break; + } + + flipState[startFaceI] = NOFLIP; + walkSurface(s, startFaceI, flipState); + } anyFlipped = flipSurface(s, flipState); }