Robustness change: empty face

This commit is contained in:
Hrvoje Jasak 2014-09-26 15:07:18 +01:00 committed by Dominik Christ
parent 8166e39e54
commit 65a19e8d07

View file

@ -33,9 +33,9 @@ Description
#undef yyFlexLexer
/* ------------------------------------------------------------------------- *\
/* ------------------------------------------------------------------------ *\
------ local definitions
\* ------------------------------------------------------------------------- */
\* ------------------------------------------------------------------------ */
#include <sstream>
// 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.
\* ------------------------------------------------------------------------- */
\* ------------------------------------------------------------------------ */
<<EOF>> {
yyterminate();
@ -270,16 +270,24 @@ elementType ^{space}"TYPE"{cspace}
#include <fstream>
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;
}