isoSurfaceCellTemplates: Skip undefined tets

Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=1506
This commit is contained in:
Henry
2015-02-04 23:06:31 +00:00
parent ebc88a4680
commit ec922fb419

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -117,7 +117,7 @@ void Foam::isoSurfaceCell::generateTriPoints
triIndex |= 8; triIndex |= 8;
} }
/* Form the vertices of the triangles for each case */ // Form the vertices of the triangles for each case
switch (triIndex) switch (triIndex)
{ {
case 0x00: case 0x00:
@ -303,6 +303,7 @@ void Foam::isoSurfaceCell::generateTriPoints
) const ) const
{ {
tetMatcher tet; tetMatcher tet;
label countNotFoundTets = 0;
forAll(mesh_.cells(), cellI) forAll(mesh_.cells(), cellI)
{ {
@ -395,16 +396,22 @@ void Foam::isoSurfaceCell::generateTriPoints
} }
else else
{ {
const cell& cFaces = mesh_.cells()[cellI];
forAll(cFaces, cFaceI) forAll(cFaces, cFaceI)
{ {
label faceI = cFaces[cFaceI]; label faceI = cFaces[cFaceI];
const face& f = mesh_.faces()[faceI]; const face& f = mesh_.faces()[faceI];
const label fp0 = mesh_.tetBasePtIs()[faceI]; label fp0 = mesh_.tetBasePtIs()[faceI];
// Skip undefined tets
if (fp0 < 0)
{
fp0 = 0;
countNotFoundTets++;
}
label fp = f.fcIndex(fp0); label fp = f.fcIndex(fp0);
for (label i = 2; i < f.size(); i++) for (label i = 2; i < f.size(); i++)
{ {
label nextFp = f.fcIndex(fp); label nextFp = f.fcIndex(fp);
@ -486,6 +493,14 @@ void Foam::isoSurfaceCell::generateTriPoints
} }
} }
if (countNotFoundTets > 0)
{
WarningIn("Foam::isoSurfaceCell::generateTriPoints")
<< "Could not find " << countNotFoundTets
<< " tet base points, which may lead to inverted triangles."
<< endl;
}
triPoints.shrink(); triPoints.shrink();
triMeshCells.shrink(); triMeshCells.shrink();
} }