BUG: correct the EnSight point value patch conversion (#2010)

- patch point ordering was affected by the EnSight face sorting
  (tri, quad, nsided). This did not affect other point fields,
  since they use the internal field values.
This commit is contained in:
Mark Olesen
2021-03-10 18:58:15 +01:00
parent 9dc70ab856
commit 273741c052

View File

@ -224,14 +224,14 @@ bool Foam::ensightOutput::writePointField
os.beginPart(part.index()); os.beginPart(part.index());
} }
labelList uniqueMeshPointLabels; labelList uniquePointLabels;
part.uniqueMeshPoints(mesh, uniqueMeshPointLabels, parallel); part.uniqueMeshPoints(mesh, uniquePointLabels, parallel);
ensightOutput::Detail::writeFieldComponents ensightOutput::Detail::writeFieldComponents
( (
os, os,
ensightFile::coordinates, ensightFile::coordinates,
UIndirectList<Type>(pf.internalField(), uniqueMeshPointLabels), UIndirectList<Type>(pf.internalField(), uniquePointLabels),
parallel parallel
); );
} }
@ -249,30 +249,42 @@ bool Foam::ensightOutput::writePointField
os.beginPart(part.index()); os.beginPart(part.index());
} }
labelList uniquePointLabels;
part.uniqueMeshPoints(mesh, uniquePointLabels, parallel);
const auto& bfld = pf.boundaryField()[patchId]; const auto& bfld = pf.boundaryField()[patchId];
// Only valuePointPatchField is actually derived from Field // Only valuePointPatchField is actually derived from Field
const auto* vpp = isA<Field<Type>>(bfld); const auto* vpp = isA<Field<Type>>(bfld);
if (vpp) if (vpp)
{ {
ensightOutput::Detail::writeFieldComponents // Require patch local indices, not mesh point labels.
( // But need to use polyPatch meshPointMap() to recover the
os, // local indices since the ensight output will have jumbled
ensightFile::coordinates, // the face output order
*vpp,
parallel const polyPatch& pp = mesh.boundaryMesh()[patchId];
);
} for (label& pointi : uniquePointLabels)
else
{ {
labelList uniqueMeshPointLabels; pointi = pp.meshPointMap()[pointi];
part.uniqueMeshPoints(mesh, uniqueMeshPointLabels, parallel); }
ensightOutput::Detail::writeFieldComponents ensightOutput::Detail::writeFieldComponents
( (
os, os,
ensightFile::coordinates, ensightFile::coordinates,
UIndirectList<Type>(pf.internalField(), uniqueMeshPointLabels), UIndirectList<Type>(*vpp, uniquePointLabels),
parallel
);
}
else
{
ensightOutput::Detail::writeFieldComponents
(
os,
ensightFile::coordinates,
UIndirectList<Type>(pf.internalField(), uniquePointLabels),
parallel parallel
); );
} }
@ -294,14 +306,14 @@ bool Foam::ensightOutput::writePointField
// uses internalField only // uses internalField only
{ {
labelList uniqueMeshPointLabels; labelList uniquePointLabels;
part.uniqueMeshPoints(mesh, uniqueMeshPointLabels, parallel); part.uniqueMeshPoints(mesh, uniquePointLabels, parallel);
ensightOutput::Detail::writeFieldComponents ensightOutput::Detail::writeFieldComponents
( (
os, os,
ensightFile::coordinates, ensightFile::coordinates,
UIndirectList<Type>(pf.internalField(), uniqueMeshPointLabels), UIndirectList<Type>(pf.internalField(), uniquePointLabels),
parallel parallel
); );
} }