BUG: foamToEnsight: reset facePrimitives

This commit is contained in:
mattijs
2013-10-18 16:19:33 +01:00
parent 71c0a5d1d7
commit 8712b8276e
2 changed files with 57 additions and 41 deletions

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 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -78,6 +78,26 @@ public:
hexes(nCells), hexes(nCells),
polys(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);
}
}; };

View File

@ -47,7 +47,8 @@ License
void Foam::ensightMesh::correct() void Foam::ensightMesh::correct()
{ {
patchPartOffset_ = 2; patchPartOffset_ = 2;
meshCellSets_ = mesh_.nCells(); meshCellSets_.setSize(mesh_.nCells());
boundaryFaceSets_.setSize(mesh_.boundary().size()); boundaryFaceSets_.setSize(mesh_.boundary().size());
allPatchNames_.clear(); allPatchNames_.clear();
patchNames_.clear(); patchNames_.clear();
@ -194,44 +195,41 @@ void Foam::ensightMesh::correct()
{ {
forAll(mesh_.boundary(), patchi) forAll(mesh_.boundary(), patchi)
{ {
if (mesh_.boundary()[patchi].size()) const polyPatch& p = mesh_.boundaryMesh()[patchi];
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());
label nTris = 0;
label nQuads = 0;
label nPolys = 0;
forAll(p, faceI)
{ {
const polyPatch& p = mesh_.boundaryMesh()[patchi]; const face& f = p[faceI];
labelList& tris = boundaryFaceSets_[patchi].tris; if (f.size() == 3)
labelList& quads = boundaryFaceSets_[patchi].quads;
labelList& polys = boundaryFaceSets_[patchi].polys;
tris.setSize(p.size());
quads.setSize(p.size());
polys.setSize(p.size());
label nTris = 0;
label nQuads = 0;
label nPolys = 0;
forAll(p, faceI)
{ {
const face& f = p[faceI]; tris[nTris++] = faceI;
}
if (f.size() == 3) else if (f.size() == 4)
{ {
tris[nTris++] = faceI; quads[nQuads++] = faceI;
} }
else if (f.size() == 4) else
{ {
quads[nQuads++] = faceI; polys[nPolys++] = 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 (patchNames_.empty() || patchNames_.found(patchName))
{ {
if (mesh_.boundary()[patchi].size()) nfp.nTris = boundaryFaceSets_[patchi].tris.size();
{ nfp.nQuads = boundaryFaceSets_[patchi].quads.size();
nfp.nTris = boundaryFaceSets_[patchi].tris.size(); nfp.nPolys = boundaryFaceSets_[patchi].polys.size();
nfp.nQuads = boundaryFaceSets_[patchi].quads.size();
nfp.nPolys = boundaryFaceSets_[patchi].polys.size();
}
} }
reduce(nfp.nTris, sumOp<label>()); reduce(nfp.nTris, sumOp<label>());
@ -1148,6 +1143,7 @@ void Foam::ensightMesh::write
if (nfp.nTris || nfp.nQuads || nfp.nPolys) if (nfp.nTris || nfp.nQuads || nfp.nPolys)
{ {
const polyPatch& p = mesh_.boundaryMesh()[patchi]; const polyPatch& p = mesh_.boundaryMesh()[patchi];
const labelList& tris = boundaryFaceSets_[patchi].tris; const labelList& tris = boundaryFaceSets_[patchi].tris;
const labelList& quads = boundaryFaceSets_[patchi].quads; const labelList& quads = boundaryFaceSets_[patchi].quads;
const labelList& polys = boundaryFaceSets_[patchi].polys; const labelList& polys = boundaryFaceSets_[patchi].polys;