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