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