Skip to content
Snippets Groups Projects
Commit a19e488f authored by Mark Olesen's avatar Mark Olesen
Browse files

consistency update - writeCompression in system/controlDict

allow switch/bool values for writeCompression in system/controlDict

- eg,
    writeCompression false; or writeCompression uncompressed;
    writeCompression true;  or writeCompression compressed;

improves consistency with other controlDict parameters
parent 190bbd69
No related branches found
No related tags found
No related merge requests found
...@@ -26,6 +26,7 @@ License ...@@ -26,6 +26,7 @@ License
#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 * * * * * * * * * * * * * //
...@@ -60,7 +61,14 @@ Foam::IOstream::formatEnum(const word& format) ...@@ -60,7 +61,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::switchType sw = Switch::asEnum(compression, true);
if (sw != Switch::INVALID)
{
return sw ? IOstream::COMPRESSED : IOstream::UNCOMPRESSED;
}
else if (compression == "uncompressed")
{ {
return IOstream::UNCOMPRESSED; return IOstream::UNCOMPRESSED;
} }
...@@ -115,7 +123,7 @@ Foam::string Foam::IOstream::versionNumber::str() const ...@@ -115,7 +123,7 @@ Foam::string Foam::IOstream::versionNumber::str() const
std::ostringstream os; std::ostringstream os;
os.precision(1); os.precision(1);
os.setf(ios_base::fixed, ios_base::floatfield); os.setf(ios_base::fixed, ios_base::floatfield);
os << versionNumber_; os << versionNumber_;
return os.str(); return os.str();
} }
...@@ -202,11 +210,11 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const IOstream::streamFormat& sf) ...@@ -202,11 +210,11 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const IOstream::streamFormat& sf)
{ {
if (sf == IOstream::ASCII) if (sf == IOstream::ASCII)
{ {
os << "ascii"; os << "ascii";
} }
else else
{ {
os << "binary"; os << "binary";
} }
return os; return os;
...@@ -215,7 +223,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const IOstream::streamFormat& sf) ...@@ -215,7 +223,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const IOstream::streamFormat& sf)
Foam::Ostream& Foam::operator<<(Ostream& os, const IOstream::versionNumber& vn) Foam::Ostream& Foam::operator<<(Ostream& os, const IOstream::versionNumber& vn)
{ {
os << vn.str().c_str(); os << vn.str().c_str();
return os; return os;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment