Skip to content
Snippets Groups Projects
Commit 125e60ca authored by Mark OLESEN's avatar Mark OLESEN
Browse files

BUG: pointPatch value ignored in vtk, ensight conversion (fixes #2010

- pointPatches may or may not have a "value" type.
  Use the patch value field where possible and the internal field
  otherwise. Previously always used the internal field.
parent 1bb7afc7
Branches
Tags
No related merge requests found
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2020 OpenCFD Ltd.
Copyright (C) 2016-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -219,14 +219,14 @@ bool Foam::ensightOutput::writePointField
{
const ensightCells& part = cellZoneParts[zoneId];
labelList uniqueMeshPointLabels;
part.uniqueMeshPoints(mesh, uniqueMeshPointLabels, parallel);
if (Pstream::master())
{
os.beginPart(part.index());
}
labelList uniqueMeshPointLabels;
part.uniqueMeshPoints(mesh, uniqueMeshPointLabels, parallel);
ensightOutput::Detail::writeFieldComponents
(
os,
......@@ -244,21 +244,38 @@ bool Foam::ensightOutput::writePointField
{
const ensightFaces& part = boundaryParts[patchId];
labelList uniqueMeshPointLabels;
part.uniqueMeshPoints(mesh, uniqueMeshPointLabels, parallel);
if (Pstream::master())
{
os.beginPart(part.index());
}
ensightOutput::Detail::writeFieldComponents
(
os,
ensightFile::coordinates,
UIndirectList<Type>(pf.internalField(), uniqueMeshPointLabels),
parallel
);
const auto& bfld = pf.boundaryField()[patchId];
// Only valuePointPatchField is actually derived from Field
const auto* vpp = isA<Field<Type>>(bfld);
if (vpp)
{
ensightOutput::Detail::writeFieldComponents
(
os,
ensightFile::coordinates,
*vpp,
parallel
);
}
else
{
labelList uniqueMeshPointLabels;
part.uniqueMeshPoints(mesh, uniqueMeshPointLabels, parallel);
ensightOutput::Detail::writeFieldComponents
(
os,
ensightFile::coordinates,
UIndirectList<Type>(pf.internalField(), uniqueMeshPointLabels),
parallel
);
}
}
//
......@@ -268,21 +285,26 @@ bool Foam::ensightOutput::writePointField
{
const ensightFaces& part = faceZoneParts[zoneId];
labelList uniqueMeshPointLabels;
part.uniqueMeshPoints(mesh, uniqueMeshPointLabels, parallel);
if (Pstream::master())
{
os.beginPart(part.index());
}
ensightOutput::Detail::writeFieldComponents
(
os,
ensightFile::coordinates,
UIndirectList<Type>(pf.internalField(), uniqueMeshPointLabels),
parallel
);
// CAVEAT - does not properly handle valuePointPatchField,
// uses internalField only
{
labelList uniqueMeshPointLabels;
part.uniqueMeshPoints(mesh, uniqueMeshPointLabels, parallel);
ensightOutput::Detail::writeFieldComponents
(
os,
ensightFile::coordinates,
UIndirectList<Type>(pf.internalField(), uniqueMeshPointLabels),
parallel
);
}
}
return true;
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2020 OpenCFD Ltd.
Copyright (C) 2016-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -82,7 +82,16 @@ void Foam::vtk::patchWriter::write
{
const auto& pfld = field.boundaryField()[patchId];
vtk::writeList(format(), pfld.patchInternalField()());
// Only valuePointPatchField is actually derived from Field
const auto* vpp = isA<Field<Type>>(pfld);
if (vpp)
{
vtk::writeList(format(), *vpp);
}
else
{
vtk::writeList(format(), pfld.patchInternalField()());
}
}
}
......@@ -122,7 +131,16 @@ void Foam::vtk::patchWriter::write
{
const auto& pfld = field.boundaryField()[patchId];
toMaster << pfld.patchInternalField()();
// Only valuePointPatchField is actually derived from Field
const auto* vpp = isA<Field<Type>>(pfld);
if (vpp)
{
toMaster << *vpp;
}
else
{
toMaster << pfld.patchInternalField();
}
}
}
}
......
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