102 const std::ios_base::openmode
mode
104 std::ios_base::in | std::ios_base::binary
107 ptr_.reset(
new std::ifstream(pathname,
mode));
113 const fileName pathname_gz(pathname +
".gz");
115 if (
isFile(pathname_gz,
false))
119 ptr_.reset(
new igzstream(pathname_gz,
mode));
124 <<
"No read support for gz compressed files (libz)"
125 <<
" : could use 'gunzip' from the command-line" <<
nl
126 <<
"file: " << pathname_gz <<
endl
150 std::ios_base::openmode
mode
152 std::ios_base::out | std::ios_base::binary
157 mode |= std::ios_base::app;
160 const fileName pathname_gz(pathname +
".gz");
169 ptr_.reset(
new ogzstream(pathname_gz,
mode));
177 <<
"No write support for gz compressed files (libz)"
178 <<
" : downgraded to UNCOMPRESSED" <<
nl
179 <<
"file: " << pathname_gz <<
endl;
187 ptr_.reset(
new std::ofstream(pathname,
mode));
197 igzstream* gz =
dynamic_cast<igzstream*
>(ptr_.get());
204 gz->open(pathname_gz);
213 ogzstream* gz =
dynamic_cast<ogzstream*
>(ptr_.get());
220 gz->open(pathname_gz);
228 std::ofstream* file =
dynamic_cast<std::ofstream*
>(ptr_.get());
237 file->open(pathname);
246 if (
dynamic_cast<const igzstream*
>(ptr_.get()))
260 if (
dynamic_cast<const ogzstream*
>(ptr_.get()))
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
compressionType
Compression treatment (UNCOMPRESSED | COMPRESSED)
@ UNCOMPRESSED
compression = false
@ COMPRESSED
compression = true
A class for handling file names.
Type
Enumerations to handle directory entry types.
@ SYMLINK
A symbolic link.
void reopen_gz(const std::string &pathname_gz)
Special 'rewind' method for compressed stream.
IOstreamOption::compressionType whichCompression() const
Which compression type?
static bool supports_gz()
True if compiled with libz support.
ifstreamPointer() noexcept=default
Default construct (empty)
Trivial output stream for calculating byte counts.
void reopen_gz(const std::string &pathname_gz)
Special 'rewind' method for compressed stream.
void reopen(const std::string &pathname)
General 'rewind' method (non-compressed)
IOstreamOption::compressionType whichCompression() const
Which compression type?
static bool supports_gz()
True if compiled with libz support.
ofstreamPointer() noexcept=default
Default construct (empty)
rAUs append(new volScalarField(IOobject::groupName("rAU", phase1.name()), 1.0/(U1Eqn.A()+byDt(max(phase1.residualAlpha() - alpha1, scalar(0)) *rho1))))
bool rm(const fileName &file)
Remove a file (or its gz equivalent), returning true if successful.
mode_t mode(const fileName &name, const bool followLink=true)
Return the file mode, normally following symbolic links.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool isFile(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist as a FILE in the file system?
errorManipArg< error, int > exit(error &err, const int errNo=1)
static void removeConflictingFiles(const fileName &otherName, const bool append, const fileName &targetName)
constexpr char nl
The newline '\n' character (0x0a)