Commit 1c646e21 authored by graham's avatar graham
Browse files

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

parent b1c7bcee
......@@ -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();
}
}
......
......@@ -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);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment