BUG: foamToEnsight : wedge and hex numbering inconsistent between mesh and fields

This commit is contained in:
mattijs
2010-10-15 15:26:25 +01:00
parent a48897c558
commit 1526db114b
3 changed files with 30 additions and 10 deletions

View File

@ -57,7 +57,6 @@ public:
labelList prisms;
labelList wedges;
labelList hexes;
labelList hexesWedges;
labelList polys;
@ -77,7 +76,6 @@ public:
prisms(nCells),
wedges(nCells),
hexes(nCells),
hexesWedges(nCells),
polys(nCells)
{}
};

View File

@ -38,6 +38,32 @@ using namespace Foam;
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
template<class Type>
Field<Type> map
(
const Field<Type>& vf,
const labelList& map1,
const labelList& map2
)
{
Field<Type> mf(map1.size() + map2.size());
forAll(map1, i)
{
mf[i] = vf[map1[i]];
}
label offset = map1.size();
forAll(map2, i)
{
mf[i + offset] = vf[map2[i]];
}
return mf;
}
template<class Type>
void writeField
(
@ -274,7 +300,8 @@ void ensightField
const labelList& tets = meshCellSets.tets;
const labelList& pyrs = meshCellSets.pyrs;
const labelList& prisms = meshCellSets.prisms;
const labelList& hexesWedges = meshCellSets.hexesWedges;
const labelList& wedges = meshCellSets.wedges;
const labelList& hexes = meshCellSets.hexes;
const labelList& polys = meshCellSets.polys;
ensightStream* ensightFilePtr = NULL;
@ -328,7 +355,7 @@ void ensightField
writeField
(
"hexa8",
Field<Type>(vf, hexesWedges),
map(vf, hexes, wedges),
ensightFile
);

View File

@ -117,7 +117,6 @@ void Foam::ensightMesh::correct()
labelList& prisms = meshCellSets_.prisms;
labelList& wedges = meshCellSets_.wedges;
labelList& hexes = meshCellSets_.hexes;
labelList& hexesWedges = meshCellSets_.hexesWedges;
labelList& polys = meshCellSets_.polys;
label nTets = 0;
@ -125,7 +124,6 @@ void Foam::ensightMesh::correct()
label nPrisms = 0;
label nWedges = 0;
label nHexes = 0;
label nHexesWedges = 0;
label nPolys = 0;
forAll(cellShapes, cellI)
@ -148,12 +146,10 @@ void Foam::ensightMesh::correct()
else if (cellModel == wedge)
{
wedges[nWedges++] = cellI;
hexesWedges[nHexesWedges++] = cellI;
}
else if (cellModel == hex)
{
hexes[nHexes++] = cellI;
hexesWedges[nHexesWedges++] = cellI;
}
else
{
@ -166,7 +162,6 @@ void Foam::ensightMesh::correct()
prisms.setSize(nPrisms);
wedges.setSize(nWedges);
hexes.setSize(nHexes);
hexesWedges.setSize(nHexesWedges);
polys.setSize(nPolys);
meshCellSets_.nTets = nTets;
@ -178,7 +173,7 @@ void Foam::ensightMesh::correct()
meshCellSets_.nPrisms = nPrisms;
reduce(meshCellSets_.nPrisms, sumOp<label>());
meshCellSets_.nHexesWedges = nHexesWedges;
meshCellSets_.nHexesWedges = nWedges+nHexes;
reduce(meshCellSets_.nHexesWedges, sumOp<label>());
meshCellSets_.nPolys = nPolys;