mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: support use of IOstreamOption for IFstream/OFstream
- can be convenient to bundle IO options as a single parameter
This commit is contained in:
@ -80,20 +80,14 @@ Foam::Detail::IFstreamAllocator::IFstreamAllocator(const fileName& pathname)
|
|||||||
Foam::IFstream::IFstream
|
Foam::IFstream::IFstream
|
||||||
(
|
(
|
||||||
const fileName& pathname,
|
const fileName& pathname,
|
||||||
streamFormat format,
|
IOstreamOption streamOpt
|
||||||
versionNumber version
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
Detail::IFstreamAllocator(pathname),
|
Detail::IFstreamAllocator(pathname),
|
||||||
ISstream
|
ISstream(*allocatedPtr_, pathname, streamOpt)
|
||||||
(
|
|
||||||
*allocatedPtr_,
|
|
||||||
pathname,
|
|
||||||
format,
|
|
||||||
version,
|
|
||||||
IFstreamAllocator::detectedCompression_
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
|
IOstream::compression(IFstreamAllocator::detectedCompression_);
|
||||||
|
|
||||||
setClosed();
|
setClosed();
|
||||||
|
|
||||||
setState(allocatedPtr_->rdstate());
|
setState(allocatedPtr_->rdstate());
|
||||||
|
|||||||
@ -100,10 +100,20 @@ public:
|
|||||||
explicit IFstream
|
explicit IFstream
|
||||||
(
|
(
|
||||||
const fileName& pathname,
|
const fileName& pathname,
|
||||||
streamFormat format=ASCII,
|
IOstreamOption streamOpt = IOstreamOption()
|
||||||
versionNumber version=currentVersion
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Construct from pathname, format (version)
|
||||||
|
IFstream
|
||||||
|
(
|
||||||
|
const fileName& pathname,
|
||||||
|
streamFormat fmt,
|
||||||
|
versionNumber ver = currentVersion
|
||||||
|
)
|
||||||
|
:
|
||||||
|
IFstream(pathname, IOstreamOption(fmt, ver))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
~IFstream() = default;
|
~IFstream() = default;
|
||||||
|
|||||||
@ -111,21 +111,12 @@ Foam::Detail::OFstreamAllocator::OFstreamAllocator
|
|||||||
Foam::OFstream::OFstream
|
Foam::OFstream::OFstream
|
||||||
(
|
(
|
||||||
const fileName& pathname,
|
const fileName& pathname,
|
||||||
streamFormat format,
|
IOstreamOption streamOpt,
|
||||||
versionNumber version,
|
|
||||||
compressionType compression,
|
|
||||||
const bool append
|
const bool append
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
Detail::OFstreamAllocator(pathname, compression, append),
|
Detail::OFstreamAllocator(pathname, streamOpt.compression(), append),
|
||||||
OSstream
|
OSstream(*allocatedPtr_, pathname, streamOpt)
|
||||||
(
|
|
||||||
*allocatedPtr_,
|
|
||||||
pathname,
|
|
||||||
format,
|
|
||||||
version,
|
|
||||||
compression
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
setClosed();
|
setClosed();
|
||||||
setState(allocatedPtr_->rdstate());
|
setState(allocatedPtr_->rdstate());
|
||||||
|
|||||||
@ -102,12 +102,23 @@ public:
|
|||||||
explicit OFstream
|
explicit OFstream
|
||||||
(
|
(
|
||||||
const fileName& pathname,
|
const fileName& pathname,
|
||||||
streamFormat format=ASCII,
|
IOstreamOption streamOpt = IOstreamOption(),
|
||||||
versionNumber version=currentVersion,
|
|
||||||
compressionType compression=UNCOMPRESSED,
|
|
||||||
const bool append = false
|
const bool append = false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Construct from pathname, format (version, compression)
|
||||||
|
OFstream
|
||||||
|
(
|
||||||
|
const fileName& pathname,
|
||||||
|
streamFormat fmt,
|
||||||
|
versionNumber ver = currentVersion,
|
||||||
|
compressionType comp = compressionType::UNCOMPRESSED,
|
||||||
|
const bool append = false
|
||||||
|
)
|
||||||
|
:
|
||||||
|
OFstream(pathname, IOstreamOption(fmt, comp, ver), append)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
~OFstream() = default;
|
~OFstream() = default;
|
||||||
|
|||||||
@ -184,16 +184,14 @@ void Foam::masterOFstream::commit()
|
|||||||
Foam::masterOFstream::masterOFstream
|
Foam::masterOFstream::masterOFstream
|
||||||
(
|
(
|
||||||
const fileName& pathName,
|
const fileName& pathName,
|
||||||
streamFormat format,
|
IOstreamOption streamOpt,
|
||||||
versionNumber version,
|
|
||||||
compressionType compression,
|
|
||||||
const bool append,
|
const bool append,
|
||||||
const bool valid
|
const bool valid
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
OStringStream(format, version),
|
OStringStream(streamOpt.format(), streamOpt.version()),
|
||||||
pathName_(pathName),
|
pathName_(pathName),
|
||||||
compression_(compression),
|
compression_(streamOpt.compression()),
|
||||||
append_(append),
|
append_(append),
|
||||||
valid_(valid)
|
valid_(valid)
|
||||||
{}
|
{}
|
||||||
|
|||||||
@ -86,17 +86,35 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct and set stream status
|
//- Construct from pathname and set stream status
|
||||||
explicit masterOFstream
|
explicit masterOFstream
|
||||||
(
|
(
|
||||||
const fileName& pathname,
|
const fileName& pathname,
|
||||||
streamFormat format=ASCII,
|
IOstreamOption streamOpt = IOstreamOption(),
|
||||||
versionNumber version=currentVersion,
|
|
||||||
compressionType compression=UNCOMPRESSED,
|
|
||||||
const bool append = false,
|
const bool append = false,
|
||||||
const bool valid = true
|
const bool valid = true
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Construct from pathname, version and set stream status
|
||||||
|
masterOFstream
|
||||||
|
(
|
||||||
|
const fileName& pathname,
|
||||||
|
streamFormat fmt,
|
||||||
|
versionNumber ver = currentVersion,
|
||||||
|
compressionType comp = compressionType::UNCOMPRESSED,
|
||||||
|
const bool append = false,
|
||||||
|
const bool valid = true
|
||||||
|
)
|
||||||
|
:
|
||||||
|
masterOFstream
|
||||||
|
(
|
||||||
|
pathname,
|
||||||
|
IOstreamOption(fmt, comp, ver),
|
||||||
|
append,
|
||||||
|
valid
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
//- Destructor - commits buffered information to file
|
//- Destructor - commits buffered information to file
|
||||||
~masterOFstream();
|
~masterOFstream();
|
||||||
|
|||||||
@ -28,6 +28,7 @@ Class
|
|||||||
|
|
||||||
Description
|
Description
|
||||||
A simple output token stream that can be used to build token lists.
|
A simple output token stream that can be used to build token lists.
|
||||||
|
Always UNCOMPRESSED.
|
||||||
|
|
||||||
Note
|
Note
|
||||||
Appending single characters to token list is fragile.
|
Appending single characters to token list is fragile.
|
||||||
@ -63,13 +64,23 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Default construct, set stream status
|
//- Default construct, set stream status
|
||||||
|
explicit OTstream(IOstreamOption streamOpt = IOstreamOption())
|
||||||
|
:
|
||||||
|
Ostream(streamOpt.format(), streamOpt.version()),
|
||||||
|
DynamicList<token>()
|
||||||
|
{
|
||||||
|
setOpened();
|
||||||
|
setGood();
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct with format, version
|
||||||
explicit OTstream
|
explicit OTstream
|
||||||
(
|
(
|
||||||
streamFormat format=ASCII,
|
streamFormat fmt,
|
||||||
versionNumber version=currentVersion
|
versionNumber ver = currentVersion
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
Ostream(format, version),
|
Ostream(fmt, ver),
|
||||||
DynamicList<token>()
|
DynamicList<token>()
|
||||||
{
|
{
|
||||||
setOpened();
|
setOpened();
|
||||||
|
|||||||
@ -199,10 +199,8 @@ bool Foam::fileOperations::collatedFileOperation::appendObject
|
|||||||
OFstream os
|
OFstream os
|
||||||
(
|
(
|
||||||
pathName,
|
pathName,
|
||||||
IOstream::BINARY,
|
IOstreamOption(IOstream::BINARY, ver), // UNCOMPRESSED
|
||||||
ver,
|
!isMaster // append slaves
|
||||||
IOstream::UNCOMPRESSED, // no compression
|
|
||||||
!isMaster
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!os.good())
|
if (!os.good())
|
||||||
@ -488,10 +486,8 @@ bool Foam::fileOperations::collatedFileOperation::writeObject
|
|||||||
masterOFstream os
|
masterOFstream os
|
||||||
(
|
(
|
||||||
pathName,
|
pathName,
|
||||||
fmt,
|
IOstreamOption(fmt, ver, cmp),
|
||||||
ver,
|
false, // append=false
|
||||||
cmp,
|
|
||||||
false,
|
|
||||||
valid
|
valid
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -534,10 +530,8 @@ bool Foam::fileOperations::collatedFileOperation::writeObject
|
|||||||
masterOFstream os
|
masterOFstream os
|
||||||
(
|
(
|
||||||
pathName,
|
pathName,
|
||||||
fmt,
|
IOstreamOption(fmt, ver, cmp),
|
||||||
ver,
|
false, // append=false
|
||||||
cmp,
|
|
||||||
false,
|
|
||||||
valid
|
valid
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -596,9 +590,7 @@ bool Foam::fileOperations::collatedFileOperation::writeObject
|
|||||||
(
|
(
|
||||||
writer_,
|
writer_,
|
||||||
pathName,
|
pathName,
|
||||||
fmt,
|
IOstreamOption(fmt, ver, cmp),
|
||||||
ver,
|
|
||||||
cmp,
|
|
||||||
useThread
|
useThread
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017-2018 OpenFOAM Foundation
|
Copyright (C) 2017-2018 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -35,16 +36,14 @@ Foam::threadedCollatedOFstream::threadedCollatedOFstream
|
|||||||
(
|
(
|
||||||
OFstreamCollator& writer,
|
OFstreamCollator& writer,
|
||||||
const fileName& pathName,
|
const fileName& pathName,
|
||||||
streamFormat format,
|
IOstreamOption streamOpt,
|
||||||
versionNumber version,
|
|
||||||
compressionType compression,
|
|
||||||
const bool useThread
|
const bool useThread
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
OStringStream(format, version),
|
OStringStream(streamOpt.format(), streamOpt.version()),
|
||||||
writer_(writer),
|
writer_(writer),
|
||||||
pathName_(pathName),
|
pathName_(pathName),
|
||||||
compression_(compression),
|
compression_(streamOpt.compression()),
|
||||||
useThread_(useThread)
|
useThread_(useThread)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -61,7 +60,7 @@ Foam::threadedCollatedOFstream::~threadedCollatedOFstream()
|
|||||||
IOstream::BINARY,
|
IOstream::BINARY,
|
||||||
version(),
|
version(),
|
||||||
compression_,
|
compression_,
|
||||||
false, // append
|
false, // append=false
|
||||||
useThread_
|
useThread_
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -72,14 +72,32 @@ public:
|
|||||||
//- Construct and set stream status
|
//- Construct and set stream status
|
||||||
threadedCollatedOFstream
|
threadedCollatedOFstream
|
||||||
(
|
(
|
||||||
OFstreamCollator&,
|
OFstreamCollator& writer,
|
||||||
const fileName& pathname,
|
const fileName& pathname,
|
||||||
streamFormat format=ASCII,
|
IOstreamOption streamOpt = IOstreamOption(),
|
||||||
versionNumber version=currentVersion,
|
|
||||||
compressionType compression=UNCOMPRESSED,
|
|
||||||
const bool useThread = true
|
const bool useThread = true
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Construct and set stream status
|
||||||
|
threadedCollatedOFstream
|
||||||
|
(
|
||||||
|
OFstreamCollator& writer,
|
||||||
|
const fileName& pathname,
|
||||||
|
streamFormat fmt,
|
||||||
|
versionNumber ver = currentVersion,
|
||||||
|
compressionType comp = compressionType::UNCOMPRESSED,
|
||||||
|
const bool useThread = true
|
||||||
|
)
|
||||||
|
:
|
||||||
|
threadedCollatedOFstream
|
||||||
|
(
|
||||||
|
writer,
|
||||||
|
pathname,
|
||||||
|
IOstreamOption(fmt, ver, comp),
|
||||||
|
useThread
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
~threadedCollatedOFstream();
|
~threadedCollatedOFstream();
|
||||||
|
|||||||
@ -466,7 +466,7 @@ bool Foam::fileOperation::writeObject
|
|||||||
const regIOobject& io,
|
const regIOobject& io,
|
||||||
IOstream::streamFormat fmt,
|
IOstream::streamFormat fmt,
|
||||||
IOstream::versionNumber ver,
|
IOstream::versionNumber ver,
|
||||||
IOstream::compressionType cmp,
|
IOstream::compressionType comp,
|
||||||
const bool valid
|
const bool valid
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
@ -478,21 +478,15 @@ bool Foam::fileOperation::writeObject
|
|||||||
|
|
||||||
autoPtr<OSstream> osPtr
|
autoPtr<OSstream> osPtr
|
||||||
(
|
(
|
||||||
NewOFstream
|
NewOFstream(pathName, IOstreamOption(fmt, ver, comp))
|
||||||
(
|
|
||||||
pathName,
|
|
||||||
fmt,
|
|
||||||
ver,
|
|
||||||
cmp
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!osPtr.valid())
|
if (!osPtr)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ostream& os = osPtr();
|
OSstream& os = osPtr();
|
||||||
|
|
||||||
// If any of these fail, return (leave error handling to Ostream class)
|
// If any of these fail, return (leave error handling to Ostream class)
|
||||||
if (!os.good())
|
if (!os.good())
|
||||||
|
|||||||
@ -409,10 +409,10 @@ public:
|
|||||||
// suppress empty local lagrangian data)
|
// suppress empty local lagrangian data)
|
||||||
virtual bool writeObject
|
virtual bool writeObject
|
||||||
(
|
(
|
||||||
const regIOobject&,
|
const regIOobject& io,
|
||||||
IOstream::streamFormat format=IOstream::ASCII,
|
IOstream::streamFormat fmt = IOstream::ASCII,
|
||||||
IOstream::versionNumber version=IOstream::currentVersion,
|
IOstream::versionNumber ver = IOstream::currentVersion,
|
||||||
IOstream::compressionType compression=IOstream::UNCOMPRESSED,
|
IOstream::compressionType comp = IOstream::UNCOMPRESSED,
|
||||||
const bool valid = true
|
const bool valid = true
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
@ -430,9 +430,7 @@ public:
|
|||||||
virtual autoPtr<OSstream> NewOFstream
|
virtual autoPtr<OSstream> NewOFstream
|
||||||
(
|
(
|
||||||
const fileName& pathname,
|
const fileName& pathname,
|
||||||
IOstream::streamFormat format=IOstream::ASCII,
|
IOstreamOption streamOpt = IOstreamOption(),
|
||||||
IOstream::versionNumber version=IOstream::currentVersion,
|
|
||||||
IOstream::compressionType compression=IOstream::UNCOMPRESSED,
|
|
||||||
const bool valid = true
|
const bool valid = true
|
||||||
) const = 0;
|
) const = 0;
|
||||||
|
|
||||||
|
|||||||
@ -2246,7 +2246,7 @@ bool Foam::fileOperations::masterUncollatedFileOperation::writeObject
|
|||||||
const regIOobject& io,
|
const regIOobject& io,
|
||||||
IOstream::streamFormat fmt,
|
IOstream::streamFormat fmt,
|
||||||
IOstream::versionNumber ver,
|
IOstream::versionNumber ver,
|
||||||
IOstream::compressionType cmp,
|
IOstream::compressionType comp,
|
||||||
const bool valid
|
const bool valid
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
@ -2266,13 +2266,11 @@ bool Foam::fileOperations::masterUncollatedFileOperation::writeObject
|
|||||||
NewOFstream
|
NewOFstream
|
||||||
(
|
(
|
||||||
pathName,
|
pathName,
|
||||||
fmt,
|
IOstreamOption(fmt, ver, comp),
|
||||||
ver,
|
|
||||||
cmp,
|
|
||||||
valid
|
valid
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
Ostream& os = osPtr();
|
OSstream& os = osPtr();
|
||||||
|
|
||||||
// If any of these fail, return (leave error handling to Ostream class)
|
// If any of these fail, return (leave error handling to Ostream class)
|
||||||
if (!os.good())
|
if (!os.good())
|
||||||
@ -2549,9 +2547,7 @@ Foam::autoPtr<Foam::OSstream>
|
|||||||
Foam::fileOperations::masterUncollatedFileOperation::NewOFstream
|
Foam::fileOperations::masterUncollatedFileOperation::NewOFstream
|
||||||
(
|
(
|
||||||
const fileName& pathName,
|
const fileName& pathName,
|
||||||
IOstream::streamFormat fmt,
|
IOstreamOption streamOpt,
|
||||||
IOstream::versionNumber ver,
|
|
||||||
IOstream::compressionType cmp,
|
|
||||||
const bool valid
|
const bool valid
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
@ -2560,10 +2556,8 @@ Foam::fileOperations::masterUncollatedFileOperation::NewOFstream
|
|||||||
new masterOFstream
|
new masterOFstream
|
||||||
(
|
(
|
||||||
pathName,
|
pathName,
|
||||||
fmt,
|
streamOpt,
|
||||||
ver,
|
false, // append=false
|
||||||
cmp,
|
|
||||||
false, // append
|
|
||||||
valid
|
valid
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@ -487,7 +487,7 @@ public:
|
|||||||
TypeName("masterUncollated");
|
TypeName("masterUncollated");
|
||||||
|
|
||||||
|
|
||||||
// Static data
|
// Static Data
|
||||||
|
|
||||||
//- Max size of parallel communications. Switches from non-blocking
|
//- Max size of parallel communications. Switches from non-blocking
|
||||||
// to scheduled when reading/writing files. Read as float to enable
|
// to scheduled when reading/writing files. Read as float to enable
|
||||||
@ -696,7 +696,7 @@ public:
|
|||||||
// Returns success state.
|
// Returns success state.
|
||||||
virtual bool writeObject
|
virtual bool writeObject
|
||||||
(
|
(
|
||||||
const regIOobject&,
|
const regIOobject& io,
|
||||||
IOstream::streamFormat format=IOstream::ASCII,
|
IOstream::streamFormat format=IOstream::ASCII,
|
||||||
IOstream::versionNumber version=IOstream::currentVersion,
|
IOstream::versionNumber version=IOstream::currentVersion,
|
||||||
IOstream::compressionType compression=IOstream::UNCOMPRESSED,
|
IOstream::compressionType compression=IOstream::UNCOMPRESSED,
|
||||||
@ -710,9 +710,7 @@ public:
|
|||||||
virtual autoPtr<OSstream> NewOFstream
|
virtual autoPtr<OSstream> NewOFstream
|
||||||
(
|
(
|
||||||
const fileName& pathname,
|
const fileName& pathname,
|
||||||
IOstream::streamFormat format=IOstream::ASCII,
|
IOstreamOption streamOpt = IOstreamOption(),
|
||||||
IOstream::versionNumber version=IOstream::currentVersion,
|
|
||||||
IOstream::compressionType compression=IOstream::UNCOMPRESSED,
|
|
||||||
const bool valid = true
|
const bool valid = true
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|||||||
@ -724,13 +724,11 @@ Foam::autoPtr<Foam::OSstream>
|
|||||||
Foam::fileOperations::uncollatedFileOperation::NewOFstream
|
Foam::fileOperations::uncollatedFileOperation::NewOFstream
|
||||||
(
|
(
|
||||||
const fileName& pathName,
|
const fileName& pathName,
|
||||||
IOstream::streamFormat fmt,
|
IOstreamOption streamOpt,
|
||||||
IOstream::versionNumber ver,
|
|
||||||
IOstream::compressionType cmp,
|
|
||||||
const bool valid
|
const bool valid
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return autoPtr<OSstream>(new OFstream(pathName, fmt, ver, cmp));
|
return autoPtr<OSstream>(new OFstream(pathName, streamOpt));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -282,9 +282,7 @@ public:
|
|||||||
virtual autoPtr<OSstream> NewOFstream
|
virtual autoPtr<OSstream> NewOFstream
|
||||||
(
|
(
|
||||||
const fileName& pathname,
|
const fileName& pathname,
|
||||||
IOstream::streamFormat format=IOstream::ASCII,
|
IOstreamOption streamOpt = IOstreamOption(),
|
||||||
IOstream::versionNumber version=IOstream::currentVersion,
|
|
||||||
IOstream::compressionType compression=IOstream::UNCOMPRESSED,
|
|
||||||
const bool valid = true
|
const bool valid = true
|
||||||
) const;
|
) const;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2012-2016 OpenFOAM Foundation
|
Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -63,12 +64,10 @@ void Foam::OBJstream::writeAndCheck(const char c)
|
|||||||
Foam::OBJstream::OBJstream
|
Foam::OBJstream::OBJstream
|
||||||
(
|
(
|
||||||
const fileName& pathname,
|
const fileName& pathname,
|
||||||
streamFormat format,
|
IOstreamOption streamOpt
|
||||||
versionNumber version,
|
|
||||||
compressionType compression
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
OFstream(pathname, format, version, compression),
|
OFstream(pathname, streamOpt),
|
||||||
startOfLine_(true),
|
startOfLine_(true),
|
||||||
nVertices_(0)
|
nVertices_(0)
|
||||||
{}
|
{}
|
||||||
|
|||||||
@ -83,11 +83,21 @@ public:
|
|||||||
explicit OBJstream
|
explicit OBJstream
|
||||||
(
|
(
|
||||||
const fileName& pathname,
|
const fileName& pathname,
|
||||||
streamFormat format=ASCII,
|
IOstreamOption streamOpt = IOstreamOption()
|
||||||
versionNumber version=currentVersion,
|
|
||||||
compressionType compression=UNCOMPRESSED
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Construct from pathname
|
||||||
|
OBJstream
|
||||||
|
(
|
||||||
|
const fileName& pathname,
|
||||||
|
streamFormat fmt,
|
||||||
|
versionNumber ver = currentVersion,
|
||||||
|
compressionType comp = compressionType::UNCOMPRESSED
|
||||||
|
)
|
||||||
|
:
|
||||||
|
OBJstream(pathname, IOstreamOption(fmt, ver, comp))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
~OBJstream() = default;
|
~OBJstream() = default;
|
||||||
|
|||||||
@ -142,13 +142,7 @@ void Foam::MeshedSurfaceProxy<Face>::write
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
OFstream os
|
OFstream os(objectDir/io.name(), t.writeStreamOption());
|
||||||
(
|
|
||||||
objectDir/io.name(),
|
|
||||||
t.writeFormat(),
|
|
||||||
IOstream::currentVersion,
|
|
||||||
t.writeCompression()
|
|
||||||
);
|
|
||||||
|
|
||||||
io.writeHeader(os);
|
io.writeHeader(os);
|
||||||
|
|
||||||
@ -174,13 +168,8 @@ void Foam::MeshedSurfaceProxy<Face>::write
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
OFstream os
|
OFstream os(objectDir/io.name(), t.writeStreamOption());
|
||||||
(
|
|
||||||
objectDir/io.name(),
|
|
||||||
t.writeFormat(),
|
|
||||||
IOstream::currentVersion,
|
|
||||||
t.writeCompression()
|
|
||||||
);
|
|
||||||
io.writeHeader(os);
|
io.writeHeader(os);
|
||||||
|
|
||||||
if (this->useFaceMap())
|
if (this->useFaceMap())
|
||||||
@ -212,8 +201,9 @@ void Foam::MeshedSurfaceProxy<Face>::write
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// write as ascii
|
// Write as ASCII-only
|
||||||
OFstream os(objectDir/io.name());
|
OFstream os(objectDir/io.name());
|
||||||
|
|
||||||
io.writeHeader(os);
|
io.writeHeader(os);
|
||||||
|
|
||||||
os << this->surfZones();
|
os << this->surfZones();
|
||||||
|
|||||||
Reference in New Issue
Block a user