diff --git a/applications/utilities/postProcessing/sampling/sample/sampleDict b/applications/utilities/postProcessing/sampling/sample/sampleDict index 92b1c02e35..593bcf82bc 100644 --- a/applications/utilities/postProcessing/sampling/sample/sampleDict +++ b/applications/utilities/postProcessing/sampling/sample/sampleDict @@ -44,6 +44,10 @@ formatOptions { format ascii; } + raw + { + compression uncompressed; // 'uncompressed' or 'compressed' + } } // interpolationScheme. choice of diff --git a/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.C b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.C index 1899b1212a..58f9f90d44 100644 --- a/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.C +++ b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,6 +36,7 @@ License namespace Foam { makeSurfaceWriterType(rawSurfaceWriter); + addToRunTimeSelectionTable(surfaceWriter, rawSurfaceWriter, wordDict); } @@ -226,14 +227,20 @@ void Foam::rawSurfaceWriter::writeTemplate mkDir(outputDir); } - OFstream os(outputDir/fieldName + '_' + surfaceName + ".raw"); + OFstream os + ( + outputDir/fieldName + '_' + surfaceName + ".raw", + IOstream::ASCII, + IOstream::currentVersion, + writeCompression_ + ); if (verbose) { Info<< "Writing field " << fieldName << " to " << os.name() << endl; } - // header + // Header os << "# " << fieldName; if (isNodeValues) { @@ -244,10 +251,10 @@ void Foam::rawSurfaceWriter::writeTemplate os << " FACE_DATA "; } - // header + // Header writeHeader(os, fieldName, values); - // values + // Values if (isNodeValues) { forAll(values, elemI) @@ -272,10 +279,24 @@ void Foam::rawSurfaceWriter::writeTemplate Foam::rawSurfaceWriter::rawSurfaceWriter() : - surfaceWriter() + surfaceWriter(), + writeCompression_(IOstream::UNCOMPRESSED) {} +Foam::rawSurfaceWriter::rawSurfaceWriter(const dictionary& options) +: + surfaceWriter(), + writeCompression_(IOstream::UNCOMPRESSED) +{ + if (options.found("compression")) + { + writeCompression_ = + IOstream::compressionEnum(options.lookup("compression")); + } +} + + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::rawSurfaceWriter::~rawSurfaceWriter() @@ -298,7 +319,13 @@ void Foam::rawSurfaceWriter::write mkDir(outputDir); } - OFstream os(outputDir/surfaceName + ".raw"); + OFstream os + ( + outputDir/surfaceName + ".raw", + IOstream::ASCII, + IOstream::currentVersion, + writeCompression_ + ); if (verbose) { @@ -306,7 +333,7 @@ void Foam::rawSurfaceWriter::write } - // header + // Header os << "# geometry NO_DATA " << faces.size() << nl << "# x y z" << nl; @@ -321,7 +348,9 @@ void Foam::rawSurfaceWriter::write } -// create write methods +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Create write methods defineSurfaceWriterWriteFields(Foam::rawSurfaceWriter); diff --git a/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.H b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.H index 6a3b3c2ee2..3d0d061557 100644 --- a/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -51,6 +51,12 @@ class rawSurfaceWriter : public surfaceWriter { + // Private data + + //- Output compression, defaults to uncompressed + IOstream::compressionType writeCompression_; + + // Private Member Functions static inline void writeLocation @@ -106,6 +112,9 @@ public: //- Construct null rawSurfaceWriter(); + //- Construct with some output options + rawSurfaceWriter(const dictionary& options); + //- Destructor virtual ~rawSurfaceWriter(); @@ -193,7 +202,6 @@ public: const bool isNodeValues, const bool verbose = false ) const; - };