Backport writeCompression from vanilla 3.0.1
This commit is contained in:
parent
cd8b1c6487
commit
02b093974b
1 changed files with 9 additions and 1 deletions
|
@ -27,6 +27,7 @@ Description
|
||||||
|
|
||||||
#include "IOstream.H"
|
#include "IOstream.H"
|
||||||
#include "error.H"
|
#include "error.H"
|
||||||
|
#include "Switch.H"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
@ -61,7 +62,14 @@ Foam::IOstream::formatEnum(const word& format)
|
||||||
Foam::IOstream::compressionType
|
Foam::IOstream::compressionType
|
||||||
Foam::IOstream::compressionEnum(const word& compression)
|
Foam::IOstream::compressionEnum(const word& compression)
|
||||||
{
|
{
|
||||||
if (compression == "uncompressed")
|
// get Switch (bool) value, but allow it to fail
|
||||||
|
Switch sw(compression, true);
|
||||||
|
|
||||||
|
if (sw.valid())
|
||||||
|
{
|
||||||
|
return sw ? IOstream::COMPRESSED : IOstream::UNCOMPRESSED;
|
||||||
|
}
|
||||||
|
else if (compression == "uncompressed")
|
||||||
{
|
{
|
||||||
return IOstream::UNCOMPRESSED;
|
return IOstream::UNCOMPRESSED;
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue