View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000843 | OpenFOAM | Bug | public | 2013-05-07 19:31 | 2016-02-02 20:24 |
Reporter | dkxls | Assigned To | henry | ||
Priority | normal | Severity | feature | Reproducibility | N/A |
Status | resolved | Resolution | fixed | ||
Platform | Linux 64bit | OS | OpenSuse | OS Version | 12.2 |
Summary | 0000843: Optional compress output for 'rawSurfaceWriter' (patch attached) | ||||
Description | Add an option for compress output to the 'rawSurfaceWriter', similar to the format option in the 'ensightSurfaceWriter'. Patches with the required changes to the source code and the example 'sampleDict' are attached. The code was tested in an modified solver and works as expected. -Armin | ||||
Tags | contribution, sample, surface writer | ||||
|
raw.patch (2,800 bytes)
diff -rupN org/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.C mod/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.C --- org/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.C 2013-05-07 20:23:34.365402010 +0300 +++ mod/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.C 2013-05-07 21:18:26.838240437 +0300 @@ -36,6 +36,7 @@ License namespace Foam { makeSurfaceWriterType(rawSurfaceWriter); + addToRunTimeSelectionTable(surfaceWriter, rawSurfaceWriter, wordDict); } @@ -226,7 +227,13 @@ void Foam::rawSurfaceWriter::writeTempla mkDir(outputDir); } - OFstream os(outputDir/fieldName + '_' + surfaceName + ".raw"); + OFstream os + ( + outputDir/fieldName + '_' + surfaceName + ".raw", + IOstream::ASCII, + IOstream::currentVersion, + writeCompression_ + ); if (verbose) { @@ -272,10 +279,25 @@ void Foam::rawSurfaceWriter::writeTempla Foam::rawSurfaceWriter::rawSurfaceWriter() : - surfaceWriter() + surfaceWriter(), + writeCompression_(IOstream::UNCOMPRESSED) {} +Foam::rawSurfaceWriter::rawSurfaceWriter(const dictionary& options) +: + surfaceWriter(), + writeCompression_(IOstream::UNCOMPRESSED) +{ + // choose uncompressed or compressed output + if (options.found("compression")) + { + writeCompression_ = + IOstream::compressionEnum(options.lookup("compression")); + } +} + + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::rawSurfaceWriter::~rawSurfaceWriter() @@ -298,7 +320,13 @@ void Foam::rawSurfaceWriter::write mkDir(outputDir); } - OFstream os(outputDir/surfaceName + ".raw"); + OFstream os + ( + outputDir/surfaceName + ".raw", + IOstream::ASCII, + IOstream::currentVersion, + writeCompression_ + ); if (verbose) { diff -rupN org/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.H mod/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.H --- org/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.H 2013-05-07 20:23:34.365402010 +0300 +++ mod/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.H 2013-05-07 21:21:51.800678054 +0300 @@ -51,6 +51,12 @@ class rawSurfaceWriter : public surfaceWriter { + // Private data + + //- Output compression (default is IOstream::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(); |
|
sampleDict.patch (422 bytes)
--- org/applications/utilities/postProcessing/sampling/sample/sampleDict 2013-05-07 20:24:27.909732612 +0300 +++ mod/applications/utilities/postProcessing/sampling/sample/sampleDict 2013-05-07 20:20:14.073906000 +0300 @@ -44,6 +44,10 @@ formatOptions { format ascii; } + raw + { + compression uncompressed; // 'uncompressed' or 'compressed' + } } // interpolationScheme. choice of |
|
Is there any way to include the provided patches? Or is the bug-tracker the wrong place for this kind of improvements to OpenFOAM? Best regards, Armin |
|
Is there a chance that this feature can be implemented? The necessary code is provided in the attached patch! |
|
Thanks for the patch and sorry about the delay. Resolved in OpenFOAM-dev by commit 605f72a27c8d13c983e718422bf7d43dbabdabbf |
Date Modified | Username | Field | Change |
---|---|---|---|
2013-05-07 19:31 | dkxls | New Issue | |
2013-05-07 19:31 | dkxls | File Added: raw.patch | |
2013-05-07 19:31 | dkxls | File Added: sampleDict.patch | |
2013-06-16 09:17 | dkxls | Note Added: 0002284 | |
2013-08-06 12:03 | dkxls | Note Added: 0002372 | |
2013-09-03 08:47 | dkxls | Tag Attached: sample | |
2013-09-03 08:47 | dkxls | Tag Attached: surface writer | |
2015-02-15 17:24 | wyldckat | Tag Attached: contribution | |
2016-02-02 20:24 | henry | Note Added: 0005885 | |
2016-02-02 20:24 | henry | Status | new => resolved |
2016-02-02 20:24 | henry | Resolution | open => fixed |
2016-02-02 20:24 | henry | Assigned To | => henry |