Robustness change: empty face
This commit is contained in:
parent
8166e39e54
commit
65a19e8d07
1 changed files with 19 additions and 11 deletions
|
@ -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)
|
||||
{
|
||||
label faceI = pFaces[i];
|
||||
|
||||
if (mesh.faces()[faceI] == f)
|
||||
if (faces[faceI] == f)
|
||||
{
|
||||
return faceI;
|
||||
}
|
||||
|
|
Reference in a new issue