diff --git a/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L b/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L index 514b8383a..980d39da9 100644 --- a/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L +++ b/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L @@ -33,9 +33,9 @@ Description #undef yyFlexLexer - /* ------------------------------------------------------------------------- *\ + /* ------------------------------------------------------------------------ *\ ------ local definitions - \* ------------------------------------------------------------------------- */ + \* ------------------------------------------------------------------------ */ #include // For EOF only @@ -124,9 +124,9 @@ elementType ^{space}"TYPE"{cspace} %} - /* ------------------------------------------------------------------------- *\ + /* ------------------------------------------------------------------------ *\ ------ Start Lexing ------ - \* ------------------------------------------------------------------------- */ + \* ------------------------------------------------------------------------ */ {node}{label}{cspace}{x}{cspace}{y}{cspace}{z}{space}\n { IStringStream nodeStream(YYText()); @@ -249,16 +249,16 @@ elementType ^{space}"TYPE"{cspace} - /* ------------------------------------------------------------------------- *\ + /* ------------------------------------------------------------------------ *\ ------ Ignore remaining space and \n s. Any other characters are errors. - \* ------------------------------------------------------------------------- */ + \* ------------------------------------------------------------------------ */ .|\n {} - /* ------------------------------------------------------------------------- *\ + /* ------------------------------------------------------------------------ *\ ------ On EOF return to previous file, if none exists terminate. - \* ------------------------------------------------------------------------- */ + \* ------------------------------------------------------------------------ */ <> { yyterminate(); @@ -270,16 +270,24 @@ elementType ^{space}"TYPE"{cspace} #include using std::ifstream; - label findFace(const polyMesh& mesh, const face& f) { + if (f.empty()) + { + FatalErrorIn("findFace(const polyMesh&, const face&)") + << "Empty face found: " << f + << exit(FatalError); + } + + const faceList& faces = mesh.faces(); + const labelList& pFaces = mesh.pointFaces()[f[0]]; - forAll(pFaces, i) + forAll (pFaces, i) { label faceI = pFaces[i]; - if (mesh.faces()[faceI] == f) + if (faces[faceI] == f) { return faceI; }