mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: foamToEnsight faceZones are mangled (issue #334)
- was using the ids coming from the zones instead of the sorted order from ensightFaces, which led to a clash in the mesh point maps that were manifest as a jumbled order. BUG: missing newlines in foamToEnsight nfaced/nsided ASCII output - was correct for foamToEnsightParts, but not for foamToEnsight -- * Many thanks to Justin Graupman for all of his testing, which has been a great help in isolating and fixing various issues.
This commit is contained in:
@ -342,7 +342,7 @@ void Foam::ensightMesh::write(ensightGeoFile& os) const
|
||||
(
|
||||
pp.meshPoints(),
|
||||
pp.meshPointMap(),
|
||||
pointToGlobal, // local patch point to unique global index
|
||||
pointToGlobal, // local point to unique global index
|
||||
uniqueMeshPointLabels // unique global points
|
||||
);
|
||||
|
||||
@ -376,43 +376,43 @@ void Foam::ensightMesh::write(ensightGeoFile& os) const
|
||||
const word& zoneName = zoneNames[zonei];
|
||||
const ensightFaces& ensFaces = faceZoneFaces_[zoneName];
|
||||
|
||||
label zoneId = mesh_.faceZones().findZoneID(zoneName);
|
||||
const faceZone& fz = mesh_.faceZones()[zoneId];
|
||||
// Use the properly sorted faceIds (ensightFaces) and do NOT use the
|
||||
// faceZone directly, otherwise the point-maps will not correspond.
|
||||
// - perform face-flipping later
|
||||
|
||||
// Renumber the faceZone points/faces into unique points
|
||||
indirectPrimitivePatch pp
|
||||
(
|
||||
IndirectList<face>(mesh_.faces(), ensFaces.faceIds()),
|
||||
mesh_.points()
|
||||
);
|
||||
|
||||
// Renumber the points/faces into unique points
|
||||
labelList pointToGlobal;
|
||||
labelList uniqueMeshPointLabels;
|
||||
autoPtr<globalIndex> globalPointsPtr =
|
||||
mesh_.globalData().mergePoints
|
||||
(
|
||||
fz().meshPoints(),
|
||||
fz().meshPointMap(),
|
||||
pointToGlobal,
|
||||
uniqueMeshPointLabels
|
||||
pp.meshPoints(),
|
||||
pp.meshPointMap(),
|
||||
pointToGlobal, // local point to unique global index
|
||||
uniqueMeshPointLabels // unique global points
|
||||
);
|
||||
|
||||
// Make a copy in the proper order
|
||||
primitiveFacePatch pp
|
||||
(
|
||||
faceList(mesh_.faces(), ensFaces.faceIds()),
|
||||
mesh_.points()
|
||||
);
|
||||
|
||||
// Renumber the faces belonging to the faceZone,
|
||||
// from local numbering to unique global index.
|
||||
// Also a good place to perform face flipping
|
||||
const boolList& flip = ensFaces.flipMap();
|
||||
forAll(pp, facei)
|
||||
faceList patchFaces(pp.localFaces());
|
||||
forAll(patchFaces, facei)
|
||||
{
|
||||
face& f = patchFaces[facei];
|
||||
|
||||
if (flip[facei])
|
||||
{
|
||||
pp[facei].flip();
|
||||
f.flip();
|
||||
}
|
||||
}
|
||||
|
||||
// Renumber the faces belonging to the faceZone,
|
||||
// from local numbering to unique global index
|
||||
faceList patchFaces(pp.localFaces());
|
||||
forAll(patchFaces, i)
|
||||
{
|
||||
inplaceRenumber(pointToGlobal, patchFaces[i]);
|
||||
inplaceRenumber(pointToGlobal, f);
|
||||
}
|
||||
|
||||
writeAllPoints
|
||||
|
||||
@ -121,6 +121,7 @@ void Foam::ensightMesh::writeFaceSizes
|
||||
const face& f = faceLst[i];
|
||||
|
||||
os.write(f.size());
|
||||
os.newline();
|
||||
}
|
||||
}
|
||||
|
||||
@ -136,6 +137,7 @@ void Foam::ensightMesh::writeFaceSizes
|
||||
const face& f = faceLst[i];
|
||||
|
||||
os.write(f.size());
|
||||
os.newline();
|
||||
}
|
||||
}
|
||||
|
||||
@ -173,10 +175,13 @@ void Foam::ensightMesh::writePolysNFaces
|
||||
ensightGeoFile& os
|
||||
) const
|
||||
{
|
||||
// write the number of faces per element (1/line in ASCII)
|
||||
forAll(addr, i)
|
||||
{
|
||||
const labelList& cf = cellFaces[addr[i]];
|
||||
const labelUList& cf = cellFaces[addr[i]];
|
||||
|
||||
os.write(cf.size());
|
||||
os.newline();
|
||||
}
|
||||
}
|
||||
|
||||
@ -189,13 +194,15 @@ void Foam::ensightMesh::writePolysNPointsPerFace
|
||||
ensightGeoFile& os
|
||||
) const
|
||||
{
|
||||
// write the number of points per element face (1/line in ASCII)
|
||||
forAll(addr, i)
|
||||
{
|
||||
const labelList& cf = cellFaces[addr[i]];
|
||||
const labelUList& cf = cellFaces[addr[i]];
|
||||
|
||||
forAll(cf, faceI)
|
||||
forAll(cf, facei)
|
||||
{
|
||||
os.write(faces[cf[faceI]].size());
|
||||
os.write(faces[cf[facei]].size());
|
||||
os.newline();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -213,11 +220,11 @@ void Foam::ensightMesh::writePolysPoints
|
||||
forAll(addr, i)
|
||||
{
|
||||
const label cellId = addr[i];
|
||||
const labelList& cf = cellFaces[cellId];
|
||||
const labelUList& cf = cellFaces[cellId];
|
||||
|
||||
forAll(cf, faceI)
|
||||
forAll(cf, facei)
|
||||
{
|
||||
const label faceId = cf[faceI];
|
||||
const label faceId = cf[facei];
|
||||
const face& f = faces[faceId]; // face points (in global points)
|
||||
|
||||
if (faceId < faceOwner.size() && faceOwner[faceId] != cellId)
|
||||
|
||||
Reference in New Issue
Block a user