Skip to content
Snippets Groups Projects
Commit 8712b827 authored by mattijs's avatar mattijs
Browse files

BUG: foamToEnsight: reset facePrimitives

parent 71c0a5d1
Branches
Tags
No related merge requests found
...@@ -2,7 +2,7 @@ ...@@ -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: ...@@ -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);
}
}; };
......
...@@ -47,7 +47,8 @@ License ...@@ -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() ...@@ -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];
{
const polyPatch& p = mesh_.boundaryMesh()[patchi];
labelList& tris = boundaryFaceSets_[patchi].tris; labelList& tris = boundaryFaceSets_[patchi].tris;
labelList& quads = boundaryFaceSets_[patchi].quads; labelList& quads = boundaryFaceSets_[patchi].quads;
labelList& polys = boundaryFaceSets_[patchi].polys; labelList& polys = boundaryFaceSets_[patchi].polys;
tris.setSize(p.size()); tris.setSize(p.size());
quads.setSize(p.size()); quads.setSize(p.size());
polys.setSize(p.size()); polys.setSize(p.size());
label nTris = 0; label nTris = 0;
label nQuads = 0; label nQuads = 0;
label nPolys = 0; label nPolys = 0;
forAll(p, faceI) forAll(p, faceI)
{ {
const face& f = p[faceI]; const face& f = p[faceI];
if (f.size() == 3) if (f.size() == 3)
{ {
tris[nTris++] = faceI; tris[nTris++] = faceI;
} }
else if (f.size() == 4) else if (f.size() == 4)
{ {
quads[nQuads++] = faceI; quads[nQuads++] = faceI;
} }
else else
{ {
polys[nPolys++] = faceI; 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() ...@@ -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 ...@@ -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;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment