ENH: use double for VTK legacy output (issue #891)

- some paraview versions (eg, on windows) don't support float, only double.

  This mostly affected the vtkSurfaceWriter.

  The foamToVTK is also affected, but since it also supports the XML
  output formats (vtp, vtu) these can be used instead.
This commit is contained in:
Mark Olesen
2018-06-21 10:24:04 +02:00
parent 813a0500e2
commit 1f953b807c
7 changed files with 49 additions and 37 deletions

View File

@ -200,13 +200,14 @@ int main(int argc, char *argv[])
<< objName << nl
<< "ASCII\n"
<< "DATASET POLYDATA\n"
<< "POINTS " << points.size() << " float\n";
<< "POINTS " << points.size() << " double\n";
forAll(points, i)
for (const point& pt : points)
{
const point& pt = points[i];
outFile << pt.x() << ' ' << pt.y() << ' ' << pt.z() << nl;
outFile
<< float(pt.x()) << ' '
<< float(pt.y()) << ' '
<< float(pt.z()) << nl;
}
outFile
@ -265,7 +266,7 @@ int main(int argc, char *argv[])
outFile
<< "POINT_DATA " << points.size() << nl
<< "SCALARS pointID float 1\n"
<< "SCALARS pointID double 1\n"
<< "LOOKUP_TABLE default\n";
forAll(points, i)
@ -284,13 +285,14 @@ int main(int argc, char *argv[])
if (!pointNormals.empty())
{
outFile << nl << "NORMALS pointNormals float\n";
outFile << nl << "NORMALS pointNormals double\n";
forAll(pointNormals, i)
for(const vector& n : pointNormals)
{
const vector& n = pointNormals[i];
outFile << n.x() << ' ' << n.y() << ' ' << n.z() << nl;
outFile
<< float(n.x()) << ' '
<< float(n.y()) << ' '
<< float(n.z()) << nl;
}
}