BUG: foamToEnsight: handle empty patches

This commit is contained in:
mattijs 2014-02-20 13:39:56 +00:00 committed by Andrew Heather
parent ee2e7e87d3
commit 59cef386cd

View File

@ -194,6 +194,8 @@ void Foam::ensightMesh::correct()
if (!noPatches_) if (!noPatches_)
{ {
forAll(mesh_.boundary(), patchi) forAll(mesh_.boundary(), patchi)
{
if (mesh_.boundary()[patchi].size())
{ {
const polyPatch& p = mesh_.boundaryMesh()[patchi]; const polyPatch& p = mesh_.boundaryMesh()[patchi];
@ -232,6 +234,7 @@ void Foam::ensightMesh::correct()
polys.setSize(nPolys); polys.setSize(nPolys);
} }
} }
}
forAll(allPatchNames_, patchi) forAll(allPatchNames_, patchi)
{ {
@ -239,11 +242,14 @@ void Foam::ensightMesh::correct()
nFacePrimitives nfp; nFacePrimitives nfp;
if (patchNames_.empty() || patchNames_.found(patchName)) if (patchNames_.empty() || patchNames_.found(patchName))
{
if (mesh_.boundary()[patchi].size())
{ {
nfp.nTris = boundaryFaceSets_[patchi].tris.size(); nfp.nTris = boundaryFaceSets_[patchi].tris.size();
nfp.nQuads = boundaryFaceSets_[patchi].quads.size(); nfp.nQuads = boundaryFaceSets_[patchi].quads.size();
nfp.nPolys = boundaryFaceSets_[patchi].polys.size(); nfp.nPolys = boundaryFaceSets_[patchi].polys.size();
} }
}
reduce(nfp.nTris, sumOp<label>()); reduce(nfp.nTris, sumOp<label>());
reduce(nfp.nQuads, sumOp<label>()); reduce(nfp.nQuads, sumOp<label>());