mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
rawSurfaceWriter: Added support for compressed output
Patch provided by Armin Wehrfritz Resolves feature request http://www.openfoam.org/mantisbt/view.php?id=843
This commit is contained in:
@ -44,6 +44,10 @@ formatOptions
|
|||||||
{
|
{
|
||||||
format ascii;
|
format ascii;
|
||||||
}
|
}
|
||||||
|
raw
|
||||||
|
{
|
||||||
|
compression uncompressed; // 'uncompressed' or 'compressed'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// interpolationScheme. choice of
|
// interpolationScheme. choice of
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -36,6 +36,7 @@ License
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
makeSurfaceWriterType(rawSurfaceWriter);
|
makeSurfaceWriterType(rawSurfaceWriter);
|
||||||
|
addToRunTimeSelectionTable(surfaceWriter, rawSurfaceWriter, wordDict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -226,14 +227,20 @@ void Foam::rawSurfaceWriter::writeTemplate
|
|||||||
mkDir(outputDir);
|
mkDir(outputDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
OFstream os(outputDir/fieldName + '_' + surfaceName + ".raw");
|
OFstream os
|
||||||
|
(
|
||||||
|
outputDir/fieldName + '_' + surfaceName + ".raw",
|
||||||
|
IOstream::ASCII,
|
||||||
|
IOstream::currentVersion,
|
||||||
|
writeCompression_
|
||||||
|
);
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
{
|
{
|
||||||
Info<< "Writing field " << fieldName << " to " << os.name() << endl;
|
Info<< "Writing field " << fieldName << " to " << os.name() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// header
|
// Header
|
||||||
os << "# " << fieldName;
|
os << "# " << fieldName;
|
||||||
if (isNodeValues)
|
if (isNodeValues)
|
||||||
{
|
{
|
||||||
@ -244,10 +251,10 @@ void Foam::rawSurfaceWriter::writeTemplate
|
|||||||
os << " FACE_DATA ";
|
os << " FACE_DATA ";
|
||||||
}
|
}
|
||||||
|
|
||||||
// header
|
// Header
|
||||||
writeHeader(os, fieldName, values);
|
writeHeader(os, fieldName, values);
|
||||||
|
|
||||||
// values
|
// Values
|
||||||
if (isNodeValues)
|
if (isNodeValues)
|
||||||
{
|
{
|
||||||
forAll(values, elemI)
|
forAll(values, elemI)
|
||||||
@ -272,10 +279,24 @@ void Foam::rawSurfaceWriter::writeTemplate
|
|||||||
|
|
||||||
Foam::rawSurfaceWriter::rawSurfaceWriter()
|
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 * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::rawSurfaceWriter::~rawSurfaceWriter()
|
Foam::rawSurfaceWriter::~rawSurfaceWriter()
|
||||||
@ -298,7 +319,13 @@ void Foam::rawSurfaceWriter::write
|
|||||||
mkDir(outputDir);
|
mkDir(outputDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
OFstream os(outputDir/surfaceName + ".raw");
|
OFstream os
|
||||||
|
(
|
||||||
|
outputDir/surfaceName + ".raw",
|
||||||
|
IOstream::ASCII,
|
||||||
|
IOstream::currentVersion,
|
||||||
|
writeCompression_
|
||||||
|
);
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
{
|
{
|
||||||
@ -306,7 +333,7 @@ void Foam::rawSurfaceWriter::write
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// header
|
// Header
|
||||||
os << "# geometry NO_DATA " << faces.size() << nl
|
os << "# geometry NO_DATA " << faces.size() << nl
|
||||||
<< "# x y z" << nl;
|
<< "# x y z" << nl;
|
||||||
|
|
||||||
@ -321,7 +348,9 @@ void Foam::rawSurfaceWriter::write
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// create write methods
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Create write methods
|
||||||
defineSurfaceWriterWriteFields(Foam::rawSurfaceWriter);
|
defineSurfaceWriterWriteFields(Foam::rawSurfaceWriter);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -51,6 +51,12 @@ class rawSurfaceWriter
|
|||||||
:
|
:
|
||||||
public surfaceWriter
|
public surfaceWriter
|
||||||
{
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Output compression, defaults to uncompressed
|
||||||
|
IOstream::compressionType writeCompression_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
static inline void writeLocation
|
static inline void writeLocation
|
||||||
@ -106,6 +112,9 @@ public:
|
|||||||
//- Construct null
|
//- Construct null
|
||||||
rawSurfaceWriter();
|
rawSurfaceWriter();
|
||||||
|
|
||||||
|
//- Construct with some output options
|
||||||
|
rawSurfaceWriter(const dictionary& options);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~rawSurfaceWriter();
|
virtual ~rawSurfaceWriter();
|
||||||
@ -193,7 +202,6 @@ public:
|
|||||||
const bool isNodeValues,
|
const bool isNodeValues,
|
||||||
const bool verbose = false
|
const bool verbose = false
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user