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

BUG: noise did not set num of output fields (VTK legacy) [fixes #2133]

ENH: less cryptic error message in surfaceWriters::vtkWriter

- fall back to nFields=1 and report the problem.
parent 3825c4ee
Branches
Tags
No related merge requests found
......@@ -304,6 +304,7 @@ scalar surfaceNoise::writeSurfaceData
false // serial - already merged
);
writerPtr_->nFields(1); // Legacy VTK
writerPtr_->write(title, allData);
writerPtr_->endTime();
......@@ -341,6 +342,7 @@ scalar surfaceNoise::writeSurfaceData
false // serial - already merged
);
writerPtr_->nFields(1); // Legacy VTK
writerPtr_->write(title, data);
writerPtr_->endTime();
......
......@@ -289,6 +289,22 @@ Foam::fileName Foam::surfaceWriters::vtkWriter::writeTemplate
if (Pstream::master() || !parallel_)
{
if (!nFields_ && writer_->legacy())
{
// Emit error message, but attempt to recover anyhow
nFields_ = 1;
FatalErrorInFunction
<< "Using VTK legacy format, but did not define nFields!"
<< nl
<< "Assuming nFields=1 (may be incorrect) and continuing..."
<< nl
<< " Field " << fieldName << " to " << outputFile << nl;
Info<< FatalError;
Info<< endl;
}
if (this->isPointData())
{
writer_->beginPointData(nFields_);
......
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