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();
@ -193,8 +194,6 @@ 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];
@ -233,7 +232,6 @@ void Foam::ensightMesh::correct()
polys.setSize(nPolys); polys.setSize(nPolys);
} }
} }
}
forAll(allPatchNames_, patchi) forAll(allPatchNames_, patchi)
{ {
@ -241,14 +239,11 @@ 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>());
@ -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;