diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/cellSets.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/cellSets.H index 1f66fa276e8e0e2e5340a35c64e56fe44b029c93..54887f662a2b560fdf8417bd8b8f1b33ac88cf55 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/cellSets.H +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/cellSets.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -78,6 +78,26 @@ public: hexes(nCells), polys(nCells) {} + + + // Member Functions + + void setSize(const label nCells) + { + nTets = 0; + nPyrs = 0; + nPrisms = 0; + nHexesWedges = 0; + nPolys = 0; + + tets.setSize(nCells); + pyrs.setSize(nCells); + prisms.setSize(nCells); + wedges.setSize(nCells); + hexes.setSize(nCells); + polys.setSize(nCells); + } + }; diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C index 0332572eeb0d16cdb907354ac36fd9a139063803..267b8dc84421a58f13afcfa678d86befe17ffcd9 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C @@ -47,7 +47,8 @@ License void Foam::ensightMesh::correct() { patchPartOffset_ = 2; - meshCellSets_ = mesh_.nCells(); + meshCellSets_.setSize(mesh_.nCells()); + boundaryFaceSets_.setSize(mesh_.boundary().size()); allPatchNames_.clear(); patchNames_.clear(); @@ -194,44 +195,41 @@ void Foam::ensightMesh::correct() { forAll(mesh_.boundary(), patchi) { - if (mesh_.boundary()[patchi].size()) - { - const polyPatch& p = mesh_.boundaryMesh()[patchi]; + const polyPatch& p = mesh_.boundaryMesh()[patchi]; - labelList& tris = boundaryFaceSets_[patchi].tris; - labelList& quads = boundaryFaceSets_[patchi].quads; - labelList& polys = boundaryFaceSets_[patchi].polys; + labelList& tris = boundaryFaceSets_[patchi].tris; + labelList& quads = boundaryFaceSets_[patchi].quads; + labelList& polys = boundaryFaceSets_[patchi].polys; - tris.setSize(p.size()); - quads.setSize(p.size()); - polys.setSize(p.size()); + tris.setSize(p.size()); + quads.setSize(p.size()); + polys.setSize(p.size()); - label nTris = 0; - label nQuads = 0; - label nPolys = 0; + label nTris = 0; + label nQuads = 0; + label nPolys = 0; - forAll(p, faceI) - { - const face& f = p[faceI]; + forAll(p, faceI) + { + const face& f = p[faceI]; - if (f.size() == 3) - { - tris[nTris++] = faceI; - } - else if (f.size() == 4) - { - quads[nQuads++] = faceI; - } - else - { - polys[nPolys++] = faceI; - } + if (f.size() == 3) + { + tris[nTris++] = faceI; + } + else if (f.size() == 4) + { + quads[nQuads++] = faceI; + } + else + { + polys[nPolys++] = faceI; } - - tris.setSize(nTris); - quads.setSize(nQuads); - polys.setSize(nPolys); } + + tris.setSize(nTris); + quads.setSize(nQuads); + polys.setSize(nPolys); } } @@ -242,12 +240,9 @@ void Foam::ensightMesh::correct() if (patchNames_.empty() || patchNames_.found(patchName)) { - if (mesh_.boundary()[patchi].size()) - { - nfp.nTris = boundaryFaceSets_[patchi].tris.size(); - nfp.nQuads = boundaryFaceSets_[patchi].quads.size(); - nfp.nPolys = boundaryFaceSets_[patchi].polys.size(); - } + nfp.nTris = boundaryFaceSets_[patchi].tris.size(); + nfp.nQuads = boundaryFaceSets_[patchi].quads.size(); + nfp.nPolys = boundaryFaceSets_[patchi].polys.size(); } reduce(nfp.nTris, sumOp<label>()); @@ -1148,6 +1143,7 @@ void Foam::ensightMesh::write if (nfp.nTris || nfp.nQuads || nfp.nPolys) { const polyPatch& p = mesh_.boundaryMesh()[patchi]; + const labelList& tris = boundaryFaceSets_[patchi].tris; const labelList& quads = boundaryFaceSets_[patchi].quads; const labelList& polys = boundaryFaceSets_[patchi].polys;