ENH: symmetryPolyPatch: handle zero faces case

This commit is contained in:
mattijs
2013-12-17 10:53:19 +00:00
parent c2f8fca557
commit 39a8a088c0

View File

@ -113,6 +113,14 @@ const Foam::vector& Foam::symmetryPlanePolyPatch::n() const
// If the symmetry normal is not set calculate it
// as the average face-normal
if (magSqr(n_) < 0.5)
{
if (returnReduce(size(), sumOp<label>()) == 0)
{
// No faces in patch. Avoid gAverage complaining and set
// normal to nonsense value to catch any use
n_ = vector::rootMax;
}
else
{
const vectorField& nf(faceNormals());
n_ = gAverage(nf);
@ -128,6 +136,7 @@ const Foam::vector& Foam::symmetryPlanePolyPatch::n() const
}
}
}
}
return n_;
}