ENH: vtkSurfaceWriter: user-specifiable precision.

Partly solves #65. Ensight writer is fixed but all the other ones probably
need doing as well.
This commit is contained in:
mattijs
2016-06-01 17:43:14 +01:00
parent 8a7880af2e
commit 2a07e34fb0
5 changed files with 37 additions and 6 deletions

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -31,6 +31,7 @@ License
namespace Foam
{
makeSurfaceWriterType(vtkSurfaceWriter);
addToRunTimeSelectionTable(surfaceWriter, vtkSurfaceWriter, wordDict);
}
@ -202,7 +203,22 @@ namespace Foam
Foam::vtkSurfaceWriter::vtkSurfaceWriter()
:
surfaceWriter()
surfaceWriter(),
writePrecision_(IOstream::defaultPrecision())
{}
Foam::vtkSurfaceWriter::vtkSurfaceWriter(const dictionary& dict)
:
surfaceWriter(),
writePrecision_
(
dict.lookupOrDefault
(
"writePrecision",
IOstream::defaultPrecision()
)
)
{}
@ -229,6 +245,7 @@ Foam::fileName Foam::vtkSurfaceWriter::write
}
OFstream os(outputDir/surfaceName + ".vtk");
os.precision(writePrecision_);
if (verbose)
{

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -50,6 +50,11 @@ class vtkSurfaceWriter
:
public surfaceWriter
{
// Private data
const unsigned int writePrecision_;
// Private Member Functions
static void writeGeometry(Ostream&, const pointField&, const faceList&);
@ -84,6 +89,9 @@ public:
//- Construct null
vtkSurfaceWriter();
//- Construct with some output options
vtkSurfaceWriter(const dictionary& options);
//- Destructor
virtual ~vtkSurfaceWriter();

View File

@ -63,6 +63,7 @@ Foam::fileName Foam::vtkSurfaceWriter::writeTemplate
}
OFstream os(outputDir/fieldName + '_' + surfaceName + ".vtk");
os.precision(writePrecision_);
if (verbose)
{