Commit 10b9467f authored by Mark Olesen's avatar Mark Olesen
Browse files

BUG: surfaceFieldValue fails writing legacy VTK format

- number of fields was not set.
- interpolated surfaces incorrectly written for all formats
parent f89de2b6
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2017-2019 OpenCFD Ltd.
Copyright (C) 2017-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -892,6 +892,16 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::read
mesh_,
dict.subDict("sampledSurfaceDict")
);
if (sampledPtr_->interpolate())
{
// Should probably ignore interpolate entirely,
// but the oldest isoSurface algorithm requires it!
WarningInFunction
<< type() << ' ' << name() << ": "
<< "sampledSurface with interpolate = true "
<< "is likely incorrect" << nl << nl;
}
}
Info<< type() << " " << name() << ":" << nl
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2019 OpenCFD Ltd.
Copyright (C) 2015-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -388,6 +388,15 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::writeValues
false // serial - already merged
);
// Point data? Should probably disallow
if (sampledPtr_)
{
surfaceWriterPtr_->isPointData() =
sampledPtr_->interpolate();
}
surfaceWriterPtr_->nFields() = 1; // Needed for VTK legacy
surfaceWriterPtr_->write(fieldName, allValues);
surfaceWriterPtr_->clear();
......
Markdown is supported
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