Added check for faces with insufficient points

This commit is contained in:
Hrvoje Jasak 2013-12-16 14:29:51 +00:00
parent 52f4078d64
commit ba3d7f689b

View file

@ -479,6 +479,12 @@ Foam::point Foam::face::centre(const pointField& meshPoints) const
{ {
// Calculate the centre by breaking the face into triangles and // Calculate the centre by breaking the face into triangles and
// area-weighted averaging their centres // area-weighted averaging their centres
if (size() < 3)
{
FatalErrorIn("point face::centre(const pointField& meshPoints) const")
<< "Face with fewer than 3 points detected: " << *this
<< abort(FatalError);
}
// If the face is a triangle, do a direct calculation // If the face is a triangle, do a direct calculation
if (size() == 3) if (size() == 3)