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

@ -71,12 +71,13 @@ void Foam::vtkSetWriter<Type>::write
<< points.name() << nl
<< "ASCII" << nl
<< "DATASET POLYDATA" << nl
<< "POINTS " << points.size() << " float" << nl;
<< "POINTS " << points.size() << " double" << nl;
forAll(points, i)
for (const point& pt : points)
{
const vector& pt = points[i];
os << pt.x() << ' ' << pt.y() << ' ' << pt.z() << nl;
os << float(pt.x()) << ' '
<< float(pt.y()) << ' '
<< float(pt.z()) << nl;
}
os << "POINT_DATA " << points.size() << nl
@ -132,15 +133,16 @@ void Foam::vtkSetWriter<Type>::write
<< tracks[0].name() << nl
<< "ASCII" << nl
<< "DATASET POLYDATA" << nl
<< "POINTS " << nPoints << " float" << nl;
<< "POINTS " << nPoints << " double" << nl;
forAll(tracks, trackI)
{
const coordSet& points = tracks[trackI];
forAll(points, i)
for (const point& pt : points)
{
const vector& pt = points[i];
os << pt.x() << ' ' << pt.y() << ' ' << pt.z() << nl;
os << float(pt.x()) << ' '
<< float(pt.y()) << ' '
<< float(pt.z()) << nl;
}
}