mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: more consistent use of IOstreamOption
- improves interface and data consistency. Older signatures are still active (via the Foam_IOstream_extras define). - refine internals for IOstreamOption streamFormat, versionNumber ENH: improve data alignment for IOstream and IOobject - fit sizeof label/scalar into unsigned char STYLE: remove dead code
This commit is contained in:
committed by
Andrew Heather
parent
e3c8af0c8f
commit
e8cf2a2c62
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -346,7 +346,7 @@ int main(int argc, char *argv[])
|
||||
is.setScalarByteSize(sizeof(otherType));
|
||||
|
||||
Info<< "Stream scalar-size ("
|
||||
<< is.scalarByteSize() << ") is native: "
|
||||
<< label(is.scalarByteSize()) << ") is native: "
|
||||
<< Switch(is.checkScalarSize<otherType>()) << nl;
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -38,6 +38,7 @@ Description
|
||||
#include "PstreamBuffers.H"
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
#include "IOobject.H"
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
@ -132,6 +133,7 @@ int main(int argc, char *argv[])
|
||||
cout<<"string:" << sizeof(Foam::string) << nl;
|
||||
}
|
||||
|
||||
cout<<"IOobject:" << sizeof(Foam::IOobject) << nl;
|
||||
cout<<"IOstream:" << sizeof(Foam::IOstream) << nl;
|
||||
cout<<"PstreamBuffers:" << sizeof(Foam::PstreamBuffers) << nl;
|
||||
cout<<"Time:" << sizeof(Foam::Time) << nl;
|
||||
|
||||
@ -290,7 +290,8 @@ Foam::IOobject::IOobject
|
||||
const objectRegistry& registry,
|
||||
readOption ro,
|
||||
writeOption wo,
|
||||
bool registerObject
|
||||
bool registerObject,
|
||||
bool globalObject
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
@ -298,14 +299,15 @@ Foam::IOobject::IOobject
|
||||
note_(),
|
||||
instance_(instance),
|
||||
local_(),
|
||||
db_(registry),
|
||||
rOpt_(ro),
|
||||
wOpt_(wo),
|
||||
registerObject_(registerObject),
|
||||
globalObject_(false),
|
||||
globalObject_(globalObject),
|
||||
objState_(GOOD),
|
||||
labelByteSize_(sizeof(label)),
|
||||
scalarByteSize_(sizeof(scalar))
|
||||
sizeofLabel_(static_cast<unsigned char>(sizeof(label))),
|
||||
sizeofScalar_(static_cast<unsigned char>(sizeof(scalar))),
|
||||
|
||||
db_(registry)
|
||||
{
|
||||
if (objectRegistry::debug)
|
||||
{
|
||||
@ -334,14 +336,15 @@ Foam::IOobject::IOobject
|
||||
note_(),
|
||||
instance_(instance),
|
||||
local_(local),
|
||||
db_(registry),
|
||||
rOpt_(ro),
|
||||
wOpt_(wo),
|
||||
registerObject_(registerObject),
|
||||
globalObject_(globalObject),
|
||||
objState_(GOOD),
|
||||
labelByteSize_(sizeof(label)),
|
||||
scalarByteSize_(sizeof(scalar))
|
||||
sizeofLabel_(static_cast<unsigned char>(sizeof(label))),
|
||||
sizeofScalar_(static_cast<unsigned char>(sizeof(scalar))),
|
||||
|
||||
db_(registry)
|
||||
{
|
||||
if (objectRegistry::debug)
|
||||
{
|
||||
@ -368,14 +371,15 @@ Foam::IOobject::IOobject
|
||||
note_(),
|
||||
instance_(),
|
||||
local_(),
|
||||
db_(registry),
|
||||
rOpt_(ro),
|
||||
wOpt_(wo),
|
||||
registerObject_(registerObject),
|
||||
globalObject_(globalObject),
|
||||
objState_(GOOD),
|
||||
labelByteSize_(sizeof(label)),
|
||||
scalarByteSize_(sizeof(scalar))
|
||||
sizeofLabel_(static_cast<unsigned char>(sizeof(label))),
|
||||
sizeofScalar_(static_cast<unsigned char>(sizeof(scalar))),
|
||||
|
||||
db_(registry)
|
||||
{
|
||||
if (!fileNameComponents(path, instance_, local_, name_))
|
||||
{
|
||||
@ -405,14 +409,15 @@ Foam::IOobject::IOobject
|
||||
note_(io.note_),
|
||||
instance_(io.instance_),
|
||||
local_(io.local_),
|
||||
db_(registry),
|
||||
rOpt_(io.rOpt_),
|
||||
wOpt_(io.wOpt_),
|
||||
registerObject_(io.registerObject_),
|
||||
globalObject_(io.globalObject_),
|
||||
objState_(io.objState_),
|
||||
labelByteSize_(io.labelByteSize_),
|
||||
scalarByteSize_(io.scalarByteSize_)
|
||||
sizeofLabel_(io.sizeofLabel_),
|
||||
sizeofScalar_(io.sizeofScalar_),
|
||||
|
||||
db_(registry)
|
||||
{}
|
||||
|
||||
|
||||
@ -427,14 +432,15 @@ Foam::IOobject::IOobject
|
||||
note_(io.note_),
|
||||
instance_(io.instance_),
|
||||
local_(io.local_),
|
||||
db_(io.db_),
|
||||
rOpt_(io.rOpt_),
|
||||
wOpt_(io.wOpt_),
|
||||
registerObject_(io.registerObject_),
|
||||
globalObject_(io.globalObject_),
|
||||
objState_(io.objState_),
|
||||
labelByteSize_(io.labelByteSize_),
|
||||
scalarByteSize_(io.scalarByteSize_)
|
||||
sizeofLabel_(io.sizeofLabel_),
|
||||
sizeofScalar_(io.sizeofScalar_),
|
||||
|
||||
db_(io.db_)
|
||||
{}
|
||||
|
||||
|
||||
@ -566,8 +572,8 @@ void Foam::IOobject::operator=(const IOobject& io)
|
||||
wOpt_ = io.wOpt_;
|
||||
globalObject_ = io.globalObject_;
|
||||
objState_ = io.objState_;
|
||||
labelByteSize_ = io.labelByteSize_;
|
||||
scalarByteSize_ = io.scalarByteSize_;
|
||||
sizeofLabel_ = io.sizeofLabel_;
|
||||
sizeofScalar_ = io.sizeofScalar_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -163,9 +163,6 @@ private:
|
||||
//- Local path component
|
||||
fileName local_;
|
||||
|
||||
//- Reference to the objectRegistry
|
||||
const objectRegistry& db_;
|
||||
|
||||
//- Read option
|
||||
readOption rOpt_;
|
||||
|
||||
@ -181,11 +178,14 @@ private:
|
||||
//- IOobject state
|
||||
objectState objState_;
|
||||
|
||||
//- The label byte-size (could also be stored as byte)
|
||||
unsigned short labelByteSize_;
|
||||
//- The sizeof (label) in bytes, possibly read from the header
|
||||
unsigned char sizeofLabel_;
|
||||
|
||||
//- The scalar byte-size (could also be stored as byte)
|
||||
unsigned short scalarByteSize_;
|
||||
//- The sizeof (scalar) in bytes, possibly read from the header
|
||||
unsigned char sizeofScalar_;
|
||||
|
||||
//- Reference to the objectRegistry
|
||||
const objectRegistry& db_;
|
||||
|
||||
|
||||
protected:
|
||||
@ -294,7 +294,8 @@ public:
|
||||
const objectRegistry& registry,
|
||||
readOption r=NO_READ,
|
||||
writeOption w=NO_WRITE,
|
||||
bool registerObject=true
|
||||
bool registerObject = true,
|
||||
bool globalObject = false
|
||||
);
|
||||
|
||||
//- Construct from name, instance, local, registry, io options
|
||||
@ -306,7 +307,7 @@ public:
|
||||
const objectRegistry& registry,
|
||||
readOption r=NO_READ,
|
||||
writeOption w=NO_WRITE,
|
||||
bool registerObject=true,
|
||||
bool registerObject = true,
|
||||
bool globalObject = false
|
||||
);
|
||||
|
||||
@ -368,7 +369,7 @@ public:
|
||||
//- Return the local objectRegistry
|
||||
const objectRegistry& db() const;
|
||||
|
||||
//- Return time
|
||||
//- Return Time associated with the objectRegistry
|
||||
const Time& time() const;
|
||||
|
||||
//- Return name
|
||||
@ -404,11 +405,11 @@ public:
|
||||
//- Is object same for all processors?
|
||||
inline bool& globalObject();
|
||||
|
||||
//- The label byte-size, possibly read from the header
|
||||
inline unsigned labelByteSize() const;
|
||||
//- The sizeof (label) in bytes, possibly read from the header
|
||||
inline unsigned labelByteSize() const noexcept;
|
||||
|
||||
//- The scalar byte-size, possibly read from the header
|
||||
inline unsigned scalarByteSize() const;
|
||||
//- The sizeof (scalar) in bytes, possibly read from the header
|
||||
inline unsigned scalarByteSize() const noexcept;
|
||||
|
||||
|
||||
// Checks
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -133,15 +133,15 @@ inline bool& Foam::IOobject::globalObject()
|
||||
}
|
||||
|
||||
|
||||
inline unsigned Foam::IOobject::labelByteSize() const
|
||||
inline unsigned Foam::IOobject::labelByteSize() const noexcept
|
||||
{
|
||||
return labelByteSize_;
|
||||
return static_cast<unsigned>(sizeofLabel_);
|
||||
}
|
||||
|
||||
|
||||
inline unsigned Foam::IOobject::scalarByteSize() const
|
||||
inline unsigned Foam::IOobject::scalarByteSize() const noexcept
|
||||
{
|
||||
return scalarByteSize_;
|
||||
return static_cast<unsigned>(sizeofScalar_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -84,22 +84,22 @@ bool Foam::IOobject::readHeader(Istream& is)
|
||||
// The note entry is optional
|
||||
headerDict.readIfPresent("note", note_);
|
||||
|
||||
labelByteSize_ = sizeof(label);
|
||||
scalarByteSize_ = sizeof(scalar);
|
||||
sizeofLabel_ = sizeof(label);
|
||||
sizeofScalar_ = sizeof(scalar);
|
||||
|
||||
// The arch information is optional
|
||||
string arch;
|
||||
if (headerDict.readIfPresent("arch", arch))
|
||||
{
|
||||
unsigned val = foamVersion::labelByteSize(arch);
|
||||
if (val) labelByteSize_ = val;
|
||||
if (val) sizeofLabel_ = static_cast<unsigned char>(val);
|
||||
|
||||
val = foamVersion::scalarByteSize(arch);
|
||||
if (val) scalarByteSize_ = val;
|
||||
if (val) sizeofScalar_ = static_cast<unsigned char>(val);
|
||||
}
|
||||
|
||||
is.setLabelByteSize(labelByteSize_);
|
||||
is.setScalarByteSize(scalarByteSize_);
|
||||
is.setLabelByteSize(sizeofLabel_);
|
||||
is.setScalarByteSize(sizeofScalar_);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -186,8 +186,7 @@ bool Foam::decomposedBlockData::readMasterHeader(IOobject& io, Istream& is)
|
||||
void Foam::decomposedBlockData::writeHeader
|
||||
(
|
||||
Ostream& os,
|
||||
const IOstream::versionNumber version,
|
||||
const IOstream::streamFormat format,
|
||||
IOstreamOption streamOpt,
|
||||
const word& objectType,
|
||||
const string& note,
|
||||
const fileName& location,
|
||||
@ -197,8 +196,8 @@ void Foam::decomposedBlockData::writeHeader
|
||||
IOobject::writeBanner(os)
|
||||
<< "FoamFile" << nl
|
||||
<< '{' << nl
|
||||
<< " version " << version << ';' << nl
|
||||
<< " format " << format << ';' << nl
|
||||
<< " version " << streamOpt.version() << ';' << nl
|
||||
<< " format " << streamOpt.format() << ';' << nl
|
||||
<< " arch " << foamVersion::buildArch << ';' << nl;
|
||||
|
||||
if (Pstream::parRun())
|
||||
@ -274,8 +273,8 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlock
|
||||
List<char> data(is);
|
||||
is.fatalCheck("read(Istream&) : reading entry");
|
||||
|
||||
IOstream::versionNumber ver(IOstream::currentVersion);
|
||||
IOstream::streamFormat fmt;
|
||||
IOstreamOption::versionNumber ver(IOstreamOption::currentVersion);
|
||||
IOstreamOption::streamFormat fmt;
|
||||
unsigned labelByteSize;
|
||||
unsigned scalarByteSize;
|
||||
{
|
||||
@ -566,24 +565,24 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlocks
|
||||
//- Set stream properties from realIsPtr on master
|
||||
|
||||
// Scatter master header info
|
||||
string versionString;
|
||||
label formatValue;
|
||||
int verValue;
|
||||
int fmtValue;
|
||||
unsigned labelByteSize;
|
||||
unsigned scalarByteSize;
|
||||
if (UPstream::master(comm))
|
||||
{
|
||||
versionString = realIsPtr().version().str();
|
||||
formatValue = static_cast<label>(realIsPtr().format());
|
||||
verValue = realIsPtr().version().canonical();
|
||||
fmtValue = static_cast<int>(realIsPtr().format());
|
||||
labelByteSize = realIsPtr().labelByteSize();
|
||||
scalarByteSize = realIsPtr().scalarByteSize();
|
||||
}
|
||||
Pstream::scatter(versionString); //, Pstream::msgType(), comm);
|
||||
Pstream::scatter(formatValue); //, Pstream::msgType(), comm);
|
||||
Pstream::scatter(verValue); //, Pstream::msgType(), comm);
|
||||
Pstream::scatter(fmtValue); //, Pstream::msgType(), comm);
|
||||
Pstream::scatter(labelByteSize); //, Pstream::msgType(), comm);
|
||||
Pstream::scatter(scalarByteSize); //, Pstream::msgType(), comm);
|
||||
|
||||
realIsPtr().version(IOstream::versionNumber(versionString));
|
||||
realIsPtr().format(IOstream::streamFormat(formatValue));
|
||||
realIsPtr().version(IOstreamOption::versionNumber::canonical(verValue));
|
||||
realIsPtr().format(IOstreamOption::streamFormat(fmtValue));
|
||||
realIsPtr().setLabelByteSize(labelByteSize);
|
||||
realIsPtr().setScalarByteSize(scalarByteSize);
|
||||
|
||||
@ -971,20 +970,27 @@ bool Foam::decomposedBlockData::writeData(Ostream& os) const
|
||||
const List<char>& data = *this;
|
||||
|
||||
IOobject io(*this);
|
||||
IOstreamOption streamOpt(os);
|
||||
|
||||
int verValue;
|
||||
int fmtValue;
|
||||
|
||||
// Re-read my own data to find out the header information
|
||||
if (Pstream::master(comm_))
|
||||
{
|
||||
UIListStream headerStream(data);
|
||||
io.readHeader(headerStream);
|
||||
|
||||
verValue = headerStream.version().canonical();
|
||||
fmtValue = static_cast<int>(headerStream.format());
|
||||
}
|
||||
|
||||
// Scatter header information
|
||||
Pstream::scatter(verValue, Pstream::msgType(), comm_);
|
||||
Pstream::scatter(fmtValue, Pstream::msgType(), comm_);
|
||||
|
||||
string versionString(os.version().str());
|
||||
label formatValue(os.format());
|
||||
Pstream::scatter(versionString, Pstream::msgType(), comm_);
|
||||
Pstream::scatter(formatValue, Pstream::msgType(), comm_);
|
||||
streamOpt.version(IOstreamOption::versionNumber::canonical(verValue));
|
||||
streamOpt.format(IOstreamOption::streamFormat(fmtValue));
|
||||
|
||||
//word masterName(name());
|
||||
//Pstream::scatter(masterName, Pstream::msgType(), comm_);
|
||||
@ -999,11 +1005,10 @@ bool Foam::decomposedBlockData::writeData(Ostream& os) const
|
||||
|
||||
if (!Pstream::master(comm_))
|
||||
{
|
||||
writeHeader
|
||||
decomposedBlockData::writeHeader
|
||||
(
|
||||
os,
|
||||
IOstreamOption::versionNumber(versionString),
|
||||
IOstreamOption::streamFormat(formatValue),
|
||||
streamOpt,
|
||||
io.headerClassName(),
|
||||
io.note(),
|
||||
masterLocation,
|
||||
@ -1074,7 +1079,7 @@ Foam::label Foam::decomposedBlockData::numBlocks(const fileName& fName)
|
||||
label nBlocks = 0;
|
||||
|
||||
IFstream is(fName);
|
||||
is.fatalCheck("decomposedBlockData::numBlocks(const fileName&)");
|
||||
is.fatalCheck(FUNCTION_NAME);
|
||||
|
||||
if (!is.good())
|
||||
{
|
||||
|
||||
@ -67,7 +67,7 @@ protected:
|
||||
const label comm_;
|
||||
|
||||
|
||||
// Protected member functions
|
||||
// Protected Member Functions
|
||||
|
||||
//- Helper: determine number of processors whose recvSizes fits
|
||||
// ito maxBufferSize
|
||||
@ -154,8 +154,7 @@ public:
|
||||
static void writeHeader
|
||||
(
|
||||
Ostream& os,
|
||||
const IOstream::versionNumber version,
|
||||
const IOstream::streamFormat format,
|
||||
IOstreamOption streamOpt,
|
||||
const word& objectType,
|
||||
const string& note,
|
||||
const fileName& location,
|
||||
|
||||
@ -48,7 +48,7 @@ Foam::IFstream::IFstream
|
||||
Foam::ifstreamPointer(pathname),
|
||||
ISstream(*(ifstreamPointer::get()), pathname, streamOpt)
|
||||
{
|
||||
IOstream::compression(ifstreamPointer::whichCompression());
|
||||
IOstreamOption::compression(ifstreamPointer::whichCompression());
|
||||
|
||||
setClosed();
|
||||
|
||||
@ -73,7 +73,7 @@ Foam::IFstream::IFstream
|
||||
<< "Cannot open empty file name"
|
||||
<< Foam::endl;
|
||||
}
|
||||
else if (IOstreamOption::COMPRESSED == IOstream::compression())
|
||||
else if (IOstreamOption::COMPRESSED == IOstreamOption::compression())
|
||||
{
|
||||
InfoInFunction
|
||||
<< "Decompressing " << (this->name() + ".gz") << Foam::endl;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -76,7 +76,7 @@ public:
|
||||
(
|
||||
const fileName& pathname,
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = currentVersion
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion
|
||||
)
|
||||
:
|
||||
IFstream(pathname, IOstreamOption(fmt, ver))
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -81,12 +81,12 @@ public:
|
||||
(
|
||||
const fileName& pathname,
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = currentVersion,
|
||||
IOstreamOption::compressionType comp = IOstreamOption::UNCOMPRESSED,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion,
|
||||
IOstreamOption::compressionType cmp = IOstreamOption::UNCOMPRESSED,
|
||||
const bool append = false
|
||||
)
|
||||
:
|
||||
OFstream(pathname, IOstreamOption(fmt, comp, ver), append)
|
||||
OFstream(pathname, IOstreamOption(fmt, ver, cmp), append)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -54,9 +54,7 @@ void Foam::masterOFstream::checkWrite
|
||||
OFstream os
|
||||
(
|
||||
fName,
|
||||
IOstream::BINARY, //format(),
|
||||
version(),
|
||||
compression_,
|
||||
IOstreamOption(IOstreamOption::BINARY, version(), compression_),
|
||||
append_
|
||||
);
|
||||
if (!os.good())
|
||||
@ -189,7 +187,7 @@ Foam::masterOFstream::masterOFstream
|
||||
const bool valid
|
||||
)
|
||||
:
|
||||
OStringStream(streamOpt.format(), streamOpt.version()),
|
||||
OStringStream(streamOpt),
|
||||
pathName_(pathName),
|
||||
compression_(streamOpt.compression()),
|
||||
append_(append),
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -57,7 +57,7 @@ class masterOFstream
|
||||
|
||||
const fileName pathName_;
|
||||
|
||||
const IOstream::compressionType compression_;
|
||||
const IOstreamOption::compressionType compression_;
|
||||
|
||||
const bool append_;
|
||||
|
||||
@ -99,9 +99,9 @@ public:
|
||||
masterOFstream
|
||||
(
|
||||
const fileName& pathname,
|
||||
streamFormat fmt,
|
||||
versionNumber ver = currentVersion,
|
||||
compressionType comp = compressionType::UNCOMPRESSED,
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion,
|
||||
IOstreamOption::compressionType cmp = IOstreamOption::UNCOMPRESSED,
|
||||
const bool append = false,
|
||||
const bool valid = true
|
||||
)
|
||||
@ -109,7 +109,7 @@ public:
|
||||
masterOFstream
|
||||
(
|
||||
pathname,
|
||||
IOstreamOption(fmt, comp, ver),
|
||||
IOstreamOption(fmt, ver, cmp),
|
||||
append,
|
||||
valid
|
||||
)
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -64,6 +64,10 @@ using std::cin;
|
||||
using std::cout;
|
||||
using std::cerr;
|
||||
|
||||
// Additional constructors and methods (as per v2012 and earlier)
|
||||
#define Foam_IOstream_extras
|
||||
// COMPAT_OPENFOAM_ORG
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
@ -84,8 +88,8 @@ public:
|
||||
//- Enumeration for stream open/closed state
|
||||
enum streamAccess : char
|
||||
{
|
||||
CLOSED = 0, //!< stream not open
|
||||
OPENED //!< stream is open
|
||||
CLOSED = 0, //!< The stream is not open
|
||||
OPENED //!< The stream is open
|
||||
};
|
||||
|
||||
|
||||
@ -102,15 +106,17 @@ protected:
|
||||
//- Name for any generic stream - normally treat as readonly
|
||||
static fileName staticName_;
|
||||
|
||||
//- Mirror of internal stream io state
|
||||
std::ios_base::iostate ioState_;
|
||||
|
||||
//- The stream open/closed state
|
||||
streamAccess openClosed_;
|
||||
|
||||
ios_base::iostate ioState_;
|
||||
//- The sizeof (label), possibly read from the header
|
||||
unsigned char sizeofLabel_;
|
||||
|
||||
//- The label byte-size (could also be stored as byte)
|
||||
unsigned short labelByteSize_;
|
||||
|
||||
//- The scalar byte-size (could also be stored as byte)
|
||||
unsigned short scalarByteSize_;
|
||||
//- The sizeof (scalar), possibly read from the header
|
||||
unsigned char sizeofScalar_;
|
||||
|
||||
//- The file line
|
||||
label lineNumber_;
|
||||
@ -121,27 +127,27 @@ protected:
|
||||
// Access
|
||||
|
||||
//- Set stream opened
|
||||
void setOpened()
|
||||
void setOpened() noexcept
|
||||
{
|
||||
openClosed_ = OPENED;
|
||||
}
|
||||
|
||||
//- Set stream closed
|
||||
void setClosed()
|
||||
void setClosed() noexcept
|
||||
{
|
||||
openClosed_ = CLOSED;
|
||||
}
|
||||
|
||||
//- Set stream state
|
||||
void setState(ios_base::iostate state)
|
||||
void setState(std::ios_base::iostate state) noexcept
|
||||
{
|
||||
ioState_ = state;
|
||||
}
|
||||
|
||||
//- Set stream to be good
|
||||
void setGood()
|
||||
//- Set stream state to be good
|
||||
void setGood() noexcept
|
||||
{
|
||||
ioState_ = ios_base::iostate(0);
|
||||
ioState_ = std::ios_base::iostate(0);
|
||||
}
|
||||
|
||||
|
||||
@ -163,10 +169,10 @@ public:
|
||||
explicit IOstream(IOstreamOption streamOpt = IOstreamOption())
|
||||
:
|
||||
IOstreamOption(streamOpt),
|
||||
ioState_(std::ios_base::iostate(0)),
|
||||
openClosed_(CLOSED),
|
||||
ioState_(ios_base::iostate(0)),
|
||||
labelByteSize_(sizeof(label)),
|
||||
scalarByteSize_(sizeof(scalar)),
|
||||
sizeofLabel_(static_cast<unsigned char>(sizeof(label))),
|
||||
sizeofScalar_(static_cast<unsigned char>(sizeof(scalar))),
|
||||
lineNumber_(0)
|
||||
{
|
||||
setBad();
|
||||
@ -175,12 +181,12 @@ public:
|
||||
//- Construct with format, version (compression)
|
||||
IOstream
|
||||
(
|
||||
streamFormat fmt,
|
||||
versionNumber ver,
|
||||
compressionType comp = compressionType::UNCOMPRESSED
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver,
|
||||
IOstreamOption::compressionType cmp = IOstreamOption::UNCOMPRESSED
|
||||
)
|
||||
:
|
||||
IOstream(IOstreamOption(fmt, comp, ver))
|
||||
IOstream(IOstreamOption(fmt, ver, cmp))
|
||||
{}
|
||||
|
||||
|
||||
@ -209,50 +215,50 @@ public:
|
||||
// Generate a FatalIOError when an error has occurred.
|
||||
bool fatalCheck(const char* operation) const;
|
||||
|
||||
//- Return true if stream has been opened
|
||||
bool opened() const
|
||||
//- True if stream has been opened
|
||||
bool opened() const noexcept
|
||||
{
|
||||
return openClosed_ == OPENED;
|
||||
}
|
||||
|
||||
//- Return true if stream is closed
|
||||
bool closed() const
|
||||
//- True if stream is closed
|
||||
bool closed() const noexcept
|
||||
{
|
||||
return openClosed_ == CLOSED;
|
||||
}
|
||||
|
||||
//- Return true if next operation might succeed
|
||||
bool good() const
|
||||
//- True if next operation might succeed
|
||||
bool good() const noexcept
|
||||
{
|
||||
return ioState_ == 0;
|
||||
}
|
||||
|
||||
//- Return true if end of input seen
|
||||
bool eof() const
|
||||
//- True if end of input seen
|
||||
bool eof() const noexcept
|
||||
{
|
||||
return ioState_ & ios_base::eofbit;
|
||||
return ioState_ & std::ios_base::eofbit;
|
||||
}
|
||||
|
||||
//- Return true if next operation will fail
|
||||
bool fail() const
|
||||
//- True if next operation will fail
|
||||
bool fail() const noexcept
|
||||
{
|
||||
return ioState_ & (ios_base::badbit | ios_base::failbit);
|
||||
return ioState_ & (std::ios_base::badbit | std::ios_base::failbit);
|
||||
}
|
||||
|
||||
//- Return true if stream is corrupted
|
||||
bool bad() const
|
||||
//- True if stream is corrupted
|
||||
bool bad() const noexcept
|
||||
{
|
||||
return ioState_ & ios_base::badbit;
|
||||
return ioState_ & std::ios_base::badbit;
|
||||
}
|
||||
|
||||
//- Return true if the stream has not failed
|
||||
explicit operator bool() const
|
||||
explicit operator bool() const noexcept
|
||||
{
|
||||
return !fail();
|
||||
}
|
||||
|
||||
//- Return true if the stream has failed
|
||||
bool operator!() const
|
||||
bool operator!() const noexcept
|
||||
{
|
||||
return fail();
|
||||
}
|
||||
@ -260,28 +266,28 @@ public:
|
||||
|
||||
// Element sizes (precision)
|
||||
|
||||
//- The label byte-size associated with the stream
|
||||
unsigned labelByteSize() const
|
||||
//- The sizeof (label) in bytes associated with the stream
|
||||
unsigned labelByteSize() const noexcept
|
||||
{
|
||||
return labelByteSize_;
|
||||
return static_cast<unsigned>(sizeofLabel_);
|
||||
}
|
||||
|
||||
//- The scalar byte-size associated with the stream
|
||||
unsigned scalarByteSize() const
|
||||
//- The sizeof (scalar) in bytes associated with the stream
|
||||
unsigned scalarByteSize() const noexcept
|
||||
{
|
||||
return scalarByteSize_;
|
||||
return static_cast<unsigned>(sizeofScalar_);
|
||||
}
|
||||
|
||||
//- Set the label byte-size associated with the stream
|
||||
void setLabelByteSize(unsigned nbytes)
|
||||
//- Set the sizeof (label) in bytes associated with the stream
|
||||
void setLabelByteSize(unsigned nbytes) noexcept
|
||||
{
|
||||
labelByteSize_ = nbytes;
|
||||
sizeofLabel_ = static_cast<unsigned char>(nbytes);
|
||||
}
|
||||
|
||||
//- Set the scalar byte-size associated with the stream
|
||||
void setScalarByteSize(unsigned nbytes)
|
||||
//- Set the sizeof (scalar) in bytes associated with the stream
|
||||
void setScalarByteSize(unsigned nbytes) noexcept
|
||||
{
|
||||
scalarByteSize_ = nbytes;
|
||||
sizeofScalar_ = static_cast<unsigned char>(nbytes);
|
||||
}
|
||||
|
||||
|
||||
@ -289,38 +295,38 @@ public:
|
||||
//- is the same as the given type
|
||||
template<class T = label>
|
||||
typename std::enable_if<std::is_integral<T>::value, bool>::type
|
||||
checkLabelSize() const
|
||||
checkLabelSize() const noexcept
|
||||
{
|
||||
return labelByteSize_ == sizeof(T);
|
||||
return sizeofLabel_ == sizeof(T);
|
||||
}
|
||||
|
||||
//- Check if the scalar byte-size associated with the stream
|
||||
//- is the same as the given type
|
||||
template<class T = scalar>
|
||||
typename std::enable_if<std::is_floating_point<T>::value, bool>::type
|
||||
checkScalarSize() const
|
||||
checkScalarSize() const noexcept
|
||||
{
|
||||
return scalarByteSize_ == sizeof(T);
|
||||
return sizeofScalar_ == sizeof(T);
|
||||
}
|
||||
|
||||
|
||||
// Stream State Functions
|
||||
|
||||
//- Const access to the current stream line number
|
||||
label lineNumber() const
|
||||
label lineNumber() const noexcept
|
||||
{
|
||||
return lineNumber_;
|
||||
}
|
||||
|
||||
//- Non-const access to the current stream line number
|
||||
label& lineNumber()
|
||||
label& lineNumber() noexcept
|
||||
{
|
||||
return lineNumber_;
|
||||
}
|
||||
|
||||
//- Set the stream line number
|
||||
// \return the previous value
|
||||
label lineNumber(const label num)
|
||||
label lineNumber(const label num) noexcept
|
||||
{
|
||||
const label old(lineNumber_);
|
||||
lineNumber_ = num;
|
||||
@ -331,36 +337,36 @@ public:
|
||||
virtual ios_base::fmtflags flags() const = 0;
|
||||
|
||||
//- Return the default precision
|
||||
static unsigned int defaultPrecision()
|
||||
static unsigned int defaultPrecision() noexcept
|
||||
{
|
||||
return precision_;
|
||||
}
|
||||
|
||||
//- Reset the default precision
|
||||
// \return the previous value
|
||||
static unsigned int defaultPrecision(unsigned int prec)
|
||||
static unsigned int defaultPrecision(unsigned int prec) noexcept
|
||||
{
|
||||
unsigned int old(precision_);
|
||||
precision_ = prec;
|
||||
return old;
|
||||
}
|
||||
|
||||
//- Set stream to have reached eof
|
||||
void setEof()
|
||||
//- Set stream state as reached 'eof'
|
||||
void setEof() noexcept
|
||||
{
|
||||
ioState_ |= ios_base::eofbit;
|
||||
ioState_ |= std::ios_base::eofbit;
|
||||
}
|
||||
|
||||
//- Set stream to have failed
|
||||
void setFail()
|
||||
//- Set stream state as 'failed'
|
||||
void setFail() noexcept
|
||||
{
|
||||
ioState_ |= ios_base::failbit;
|
||||
ioState_ |= std::ios_base::failbit;
|
||||
}
|
||||
|
||||
//- Set stream to be bad
|
||||
//- Set stream state to be 'bad'
|
||||
void setBad()
|
||||
{
|
||||
ioState_ |= ios_base::badbit;
|
||||
ioState_ |= std::ios_base::badbit;
|
||||
}
|
||||
|
||||
//- Set flags of stream
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -123,6 +123,30 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- A string representation as major.minor
|
||||
std::string str() const
|
||||
{
|
||||
return
|
||||
(
|
||||
std::to_string(int(number_ / 10)) // major
|
||||
+ '.'
|
||||
+ std::to_string(int(number_ % 10)) // minor
|
||||
);
|
||||
}
|
||||
|
||||
//- From version to canonical integer value
|
||||
int canonical() const noexcept
|
||||
{
|
||||
return number_;
|
||||
}
|
||||
|
||||
//- From canonical integer value to version
|
||||
static versionNumber canonical(int verNum) noexcept
|
||||
{
|
||||
// Split into major/minor
|
||||
return versionNumber(int(verNum / 10), int(verNum % 10));
|
||||
}
|
||||
|
||||
//- Compare differences in the versions
|
||||
// Negative when 'this' is less than other.
|
||||
// Positive when 'this' is greater than other.
|
||||
@ -130,33 +154,6 @@ public:
|
||||
{
|
||||
return number_ - other.number_;
|
||||
}
|
||||
|
||||
//- The canonical major/minor pair as an integer value.
|
||||
int canonical() noexcept
|
||||
{
|
||||
return number_;
|
||||
}
|
||||
|
||||
//- Return the major version number.
|
||||
int getMajor() const noexcept
|
||||
{
|
||||
return int(number_ / 10);
|
||||
}
|
||||
|
||||
//- Return the minor version number
|
||||
int getMinor() const noexcept
|
||||
{
|
||||
return int(number_ % 10);
|
||||
}
|
||||
|
||||
//- A string representation of major.minor
|
||||
std::string str() const
|
||||
{
|
||||
return
|
||||
std::to_string(getMajor())
|
||||
+ '.'
|
||||
+ std::to_string(getMinor());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -364,6 +361,8 @@ public:
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
//- Output format type as text string (ascii | binary)
|
||||
Ostream& operator<<(Ostream& os, const IOstreamOption::streamFormat& fmt);
|
||||
|
||||
@ -371,6 +370,8 @@ Ostream& operator<<(Ostream& os, const IOstreamOption::streamFormat& fmt);
|
||||
Ostream& operator<<(Ostream& os, const IOstreamOption::versionNumber& ver);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * //
|
||||
|
||||
// Comparison Operators
|
||||
|
||||
//- Version number equality
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -96,12 +96,12 @@ public:
|
||||
//- Construct with format, version (compression)
|
||||
explicit Istream
|
||||
(
|
||||
streamFormat fmt,
|
||||
versionNumber ver = currentVersion,
|
||||
compressionType comp = compressionType::UNCOMPRESSED
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion,
|
||||
IOstreamOption::compressionType cmp = IOstreamOption::UNCOMPRESSED
|
||||
)
|
||||
:
|
||||
Istream(IOstreamOption(fmt, comp, ver))
|
||||
Istream(IOstreamOption(fmt, ver, cmp))
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -96,12 +96,12 @@ public:
|
||||
//- Construct with format, version (compression)
|
||||
explicit Ostream
|
||||
(
|
||||
streamFormat fmt,
|
||||
versionNumber ver = currentVersion,
|
||||
compressionType comp = compressionType::UNCOMPRESSED
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion,
|
||||
IOstreamOption::compressionType cmp = IOstreamOption::UNCOMPRESSED
|
||||
)
|
||||
:
|
||||
Ostream(IOstreamOption(fmt, comp, ver))
|
||||
Ostream(IOstreamOption(fmt, ver, cmp))
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -36,8 +37,8 @@ Foam::IPstream::IPstream
|
||||
const label bufSize,
|
||||
const int tag,
|
||||
const label comm,
|
||||
streamFormat format,
|
||||
versionNumber version
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver
|
||||
)
|
||||
:
|
||||
Pstream(commsType, bufSize),
|
||||
@ -50,8 +51,8 @@ Foam::IPstream::IPstream
|
||||
tag, // tag
|
||||
comm,
|
||||
false, // do not clear buf_ if at end
|
||||
format,
|
||||
version
|
||||
fmt,
|
||||
ver
|
||||
),
|
||||
externalBufPosition_(0)
|
||||
{}
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -64,7 +65,7 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct given process index to read from and optional buffer size,
|
||||
// read format and IO version
|
||||
//- read format and IO version
|
||||
IPstream
|
||||
(
|
||||
const commsTypes commsType,
|
||||
@ -72,10 +73,9 @@ public:
|
||||
const label bufSize = 0,
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm,
|
||||
streamFormat format=BINARY,
|
||||
versionNumber version=currentVersion
|
||||
IOstreamOption::streamFormat fmt = IOstreamOption::BINARY,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -36,12 +37,12 @@ Foam::OPstream::OPstream
|
||||
const label bufSize,
|
||||
const int tag,
|
||||
const label comm,
|
||||
streamFormat format,
|
||||
versionNumber version
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver
|
||||
)
|
||||
:
|
||||
Pstream(commsType, bufSize),
|
||||
UOPstream(commsType, toProcNo, buf_, tag, comm, true, format, version)
|
||||
UOPstream(commsType, toProcNo, buf_, tag, comm, true, fmt, ver)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -55,13 +56,12 @@ class OPstream
|
||||
public Pstream,
|
||||
public UOPstream
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct given process index to send to and optional buffer size,
|
||||
// write format and IO version
|
||||
//- write format and IO version
|
||||
OPstream
|
||||
(
|
||||
const commsTypes commsType,
|
||||
@ -69,10 +69,9 @@ public:
|
||||
const label bufSize = 0,
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm,
|
||||
streamFormat format=BINARY,
|
||||
versionNumber version=currentVersion
|
||||
IOstreamOption::streamFormat fmt = IOstreamOption::BINARY,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -39,15 +40,15 @@ Foam::PstreamBuffers::PstreamBuffers
|
||||
const UPstream::commsTypes commsType,
|
||||
const int tag,
|
||||
const label comm,
|
||||
IOstream::streamFormat format,
|
||||
IOstream::versionNumber version
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver
|
||||
)
|
||||
:
|
||||
commsType_(commsType),
|
||||
tag_(tag),
|
||||
comm_(comm),
|
||||
format_(format),
|
||||
version_(version),
|
||||
format_(fmt),
|
||||
version_(ver),
|
||||
sendBuf_(UPstream::nProcs(comm)),
|
||||
recvBuf_(UPstream::nProcs(comm)),
|
||||
recvBufPos_(UPstream::nProcs(comm), 0),
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -99,9 +100,9 @@ class PstreamBuffers
|
||||
|
||||
const label comm_;
|
||||
|
||||
const IOstream::streamFormat format_;
|
||||
const IOstreamOption::streamFormat format_;
|
||||
|
||||
const IOstream::versionNumber version_;
|
||||
const IOstreamOption::versionNumber version_;
|
||||
|
||||
//- Send buffer
|
||||
List<DynamicList<char>> sendBuf_;
|
||||
@ -130,8 +131,8 @@ public:
|
||||
const UPstream::commsTypes commsType,
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm,
|
||||
IOstream::streamFormat format=IOstream::BINARY,
|
||||
IOstream::versionNumber version=IOstream::currentVersion
|
||||
IOstreamOption::streamFormat vmt = IOstreamOption::BINARY,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion
|
||||
);
|
||||
|
||||
//- Destructor
|
||||
|
||||
@ -101,7 +101,7 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct given process index to read from and optional buffer size,
|
||||
// read format and IO version
|
||||
//- read format and IO version
|
||||
UIPstream
|
||||
(
|
||||
const commsTypes commsType,
|
||||
@ -111,8 +111,8 @@ public:
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm,
|
||||
const bool clearAtEnd = false, // destroy externalBuf if at end
|
||||
streamFormat format=BINARY,
|
||||
versionNumber version=currentVersion
|
||||
IOstreamOption::streamFormat fmt = IOstreamOption::BINARY,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion
|
||||
);
|
||||
|
||||
//- Construct given buffers
|
||||
|
||||
@ -126,12 +126,12 @@ Foam::UOPstream::UOPstream
|
||||
const int tag,
|
||||
const label comm,
|
||||
const bool sendAtDestruct,
|
||||
streamFormat format,
|
||||
versionNumber version
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver
|
||||
)
|
||||
:
|
||||
UPstream(commsType),
|
||||
Ostream(format, version),
|
||||
Ostream(fmt, ver),
|
||||
toProcNo_(toProcNo),
|
||||
sendBuf_(sendBuf),
|
||||
tag_(tag),
|
||||
|
||||
@ -113,8 +113,8 @@ public:
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm,
|
||||
const bool sendAtDestruct = true,
|
||||
streamFormat format=BINARY,
|
||||
versionNumber version=currentVersion
|
||||
IOstreamOption::streamFormat fmt = IOstreamOption::BINARY,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion
|
||||
);
|
||||
|
||||
//- Construct given buffers
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -103,12 +103,12 @@ public:
|
||||
(
|
||||
std::istream& is,
|
||||
const string& streamName,
|
||||
streamFormat fmt,
|
||||
versionNumber ver = currentVersion,
|
||||
compressionType comp = compressionType::UNCOMPRESSED
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion,
|
||||
IOstreamOption::compressionType cmp = IOstreamOption::UNCOMPRESSED
|
||||
)
|
||||
:
|
||||
ISstream(is, streamName, IOstreamOption(fmt, comp, ver))
|
||||
ISstream(is, streamName, IOstreamOption(fmt, ver, cmp))
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -90,12 +90,12 @@ public:
|
||||
(
|
||||
std::ostream& os,
|
||||
const string& streamName,
|
||||
streamFormat fmt,
|
||||
versionNumber ver = currentVersion,
|
||||
compressionType comp = compressionType::UNCOMPRESSED
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion,
|
||||
IOstreamOption::compressionType cmp = IOstreamOption::UNCOMPRESSED
|
||||
)
|
||||
:
|
||||
OSstream(os, streamName, IOstreamOption(fmt, comp, ver))
|
||||
OSstream(os, streamName, IOstreamOption(fmt, ver, cmp))
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -28,7 +28,7 @@ Class
|
||||
Foam::prefixOSstream
|
||||
|
||||
Description
|
||||
Version of OSstream which prints a prefix on each line.
|
||||
Version of OSstream that prints a prefix on each line.
|
||||
|
||||
This is useful for running in parallel as it allows the processor number
|
||||
to be automatically prepended to each message line.
|
||||
@ -85,12 +85,12 @@ public:
|
||||
(
|
||||
std::ostream& os,
|
||||
const string& streamName,
|
||||
streamFormat fmt,
|
||||
versionNumber ver = currentVersion,
|
||||
compressionType comp = compressionType::UNCOMPRESSED
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion,
|
||||
IOstreamOption::compressionType cmp = IOstreamOption::UNCOMPRESSED
|
||||
)
|
||||
:
|
||||
prefixOSstream(os, streamName, IOstreamOption(fmt, comp, ver))
|
||||
prefixOSstream(os, streamName, IOstreamOption(fmt, ver, cmp))
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -71,10 +71,7 @@ protected:
|
||||
// Constructors
|
||||
|
||||
//- Default construct
|
||||
StringStreamAllocator()
|
||||
:
|
||||
stream_()
|
||||
{}
|
||||
StringStreamAllocator() = default;
|
||||
|
||||
//- Copy construct from string
|
||||
StringStreamAllocator(const std::string& s)
|
||||
@ -107,7 +104,7 @@ public:
|
||||
Class IStringStream Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
//- Input from string buffer, using a ISstream
|
||||
//- Input from string buffer, using a ISstream. Always UNCOMPRESSED.
|
||||
class IStringStream
|
||||
:
|
||||
public Detail::StringStreamAllocator<std::istringstream>,
|
||||
@ -119,41 +116,36 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Default construct
|
||||
//- Default construct or with specified stream option
|
||||
explicit IStringStream
|
||||
(
|
||||
streamFormat format=ASCII,
|
||||
versionNumber version=currentVersion
|
||||
IOstreamOption streamOpt = IOstreamOption()
|
||||
)
|
||||
:
|
||||
allocator_type(),
|
||||
ISstream(stream_, "input", format, version)
|
||||
ISstream(stream_, "input", streamOpt.format(), streamOpt.version())
|
||||
{}
|
||||
|
||||
//- Construct from std::string
|
||||
explicit IStringStream
|
||||
(
|
||||
const std::string& s,
|
||||
streamFormat format=ASCII,
|
||||
versionNumber version=currentVersion,
|
||||
const Foam::string& name="input"
|
||||
IOstreamOption streamOpt = IOstreamOption()
|
||||
)
|
||||
:
|
||||
allocator_type(s),
|
||||
ISstream(stream_, name, format, version)
|
||||
ISstream(stream_, "input", streamOpt.format(), streamOpt.version())
|
||||
{}
|
||||
|
||||
//- Construct from char*
|
||||
explicit IStringStream
|
||||
(
|
||||
const char* s,
|
||||
streamFormat format=ASCII,
|
||||
versionNumber version=currentVersion,
|
||||
const Foam::string& name="input"
|
||||
IOstreamOption streamOpt = IOstreamOption()
|
||||
)
|
||||
:
|
||||
allocator_type(s),
|
||||
ISstream(stream_, name, format, version)
|
||||
ISstream(stream_, "input", streamOpt.format(), streamOpt.version())
|
||||
{}
|
||||
|
||||
//- Copy construct, copies content and format
|
||||
@ -185,6 +177,44 @@ public:
|
||||
{
|
||||
return const_cast<IStringStream&>(*this);
|
||||
}
|
||||
|
||||
|
||||
// Additional constructors and methods (as per v2012 and earlier)
|
||||
#ifdef Foam_IOstream_extras
|
||||
|
||||
//- Default construct
|
||||
explicit IStringStream
|
||||
(
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion
|
||||
)
|
||||
:
|
||||
IStringStream(IOstreamOption(fmt, ver))
|
||||
{}
|
||||
|
||||
//- Construct from std::string
|
||||
IStringStream
|
||||
(
|
||||
const std::string& s,
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion
|
||||
)
|
||||
:
|
||||
IStringStream(s, IOstreamOption(fmt, ver))
|
||||
{}
|
||||
|
||||
//- Construct from char*
|
||||
IStringStream
|
||||
(
|
||||
const char* s,
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion
|
||||
)
|
||||
:
|
||||
IStringStream(s, IOstreamOption(fmt, ver))
|
||||
{}
|
||||
|
||||
#endif /* Foam_IOstream_extras */
|
||||
};
|
||||
|
||||
|
||||
@ -192,7 +222,7 @@ public:
|
||||
Class OStringStream Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
//- Output to string buffer, using a OSstream
|
||||
//- Output to string buffer, using a OSstream. Always UNCOMPRESSED.
|
||||
class OStringStream
|
||||
:
|
||||
public Detail::StringStreamAllocator<std::ostringstream>,
|
||||
@ -204,15 +234,14 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Default construct
|
||||
//- Default construct or with specified stream option
|
||||
explicit OStringStream
|
||||
(
|
||||
streamFormat format=ASCII,
|
||||
versionNumber version=currentVersion
|
||||
IOstreamOption streamOpt = IOstreamOption()
|
||||
)
|
||||
:
|
||||
allocator_type(),
|
||||
OSstream(stream_, "output", format, version)
|
||||
OSstream(stream_, "output", streamOpt.format(), streamOpt.version())
|
||||
{}
|
||||
|
||||
//- Copy construct, copies content and format
|
||||
@ -241,6 +270,22 @@ public:
|
||||
|
||||
//- Print stream description to Ostream
|
||||
virtual void print(Ostream& os) const;
|
||||
|
||||
|
||||
// Older style, without stream option (including 2012 release)
|
||||
#ifdef Foam_IOstream_extras
|
||||
|
||||
//- Default construct
|
||||
explicit OStringStream
|
||||
(
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion
|
||||
)
|
||||
:
|
||||
OStringStream(IOstreamOption(fmt, ver))
|
||||
{}
|
||||
|
||||
#endif /* Foam_IOstream_extras */
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -55,10 +55,10 @@ Foam::label Foam::ITstream::parseStream(ISstream& is, tokenList& tokens)
|
||||
Foam::tokenList Foam::ITstream::parse
|
||||
(
|
||||
const UList<char>& input,
|
||||
streamFormat format
|
||||
IOstreamOption streamOpt
|
||||
)
|
||||
{
|
||||
UIListStream is(input, format, IOstream::currentVersion);
|
||||
UIListStream is(input, streamOpt);
|
||||
|
||||
tokenList tokens;
|
||||
parseStream(is, tokens);
|
||||
@ -69,16 +69,10 @@ Foam::tokenList Foam::ITstream::parse
|
||||
Foam::tokenList Foam::ITstream::parse
|
||||
(
|
||||
const std::string& input,
|
||||
streamFormat format
|
||||
IOstreamOption streamOpt
|
||||
)
|
||||
{
|
||||
UIListStream is
|
||||
(
|
||||
input.data(),
|
||||
input.size(),
|
||||
format,
|
||||
IOstream::currentVersion
|
||||
);
|
||||
UIListStream is(input.data(), input.size(), streamOpt);
|
||||
|
||||
tokenList tokens;
|
||||
parseStream(is, tokens);
|
||||
@ -89,10 +83,10 @@ Foam::tokenList Foam::ITstream::parse
|
||||
Foam::tokenList Foam::ITstream::parse
|
||||
(
|
||||
const char* input,
|
||||
streamFormat format
|
||||
IOstreamOption streamOpt
|
||||
)
|
||||
{
|
||||
UIListStream is(input, strlen(input), format, IOstream::currentVersion);
|
||||
UIListStream is(input, strlen(input), streamOpt);
|
||||
|
||||
tokenList tokens;
|
||||
parseStream(is, tokens);
|
||||
@ -141,16 +135,15 @@ Foam::ITstream::ITstream
|
||||
(
|
||||
const string& name,
|
||||
const UList<char>& input,
|
||||
streamFormat format,
|
||||
versionNumber version
|
||||
IOstreamOption streamOpt
|
||||
)
|
||||
:
|
||||
Istream(format, version),
|
||||
Istream(streamOpt.format(), streamOpt.version()),
|
||||
tokenList(),
|
||||
name_(name),
|
||||
tokenIndex_(0)
|
||||
{
|
||||
UIListStream is(input, format, version);
|
||||
UIListStream is(input, streamOpt);
|
||||
|
||||
parseStream(is, static_cast<tokenList&>(*this));
|
||||
ITstream::rewind();
|
||||
@ -161,16 +154,15 @@ Foam::ITstream::ITstream
|
||||
(
|
||||
const string& name,
|
||||
const std::string& input,
|
||||
streamFormat format,
|
||||
versionNumber version
|
||||
IOstreamOption streamOpt
|
||||
)
|
||||
:
|
||||
Istream(format, version),
|
||||
Istream(streamOpt.format(), streamOpt.version()),
|
||||
tokenList(),
|
||||
name_(name),
|
||||
tokenIndex_(0)
|
||||
{
|
||||
UIListStream is(input.data(), input.size(), format, version);
|
||||
UIListStream is(input.data(), input.size(), streamOpt);
|
||||
|
||||
parseStream(is, static_cast<tokenList&>(*this));
|
||||
ITstream::rewind();
|
||||
@ -181,16 +173,15 @@ Foam::ITstream::ITstream
|
||||
(
|
||||
const string& name,
|
||||
const char* input,
|
||||
streamFormat format,
|
||||
versionNumber version
|
||||
IOstreamOption streamOpt
|
||||
)
|
||||
:
|
||||
Istream(format, version),
|
||||
Istream(streamOpt.format(), streamOpt.version()),
|
||||
tokenList(),
|
||||
name_(name),
|
||||
tokenIndex_(0)
|
||||
{
|
||||
UIListStream is(input, strlen(input), format, version);
|
||||
UIListStream is(input, strlen(input), streamOpt);
|
||||
|
||||
parseStream(is, static_cast<tokenList&>(*this));
|
||||
ITstream::rewind();
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -115,16 +115,15 @@ public:
|
||||
setGood();
|
||||
}
|
||||
|
||||
//- Construct from components
|
||||
//- Construct from components, copying the tokens
|
||||
ITstream
|
||||
(
|
||||
const string& name,
|
||||
const UList<token>& tokens,
|
||||
streamFormat format=ASCII,
|
||||
versionNumber version=currentVersion
|
||||
IOstreamOption streamOpt = IOstreamOption()
|
||||
)
|
||||
:
|
||||
Istream(format, version),
|
||||
Istream(streamOpt.format(), streamOpt.version()),
|
||||
tokenList(tokens),
|
||||
name_(name),
|
||||
tokenIndex_(0)
|
||||
@ -138,11 +137,10 @@ public:
|
||||
(
|
||||
const string& name,
|
||||
List<token>&& tokens,
|
||||
streamFormat format=ASCII,
|
||||
versionNumber version=currentVersion
|
||||
IOstreamOption streamOpt = IOstreamOption()
|
||||
)
|
||||
:
|
||||
Istream(format, version),
|
||||
Istream(streamOpt.format(), streamOpt.version()),
|
||||
tokenList(std::move(tokens)),
|
||||
name_(name),
|
||||
tokenIndex_(0)
|
||||
@ -157,8 +155,7 @@ public:
|
||||
(
|
||||
const string& name,
|
||||
const UList<char>& input,
|
||||
streamFormat format=ASCII,
|
||||
versionNumber version=currentVersion
|
||||
IOstreamOption streamOpt = IOstreamOption()
|
||||
);
|
||||
|
||||
//- Construct token list by parsing the input string
|
||||
@ -167,8 +164,7 @@ public:
|
||||
(
|
||||
const string& name,
|
||||
const std::string& input,
|
||||
streamFormat format=ASCII,
|
||||
versionNumber version=currentVersion
|
||||
IOstreamOption streamOpt = IOstreamOption()
|
||||
);
|
||||
|
||||
//- Construct token list by parsing the input character sequence
|
||||
@ -177,8 +173,7 @@ public:
|
||||
(
|
||||
const string& name,
|
||||
const char* input,
|
||||
streamFormat format=ASCII,
|
||||
versionNumber version=currentVersion
|
||||
IOstreamOption streamOpt = IOstreamOption()
|
||||
);
|
||||
|
||||
|
||||
@ -193,7 +188,7 @@ public:
|
||||
static tokenList parse
|
||||
(
|
||||
const UList<char>& input,
|
||||
streamFormat format=ASCII
|
||||
IOstreamOption streamOpt = IOstreamOption()
|
||||
);
|
||||
|
||||
//- Create token list by parsing the input string until
|
||||
@ -201,7 +196,7 @@ public:
|
||||
static tokenList parse
|
||||
(
|
||||
const std::string& input,
|
||||
streamFormat format=ASCII
|
||||
IOstreamOption streamOpt = IOstreamOption()
|
||||
);
|
||||
|
||||
//- Create token list by parsing the input character sequence until
|
||||
@ -209,7 +204,7 @@ public:
|
||||
static tokenList parse
|
||||
(
|
||||
const char* input,
|
||||
streamFormat format=ASCII
|
||||
IOstreamOption streamOpt = IOstreamOption()
|
||||
);
|
||||
|
||||
|
||||
@ -359,6 +354,109 @@ public:
|
||||
|
||||
//- Move assignment of tokens, with rewind()
|
||||
void operator=(List<token>&& toks);
|
||||
|
||||
|
||||
// Additional constructors and methods (as per v2012 and earlier)
|
||||
#ifdef Foam_IOstream_extras
|
||||
|
||||
//- Construct from components, copying the tokens
|
||||
ITstream
|
||||
(
|
||||
const string& name,
|
||||
const UList<token>& tokens,
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion
|
||||
)
|
||||
:
|
||||
ITstream(name, tokens, IOstreamOption(fmt, ver))
|
||||
{}
|
||||
|
||||
//- Construct from components, transferring the tokens
|
||||
ITstream
|
||||
(
|
||||
const string& name,
|
||||
List<token>&& tokens,
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion
|
||||
)
|
||||
:
|
||||
ITstream(name, std::move(tokens), IOstreamOption(fmt, ver))
|
||||
{}
|
||||
|
||||
//- Construct token list by parsing the input character sequence
|
||||
// Uses UIListStream internally.
|
||||
ITstream
|
||||
(
|
||||
const string& name,
|
||||
const UList<char>& input,
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion
|
||||
)
|
||||
:
|
||||
ITstream(name, input, IOstreamOption(fmt, ver))
|
||||
{}
|
||||
|
||||
//- Construct token list by parsing the input string
|
||||
// Uses UIListStream internally.
|
||||
ITstream
|
||||
(
|
||||
const string& name,
|
||||
const std::string& input,
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion
|
||||
)
|
||||
:
|
||||
ITstream(name, input, IOstreamOption(fmt, ver))
|
||||
{}
|
||||
|
||||
//- Construct token list by parsing the input character sequence
|
||||
// Uses UIListStream internally.
|
||||
ITstream
|
||||
(
|
||||
const string& name,
|
||||
const char* input,
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion
|
||||
)
|
||||
:
|
||||
ITstream(name, input, IOstreamOption(fmt, ver))
|
||||
{}
|
||||
|
||||
|
||||
//- Create token list by parsing the input character sequence until
|
||||
//- no good tokens remain.
|
||||
static tokenList parse
|
||||
(
|
||||
const UList<char>& input,
|
||||
IOstreamOption::streamFormat fmt
|
||||
)
|
||||
{
|
||||
return parse(input, IOstreamOption(fmt));
|
||||
}
|
||||
|
||||
//- Create token list by parsing the input string until
|
||||
//- no good tokens remain.
|
||||
static tokenList parse
|
||||
(
|
||||
const std::string& input,
|
||||
IOstreamOption::streamFormat fmt
|
||||
)
|
||||
{
|
||||
return parse(input, IOstreamOption(fmt));
|
||||
}
|
||||
|
||||
//- Create token list by parsing the input character sequence until
|
||||
//- no good tokens remain.
|
||||
static tokenList parse
|
||||
(
|
||||
const char* input,
|
||||
IOstreamOption::streamFormat fmt
|
||||
)
|
||||
{
|
||||
return parse(input, IOstreamOption(fmt));
|
||||
}
|
||||
|
||||
#endif /* Foam_IOstream_extras */
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -143,7 +143,7 @@ Foam::Ostream& Foam::OTstream::write(const doubleScalar val)
|
||||
|
||||
Foam::Ostream& Foam::OTstream::write(const char* data, std::streamsize count)
|
||||
{
|
||||
if (format() != BINARY)
|
||||
if (format() != IOstreamOption::BINARY)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "stream format not binary"
|
||||
@ -173,7 +173,7 @@ Foam::Ostream& Foam::OTstream::writeRaw
|
||||
|
||||
bool Foam::OTstream::beginRawWrite(std::streamsize count)
|
||||
{
|
||||
if (format() != BINARY)
|
||||
if (format() != IOstreamOption::BINARY)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "stream format not binary"
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -73,16 +73,6 @@ public:
|
||||
setGood();
|
||||
}
|
||||
|
||||
//- Construct with format, version
|
||||
explicit OTstream
|
||||
(
|
||||
streamFormat fmt,
|
||||
versionNumber ver = currentVersion
|
||||
)
|
||||
:
|
||||
OTstream(IOstreamOption(fmt, ver))
|
||||
{}
|
||||
|
||||
//- Copy construct
|
||||
OTstream(const OTstream& os)
|
||||
:
|
||||
@ -268,6 +258,22 @@ public:
|
||||
|
||||
//- Print stream description to Ostream
|
||||
void print(Ostream& os) const;
|
||||
|
||||
|
||||
// Additional constructors and methods (as per v2012 and earlier)
|
||||
#ifdef Foam_IOstream_extras
|
||||
|
||||
//- Construct empty with format, version
|
||||
explicit OTstream
|
||||
(
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion
|
||||
)
|
||||
:
|
||||
OTstream(IOstreamOption(fmt, ver))
|
||||
{}
|
||||
|
||||
#endif /* Foam_IOstream_extras */
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -72,10 +72,8 @@ class osha1stream
|
||||
|
||||
public:
|
||||
|
||||
//- Construct null
|
||||
sha1buf()
|
||||
{}
|
||||
|
||||
//- Default construct
|
||||
sha1buf() = default;
|
||||
|
||||
//- Full access to the sha1
|
||||
inline SHA1& sha1()
|
||||
@ -94,7 +92,7 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
//- Default construct
|
||||
osha1stream()
|
||||
:
|
||||
std::ostream(&buf_)
|
||||
@ -114,7 +112,6 @@ public:
|
||||
{
|
||||
return buf_.sha1();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -140,11 +137,8 @@ protected:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
OSHA1streamAllocator()
|
||||
:
|
||||
stream_()
|
||||
{}
|
||||
//- Default construct
|
||||
OSHA1streamAllocator() = default;
|
||||
|
||||
|
||||
public:
|
||||
@ -170,7 +164,6 @@ public:
|
||||
{
|
||||
return stream_.sha1().clear();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} // End namespace Detail
|
||||
@ -201,14 +194,13 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct with an empty digest
|
||||
OSHA1stream
|
||||
explicit OSHA1stream
|
||||
(
|
||||
streamFormat format=ASCII,
|
||||
versionNumber version=currentVersion
|
||||
IOstreamOption streamOpt = IOstreamOption()
|
||||
)
|
||||
:
|
||||
allocator_type(),
|
||||
OSstream(stream_, "sha1", format, version)
|
||||
OSstream(stream_, "sha1", streamOpt.format(), streamOpt.version())
|
||||
{}
|
||||
|
||||
|
||||
@ -230,6 +222,22 @@ public:
|
||||
{
|
||||
sha1().clear();
|
||||
}
|
||||
|
||||
|
||||
// Additional constructors and methods (as per v2012 and earlier)
|
||||
#ifdef Foam_IOstream_extras
|
||||
|
||||
//- Construct empty
|
||||
explicit OSHA1stream
|
||||
(
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion
|
||||
)
|
||||
:
|
||||
OSHA1stream(IOstreamOption(fmt, ver))
|
||||
{}
|
||||
|
||||
#endif /* Foam_IOstream_extras */
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -48,7 +48,6 @@ See Also
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
namespace Detail
|
||||
{
|
||||
|
||||
@ -130,7 +129,7 @@ public:
|
||||
Class IListStream Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
//- An ISstream with internal List storage
|
||||
//- An ISstream with internal List storage. Always UNCOMPRESSED.
|
||||
class IListStream
|
||||
:
|
||||
public Detail::IListStreamAllocator,
|
||||
@ -145,26 +144,22 @@ public:
|
||||
//- Default construct with an empty list
|
||||
explicit IListStream
|
||||
(
|
||||
streamFormat format=ASCII,
|
||||
versionNumber version=currentVersion
|
||||
IOstreamOption streamOpt = IOstreamOption()
|
||||
)
|
||||
:
|
||||
allocator_type(),
|
||||
ISstream(stream_, "input", format, version)
|
||||
ISstream(stream_, "input", streamOpt.format(), streamOpt.version())
|
||||
{}
|
||||
|
||||
|
||||
//- Move construct from List
|
||||
explicit IListStream
|
||||
(
|
||||
::Foam::List<char>&& buffer, // Fully qualify (issue #1521)
|
||||
streamFormat format=ASCII,
|
||||
versionNumber version=currentVersion,
|
||||
const Foam::string& name="input"
|
||||
IOstreamOption streamOpt = IOstreamOption()
|
||||
)
|
||||
:
|
||||
allocator_type(std::move(buffer)),
|
||||
ISstream(stream_, name, format, version)
|
||||
ISstream(stream_, "input", streamOpt.format(), streamOpt.version())
|
||||
{}
|
||||
|
||||
|
||||
@ -173,13 +168,11 @@ public:
|
||||
explicit IListStream
|
||||
(
|
||||
DynamicList<char,SizeMin>&& buffer,
|
||||
streamFormat format=ASCII,
|
||||
versionNumber version=currentVersion,
|
||||
const Foam::string& name="input"
|
||||
IOstreamOption streamOpt = IOstreamOption()
|
||||
)
|
||||
:
|
||||
allocator_type(std::move(buffer)),
|
||||
ISstream(stream_, name, format, version)
|
||||
ISstream(stream_, "input", streamOpt.format(), streamOpt.version())
|
||||
{}
|
||||
|
||||
|
||||
@ -215,6 +208,47 @@ public:
|
||||
{
|
||||
return const_cast<Istream&>(static_cast<const Istream&>(*this));
|
||||
}
|
||||
|
||||
|
||||
// Additional constructors and methods (as per v2012 and earlier)
|
||||
#ifdef Foam_IOstream_extras
|
||||
|
||||
//- Construct with an empty list
|
||||
explicit IListStream
|
||||
(
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion
|
||||
)
|
||||
:
|
||||
IListStream(IOstreamOption(fmt, ver))
|
||||
{}
|
||||
|
||||
|
||||
//- Move construct from List
|
||||
IListStream
|
||||
(
|
||||
::Foam::List<char>&& buffer, // Fully qualify (issue #1521)
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion
|
||||
)
|
||||
:
|
||||
IListStream(std::move(buffer), IOstreamOption(fmt, ver))
|
||||
{}
|
||||
|
||||
|
||||
//- Move construct from DynamicList
|
||||
template<int SizeMin>
|
||||
explicit IListStream
|
||||
(
|
||||
DynamicList<char,SizeMin>&& buffer,
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion
|
||||
)
|
||||
:
|
||||
IListStream(std::move(buffer), IOstreamOption(fmt, ver))
|
||||
{}
|
||||
|
||||
#endif /* Foam_IOstream_extras */
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -260,12 +260,11 @@ public:
|
||||
//- Default construct
|
||||
explicit OCountStream
|
||||
(
|
||||
streamFormat format=ASCII,
|
||||
versionNumber version=currentVersion
|
||||
IOstreamOption streamOpt = IOstreamOption()
|
||||
)
|
||||
:
|
||||
allocator_type(),
|
||||
OSstream(stream_, "count", format, version)
|
||||
OSstream(stream_, "count", streamOpt.format(), streamOpt.version())
|
||||
{}
|
||||
|
||||
//- Copy construct
|
||||
@ -287,6 +286,23 @@ public:
|
||||
|
||||
//- Print stream description to Ostream
|
||||
virtual void print(Ostream& os) const;
|
||||
|
||||
|
||||
// Additional constructors and methods (as per v2012 and earlier)
|
||||
#ifdef Foam_IOstream_extras
|
||||
|
||||
//- Default construct
|
||||
explicit OCountStream
|
||||
(
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion
|
||||
)
|
||||
:
|
||||
OCountStream(IOstreamOption(fmt, ver))
|
||||
{}
|
||||
|
||||
|
||||
#endif /* Foam_IOstream_extras */
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -409,36 +409,33 @@ public:
|
||||
//- Default construct (empty output)
|
||||
explicit OListStream
|
||||
(
|
||||
streamFormat format=ASCII,
|
||||
versionNumber version=currentVersion
|
||||
IOstreamOption streamOpt = IOstreamOption()
|
||||
)
|
||||
:
|
||||
allocator_type(),
|
||||
OSstream(stream_, "output", format, version)
|
||||
OSstream(stream_, "output", streamOpt.format(), streamOpt.version())
|
||||
{}
|
||||
|
||||
//- Construct with initial reserved number of bytes
|
||||
explicit OListStream
|
||||
(
|
||||
size_t nbytes,
|
||||
streamFormat format=ASCII,
|
||||
versionNumber version=currentVersion
|
||||
IOstreamOption streamOpt = IOstreamOption()
|
||||
)
|
||||
:
|
||||
allocator_type(nbytes),
|
||||
OSstream(stream_, "output", format, version)
|
||||
OSstream(stream_, "output", streamOpt.format(), streamOpt.version())
|
||||
{}
|
||||
|
||||
//- Move construct from an existing List
|
||||
explicit OListStream
|
||||
(
|
||||
List<char>&& buffer,
|
||||
streamFormat format=ASCII,
|
||||
versionNumber version=currentVersion
|
||||
IOstreamOption streamOpt = IOstreamOption()
|
||||
)
|
||||
:
|
||||
allocator_type(std::move(buffer)),
|
||||
OSstream(stream_, "output", format, version)
|
||||
OSstream(stream_, "output", streamOpt.format(), streamOpt.version())
|
||||
{}
|
||||
|
||||
//- Move construct from an existing DynamicList
|
||||
@ -446,12 +443,11 @@ public:
|
||||
explicit OListStream
|
||||
(
|
||||
DynamicList<char,SizeMin>&& buffer,
|
||||
streamFormat format=ASCII,
|
||||
versionNumber version=currentVersion
|
||||
IOstreamOption streamOpt = IOstreamOption()
|
||||
)
|
||||
:
|
||||
allocator_type(std::move(buffer)),
|
||||
OSstream(stream_, "output", format, version)
|
||||
OSstream(stream_, "output", streamOpt.format(), streamOpt.version())
|
||||
{}
|
||||
|
||||
|
||||
@ -466,6 +462,56 @@ public:
|
||||
|
||||
//- Print stream description to Ostream
|
||||
virtual void print(Ostream& os) const;
|
||||
|
||||
|
||||
// Additional constructors and methods (as per v2012 and earlier)
|
||||
#ifdef Foam_IOstream_extras
|
||||
|
||||
//- Default construct (empty output)
|
||||
explicit OListStream
|
||||
(
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion
|
||||
)
|
||||
:
|
||||
OListStream(IOstreamOption(fmt, ver))
|
||||
{}
|
||||
|
||||
//- Construct with initial reserved number of bytes
|
||||
explicit OListStream
|
||||
(
|
||||
size_t nbytes,
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion
|
||||
)
|
||||
:
|
||||
OListStream(nbytes, IOstreamOption(fmt, ver))
|
||||
{}
|
||||
|
||||
//- Move construct from an existing List
|
||||
OListStream
|
||||
(
|
||||
List<char>&& buffer,
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion
|
||||
)
|
||||
:
|
||||
OListStream(std::move(buffer), IOstreamOption(fmt, ver))
|
||||
{}
|
||||
|
||||
//- Move construct from an existing DynamicList
|
||||
template<int SizeMin>
|
||||
OListStream
|
||||
(
|
||||
DynamicList<char,SizeMin>&& buffer,
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion
|
||||
)
|
||||
:
|
||||
OListStream(std::move(buffer), IOstreamOption(fmt, ver))
|
||||
{}
|
||||
|
||||
#endif /* Foam_IOstream_extras */
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -216,54 +216,44 @@ public:
|
||||
(
|
||||
const char* buffer,
|
||||
size_t nbytes,
|
||||
streamFormat format=ASCII,
|
||||
versionNumber version=currentVersion,
|
||||
const Foam::string& name="input"
|
||||
IOstreamOption streamOpt = IOstreamOption()
|
||||
)
|
||||
:
|
||||
allocator_type(const_cast<char*>(buffer), nbytes),
|
||||
ISstream(stream_, name, format, version)
|
||||
{}
|
||||
|
||||
|
||||
//- Construct using data area from a FixedList
|
||||
template<unsigned N>
|
||||
explicit UIListStream
|
||||
(
|
||||
const FixedList<char, N>& buffer,
|
||||
streamFormat format=ASCII,
|
||||
versionNumber version=currentVersion,
|
||||
const Foam::string& name="input"
|
||||
)
|
||||
:
|
||||
UIListStream(buffer.cdata(), N, format, version, name)
|
||||
ISstream(stream_, "input", streamOpt.format(), streamOpt.version())
|
||||
{}
|
||||
|
||||
//- Construct using data area from a List and number of bytes
|
||||
UIListStream
|
||||
(
|
||||
const UList<char>& buffer,
|
||||
label size,
|
||||
streamFormat format=ASCII,
|
||||
versionNumber version=currentVersion,
|
||||
const Foam::string& name="input"
|
||||
size_t nbytes,
|
||||
IOstreamOption streamOpt = IOstreamOption()
|
||||
)
|
||||
:
|
||||
UIListStream(buffer.cdata(), size, format, version, name)
|
||||
UIListStream(buffer.cdata(), nbytes, streamOpt)
|
||||
{}
|
||||
|
||||
|
||||
//- Construct using data area from a List and its inherent storage size
|
||||
// Uses addressed size, thus no special treatment for a DynamicList
|
||||
explicit UIListStream
|
||||
(
|
||||
const UList<char>& buffer,
|
||||
streamFormat format=ASCII,
|
||||
versionNumber version=currentVersion,
|
||||
const Foam::string& name="input"
|
||||
IOstreamOption streamOpt = IOstreamOption()
|
||||
)
|
||||
:
|
||||
UIListStream(buffer.cdata(), buffer.size(), format, version, name)
|
||||
UIListStream(buffer.cdata(), buffer.size(), streamOpt)
|
||||
{}
|
||||
|
||||
//- Construct using data area from a FixedList
|
||||
template<unsigned N>
|
||||
explicit UIListStream
|
||||
(
|
||||
const FixedList<char, N>& buffer,
|
||||
IOstreamOption streamOpt = IOstreamOption()
|
||||
)
|
||||
:
|
||||
UIListStream(buffer.cdata(), N, streamOpt)
|
||||
{}
|
||||
|
||||
|
||||
@ -294,6 +284,60 @@ public:
|
||||
{
|
||||
return const_cast<Istream&>(static_cast<const Istream&>(*this));
|
||||
}
|
||||
|
||||
|
||||
// Additional constructors and methods (as per v2012 and earlier)
|
||||
#ifdef Foam_IOstream_extras
|
||||
|
||||
//- Construct using specified buffer and number of bytes
|
||||
UIListStream
|
||||
(
|
||||
const char* buffer,
|
||||
size_t nbytes,
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion
|
||||
)
|
||||
:
|
||||
UIListStream(buffer, nbytes, IOstreamOption(fmt, ver))
|
||||
{}
|
||||
|
||||
//- Construct using data area from a List and number of bytes
|
||||
UIListStream
|
||||
(
|
||||
const UList<char>& buffer,
|
||||
size_t nbytes,
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion
|
||||
)
|
||||
:
|
||||
UIListStream(buffer.cdata(), nbytes, IOstreamOption(fmt, ver))
|
||||
{}
|
||||
|
||||
//- Construct using data area from a List and its inherent storage size
|
||||
// Uses addressed size, thus no special treatment for a DynamicList
|
||||
UIListStream
|
||||
(
|
||||
const UList<char>& buf,
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion
|
||||
)
|
||||
:
|
||||
UIListStream(buf.cdata(), buf.size(), IOstreamOption(fmt, ver))
|
||||
{}
|
||||
|
||||
//- Construct using data area from a FixedList
|
||||
template<unsigned N>
|
||||
UIListStream
|
||||
(
|
||||
const FixedList<char, N>& buffer,
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion
|
||||
)
|
||||
:
|
||||
UIListStream(buffer.cdata(), N, IOstreamOption(fmt, ver))
|
||||
{}
|
||||
|
||||
#endif /* Foam_IOstream_extras */
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -190,24 +190,32 @@ public:
|
||||
(
|
||||
char* buffer,
|
||||
size_t nbytes,
|
||||
streamFormat format=ASCII,
|
||||
versionNumber version=currentVersion
|
||||
IOstreamOption streamOpt = IOstreamOption()
|
||||
)
|
||||
:
|
||||
allocator_type(buffer, nbytes),
|
||||
OSstream(stream_, "output", format, version)
|
||||
OSstream(stream_, "output", streamOpt.format(), streamOpt.version())
|
||||
{}
|
||||
|
||||
//- Construct using data area from a List and number of bytes
|
||||
UOListStream
|
||||
(
|
||||
UList<char>& buffer,
|
||||
size_t size,
|
||||
streamFormat format=ASCII,
|
||||
versionNumber version=currentVersion
|
||||
size_t nbytes,
|
||||
IOstreamOption streamOpt = IOstreamOption()
|
||||
)
|
||||
:
|
||||
UOListStream(buffer.data(), size, format, version)
|
||||
UOListStream(buffer.data(), nbytes, streamOpt)
|
||||
{}
|
||||
|
||||
//- Construct using data area from a List and its inherent storage size
|
||||
explicit UOListStream
|
||||
(
|
||||
UList<char>& buffer,
|
||||
IOstreamOption streamOpt = IOstreamOption()
|
||||
)
|
||||
:
|
||||
UOListStream(buffer.data(), buffer.size(), streamOpt)
|
||||
{}
|
||||
|
||||
//- Construct using data area from a FixedList
|
||||
@ -215,35 +223,21 @@ public:
|
||||
explicit UOListStream
|
||||
(
|
||||
FixedList<char, N>& buffer,
|
||||
streamFormat format=ASCII,
|
||||
versionNumber version=currentVersion
|
||||
IOstreamOption streamOpt = IOstreamOption()
|
||||
)
|
||||
:
|
||||
UOListStream(buffer.data(), N, format, version)
|
||||
UOListStream(buffer.data(), N, streamOpt)
|
||||
{}
|
||||
|
||||
//- Construct using data area from a List and its inherent storage size
|
||||
explicit UOListStream
|
||||
(
|
||||
UList<char>& buffer,
|
||||
streamFormat format=ASCII,
|
||||
versionNumber version=currentVersion
|
||||
)
|
||||
:
|
||||
UOListStream(buffer.data(), buffer.size(), format, version)
|
||||
{}
|
||||
|
||||
|
||||
//- Construct using data area from a DynamicList and its capacity
|
||||
template<int SizeMin>
|
||||
explicit UOListStream
|
||||
(
|
||||
DynamicList<char,SizeMin>& buffer,
|
||||
streamFormat format=ASCII,
|
||||
versionNumber version=currentVersion
|
||||
IOstreamOption streamOpt = IOstreamOption()
|
||||
)
|
||||
:
|
||||
UOListStream(buffer.data(), buffer.capacity(), format, version)
|
||||
UOListStream(buffer.data(), buffer.capacity(), streamOpt)
|
||||
{}
|
||||
|
||||
|
||||
@ -258,6 +252,71 @@ public:
|
||||
|
||||
//- Print stream description to Ostream
|
||||
virtual void print(Ostream& os) const;
|
||||
|
||||
|
||||
// Additional constructors and methods (as per v2012 and earlier)
|
||||
#ifdef Foam_IOstream_extras
|
||||
|
||||
//- Construct using specified buffer and number of bytes
|
||||
UOListStream
|
||||
(
|
||||
char* buffer,
|
||||
size_t nbytes,
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion
|
||||
)
|
||||
:
|
||||
UOListStream(buffer, nbytes, IOstreamOption(fmt, ver))
|
||||
{}
|
||||
|
||||
//- Construct using data area from a List and number of bytes
|
||||
UOListStream
|
||||
(
|
||||
UList<char>& buffer,
|
||||
size_t nbytes,
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion
|
||||
)
|
||||
:
|
||||
UOListStream(buffer.data(), nbytes, IOstreamOption(fmt, ver))
|
||||
{}
|
||||
|
||||
//- Construct using data area from a List and its inherent storage size
|
||||
UOListStream
|
||||
(
|
||||
UList<char>& buffer,
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion
|
||||
)
|
||||
:
|
||||
UOListStream(buffer.data(), buffer.size(), IOstreamOption(fmt, ver))
|
||||
{}
|
||||
|
||||
//- Construct using data area from a FixedList
|
||||
template<unsigned N>
|
||||
UOListStream
|
||||
(
|
||||
FixedList<char, N>& buffer,
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion
|
||||
)
|
||||
:
|
||||
UOListStream(buffer.data(), N, IOstreamOption(fmt, ver))
|
||||
{}
|
||||
|
||||
//- Construct using data area from a DynamicList and its capacity
|
||||
template<int SizeMin>
|
||||
UOListStream
|
||||
(
|
||||
DynamicList<char,SizeMin>& buf,
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion
|
||||
)
|
||||
:
|
||||
UOListStream(buf.data(), buf.capacity(), IOstreamOption(fmt, ver))
|
||||
{}
|
||||
|
||||
#endif /* Foam_IOstream_extras */
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -249,7 +249,7 @@ void Foam::Time::readDict()
|
||||
|
||||
for (simpleRegIOobject* obj : objects)
|
||||
{
|
||||
OStringStream os(IOstream::ASCII);
|
||||
OStringStream os;
|
||||
os << dict;
|
||||
IStringStream is(os.str());
|
||||
obj->readData(is);
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -252,8 +252,7 @@ Foam::primitiveEntry::primitiveEntry
|
||||
(
|
||||
is.name() + '.' + key,
|
||||
tokenList(10),
|
||||
is.format(),
|
||||
is.version()
|
||||
static_cast<IOstreamOption>(is)
|
||||
)
|
||||
{
|
||||
readEntry(dict, is);
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -78,7 +78,7 @@ protected:
|
||||
//- Helper: check readOpt flags and read if necessary
|
||||
bool readHeaderOk
|
||||
(
|
||||
const IOstream::streamFormat PstreamFormat,
|
||||
const IOstreamOption::streamFormat fmt,
|
||||
const word& typeName
|
||||
);
|
||||
|
||||
@ -358,9 +358,9 @@ public:
|
||||
FOAM_DEPRECATED_FOR(2020-02, "writeObject(IOstreamOption, bool)")
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType comp,
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver,
|
||||
IOstreamOption::compressionType comp,
|
||||
const bool valid
|
||||
) const;
|
||||
};
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -37,7 +37,7 @@ License
|
||||
|
||||
bool Foam::regIOobject::readHeaderOk
|
||||
(
|
||||
const IOstream::streamFormat format,
|
||||
const IOstreamOption::streamFormat fmt,
|
||||
const word& typeName
|
||||
)
|
||||
{
|
||||
@ -77,7 +77,7 @@ bool Foam::regIOobject::readHeaderOk
|
||||
|| isHeaderOk
|
||||
)
|
||||
{
|
||||
return fileHandler().read(*this, masterOnly, format, typeName);
|
||||
return fileHandler().read(*this, masterOnly, fmt, typeName);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -28,7 +28,6 @@ License
|
||||
|
||||
#include "regIOobject.H"
|
||||
#include "Time.H"
|
||||
#include "OSspecific.H"
|
||||
#include "OFstream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -42,8 +41,7 @@ bool Foam::regIOobject::writeObject
|
||||
if (!good())
|
||||
{
|
||||
SeriousErrorInFunction
|
||||
<< "bad object " << name()
|
||||
<< endl;
|
||||
<< "bad object " << name() << endl;
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -51,8 +49,7 @@ bool Foam::regIOobject::writeObject
|
||||
if (instance().empty())
|
||||
{
|
||||
SeriousErrorInFunction
|
||||
<< "instance undefined for object " << name()
|
||||
<< endl;
|
||||
<< "instance undefined for object " << name() << endl;
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -97,9 +94,6 @@ bool Foam::regIOobject::writeObject
|
||||
}
|
||||
|
||||
|
||||
bool osGood = false;
|
||||
|
||||
|
||||
// Everyone check or just master
|
||||
bool masterOnly =
|
||||
isGlobal
|
||||
@ -108,36 +102,9 @@ bool Foam::regIOobject::writeObject
|
||||
|| regIOobject::fileModificationChecking == inotifyMaster
|
||||
);
|
||||
|
||||
|
||||
bool osGood = false;
|
||||
if (Pstream::master() || !masterOnly)
|
||||
{
|
||||
//if (mkDir(path()))
|
||||
//{
|
||||
// // Try opening an OFstream for object
|
||||
// OFstream os(objectPath(), streamOpt);
|
||||
//
|
||||
// // If any of these fail, return (leave error handling to Ostream
|
||||
// // class)
|
||||
// if (!os.good())
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// if (!writeHeader(os))
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// // Write the data to the Ostream
|
||||
// if (!writeData(os))
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// writeEndDivider(os);
|
||||
//
|
||||
// osGood = os.good();
|
||||
//}
|
||||
osGood = fileHandler().writeObject(*this, streamOpt, valid);
|
||||
}
|
||||
else
|
||||
@ -174,9 +141,9 @@ bool Foam::regIOobject::write(const bool valid) const
|
||||
|
||||
bool Foam::regIOobject::writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver,
|
||||
IOstreamOption::compressionType cmp,
|
||||
const bool valid
|
||||
) const
|
||||
{
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -57,7 +57,7 @@ void Foam::simpleObjectRegistry::setValues
|
||||
|
||||
if (dEntry.isDict())
|
||||
{
|
||||
OStringStream os(IOstream::ASCII);
|
||||
OStringStream os;
|
||||
os << dEntry.dict();
|
||||
IStringStream is(os.str());
|
||||
|
||||
|
||||
@ -44,14 +44,12 @@ namespace Foam
|
||||
bool Foam::OFstreamCollator::writeFile
|
||||
(
|
||||
const label comm,
|
||||
const word& typeName,
|
||||
const word& objectType,
|
||||
const fileName& fName,
|
||||
const string& masterData,
|
||||
const labelUList& recvSizes,
|
||||
const PtrList<SubList<char>>& slaveData, // optional slave data
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool append
|
||||
)
|
||||
{
|
||||
@ -79,17 +77,7 @@ bool Foam::OFstreamCollator::writeFile
|
||||
if (UPstream::master(comm))
|
||||
{
|
||||
Foam::mkDir(fName.path());
|
||||
osPtr.reset
|
||||
(
|
||||
new OFstream
|
||||
(
|
||||
fName,
|
||||
fmt,
|
||||
ver,
|
||||
cmp,
|
||||
append
|
||||
)
|
||||
);
|
||||
osPtr.reset(new OFstream(fName, streamOpt, append));
|
||||
|
||||
// We don't have IOobject so cannot use IOobject::writeHeader
|
||||
if (!append)
|
||||
@ -97,9 +85,8 @@ bool Foam::OFstreamCollator::writeFile
|
||||
decomposedBlockData::writeHeader
|
||||
(
|
||||
*osPtr,
|
||||
ver,
|
||||
fmt,
|
||||
typeName,
|
||||
streamOpt,
|
||||
objectType,
|
||||
"", // note
|
||||
fName, // location
|
||||
fName.name() // object name
|
||||
@ -195,7 +182,7 @@ void* Foam::OFstreamCollator::writeAll(void *threadarg)
|
||||
PtrList<SubList<char>> slaveData;
|
||||
if (ptr->slaveData_.size())
|
||||
{
|
||||
slaveData.setSize(ptr->slaveData_.size());
|
||||
slaveData.resize(ptr->slaveData_.size());
|
||||
forAll(slaveData, proci)
|
||||
{
|
||||
if (ptr->slaveData_.set(proci))
|
||||
@ -216,14 +203,12 @@ void* Foam::OFstreamCollator::writeAll(void *threadarg)
|
||||
bool ok = writeFile
|
||||
(
|
||||
ptr->comm_,
|
||||
ptr->typeName_,
|
||||
ptr->objectType_,
|
||||
ptr->pathName_,
|
||||
ptr->data_,
|
||||
ptr->sizes_,
|
||||
slaveData,
|
||||
ptr->format_,
|
||||
ptr->version_,
|
||||
ptr->compression_,
|
||||
ptr->streamOpt_,
|
||||
ptr->append_
|
||||
);
|
||||
if (!ok)
|
||||
@ -354,12 +339,10 @@ Foam::OFstreamCollator::~OFstreamCollator()
|
||||
|
||||
bool Foam::OFstreamCollator::write
|
||||
(
|
||||
const word& typeName,
|
||||
const word& objectType,
|
||||
const fileName& fName,
|
||||
const string& data,
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool append,
|
||||
const bool useThread
|
||||
)
|
||||
@ -393,14 +376,12 @@ bool Foam::OFstreamCollator::write
|
||||
return writeFile
|
||||
(
|
||||
localComm_,
|
||||
typeName,
|
||||
objectType,
|
||||
fName,
|
||||
data,
|
||||
recvSizes,
|
||||
dummySlaveData,
|
||||
fmt,
|
||||
ver,
|
||||
cmp,
|
||||
streamOpt,
|
||||
append
|
||||
);
|
||||
}
|
||||
@ -429,7 +410,7 @@ bool Foam::OFstreamCollator::write
|
||||
new writeData
|
||||
(
|
||||
threadComm_, // Note: comm not actually used anymore
|
||||
typeName,
|
||||
objectType,
|
||||
fName,
|
||||
(
|
||||
Pstream::master(localComm_)
|
||||
@ -437,9 +418,7 @@ bool Foam::OFstreamCollator::write
|
||||
: string::null
|
||||
),
|
||||
recvSizes,
|
||||
fmt,
|
||||
ver,
|
||||
cmp,
|
||||
streamOpt,
|
||||
append
|
||||
)
|
||||
);
|
||||
@ -559,13 +538,11 @@ bool Foam::OFstreamCollator::write
|
||||
new writeData
|
||||
(
|
||||
threadComm_,
|
||||
typeName,
|
||||
objectType,
|
||||
fName,
|
||||
data,
|
||||
recvSizes,
|
||||
fmt,
|
||||
ver,
|
||||
cmp,
|
||||
streamOpt,
|
||||
append
|
||||
)
|
||||
);
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2018 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -42,9 +43,6 @@ Description
|
||||
collecting is done locally; the thread only does the writing
|
||||
(since the data has already been collected)
|
||||
|
||||
|
||||
Operation determine
|
||||
|
||||
SourceFiles
|
||||
OFstreamCollator.C
|
||||
|
||||
@ -71,45 +69,39 @@ namespace Foam
|
||||
|
||||
class OFstreamCollator
|
||||
{
|
||||
// Private class
|
||||
// Private Class
|
||||
|
||||
class writeData
|
||||
{
|
||||
public:
|
||||
|
||||
const label comm_;
|
||||
const word typeName_;
|
||||
const word objectType_;
|
||||
const fileName pathName_;
|
||||
const string data_;
|
||||
const labelList sizes_;
|
||||
PtrList<List<char>> slaveData_;
|
||||
const IOstream::streamFormat format_;
|
||||
const IOstream::versionNumber version_;
|
||||
const IOstream::compressionType compression_;
|
||||
const IOstreamOption streamOpt_;
|
||||
const bool append_;
|
||||
|
||||
writeData
|
||||
(
|
||||
const label comm,
|
||||
const word& typeName,
|
||||
const word& objectType,
|
||||
const fileName& pathName,
|
||||
const string& data,
|
||||
const labelList& sizes,
|
||||
IOstream::streamFormat format,
|
||||
IOstream::versionNumber version,
|
||||
IOstream::compressionType compression,
|
||||
IOstreamOption streamOpt,
|
||||
const bool append
|
||||
)
|
||||
:
|
||||
comm_(comm),
|
||||
typeName_(typeName),
|
||||
objectType_(objectType),
|
||||
pathName_(pathName),
|
||||
data_(data),
|
||||
sizes_(sizes),
|
||||
slaveData_(0),
|
||||
format_(format),
|
||||
version_(version),
|
||||
compression_(compression),
|
||||
slaveData_(),
|
||||
streamOpt_(streamOpt),
|
||||
append_(append)
|
||||
{}
|
||||
|
||||
@ -157,14 +149,12 @@ class OFstreamCollator
|
||||
static bool writeFile
|
||||
(
|
||||
const label comm,
|
||||
const word& typeName,
|
||||
const word& objectType,
|
||||
const fileName& fName,
|
||||
const string& masterData,
|
||||
const labelUList& recvSizes,
|
||||
const PtrList<SubList<char>>& slaveData,
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool append
|
||||
);
|
||||
|
||||
@ -185,10 +175,10 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct from buffer size. 0 = do not use thread
|
||||
OFstreamCollator(const off_t maxBufferSize);
|
||||
explicit OFstreamCollator(const off_t maxBufferSize);
|
||||
|
||||
//- Construct from buffer size (0 = do not use thread) and local
|
||||
// thread
|
||||
//- Construct from buffer size (0 = do not use thread)
|
||||
//- and specified communicator
|
||||
OFstreamCollator(const off_t maxBufferSize, const label comm);
|
||||
|
||||
|
||||
@ -196,18 +186,17 @@ public:
|
||||
virtual ~OFstreamCollator();
|
||||
|
||||
|
||||
// Member functions
|
||||
// Member Functions
|
||||
|
||||
//- Write file with contents. Blocks until writethread has space
|
||||
// available (total file sizes < maxBufferSize)
|
||||
//- Write file with contents.
|
||||
// Blocks until writethread has space available
|
||||
// (total file sizes < maxBufferSize)
|
||||
bool write
|
||||
(
|
||||
const word& typeName,
|
||||
const word& objectType,
|
||||
const fileName&,
|
||||
const string& data,
|
||||
IOstream::streamFormat,
|
||||
IOstream::versionNumber,
|
||||
IOstream::compressionType,
|
||||
IOstreamOption streamOpt,
|
||||
const bool append,
|
||||
const bool useThread = true
|
||||
);
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2018 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -161,7 +161,7 @@ bool Foam::fileOperations::collatedFileOperation::appendObject
|
||||
// Create string from all data to write
|
||||
string buf;
|
||||
{
|
||||
OStringStream os(streamOpt.format(), streamOpt.version());
|
||||
OStringStream os(streamOpt);
|
||||
if (isMaster)
|
||||
{
|
||||
if (!io.writeHeader(os))
|
||||
@ -204,23 +204,15 @@ bool Foam::fileOperations::collatedFileOperation::appendObject
|
||||
|
||||
if (isMaster)
|
||||
{
|
||||
IOobject::writeBanner(os)
|
||||
<< "FoamFile\n{\n"
|
||||
<< " version " << os.version() << ";\n"
|
||||
<< " format " << os.format() << ";\n"
|
||||
<< " class " << decomposedBlockData::typeName
|
||||
<< ";\n";
|
||||
|
||||
// This may be useful to have as well
|
||||
if (os.format() == IOstream::BINARY)
|
||||
{
|
||||
os << " arch " << foamVersion::buildArch << ";\n";
|
||||
}
|
||||
|
||||
os << " location " << pathName << ";\n"
|
||||
<< " object " << pathName.name() << ";\n"
|
||||
<< "}" << nl;
|
||||
IOobject::writeDivider(os) << nl;
|
||||
decomposedBlockData::writeHeader
|
||||
(
|
||||
os,
|
||||
static_cast<IOstreamOption>(os),
|
||||
decomposedBlockData::typeName, // class
|
||||
"", // note
|
||||
pathName, // location
|
||||
pathName.name() // object
|
||||
);
|
||||
}
|
||||
|
||||
// Write data
|
||||
|
||||
@ -105,7 +105,7 @@ public:
|
||||
TypeName("collated");
|
||||
|
||||
|
||||
// Static data
|
||||
// Static Data
|
||||
|
||||
//- Max size of thread buffer size. This is the overall size of
|
||||
// all files to be written. Starts blocking if not enough size.
|
||||
@ -115,8 +115,8 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
collatedFileOperation(bool verbose);
|
||||
//- Default construct
|
||||
explicit collatedFileOperation(bool verbose);
|
||||
|
||||
//- Construct from user communicator
|
||||
collatedFileOperation
|
||||
@ -163,8 +163,8 @@ public:
|
||||
//- Actual name of processors dir
|
||||
virtual word processorsDir(const fileName&) const;
|
||||
|
||||
//- Set number of processor directories/results. Only used in
|
||||
// decomposePar
|
||||
//- Set number of processor directories/results.
|
||||
//- Only used in decomposePar
|
||||
virtual void setNProcs(const label nProcs);
|
||||
};
|
||||
|
||||
@ -197,9 +197,7 @@ public:
|
||||
//- Needs threading
|
||||
virtual bool needsThreading() const
|
||||
{
|
||||
return
|
||||
collatedFileOperation::maxThreadFileBufferSize
|
||||
> 0;
|
||||
return (collatedFileOperation::maxThreadFileBufferSize > 0);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2018 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -90,8 +91,8 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
hostCollatedFileOperation(const bool verbose);
|
||||
//- Default construct
|
||||
explicit hostCollatedFileOperation(const bool verbose);
|
||||
|
||||
|
||||
//- Destructor
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2018 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -40,7 +40,7 @@ Foam::threadedCollatedOFstream::threadedCollatedOFstream
|
||||
const bool useThread
|
||||
)
|
||||
:
|
||||
OStringStream(streamOpt.format(), streamOpt.version()),
|
||||
OStringStream(streamOpt),
|
||||
writer_(writer),
|
||||
pathName_(pathName),
|
||||
compression_(streamOpt.compression()),
|
||||
@ -57,9 +57,7 @@ Foam::threadedCollatedOFstream::~threadedCollatedOFstream()
|
||||
decomposedBlockData::typeName,
|
||||
pathName_,
|
||||
str(),
|
||||
IOstream::BINARY,
|
||||
version(),
|
||||
compression_,
|
||||
IOstreamOption(IOstream::BINARY, version(), compression_),
|
||||
false, // append=false
|
||||
useThread_
|
||||
);
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2018 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -44,6 +45,7 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward Declarations
|
||||
class OFstreamCollator;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
@ -54,13 +56,14 @@ class threadedCollatedOFstream
|
||||
:
|
||||
public OStringStream
|
||||
{
|
||||
// Private data
|
||||
// Private Data
|
||||
|
||||
//- The backend writer
|
||||
OFstreamCollator& writer_;
|
||||
|
||||
const fileName pathName_;
|
||||
|
||||
const IOstream::compressionType compression_;
|
||||
const IOstreamOption::compressionType compression_;
|
||||
|
||||
const bool useThread_;
|
||||
|
||||
@ -78,14 +81,22 @@ public:
|
||||
const bool useThread = true
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
~threadedCollatedOFstream();
|
||||
|
||||
|
||||
// Additional constructors and methods (as per v2012 and earlier)
|
||||
#ifdef Foam_IOstream_extras
|
||||
|
||||
//- Construct and set stream status
|
||||
threadedCollatedOFstream
|
||||
(
|
||||
OFstreamCollator& writer,
|
||||
const fileName& pathname,
|
||||
streamFormat fmt,
|
||||
versionNumber ver = currentVersion,
|
||||
compressionType comp = compressionType::UNCOMPRESSED,
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion,
|
||||
IOstreamOption::compressionType cmp = IOstreamOption::UNCOMPRESSED,
|
||||
const bool useThread = true
|
||||
)
|
||||
:
|
||||
@ -93,14 +104,12 @@ public:
|
||||
(
|
||||
writer,
|
||||
pathname,
|
||||
IOstreamOption(fmt, ver, comp),
|
||||
IOstreamOption(fmt, ver, cmp),
|
||||
useThread
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
//- Destructor
|
||||
~threadedCollatedOFstream();
|
||||
#endif /* Foam_IOstream_extras */
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -437,7 +437,7 @@ public:
|
||||
(
|
||||
regIOobject&,
|
||||
const bool masterOnly,
|
||||
const IOstream::streamFormat format,
|
||||
const IOstreamOption::streamFormat format,
|
||||
const word& typeName
|
||||
) const = 0;
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2018 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -500,7 +500,7 @@ void Foam::fileOperations::masterUncollatedFileOperation::readAndSend
|
||||
PstreamBuffers& pBufs
|
||||
)
|
||||
{
|
||||
IFstream ifs(filePath, IOstream::streamFormat::BINARY);
|
||||
IFstream ifs(filePath, IOstreamOption::BINARY);
|
||||
|
||||
if (!ifs.good())
|
||||
{
|
||||
@ -516,7 +516,7 @@ void Foam::fileOperations::masterUncollatedFileOperation::readAndSend
|
||||
<< filePath << endl;
|
||||
}
|
||||
|
||||
if (ifs.compression() == IOstream::compressionType::COMPRESSED)
|
||||
if (ifs.compression() == IOstreamOption::COMPRESSED)
|
||||
{
|
||||
// Could use Foam::fileSize, estimate uncompressed size (eg, 2x)
|
||||
// and then string reserve followed by string assign...
|
||||
@ -2087,7 +2087,7 @@ bool Foam::fileOperations::masterUncollatedFileOperation::read
|
||||
(
|
||||
regIOobject& io,
|
||||
const bool masterOnly,
|
||||
const IOstream::streamFormat format,
|
||||
const IOstreamOption::streamFormat format,
|
||||
const word& typeName
|
||||
) const
|
||||
{
|
||||
@ -2203,7 +2203,7 @@ bool Foam::fileOperations::masterUncollatedFileOperation::writeObject
|
||||
setTime(io.time());
|
||||
|
||||
autoPtr<OSstream> osPtr(NewOFstream(pathName, streamOpt, valid));
|
||||
OSstream& os = osPtr();
|
||||
OSstream& os = *osPtr;
|
||||
|
||||
// If any of these fail, return (leave error handling to Ostream class)
|
||||
if (!os.good())
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -89,7 +89,7 @@ class masterUncollatedFileOperation
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
// Protected Data
|
||||
|
||||
//- Any communicator allocated by me
|
||||
const label myComm_;
|
||||
@ -98,7 +98,7 @@ protected:
|
||||
mutable HashPtrTable<instantList> times_;
|
||||
|
||||
|
||||
// Protected classes
|
||||
// Protected Classes
|
||||
|
||||
class mkDirOp
|
||||
{
|
||||
@ -488,8 +488,8 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
masterUncollatedFileOperation(bool verbose);
|
||||
//- Default construct
|
||||
explicit masterUncollatedFileOperation(bool verbose);
|
||||
|
||||
//- Construct from communicator
|
||||
masterUncollatedFileOperation(const label comm, bool verbose);
|
||||
@ -679,7 +679,7 @@ public:
|
||||
(
|
||||
regIOobject&,
|
||||
const bool masterOnly,
|
||||
const IOstream::streamFormat format,
|
||||
const IOstreamOption::streamFormat format,
|
||||
const word& typeName
|
||||
) const;
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -613,7 +613,7 @@ bool Foam::fileOperations::uncollatedFileOperation::read
|
||||
(
|
||||
regIOobject& io,
|
||||
const bool masterOnly,
|
||||
const IOstream::streamFormat format,
|
||||
const IOstreamOption::streamFormat format,
|
||||
const word& typeName
|
||||
) const
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -86,7 +86,7 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Default construct
|
||||
uncollatedFileOperation(bool verbose);
|
||||
explicit uncollatedFileOperation(bool verbose);
|
||||
|
||||
|
||||
//- Destructor
|
||||
@ -272,7 +272,7 @@ public:
|
||||
(
|
||||
regIOobject&,
|
||||
const bool masterOnly,
|
||||
const IOstream::streamFormat format,
|
||||
const IOstreamOption::streamFormat format,
|
||||
const word& typeName
|
||||
) const;
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -225,10 +225,9 @@ void Foam::csvTableReader<Type>::write(Ostream& os) const
|
||||
os.writeEntry("refColumn", refColumn_);
|
||||
|
||||
// Force writing labelList in ASCII
|
||||
const enum IOstream::streamFormat fmt = os.format();
|
||||
os.format(IOstream::ASCII);
|
||||
const auto oldFmt = os.format(IOstream::ASCII);
|
||||
os.writeEntry("componentColumns", componentColumns_);
|
||||
os.format(fmt);
|
||||
os.format(oldFmt);
|
||||
|
||||
os.writeEntry("separator", string(separator_));
|
||||
}
|
||||
|
||||
@ -1181,7 +1181,7 @@ bool Foam::polyBoundaryMesh::writeObject
|
||||
const bool valid
|
||||
) const
|
||||
{
|
||||
streamOpt.compression(IOstream::UNCOMPRESSED);
|
||||
streamOpt.compression(IOstreamOption::UNCOMPRESSED);
|
||||
return regIOobject::writeObject(streamOpt, valid);
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -260,10 +260,9 @@ void Foam::Function1Types::CSV<Type>::writeEntries(Ostream& os) const
|
||||
os.writeEntry("refColumn", refColumn_);
|
||||
|
||||
// Force writing labelList in ASCII
|
||||
const enum IOstream::streamFormat fmt = os.format();
|
||||
os.format(IOstream::ASCII);
|
||||
const auto oldFmt = os.format(IOstream::ASCII);
|
||||
os.writeEntry("componentColumns", componentColumns_);
|
||||
os.format(fmt);
|
||||
os.format(oldFmt);
|
||||
|
||||
os.writeEntry("separator", string(separator_));
|
||||
os.writeEntry("mergeSeparators", mergeSeparators_);
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -41,12 +42,12 @@ Foam::UIPstream::UIPstream
|
||||
const int tag,
|
||||
const label comm,
|
||||
const bool clearAtEnd,
|
||||
streamFormat format,
|
||||
versionNumber version
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver
|
||||
)
|
||||
:
|
||||
UPstream(commsType),
|
||||
Istream(format, version),
|
||||
Istream(fmt, ver),
|
||||
fromProcNo_(fromProcNo),
|
||||
externalBuf_(externalBuf),
|
||||
externalBufPosition_(externalBufPosition),
|
||||
@ -88,8 +89,7 @@ Foam::label Foam::UIPstream::read
|
||||
)
|
||||
{
|
||||
NotImplemented;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -47,12 +47,12 @@ Foam::UIPstream::UIPstream
|
||||
const int tag,
|
||||
const label comm,
|
||||
const bool clearAtEnd,
|
||||
streamFormat format,
|
||||
versionNumber version
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver
|
||||
)
|
||||
:
|
||||
UPstream(commsType),
|
||||
Istream(format, version),
|
||||
Istream(fmt, ver),
|
||||
fromProcNo_(fromProcNo),
|
||||
externalBuf_(externalBuf),
|
||||
externalBufPosition_(externalBufPosition),
|
||||
|
||||
@ -579,17 +579,13 @@ bool Foam::ccm::reader::hasSolution()
|
||||
void Foam::ccm::reader::writeMesh
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
IOstream::streamFormat fmt
|
||||
IOstreamOption streamOpt
|
||||
) const
|
||||
{
|
||||
mesh.removeFiles();
|
||||
|
||||
Info<< "Writing polyMesh" << endl;
|
||||
mesh.writeObject
|
||||
(
|
||||
IOstreamOption(fmt),
|
||||
true
|
||||
);
|
||||
mesh.writeObject(streamOpt, true);
|
||||
writeAux(mesh);
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -161,7 +161,6 @@ SourceFiles
|
||||
#include "ccmInterfaceDefinitions.H"
|
||||
#include "ccmSolutionTable.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
@ -395,7 +394,7 @@ private:
|
||||
const objectRegistry& registry,
|
||||
const word& propertyName,
|
||||
const labelList& list,
|
||||
IOstream::streamFormat fmt = IOstream::ASCII
|
||||
IOstreamOption streamOpt
|
||||
) const;
|
||||
|
||||
// polyMesh Friend Functions
|
||||
@ -493,7 +492,7 @@ public:
|
||||
void writeMesh
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
IOstream::streamFormat fmt = IOstream::BINARY
|
||||
IOstreamOption streamOpt = IOstreamOption(IOstreamOption::BINARY)
|
||||
) const;
|
||||
|
||||
//- Write cellTable, boundaryRegion and interface information
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -146,7 +146,7 @@ void Foam::ccm::reader::writeMeshLabelList
|
||||
const objectRegistry& registry,
|
||||
const word& propertyName,
|
||||
const labelList& list,
|
||||
IOstream::streamFormat fmt
|
||||
IOstreamOption streamOpt
|
||||
) const
|
||||
{
|
||||
// Write constant/polyMesh/propertyName
|
||||
@ -171,12 +171,8 @@ void Foam::ccm::reader::writeMeshLabelList
|
||||
// NOTE:
|
||||
// The cellTableId is an integer and almost always < 1000, thus ASCII
|
||||
// will be compacter than binary and makes external scripting easier
|
||||
//
|
||||
ioObj.writeObject
|
||||
(
|
||||
IOstreamOption(fmt),
|
||||
true
|
||||
);
|
||||
|
||||
ioObj.writeObject(streamOpt, true);
|
||||
}
|
||||
|
||||
|
||||
@ -197,7 +193,7 @@ void Foam::ccm::reader::writeAux
|
||||
registry,
|
||||
"origCellId",
|
||||
origCellId_,
|
||||
IOstream::BINARY
|
||||
IOstreamOption(IOstreamOption::BINARY)
|
||||
);
|
||||
|
||||
// Write cellTableId as List<label>
|
||||
@ -207,7 +203,7 @@ void Foam::ccm::reader::writeAux
|
||||
registry,
|
||||
"cellTableId",
|
||||
cellTableId_,
|
||||
IOstream::ASCII
|
||||
IOstreamOption(IOstreamOption::ASCII)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -124,17 +124,13 @@ Foam::autoPtr<Foam::polyMesh> Foam::meshReader::mesh
|
||||
void Foam::meshReader::writeMesh
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
IOstream::streamFormat fmt
|
||||
IOstreamOption streamOpt
|
||||
) const
|
||||
{
|
||||
mesh.removeFiles();
|
||||
|
||||
Info<< "Writing polyMesh" << endl;
|
||||
mesh.writeObject
|
||||
(
|
||||
IOstreamOption(fmt),
|
||||
true
|
||||
);
|
||||
mesh.writeObject(streamOpt, true);
|
||||
writeAux(mesh);
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -193,7 +193,7 @@ private:
|
||||
const objectRegistry& registry,
|
||||
const word& propertyName,
|
||||
const labelList& list,
|
||||
IOstream::streamFormat fmt = IOstream::ASCII
|
||||
IOstreamOption streamOpt
|
||||
) const;
|
||||
|
||||
//- Return list of faces for every cell
|
||||
@ -291,7 +291,7 @@ public:
|
||||
void writeMesh
|
||||
(
|
||||
const polyMesh&,
|
||||
IOstream::streamFormat fmt = IOstream::BINARY
|
||||
IOstreamOption streamOpt = IOstreamOption(IOstreamOption::BINARY)
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -109,7 +109,7 @@ void Foam::meshReader::writeMeshLabelList
|
||||
const objectRegistry& registry,
|
||||
const word& propertyName,
|
||||
const labelList& list,
|
||||
IOstream::streamFormat fmt
|
||||
IOstreamOption streamOpt
|
||||
) const
|
||||
{
|
||||
// write constant/polyMesh/propertyName
|
||||
@ -129,14 +129,14 @@ void Foam::meshReader::writeMeshLabelList
|
||||
);
|
||||
|
||||
|
||||
ioObj.note() = "persistent data for star-cd <-> foam translation";
|
||||
ioObj.note() = "persistent data for STARCD <-> OPENFOAM translation";
|
||||
Info<< "Writing " << ioObj.name() << " to " << ioObj.objectPath() << endl;
|
||||
|
||||
// NOTE:
|
||||
// the cellTableId is an integer and almost always < 1000, thus ASCII
|
||||
// will be compacter than binary and makes external scripting easier
|
||||
|
||||
ioObj.writeObject(IOstreamOption(fmt), true);
|
||||
ioObj.writeObject(streamOpt, true);
|
||||
}
|
||||
|
||||
|
||||
@ -153,7 +153,7 @@ void Foam::meshReader::writeAux(const objectRegistry& registry) const
|
||||
registry,
|
||||
"origCellId",
|
||||
origCellId_,
|
||||
IOstream::BINARY
|
||||
IOstreamOption(IOstreamOption::BINARY)
|
||||
);
|
||||
|
||||
// write cellTableId as List<label>
|
||||
@ -163,7 +163,7 @@ void Foam::meshReader::writeAux(const objectRegistry& registry) const
|
||||
registry,
|
||||
"cellTableId",
|
||||
cellTableId_,
|
||||
IOstream::ASCII
|
||||
IOstreamOption(IOstreamOption::ASCII)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -376,7 +376,7 @@ void Foam::fileFormats::FIREMeshReader::addPatches(polyMesh& mesh) const
|
||||
|
||||
bool Foam::fileFormats::FIREMeshReader::readGeometry(const scalar scaleFactor)
|
||||
{
|
||||
IOstream::streamFormat fmt = IOstream::ASCII;
|
||||
IOstreamOption::streamFormat fmt = IOstream::ASCII;
|
||||
|
||||
const word ext(geometryFile_.ext());
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -32,10 +32,10 @@ License
|
||||
Foam::ensightReadFile::ensightReadFile
|
||||
(
|
||||
const fileName& pathname,
|
||||
IOstream::streamFormat format
|
||||
IOstreamOption::streamFormat fmt
|
||||
)
|
||||
:
|
||||
IFstream(pathname, format)
|
||||
IFstream(pathname, fmt)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -65,10 +65,10 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct from pathname. Default format is binary.
|
||||
ensightReadFile
|
||||
explicit ensightReadFile
|
||||
(
|
||||
const fileName& pathname,
|
||||
IOstream::streamFormat format=IOstream::BINARY
|
||||
IOstreamOption::streamFormat fmt = IOstreamOption::BINARY
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -204,7 +204,7 @@ void Foam::fileFormats::FIRECore::putFireLabel
|
||||
const label value
|
||||
)
|
||||
{
|
||||
if (os.format() == Foam::IOstream::BINARY)
|
||||
if (os.format() == IOstream::BINARY)
|
||||
{
|
||||
fireInt_t ivalue(value);
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -90,12 +90,12 @@ public:
|
||||
OBJstream
|
||||
(
|
||||
const fileName& pathname,
|
||||
streamFormat fmt,
|
||||
versionNumber ver = currentVersion,
|
||||
compressionType comp = compressionType::UNCOMPRESSED
|
||||
IOstreamOption::streamFormat fmt,
|
||||
IOstreamOption::versionNumber ver = IOstreamOption::currentVersion,
|
||||
IOstreamOption::compressionType cmp = IOstreamOption::UNCOMPRESSED
|
||||
)
|
||||
:
|
||||
OBJstream(pathname, IOstreamOption(fmt, ver, comp))
|
||||
OBJstream(pathname, IOstreamOption(fmt, ver, cmp))
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -69,7 +69,7 @@ protected:
|
||||
};
|
||||
|
||||
//- Format flag
|
||||
IOstream::streamFormat streamFormat_;
|
||||
IOstreamOption::streamFormat streamFormat_;
|
||||
|
||||
//- Base directory
|
||||
fileName baseDir_;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -204,7 +204,7 @@ void Foam::fileFormats::STLsurfaceFormat<Face>::writeAscii
|
||||
(
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf,
|
||||
IOstream::compressionType comp
|
||||
IOstreamOption::compressionType comp
|
||||
)
|
||||
{
|
||||
OFstream os(filename, IOstreamOption(IOstream::ASCII, comp));
|
||||
@ -303,7 +303,7 @@ void Foam::fileFormats::STLsurfaceFormat<Face>::writeAscii
|
||||
(
|
||||
const fileName& filename,
|
||||
const UnsortedMeshedSurface<Face>& surf,
|
||||
IOstream::compressionType comp
|
||||
IOstreamOption::compressionType comp
|
||||
)
|
||||
{
|
||||
const pointField& pointLst = surf.points();
|
||||
@ -416,7 +416,7 @@ void Foam::fileFormats::STLsurfaceFormat<Face>::write
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf,
|
||||
const STLFormat format,
|
||||
IOstream::compressionType comp
|
||||
IOstreamOption::compressionType comp
|
||||
)
|
||||
{
|
||||
if (STLCore::isBinaryName(filename, format))
|
||||
@ -461,7 +461,7 @@ void Foam::fileFormats::STLsurfaceFormat<Face>::write
|
||||
const fileName& filename,
|
||||
const UnsortedMeshedSurface<Face>& surf,
|
||||
const STLFormat format,
|
||||
IOstream::compressionType comp
|
||||
IOstreamOption::compressionType comp
|
||||
)
|
||||
{
|
||||
if (STLCore::isBinaryName(filename, format))
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -108,7 +108,7 @@ public:
|
||||
(
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf,
|
||||
IOstream::compressionType comp = IOstream::UNCOMPRESSED
|
||||
IOstreamOption::compressionType comp = IOstreamOption::UNCOMPRESSED
|
||||
);
|
||||
|
||||
//- Write surface mesh components by proxy (as BINARY)
|
||||
@ -123,7 +123,7 @@ public:
|
||||
(
|
||||
const fileName& filename,
|
||||
const UnsortedMeshedSurface<Face>& surf,
|
||||
IOstream::compressionType comp = IOstream::UNCOMPRESSED
|
||||
IOstreamOption::compressionType comp = IOstreamOption::UNCOMPRESSED
|
||||
);
|
||||
|
||||
//- Write UnsortedMeshedSurface (as BINARY) unsorted by zone
|
||||
@ -140,7 +140,7 @@ public:
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf,
|
||||
const STLFormat format,
|
||||
IOstream::compressionType comp = IOstream::UNCOMPRESSED
|
||||
IOstreamOption::compressionType comp = IOstreamOption::UNCOMPRESSED
|
||||
);
|
||||
|
||||
//- Write UnsortedMeshedSurface
|
||||
@ -150,7 +150,7 @@ public:
|
||||
const fileName& filename,
|
||||
const UnsortedMeshedSurface<Face>& surf,
|
||||
const STLFormat format,
|
||||
IOstream::compressionType comp = IOstream::UNCOMPRESSED
|
||||
IOstreamOption::compressionType comp = IOstreamOption::UNCOMPRESSED
|
||||
);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user