Added surface area report

This commit is contained in:
Hrvoje Jasak 2012-12-12 19:04:25 +00:00
parent 503997a5db
commit f0f8e973ec

View file

@ -68,7 +68,7 @@ bool validTri(const bool verbose, const triSurface& surf, const label faceI)
return false;
}
// duplicate triangle check
// Duplicate triangle check
const labelList& fFaces = surf.faceFaces()[faceI];
@ -187,6 +187,7 @@ int main(int argc, char *argv[])
// ~~~~
triSurface surf(surfFileName);
const pointField& surfPoints = surf.points();
Pout<< "Statistics:" << endl;
@ -199,6 +200,7 @@ int main(int argc, char *argv[])
{
labelList regionSize(surf.patches().size(), 0);
scalarField regionSumArea(surf.patches().size(), 0);
forAll(surf, faceI)
{
@ -208,22 +210,24 @@ int main(int argc, char *argv[])
{
WarningIn(args.executable())
<< "Triangle " << faceI << " vertices " << surf[faceI]
<< " has region " << region << " which is outside the range"
<< " of regions 0.." << surf.patches().size()-1
<< " has region " << region
<< " which is outside the range"
<< " of regions 0.." << surf.patches().size() - 1
<< endl;
}
else
{
regionSize[region]++;
regionSumArea[region] += surf[faceI].mag(surfPoints);
}
}
Pout<< "Region\tSize" << nl
<< "------\t----" << nl;
Pout<< "Region\tSize\tArea" << nl
<< "------\t----\t----" << nl;
forAll(surf.patches(), patchI)
{
Pout<< surf.patches()[patchI].name() << '\t'
<< regionSize[patchI] << nl;
Pout<< surf.patches()[patchI].name() << tab
<< regionSize[patchI] << tab << regionSumArea[patchI] << nl;
}
Pout<< nl << endl;
}