From 1526db114b94317d7b9a18d42fc162fe32db2673 Mon Sep 17 00:00:00 2001 From: mattijs <mattijs> Date: Fri, 15 Oct 2010 15:26:25 +0100 Subject: [PATCH] BUG: foamToEnsight : wedge and hex numbering inconsistent between mesh and fields --- .../dataConversion/foamToEnsight/cellSets.H | 2 -- .../foamToEnsight/ensightField.C | 31 +++++++++++++++++-- .../foamToEnsight/ensightMesh.C | 7 +---- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/cellSets.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/cellSets.H index 86eaa03d887..ff358d78874 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/cellSets.H +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/cellSets.H @@ -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) {} }; diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C index 8a79f54d969..7ffa7a4ca56 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C @@ -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 ); diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C index cff09a395d6..77fb706d567 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C @@ -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; -- GitLab