ENH: Using triangle quality without checking - check is now in triangle class.

This commit is contained in:
graham 2011-01-19 19:39:27 +00:00
parent b1c7bcee4e
commit 1c646e2143
2 changed files with 13 additions and 25 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -315,32 +315,12 @@ int main(int argc, char *argv[])
}
else
{
triPointRef tri
triQ[faceI] = triPointRef
(
surf.points()[f[0]],
surf.points()[f[1]],
surf.points()[f[2]]
);
vector ba(tri.b() - tri.a());
ba /= mag(ba) + VSMALL;
vector ca(tri.c() - tri.a());
ca /= mag(ca) + VSMALL;
if (mag(ba&ca) > 1-1E-3)
{
triQ[faceI] = SMALL;
}
else
{
triQ[faceI] = triPointRef
(
surf.points()[f[0]],
surf.points()[f[1]],
surf.points()[f[2]]
).quality();
}
).quality();
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -160,7 +160,15 @@ inline Foam::scalar Foam::triangle<Point, PointRef>::circumRadius() const
template<class Point, class PointRef>
inline Foam::scalar Foam::triangle<Point, PointRef>::quality() const
{
return mag()/(Foam::sqr(circumRadius())*3.0*sqrt(3.0)/4.0 + VSMALL);
scalar c = circumRadius();
if (c < ROOTVSMALL)
{
// zero circumRadius, something has gone wrong.
return SMALL;
}
return mag()/(Foam::sqr(c)*3.0*sqrt(3.0)/4.0);
}