mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'feature-writeObject' into 'develop'
Feature write object See merge request Development/openfoam!341
This commit is contained in:
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -48,8 +49,8 @@ int main(int argc, char *argv[])
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
IOstream::streamFormat format=IOstream::BINARY;
|
||||
// IOstream::streamFormat format=IOstream::ASCII;
|
||||
IOstream::streamFormat format = IOstream::BINARY;
|
||||
// IOstream::streamFormat format = IOstream::ASCII;
|
||||
|
||||
const label size = 20000000;
|
||||
|
||||
@ -84,12 +85,9 @@ int main(int argc, char *argv[])
|
||||
<< runTime.cpuTimeIncrement() << " s" << nl << endl;
|
||||
|
||||
|
||||
// Write binary
|
||||
faces2.writeObject
|
||||
(
|
||||
format,
|
||||
IOstream::currentVersion,
|
||||
IOstream::UNCOMPRESSED,
|
||||
IOstreamOption(format),
|
||||
true
|
||||
);
|
||||
|
||||
@ -147,12 +145,9 @@ int main(int argc, char *argv[])
|
||||
<< runTime.cpuTimeIncrement() << " s" << nl << endl;
|
||||
|
||||
|
||||
// Write binary
|
||||
faces2.writeObject
|
||||
(
|
||||
format,
|
||||
IOstream::currentVersion,
|
||||
IOstream::UNCOMPRESSED,
|
||||
IOstreamOption(format),
|
||||
true
|
||||
);
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2017 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -643,9 +643,11 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
!runTime.objectRegistry::writeObject
|
||||
(
|
||||
runTime.writeFormat(),
|
||||
IOstream::currentVersion,
|
||||
runTime.writeCompression(),
|
||||
IOstreamOption
|
||||
(
|
||||
runTime.writeFormat(),
|
||||
runTime.writeCompression()
|
||||
),
|
||||
true
|
||||
)
|
||||
)
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -157,12 +157,10 @@ bool writeZones
|
||||
|
||||
Info<< " Writing " << name << endl;
|
||||
|
||||
// Force writing as ascii
|
||||
// Force writing as ASCII
|
||||
writeOk = meshObject.regIOobject::writeObject
|
||||
(
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
compression,
|
||||
IOstreamOption(IOstream::ASCII, compression),
|
||||
true
|
||||
);
|
||||
}
|
||||
@ -471,9 +469,11 @@ int main(int argc, char *argv[])
|
||||
|
||||
parcels.writeObject
|
||||
(
|
||||
runTime.writeFormat(),
|
||||
IOstream::currentVersion,
|
||||
runTime.writeCompression(),
|
||||
IOstreamOption
|
||||
(
|
||||
runTime.writeFormat(),
|
||||
runTime.writeCompression()
|
||||
),
|
||||
parcels.size()
|
||||
);
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -93,14 +93,8 @@ public:
|
||||
virtual void autoMap(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Switch off writing the objects
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
const bool valid
|
||||
) const
|
||||
//- Disable writing objects
|
||||
virtual bool writeObject(IOstreamOption, const bool valid) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -660,9 +660,7 @@ int main(int argc, char *argv[])
|
||||
Info<< "Writing modified " << fieldName << endl;
|
||||
dictList.writeObject
|
||||
(
|
||||
runTime.writeFormat(),
|
||||
IOstream::currentVersion,
|
||||
IOstream::UNCOMPRESSED,
|
||||
IOstreamOption(runTime.writeFormat()),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2017 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -199,9 +199,7 @@ void createFieldFiles
|
||||
|
||||
fieldOut.regIOobject::writeObject
|
||||
(
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
IOstream::UNCOMPRESSED,
|
||||
IOstreamOption(IOstream::ASCII),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2007-2019 PCOpt/NTUA
|
||||
Copyright (C) 2013-2019 FOSS GP
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -95,9 +95,7 @@ int main(int argc, char *argv[])
|
||||
// Write modified dictionary
|
||||
optDict.regIOobject::writeObject
|
||||
(
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
IOstream::UNCOMPRESSED,
|
||||
IOstreamOption(IOstream::ASCII),
|
||||
true
|
||||
);
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -175,28 +175,26 @@ Foam::CompactIOField<T, BaseType>::CompactIOField
|
||||
template<class T, class BaseType>
|
||||
bool Foam::CompactIOField<T, BaseType>::writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const
|
||||
{
|
||||
if (fmt == IOstream::ASCII)
|
||||
if (streamOpt.format() == IOstream::ASCII)
|
||||
{
|
||||
// Change type to be non-compact format type
|
||||
const word oldTypeName(typeName);
|
||||
|
||||
const_cast<word&>(typeName) = IOField<T>::typeName;
|
||||
|
||||
bool good = regIOobject::writeObject(IOstream::ASCII, ver, cmp, valid);
|
||||
bool good = regIOobject::writeObject(streamOpt, valid);
|
||||
|
||||
// Change type back
|
||||
// Restore type
|
||||
const_cast<word&>(typeName) = oldTypeName;
|
||||
|
||||
return good;
|
||||
}
|
||||
|
||||
return regIOobject::writeObject(fmt, ver, cmp, valid);
|
||||
return regIOobject::writeObject(streamOpt, valid);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -112,11 +113,10 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Write using stream options
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstream::streamFormat,
|
||||
IOstream::versionNumber,
|
||||
IOstream::compressionType,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const;
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -168,21 +168,17 @@ Foam::CompactIOList<T, BaseType>::CompactIOList
|
||||
template<class T, class BaseType>
|
||||
bool Foam::CompactIOList<T, BaseType>::writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const
|
||||
{
|
||||
bool nonCompact = false;
|
||||
|
||||
if (fmt == IOstream::ASCII)
|
||||
if
|
||||
(
|
||||
streamOpt.format() == IOstream::BINARY
|
||||
&& overflows()
|
||||
)
|
||||
{
|
||||
nonCompact = true;
|
||||
}
|
||||
else if (overflows())
|
||||
{
|
||||
nonCompact = true;
|
||||
streamOpt.format(IOstream::ASCII);
|
||||
|
||||
WarningInFunction
|
||||
<< "Overall number of elements of CompactIOList of size "
|
||||
@ -190,14 +186,14 @@ bool Foam::CompactIOList<T, BaseType>::writeObject
|
||||
<< nl << " Switching to ascii writing" << endl;
|
||||
}
|
||||
|
||||
if (nonCompact)
|
||||
if (streamOpt.format() == IOstream::ASCII)
|
||||
{
|
||||
// Change to non-compact type
|
||||
// Change type to be non-compact format type
|
||||
const word oldTypeName(typeName);
|
||||
|
||||
const_cast<word&>(typeName) = IOList<T>::typeName;
|
||||
|
||||
bool good = regIOobject::writeObject(IOstream::ASCII, ver, cmp, valid);
|
||||
bool good = regIOobject::writeObject(streamOpt, valid);
|
||||
|
||||
// Change type back
|
||||
const_cast<word&>(typeName) = oldTypeName;
|
||||
@ -205,7 +201,7 @@ bool Foam::CompactIOList<T, BaseType>::writeObject
|
||||
return good;
|
||||
}
|
||||
|
||||
return regIOobject::writeObject(fmt, ver, cmp, valid);
|
||||
return regIOobject::writeObject(streamOpt, valid);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -114,11 +114,10 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Write using stream options. Checks for overflow in binary
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstream::streamFormat,
|
||||
IOstream::versionNumber,
|
||||
IOstream::compressionType,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const;
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2018 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -30,7 +31,6 @@ License
|
||||
#include "IPstream.H"
|
||||
#include "PstreamBuffers.H"
|
||||
#include "Fstream.H"
|
||||
#include "StringStream.H"
|
||||
#include "dictionary.H"
|
||||
#include "objectRegistry.H"
|
||||
#include "SubList.H"
|
||||
@ -160,12 +160,6 @@ Foam::decomposedBlockData::decomposedBlockData
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::decomposedBlockData::~decomposedBlockData()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Members Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::decomposedBlockData::readMasterHeader(IOobject& io, Istream& is)
|
||||
@ -181,15 +175,11 @@ bool Foam::decomposedBlockData::readMasterHeader(IOobject& io, Istream& is)
|
||||
|
||||
List<char> data(is);
|
||||
is.fatalCheck("read(Istream&) : reading entry");
|
||||
IListStream str
|
||||
(
|
||||
std::move(data),
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
is.name()
|
||||
);
|
||||
|
||||
return io.readHeader(str);
|
||||
UIListStream headerStream(data);
|
||||
headerStream.name() = is.name();
|
||||
|
||||
return io.readHeader(headerStream);
|
||||
}
|
||||
|
||||
|
||||
@ -254,24 +244,15 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlock
|
||||
|
||||
is.fatalCheck("read(Istream&)");
|
||||
|
||||
List<char> data;
|
||||
autoPtr<ISstream> realIsPtr;
|
||||
|
||||
if (blocki == 0)
|
||||
{
|
||||
is >> data;
|
||||
List<char> data(is);
|
||||
is.fatalCheck("read(Istream&) : reading entry");
|
||||
|
||||
realIsPtr.reset
|
||||
(
|
||||
new IListStream
|
||||
(
|
||||
std::move(data),
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
is.name()
|
||||
)
|
||||
);
|
||||
realIsPtr.reset(new IListStream(std::move(data)));
|
||||
realIsPtr->name() = is.name();
|
||||
|
||||
// Read header
|
||||
if (!headerIO.readHeader(realIsPtr()))
|
||||
@ -284,7 +265,7 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlock
|
||||
else
|
||||
{
|
||||
// Read master for header
|
||||
is >> data;
|
||||
List<char> data(is);
|
||||
is.fatalCheck("read(Istream&) : reading entry");
|
||||
|
||||
IOstream::versionNumber ver(IOstream::currentVersion);
|
||||
@ -292,13 +273,7 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlock
|
||||
unsigned labelByteSize;
|
||||
unsigned scalarByteSize;
|
||||
{
|
||||
UIListStream headerStream
|
||||
(
|
||||
data,
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
is.name()
|
||||
);
|
||||
UIListStream headerStream(data);
|
||||
|
||||
// Read header
|
||||
if (!headerIO.readHeader(headerStream))
|
||||
@ -315,20 +290,12 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlock
|
||||
|
||||
for (label i = 1; i < blocki+1; i++)
|
||||
{
|
||||
// Read data, override old data
|
||||
// Read and discard data, only retain the last one
|
||||
is >> data;
|
||||
is.fatalCheck("read(Istream&) : reading entry");
|
||||
}
|
||||
realIsPtr.reset
|
||||
(
|
||||
new IListStream
|
||||
(
|
||||
std::move(data),
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
is.name()
|
||||
)
|
||||
);
|
||||
realIsPtr.reset(new IListStream(std::move(data)));
|
||||
realIsPtr->name() = is.name();
|
||||
|
||||
// Apply master stream settings to realIsPtr
|
||||
realIsPtr().format(fmt);
|
||||
@ -336,6 +303,7 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlock
|
||||
realIsPtr().setLabelByteSize(labelByteSize);
|
||||
realIsPtr().setScalarByteSize(scalarByteSize);
|
||||
}
|
||||
|
||||
return realIsPtr;
|
||||
}
|
||||
|
||||
@ -358,22 +326,6 @@ bool Foam::decomposedBlockData::readBlocks
|
||||
|
||||
bool ok = false;
|
||||
|
||||
|
||||
|
||||
//// Scatter master header info
|
||||
//string ver;
|
||||
//unsigned labelByteSize;
|
||||
//unsigned scalarByteSize;
|
||||
//if (UPstream::master(comm))
|
||||
//{
|
||||
// ver = isPtr().version().str();
|
||||
// labelByteSize = isPtr().labelByteSize();
|
||||
// scalarByteSize = isPtr().scalarByteSize();
|
||||
//}
|
||||
//Pstream::scatter(ver); //, Pstream::msgType(), comm);
|
||||
//Pstream::scatter(labelByteSize); //, Pstream::msgType(), comm);
|
||||
//Pstream::scatter(scalarByteSize); //, Pstream::msgType(), comm);
|
||||
|
||||
if (commsType == UPstream::commsTypes::scheduled)
|
||||
{
|
||||
if (UPstream::master(comm))
|
||||
@ -509,17 +461,8 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlocks
|
||||
is >> data;
|
||||
is.fatalCheck("read(Istream&) : reading entry");
|
||||
|
||||
realIsPtr.reset
|
||||
(
|
||||
new IListStream
|
||||
(
|
||||
std::move(data),
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
fName
|
||||
)
|
||||
);
|
||||
|
||||
realIsPtr.reset(new IListStream(std::move(data)));
|
||||
realIsPtr->name() = fName;
|
||||
|
||||
// Read header
|
||||
if (!headerIO.readHeader(realIsPtr()))
|
||||
@ -566,16 +509,8 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlocks
|
||||
);
|
||||
is >> data;
|
||||
|
||||
realIsPtr.reset
|
||||
(
|
||||
new IListStream
|
||||
(
|
||||
std::move(data),
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
fName
|
||||
)
|
||||
);
|
||||
realIsPtr.reset(new IListStream(std::move(data)));
|
||||
realIsPtr->name() = fName;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -597,16 +532,8 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlocks
|
||||
is >> data;
|
||||
is.fatalCheck("read(Istream&) : reading entry");
|
||||
|
||||
realIsPtr.reset
|
||||
(
|
||||
new IListStream
|
||||
(
|
||||
std::move(data),
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
fName
|
||||
)
|
||||
);
|
||||
realIsPtr.reset(new IListStream(std::move(data)));
|
||||
realIsPtr->name() = fName;
|
||||
|
||||
// Read header
|
||||
if (!headerIO.readHeader(realIsPtr()))
|
||||
@ -643,16 +570,8 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlocks
|
||||
UIPstream is(UPstream::masterNo(), pBufs);
|
||||
is >> data;
|
||||
|
||||
realIsPtr.reset
|
||||
(
|
||||
new IListStream
|
||||
(
|
||||
std::move(data),
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
fName
|
||||
)
|
||||
);
|
||||
realIsPtr.reset(new IListStream(std::move(data)));
|
||||
realIsPtr->name() = fName;
|
||||
}
|
||||
}
|
||||
|
||||
@ -661,26 +580,24 @@ Foam::autoPtr<Foam::ISstream> Foam::decomposedBlockData::readBlocks
|
||||
//- Set stream properties from realIsPtr on master
|
||||
|
||||
// Scatter master header info
|
||||
string ver;
|
||||
string format;
|
||||
string versionString;
|
||||
label formatValue;
|
||||
unsigned labelByteSize;
|
||||
unsigned scalarByteSize;
|
||||
if (UPstream::master(comm))
|
||||
{
|
||||
ver = realIsPtr().version().str();
|
||||
OStringStream os;
|
||||
os << realIsPtr().format();
|
||||
format = os.str();
|
||||
versionString = realIsPtr().version().str();
|
||||
formatValue = static_cast<label>(realIsPtr().format());
|
||||
labelByteSize = realIsPtr().labelByteSize();
|
||||
scalarByteSize = realIsPtr().scalarByteSize();
|
||||
}
|
||||
Pstream::scatter(ver); //, Pstream::msgType(), comm);
|
||||
Pstream::scatter(format); //, Pstream::msgType(), comm);
|
||||
Pstream::scatter(versionString); //, Pstream::msgType(), comm);
|
||||
Pstream::scatter(formatValue); //, Pstream::msgType(), comm);
|
||||
Pstream::scatter(labelByteSize); //, Pstream::msgType(), comm);
|
||||
Pstream::scatter(scalarByteSize); //, Pstream::msgType(), comm);
|
||||
|
||||
realIsPtr().version(IOstream::versionNumber(ver));
|
||||
realIsPtr().format(format);
|
||||
realIsPtr().version(IOstream::versionNumber(versionString));
|
||||
realIsPtr().format(IOstream::streamFormat(formatValue));
|
||||
realIsPtr().setLabelByteSize(labelByteSize);
|
||||
realIsPtr().setScalarByteSize(scalarByteSize);
|
||||
|
||||
@ -1072,30 +989,17 @@ bool Foam::decomposedBlockData::writeData(Ostream& os) const
|
||||
// Re-read my own data to find out the header information
|
||||
if (Pstream::master(comm_))
|
||||
{
|
||||
UIListStream is
|
||||
(
|
||||
data,
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
name()
|
||||
);
|
||||
io.readHeader(is);
|
||||
UIListStream headerStream(data);
|
||||
io.readHeader(headerStream);
|
||||
}
|
||||
|
||||
// Scatter header information
|
||||
|
||||
// version
|
||||
string versionString(os.version().str());
|
||||
Pstream::scatter(versionString, Pstream::msgType(), comm_);
|
||||
|
||||
// stream
|
||||
string formatString;
|
||||
{
|
||||
OStringStream os;
|
||||
os << os.format();
|
||||
formatString = os.str();
|
||||
Pstream::scatter(formatString, Pstream::msgType(), comm_);
|
||||
}
|
||||
label formatValue(os.format());
|
||||
Pstream::scatter(formatValue, Pstream::msgType(), comm_);
|
||||
|
||||
//word masterName(name());
|
||||
//Pstream::scatter(masterName, Pstream::msgType(), comm_);
|
||||
@ -1114,7 +1018,7 @@ bool Foam::decomposedBlockData::writeData(Ostream& os) const
|
||||
(
|
||||
os,
|
||||
IOstream::versionNumber(versionString),
|
||||
IOstream::formatEnum(formatString),
|
||||
IOstream::streamFormat(formatValue),
|
||||
io.headerClassName(),
|
||||
io.note(),
|
||||
masterLocation,
|
||||
@ -1122,12 +1026,18 @@ bool Foam::decomposedBlockData::writeData(Ostream& os) const
|
||||
);
|
||||
}
|
||||
|
||||
string str
|
||||
(
|
||||
reinterpret_cast<const char*>(data.cbegin()),
|
||||
data.byteSize()
|
||||
);
|
||||
os.writeQuoted(str, false);
|
||||
// Write the character data
|
||||
if (isA<OFstream>(os))
|
||||
{
|
||||
// Serial file output - can use writeRaw()
|
||||
os.writeRaw(data.cdata(), data.byteSize());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Other cases are less fortunate, and no std::string_view
|
||||
std::string str(data.cdata(), data.byteSize());
|
||||
os.writeQuoted(str, false);
|
||||
}
|
||||
|
||||
if (!Pstream::master(comm_))
|
||||
{
|
||||
@ -1140,18 +1050,19 @@ bool Foam::decomposedBlockData::writeData(Ostream& os) const
|
||||
|
||||
bool Foam::decomposedBlockData::writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const
|
||||
{
|
||||
// Always write BINARY
|
||||
streamOpt.format(IOstream::BINARY);
|
||||
|
||||
autoPtr<OSstream> osPtr;
|
||||
if (UPstream::master(comm_))
|
||||
{
|
||||
// Note: always write binary. These are strings so readable
|
||||
// anyway. They have already be tokenised on the sending side.
|
||||
osPtr.reset(new OFstream(objectPath(), IOstream::BINARY, ver, cmp));
|
||||
// Note: always write binary. These are strings so readable anyway.
|
||||
// They have already be tokenised on the sending side.
|
||||
osPtr.reset(new OFstream(objectPath(), streamOpt));
|
||||
IOobject::writeHeader(osPtr());
|
||||
}
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2018 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -57,7 +58,7 @@ class decomposedBlockData
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
// Protected Data
|
||||
|
||||
//- Type to use for gather
|
||||
const UPstream::commsTypes commsType_;
|
||||
@ -90,6 +91,7 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
//- Declare type-name, virtual type (with debug switch)
|
||||
TypeName("decomposedBlockData");
|
||||
|
||||
|
||||
@ -123,7 +125,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~decomposedBlockData();
|
||||
virtual ~decomposedBlockData() = default;
|
||||
|
||||
|
||||
// Member functions
|
||||
@ -133,14 +135,12 @@ public:
|
||||
|
||||
//- Write separated content. Assumes content is the serialised data
|
||||
// and that the master data contains a header
|
||||
virtual bool writeData(Ostream&) const;
|
||||
virtual bool writeData(Ostream& os) const;
|
||||
|
||||
//- Write using given format, version and compression
|
||||
//- Write using stream options
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstream::streamFormat,
|
||||
IOstream::versionNumber,
|
||||
IOstream::compressionType,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const;
|
||||
|
||||
@ -226,7 +226,7 @@ public:
|
||||
);
|
||||
|
||||
//- Detect number of blocks in a file
|
||||
static label numBlocks(const fileName&);
|
||||
static label numBlocks(const fileName& fName);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -392,12 +392,10 @@ public:
|
||||
//- Write time dictionary to the \<time\>/uniform directory
|
||||
virtual bool writeTimeDict() const;
|
||||
|
||||
//- Write using given format, version and compression
|
||||
//- Write using stream options
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstream::streamFormat,
|
||||
IOstream::versionNumber,
|
||||
IOstream::compressionType,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const;
|
||||
|
||||
|
||||
@ -524,9 +524,7 @@ bool Foam::Time::writeTimeDict() const
|
||||
|
||||
return timeDict.regIOobject::writeObject
|
||||
(
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
IOstream::UNCOMPRESSED,
|
||||
IOstreamOption(IOstream::ASCII),
|
||||
true
|
||||
);
|
||||
}
|
||||
@ -534,9 +532,7 @@ bool Foam::Time::writeTimeDict() const
|
||||
|
||||
bool Foam::Time::writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const
|
||||
{
|
||||
@ -546,7 +542,7 @@ bool Foam::Time::writeObject
|
||||
|
||||
if (writeOK)
|
||||
{
|
||||
writeOK = objectRegistry::writeObject(fmt, ver, cmp, valid);
|
||||
writeOK = objectRegistry::writeObject(streamOpt, valid);
|
||||
}
|
||||
|
||||
if (writeOK)
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -625,9 +625,7 @@ bool Foam::functionObjectList::execute()
|
||||
|
||||
stateDictPtr_->writeObject
|
||||
(
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
time_.writeCompression(),
|
||||
IOstreamOption(IOstream::ASCII, time_.writeCompression()),
|
||||
true
|
||||
);
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -473,9 +473,7 @@ bool Foam::objectRegistry::readIfModified()
|
||||
|
||||
bool Foam::objectRegistry::writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const
|
||||
{
|
||||
@ -496,7 +494,7 @@ bool Foam::objectRegistry::writeObject
|
||||
|
||||
if ((*iter)->writeOpt() != NO_WRITE)
|
||||
{
|
||||
ok = (*iter)->writeObject(fmt, ver, cmp, valid) && ok;
|
||||
ok = (*iter)->writeObject(streamOpt, valid) && ok;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -524,12 +524,10 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
//- Write the objects
|
||||
//- Write the objects using stream options
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const;
|
||||
|
||||
|
||||
@ -43,6 +43,7 @@ SourceFiles
|
||||
|
||||
#include "IOobject.H"
|
||||
#include "typeInfo.H"
|
||||
#include "stdFoam.H"
|
||||
#include "OSspecific.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -319,12 +320,10 @@ public:
|
||||
// Must be defined in derived types
|
||||
virtual bool writeData(Ostream&) const = 0;
|
||||
|
||||
//- Write using given format, version and compression
|
||||
//- Write using stream options
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstream::streamFormat,
|
||||
IOstream::versionNumber,
|
||||
IOstream::compressionType,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const;
|
||||
|
||||
@ -345,6 +344,19 @@ public:
|
||||
|
||||
//- Copy assignment
|
||||
void operator=(const IOobject& io);
|
||||
|
||||
|
||||
// Housekeeping
|
||||
|
||||
//- Write using given format, version and compression
|
||||
FOAM_DEPRECATED_FOR(2020-02, "writeObject(IOstreamOption, bool)")
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType comp,
|
||||
const bool valid
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -23,9 +24,6 @@ License
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
write function for regIOobjects
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "regIOobject.H"
|
||||
@ -37,9 +35,7 @@ Description
|
||||
|
||||
bool Foam::regIOobject::writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const
|
||||
{
|
||||
@ -62,7 +58,6 @@ bool Foam::regIOobject::writeObject
|
||||
}
|
||||
|
||||
|
||||
|
||||
//- uncomment this if you want to write global objects on master only
|
||||
//bool isGlobal = global();
|
||||
bool isGlobal = false;
|
||||
@ -119,7 +114,7 @@ bool Foam::regIOobject::writeObject
|
||||
//if (mkDir(path()))
|
||||
//{
|
||||
// // Try opening an OFstream for object
|
||||
// OFstream os(objectPath(), fmt, ver, cmp);
|
||||
// OFstream os(objectPath(), streamOpt);
|
||||
//
|
||||
// // If any of these fail, return (leave error handling to Ostream
|
||||
// // class)
|
||||
@ -143,7 +138,7 @@ bool Foam::regIOobject::writeObject
|
||||
//
|
||||
// osGood = os.good();
|
||||
//}
|
||||
osGood = fileHandler().writeObject(*this, fmt, ver, cmp, valid);
|
||||
osGood = fileHandler().writeObject(*this, streamOpt, valid);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -171,12 +166,22 @@ bool Foam::regIOobject::write(const bool valid) const
|
||||
{
|
||||
return writeObject
|
||||
(
|
||||
time().writeFormat(),
|
||||
IOstream::currentVersion,
|
||||
time().writeCompression(),
|
||||
IOstreamOption(time().writeFormat(), time().writeCompression()),
|
||||
valid
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::regIOobject::writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
const bool valid
|
||||
) const
|
||||
{
|
||||
return writeObject(IOstreamOption(fmt, ver, cmp), valid);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -118,9 +118,7 @@ bool Foam::fileOperations::collatedFileOperation::appendObject
|
||||
(
|
||||
const regIOobject& io,
|
||||
const fileName& pathName,
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp
|
||||
IOstreamOption streamOpt
|
||||
) const
|
||||
{
|
||||
// Append to processors/ file
|
||||
@ -169,7 +167,7 @@ bool Foam::fileOperations::collatedFileOperation::appendObject
|
||||
// Create string from all data to write
|
||||
string buf;
|
||||
{
|
||||
OStringStream os(fmt, ver);
|
||||
OStringStream os(streamOpt.format(), streamOpt.version());
|
||||
if (isMaster)
|
||||
{
|
||||
if (!io.writeHeader(os))
|
||||
@ -199,7 +197,7 @@ bool Foam::fileOperations::collatedFileOperation::appendObject
|
||||
OFstream os
|
||||
(
|
||||
pathName,
|
||||
IOstreamOption(IOstream::BINARY, ver), // UNCOMPRESSED
|
||||
IOstreamOption(IOstream::BINARY, streamOpt.version()), // UNCOMPRESSED
|
||||
!isMaster // append slaves
|
||||
);
|
||||
|
||||
@ -461,9 +459,7 @@ Foam::fileName Foam::fileOperations::collatedFileOperation::objectPath
|
||||
bool Foam::fileOperations::collatedFileOperation::writeObject
|
||||
(
|
||||
const regIOobject& io,
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const
|
||||
{
|
||||
@ -486,7 +482,7 @@ bool Foam::fileOperations::collatedFileOperation::writeObject
|
||||
masterOFstream os
|
||||
(
|
||||
pathName,
|
||||
IOstreamOption(fmt, ver, cmp),
|
||||
streamOpt,
|
||||
false, // append=false
|
||||
valid
|
||||
);
|
||||
@ -530,7 +526,7 @@ bool Foam::fileOperations::collatedFileOperation::writeObject
|
||||
masterOFstream os
|
||||
(
|
||||
pathName,
|
||||
IOstreamOption(fmt, ver, cmp),
|
||||
streamOpt,
|
||||
false, // append=false
|
||||
valid
|
||||
);
|
||||
@ -565,7 +561,7 @@ bool Foam::fileOperations::collatedFileOperation::writeObject
|
||||
<< " appending to " << pathName << endl;
|
||||
}
|
||||
|
||||
return appendObject(io, pathName, fmt, ver, cmp);
|
||||
return appendObject(io, pathName, streamOpt);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -590,7 +586,7 @@ bool Foam::fileOperations::collatedFileOperation::writeObject
|
||||
(
|
||||
writer_,
|
||||
pathName,
|
||||
IOstreamOption(fmt, ver, cmp),
|
||||
streamOpt,
|
||||
useThread
|
||||
);
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -95,9 +95,7 @@ protected:
|
||||
(
|
||||
const regIOobject& io,
|
||||
const fileName& pathName,
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp
|
||||
IOstreamOption streamOpt
|
||||
) const;
|
||||
|
||||
|
||||
@ -150,9 +148,7 @@ public:
|
||||
virtual bool writeObject
|
||||
(
|
||||
const regIOobject&,
|
||||
IOstream::streamFormat format=IOstream::ASCII,
|
||||
IOstream::versionNumber version=IOstream::currentVersion,
|
||||
IOstream::compressionType compression=IOstream::UNCOMPRESSED,
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const bool valid = true
|
||||
) const;
|
||||
|
||||
|
||||
@ -464,9 +464,7 @@ Foam::fileName Foam::fileOperation::objectPath
|
||||
bool Foam::fileOperation::writeObject
|
||||
(
|
||||
const regIOobject& io,
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType comp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const
|
||||
{
|
||||
@ -476,10 +474,7 @@ bool Foam::fileOperation::writeObject
|
||||
|
||||
mkDir(pathName.path());
|
||||
|
||||
autoPtr<OSstream> osPtr
|
||||
(
|
||||
NewOFstream(pathName, IOstreamOption(fmt, ver, comp))
|
||||
);
|
||||
autoPtr<OSstream> osPtr(NewOFstream(pathName, streamOpt));
|
||||
|
||||
if (!osPtr)
|
||||
{
|
||||
|
||||
@ -410,9 +410,7 @@ public:
|
||||
virtual bool writeObject
|
||||
(
|
||||
const regIOobject& io,
|
||||
IOstream::streamFormat fmt = IOstream::ASCII,
|
||||
IOstream::versionNumber ver = IOstream::currentVersion,
|
||||
IOstream::compressionType comp = IOstream::UNCOMPRESSED,
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const bool valid = true
|
||||
) const;
|
||||
|
||||
|
||||
@ -494,93 +494,71 @@ bool Foam::fileOperations::masterUncollatedFileOperation::uniformFile
|
||||
void Foam::fileOperations::masterUncollatedFileOperation::readAndSend
|
||||
(
|
||||
const fileName& filePath,
|
||||
const IOstream::compressionType cmp,
|
||||
const labelUList& procs,
|
||||
PstreamBuffers& pBufs
|
||||
)
|
||||
{
|
||||
if (cmp == IOstream::compressionType::COMPRESSED)
|
||||
IFstream ifs(filePath, IOstream::streamFormat::BINARY);
|
||||
|
||||
if (!ifs.good())
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "masterUncollatedFileOperation::readAndSend :"
|
||||
<< " Opening compressed " << filePath << endl;
|
||||
}
|
||||
|
||||
IFstream is(filePath, IOstream::streamFormat::BINARY);
|
||||
|
||||
if (!is.good())
|
||||
{
|
||||
FatalIOErrorInFunction(filePath) << "Cannot open file " << filePath
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
std::ostringstream stringStr;
|
||||
stringStr << is.stdStream().rdbuf();
|
||||
string buf(stringStr.str());
|
||||
|
||||
forAll(procs, i)
|
||||
{
|
||||
UOPstream os(procs[i], pBufs);
|
||||
os.write(&buf[0], buf.size());
|
||||
}
|
||||
FatalIOErrorInFunction(filePath)
|
||||
<< "Cannot open file " << filePath
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
else
|
||||
|
||||
if (debug)
|
||||
{
|
||||
off_t count(Foam::fileSize(filePath));
|
||||
IFstream is(filePath, IOstream::streamFormat::BINARY);
|
||||
Pout<< "masterUncollatedFileOperation::readAndSend :"
|
||||
<< " compressed:" << bool(ifs.compression()) << " "
|
||||
<< filePath << endl;
|
||||
}
|
||||
|
||||
if (!is.good())
|
||||
if (ifs.compression() == IOstream::compressionType::COMPRESSED)
|
||||
{
|
||||
// Could use Foam::fileSize, estimate uncompressed size (eg, 2x)
|
||||
// and then string reserve followed by string assign...
|
||||
|
||||
// Uncompress and read file contents into a character buffer
|
||||
const std::string buf
|
||||
(
|
||||
std::istreambuf_iterator<char>(ifs.stdStream()),
|
||||
std::istreambuf_iterator<char>()
|
||||
);
|
||||
|
||||
for (const label proci : procs)
|
||||
{
|
||||
FatalIOErrorInFunction(filePath) << "Cannot open file " << filePath
|
||||
<< exit(FatalIOError);
|
||||
UOPstream os(proci, pBufs);
|
||||
os.write(buf.data(), buf.length());
|
||||
}
|
||||
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "masterUncollatedFileOperation::readStream :"
|
||||
<< " From " << filePath << " reading " << label(count)
|
||||
<< " From " << filePath << " sent " << buf.size()
|
||||
<< " bytes" << endl;
|
||||
}
|
||||
List<char> buf(static_cast<label>(count));
|
||||
is.stdStream().read(buf.begin(), count);
|
||||
|
||||
forAll(procs, i)
|
||||
{
|
||||
UOPstream os(procs[i], pBufs);
|
||||
os.write(buf.begin(), count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::fileOperations::masterUncollatedFileOperation::readAndSend
|
||||
(
|
||||
const fileName& fName,
|
||||
const labelUList& procs,
|
||||
PstreamBuffers& pBufs
|
||||
)
|
||||
{
|
||||
if (Foam::exists(fName+".gz", false))
|
||||
{
|
||||
readAndSend
|
||||
(
|
||||
fName,
|
||||
IOstream::compressionType::COMPRESSED,
|
||||
procs,
|
||||
pBufs
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
readAndSend
|
||||
(
|
||||
fName,
|
||||
IOstream::compressionType::UNCOMPRESSED,
|
||||
procs,
|
||||
pBufs
|
||||
);
|
||||
const off_t count(Foam::fileSize(filePath));
|
||||
|
||||
// Read file contents into a character buffer
|
||||
List<char> buf(static_cast<label>(count));
|
||||
ifs.stdStream().read(buf.data(), count);
|
||||
|
||||
for (const label proci : procs)
|
||||
{
|
||||
UOPstream os(proci, pBufs);
|
||||
os.write(buf.cdata(), count);
|
||||
}
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "masterUncollatedFileOperation::readStream :"
|
||||
<< " From " << filePath << " sent " << buf.size()
|
||||
<< " bytes" << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -656,18 +634,16 @@ Foam::fileOperations::masterUncollatedFileOperation::read
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
autoPtr<IFstream> ifsPtr(new IFstream(filePaths[0]));
|
||||
// Open master
|
||||
isPtr.reset(new IFstream(filePaths[0]));
|
||||
|
||||
// Read header
|
||||
if (!io.readHeader(ifsPtr()))
|
||||
if (!io.readHeader(isPtr()))
|
||||
{
|
||||
FatalIOErrorInFunction(ifsPtr())
|
||||
FatalIOErrorInFunction(isPtr())
|
||||
<< "problem while reading header for object "
|
||||
<< io.name() << exit(FatalIOError);
|
||||
}
|
||||
|
||||
// Open master (steal from ifsPtr)
|
||||
isPtr.reset(ifsPtr.ptr());
|
||||
}
|
||||
|
||||
// Read slave files
|
||||
@ -715,7 +691,7 @@ Foam::fileOperations::masterUncollatedFileOperation::read
|
||||
List<char> buf(recvSizes[Pstream::masterNo()]);
|
||||
if (recvSizes[Pstream::masterNo()] > 0)
|
||||
{
|
||||
is.read(buf.begin(), recvSizes[Pstream::masterNo()]);
|
||||
is.read(buf.data(), recvSizes[Pstream::masterNo()]);
|
||||
}
|
||||
|
||||
if (debug)
|
||||
@ -723,17 +699,15 @@ Foam::fileOperations::masterUncollatedFileOperation::read
|
||||
Pout<< "masterUncollatedFileOperation::readStream :"
|
||||
<< " Done reading " << buf.size() << " bytes" << endl;
|
||||
}
|
||||
const fileName& fName = filePaths[Pstream::myProcNo(comm)];
|
||||
isPtr.reset
|
||||
(
|
||||
new IListStream
|
||||
(
|
||||
std::move(buf),
|
||||
IOstream::BINARY,
|
||||
IOstream::currentVersion,
|
||||
fName
|
||||
)
|
||||
);
|
||||
|
||||
// A local character buffer copy of the Pstream contents.
|
||||
// Construct with same parameters (ASCII, current version)
|
||||
// as the IFstream so that it has the same characteristics.
|
||||
|
||||
isPtr.reset(new IListStream(std::move(buf)));
|
||||
|
||||
// With the proper file name
|
||||
isPtr->name() = filePaths[Pstream::myProcNo(comm)];
|
||||
|
||||
if (!io.readHeader(isPtr()))
|
||||
{
|
||||
@ -1424,6 +1398,7 @@ Foam::fileName Foam::fileOperations::masterUncollatedFileOperation::dirPath
|
||||
{
|
||||
// Retest all processors separately since some processors might
|
||||
// have the file and some not (e.g. lagrangian data)
|
||||
|
||||
objPath = masterOp<fileName, fileOrNullOp>
|
||||
(
|
||||
io.objectPath(),
|
||||
@ -1721,7 +1696,7 @@ Foam::fileOperations::masterUncollatedFileOperation::readObjects
|
||||
{
|
||||
// Avoid fileOperation::readObjects from triggering parallel ops
|
||||
// (through call to filePath which triggers parallel )
|
||||
bool oldParRun = UPstream::parRun();
|
||||
const bool oldParRun = UPstream::parRun();
|
||||
UPstream::parRun() = false;
|
||||
|
||||
//- Use non-time searching version
|
||||
@ -1872,8 +1847,8 @@ bool Foam::fileOperations::masterUncollatedFileOperation::readHeader
|
||||
== decomposedBlockData::typeName
|
||||
)
|
||||
{
|
||||
// Read the header inside the container (master
|
||||
// data)
|
||||
// Read the header inside the container
|
||||
// (master data)
|
||||
result[proci] = decomposedBlockData::
|
||||
readMasterHeader
|
||||
(
|
||||
@ -2003,7 +1978,6 @@ Foam::fileOperations::masterUncollatedFileOperation::readStream
|
||||
);
|
||||
|
||||
|
||||
List<char> data;
|
||||
if (!Pstream::parRun())
|
||||
{
|
||||
// Analyse the objectpath to find out the processor we're trying
|
||||
@ -2038,20 +2012,6 @@ Foam::fileOperations::masterUncollatedFileOperation::readStream
|
||||
}
|
||||
else
|
||||
{
|
||||
// Scatter master header info
|
||||
//string versionString;
|
||||
//string formatString;
|
||||
//if (isPtr.valid())
|
||||
//{
|
||||
// versionString = isPtr().version().str();
|
||||
// OStringStream os;
|
||||
// os << isPtr().format();
|
||||
// formatString = (os.str());
|
||||
//}
|
||||
//
|
||||
//Pstream::scatter(versionString); //, Pstream::msgType(), comm);
|
||||
//Pstream::scatter(formatString); //, Pstream::msgType(), comm);
|
||||
|
||||
// Get size of file
|
||||
off_t sz = Foam::fileSize(fName);
|
||||
bool bigSize = sz > off_t(maxMasterFileBufferSize);
|
||||
@ -2131,7 +2091,7 @@ Foam::fileOperations::masterUncollatedFileOperation::readStream
|
||||
Pstream::gatherList(procValid, Pstream::msgType(), comm_);
|
||||
|
||||
// Uniform in local comm
|
||||
bool uniform = uniformFile(filePaths);
|
||||
const bool uniform = uniformFile(filePaths);
|
||||
|
||||
return read(io, comm_, uniform, filePaths, procValid);
|
||||
}
|
||||
@ -2161,7 +2121,7 @@ bool Foam::fileOperations::masterUncollatedFileOperation::read
|
||||
if (Pstream::master()) // comm_))
|
||||
{
|
||||
// Do master-only reading always.
|
||||
bool oldParRun = UPstream::parRun();
|
||||
const bool oldParRun = UPstream::parRun();
|
||||
UPstream::parRun() = false;
|
||||
|
||||
ok = io.readData(io.readStream(typeName));
|
||||
@ -2244,9 +2204,7 @@ bool Foam::fileOperations::masterUncollatedFileOperation::read
|
||||
bool Foam::fileOperations::masterUncollatedFileOperation::writeObject
|
||||
(
|
||||
const regIOobject& io,
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType comp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const
|
||||
{
|
||||
@ -2261,15 +2219,7 @@ bool Foam::fileOperations::masterUncollatedFileOperation::writeObject
|
||||
// Make sure to pick up any new times
|
||||
setTime(io.time());
|
||||
|
||||
autoPtr<OSstream> osPtr
|
||||
(
|
||||
NewOFstream
|
||||
(
|
||||
pathName,
|
||||
IOstreamOption(fmt, ver, comp),
|
||||
valid
|
||||
)
|
||||
);
|
||||
autoPtr<OSstream> osPtr(NewOFstream(pathName, streamOpt, valid));
|
||||
OSstream& os = osPtr();
|
||||
|
||||
// If any of these fail, return (leave error handling to Ostream class)
|
||||
@ -2317,7 +2267,7 @@ Foam::instantList Foam::fileOperations::masterUncollatedFileOperation::findTimes
|
||||
if (Pstream::master()) // comm_))
|
||||
{
|
||||
// Do master-only reading always.
|
||||
bool oldParRun = UPstream::parRun();
|
||||
const bool oldParRun = UPstream::parRun();
|
||||
UPstream::parRun() = false;
|
||||
times = fileOperation::findTimes(directory, constantName);
|
||||
UPstream::parRun() = oldParRun;
|
||||
@ -2353,6 +2303,8 @@ void Foam::fileOperations::masterUncollatedFileOperation::setTime
|
||||
}
|
||||
|
||||
// Mutable access to instantList for modification and sorting
|
||||
// - cannot use auto type deduction here
|
||||
|
||||
HashPtrTable<instantList>::iterator iter = times_.find(tm.path());
|
||||
|
||||
if (iter.found())
|
||||
@ -2361,48 +2313,40 @@ void Foam::fileOperations::masterUncollatedFileOperation::setTime
|
||||
|
||||
const instant timeNow(tm.value(), tm.timeName());
|
||||
|
||||
if (times.size() > 0 && times[0].name() == tm.constant())
|
||||
{
|
||||
// Exclude constant
|
||||
SubList<instant> realTimes(times, times.size()-1, 1);
|
||||
if
|
||||
// Exclude constant when checking and sorting
|
||||
const label skipConst =
|
||||
(
|
||||
(!times.empty() && times[0].name() == tm.constant())
|
||||
? 1
|
||||
: 0
|
||||
);
|
||||
|
||||
if
|
||||
(
|
||||
findSortedIndex
|
||||
(
|
||||
findSortedIndex
|
||||
(
|
||||
SubList<instant>(times, times.size()-1, 1),
|
||||
timeNow
|
||||
)
|
||||
== -1
|
||||
SubList<instant>(times, times.size()-skipConst, skipConst),
|
||||
timeNow
|
||||
)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "masterUncollatedFileOperation::setTime :"
|
||||
<< " Caching time " << tm.timeName()
|
||||
<< " for case:" << tm.path() << endl;
|
||||
}
|
||||
|
||||
times.append(timeNow);
|
||||
SubList<instant> realTimes(times, times.size()-1, 1);
|
||||
Foam::stableSort(realTimes);
|
||||
}
|
||||
}
|
||||
else
|
||||
== -1
|
||||
)
|
||||
{
|
||||
if (findSortedIndex(times, timeNow) == -1)
|
||||
if (debug)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "masterUncollatedFileOperation::setTime :"
|
||||
<< " Caching time " << tm.timeName()
|
||||
<< " for case:" << tm.path() << endl;
|
||||
}
|
||||
|
||||
times.append(timeNow);
|
||||
Foam::stableSort(times);
|
||||
Pout<< "masterUncollatedFileOperation::setTime :"
|
||||
<< " Caching time " << tm.timeName()
|
||||
<< " for case:" << tm.path() << endl;
|
||||
}
|
||||
|
||||
times.append(timeNow);
|
||||
SubList<instant> realTimes
|
||||
(
|
||||
times, times.size()-skipConst, skipConst
|
||||
);
|
||||
Foam::stableSort(realTimes);
|
||||
}
|
||||
}
|
||||
|
||||
fileOperation::setTime(tm);
|
||||
}
|
||||
|
||||
@ -2413,6 +2357,8 @@ Foam::fileOperations::masterUncollatedFileOperation::NewIFstream
|
||||
const fileName& filePath
|
||||
) const
|
||||
{
|
||||
autoPtr<ISstream> isPtr;
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// Insert logic of filePath. We assume that if a file is absolute
|
||||
@ -2441,25 +2387,12 @@ Foam::fileOperations::masterUncollatedFileOperation::NewIFstream
|
||||
<< " Opening global file " << filePath << endl;
|
||||
}
|
||||
|
||||
IOstream::compressionType cmp
|
||||
readAndSend
|
||||
(
|
||||
Foam::exists(filePath+".gz", false)
|
||||
? IOstream::compressionType::COMPRESSED
|
||||
: IOstream::compressionType::UNCOMPRESSED
|
||||
filePath,
|
||||
identity(Pstream::nProcs(Pstream::worldComm)-1, 1),
|
||||
pBufs
|
||||
);
|
||||
|
||||
labelList procs(Pstream::nProcs(Pstream::worldComm)-1);
|
||||
for
|
||||
(
|
||||
label proci = 1;
|
||||
proci < Pstream::nProcs(Pstream::worldComm);
|
||||
proci++
|
||||
)
|
||||
{
|
||||
procs[proci-1] = proci;
|
||||
}
|
||||
|
||||
readAndSend(filePath, cmp, procs, pBufs);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2470,17 +2403,9 @@ Foam::fileOperations::masterUncollatedFileOperation::NewIFstream
|
||||
proci++
|
||||
)
|
||||
{
|
||||
IOstream::compressionType cmp
|
||||
(
|
||||
Foam::exists(filePaths[proci]+".gz", false)
|
||||
? IOstream::compressionType::COMPRESSED
|
||||
: IOstream::compressionType::UNCOMPRESSED
|
||||
);
|
||||
|
||||
readAndSend
|
||||
(
|
||||
filePaths[proci],
|
||||
cmp,
|
||||
labelList(1, proci),
|
||||
pBufs
|
||||
);
|
||||
@ -2495,10 +2420,7 @@ Foam::fileOperations::masterUncollatedFileOperation::NewIFstream
|
||||
if (Pstream::master(Pstream::worldComm))
|
||||
{
|
||||
// Read myself
|
||||
return autoPtr<ISstream>
|
||||
(
|
||||
new IFstream(filePaths[Pstream::masterNo()])
|
||||
);
|
||||
isPtr.reset(new IFstream(filePaths[Pstream::masterNo()]));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2512,7 +2434,7 @@ Foam::fileOperations::masterUncollatedFileOperation::NewIFstream
|
||||
UIPstream is(Pstream::masterNo(), pBufs);
|
||||
|
||||
List<char> buf(recvSizes[Pstream::masterNo()]);
|
||||
is.read(buf.begin(), buf.size());
|
||||
is.read(buf.data(), buf.size());
|
||||
|
||||
if (debug)
|
||||
{
|
||||
@ -2520,26 +2442,23 @@ Foam::fileOperations::masterUncollatedFileOperation::NewIFstream
|
||||
<< " Done reading " << buf.size() << " bytes" << endl;
|
||||
}
|
||||
|
||||
// Note: IPstream is not an IStream so use a IStringStream to
|
||||
// convert the buffer. Note that we construct with a string
|
||||
// so it holds a copy of the buffer.
|
||||
return autoPtr<ISstream>
|
||||
(
|
||||
new IListStream
|
||||
(
|
||||
std::move(buf),
|
||||
IOstream::BINARY,
|
||||
IOstream::currentVersion,
|
||||
filePath
|
||||
)
|
||||
);
|
||||
// A local character buffer copy of the Pstream contents.
|
||||
// Construct with same parameters (ASCII, current version)
|
||||
// as the IFstream so that it has the same characteristics.
|
||||
|
||||
isPtr.reset(new IListStream(std::move(buf)));
|
||||
|
||||
// With the proper file name
|
||||
isPtr->name() = filePath;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Read myself
|
||||
return autoPtr<ISstream>(new IFstream(filePath));
|
||||
isPtr.reset(new IFstream(filePath));
|
||||
}
|
||||
|
||||
return isPtr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -448,20 +448,11 @@ protected:
|
||||
const word& instancePath
|
||||
) const;
|
||||
|
||||
//- Read file contents and send to processors
|
||||
//- Read file contents and send to processors.
|
||||
// Handles compressed or uncompressed files
|
||||
static void readAndSend
|
||||
(
|
||||
const fileName& filePath,
|
||||
const IOstream::compressionType cmp,
|
||||
const labelUList& procs,
|
||||
PstreamBuffers& pBufs
|
||||
);
|
||||
|
||||
//- Detect file (possibly compressed), read file contents and send
|
||||
// to processors
|
||||
static void readAndSend
|
||||
(
|
||||
const fileName& fName,
|
||||
const labelUList& procs,
|
||||
PstreamBuffers& pBufs
|
||||
);
|
||||
@ -697,9 +688,7 @@ public:
|
||||
virtual bool writeObject
|
||||
(
|
||||
const regIOobject& io,
|
||||
IOstream::streamFormat format=IOstream::ASCII,
|
||||
IOstream::versionNumber version=IOstream::currentVersion,
|
||||
IOstream::compressionType compression=IOstream::UNCOMPRESSED,
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const bool valid = true
|
||||
) const;
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2009-2016 Bernhard Gschaider
|
||||
Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -393,19 +393,11 @@ bool Foam::profiling::writeData(Ostream& os) const
|
||||
|
||||
bool Foam::profiling::writeObject
|
||||
(
|
||||
IOstream::streamFormat,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType,
|
||||
IOstreamOption,
|
||||
const bool valid
|
||||
) const
|
||||
{
|
||||
return regIOobject::writeObject
|
||||
(
|
||||
IOstream::ASCII,
|
||||
ver,
|
||||
IOstream::UNCOMPRESSED,
|
||||
true
|
||||
);
|
||||
return regIOobject::writeObject(IOstreamOption(IOstream::ASCII), true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2009-2016 Bernhard Gschaider
|
||||
Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -247,12 +247,10 @@ public:
|
||||
//- writeData member function required by regIOobject
|
||||
virtual bool writeData(Ostream& os) const;
|
||||
|
||||
//- Write as uncompressed ASCII, using given format
|
||||
//- Write as uncompressed ASCII
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstream::streamFormat ignoreAlwaysASCII,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType ignoreAlwaysUncompressed,
|
||||
IOstreamOption /*ignore*/,
|
||||
const bool valid
|
||||
) const;
|
||||
};
|
||||
|
||||
@ -234,9 +234,7 @@ void Foam::uniformInterpolationTable<Type>::write() const
|
||||
|
||||
dict.regIOobject::writeObject
|
||||
(
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
dict.time().writeCompression(),
|
||||
IOstreamOption(IOstream::ASCII, dict.time().writeCompression()),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -1234,13 +1234,12 @@ bool Foam::polyBoundaryMesh::writeData(Ostream& os) const
|
||||
|
||||
bool Foam::polyBoundaryMesh::writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const
|
||||
{
|
||||
return regIOobject::writeObject(fmt, ver, IOstream::UNCOMPRESSED, valid);
|
||||
streamOpt.compression(IOstream::UNCOMPRESSED);
|
||||
return regIOobject::writeObject(streamOpt, valid);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -270,12 +270,10 @@ public:
|
||||
//- writeData member function required by regIOobject
|
||||
virtual bool writeData(Ostream& os) const;
|
||||
|
||||
//- Write using given format, version, compression
|
||||
//- Write using stream options
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const;
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -587,9 +587,7 @@ void Foam::ccm::reader::writeMesh
|
||||
Info<< "Writing polyMesh" << endl;
|
||||
mesh.writeObject
|
||||
(
|
||||
fmt,
|
||||
IOstream::currentVersion,
|
||||
IOstream::UNCOMPRESSED,
|
||||
IOstreamOption(fmt),
|
||||
true
|
||||
);
|
||||
writeAux(mesh);
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -174,9 +174,7 @@ void Foam::ccm::reader::writeMeshLabelList
|
||||
//
|
||||
ioObj.writeObject
|
||||
(
|
||||
fmt,
|
||||
IOstream::currentVersion,
|
||||
IOstream::UNCOMPRESSED,
|
||||
IOstreamOption(fmt),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
@ -133,9 +133,7 @@ void Foam::meshReader::writeMesh
|
||||
Info<< "Writing polyMesh" << endl;
|
||||
mesh.writeObject
|
||||
(
|
||||
fmt,
|
||||
IOstream::currentVersion,
|
||||
IOstream::UNCOMPRESSED,
|
||||
IOstreamOption(fmt),
|
||||
true
|
||||
);
|
||||
writeAux(mesh);
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -135,14 +135,8 @@ void Foam::meshReader::writeMeshLabelList
|
||||
// NOTE:
|
||||
// the cellTableId is an integer and almost always < 1000, thus ASCII
|
||||
// will be compacter than binary and makes external scripting easier
|
||||
//
|
||||
ioObj.writeObject
|
||||
(
|
||||
fmt,
|
||||
IOstream::currentVersion,
|
||||
IOstream::UNCOMPRESSED,
|
||||
true
|
||||
);
|
||||
|
||||
ioObj.writeObject(IOstreamOption(fmt), true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -1387,9 +1387,7 @@ bool Foam::dynamicRefineFvMesh::update()
|
||||
|
||||
bool Foam::dynamicRefineFvMesh::writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const
|
||||
{
|
||||
@ -1398,7 +1396,7 @@ bool Foam::dynamicRefineFvMesh::writeObject
|
||||
|
||||
bool writeOk =
|
||||
(
|
||||
dynamicFvMesh::writeObject(fmt, ver, cmp, valid)
|
||||
dynamicFvMesh::writeObject(streamOpt, valid)
|
||||
&& meshCutter_.write(valid)
|
||||
);
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -264,12 +264,10 @@ public:
|
||||
|
||||
// Writing
|
||||
|
||||
//- Write using given format, version and compression
|
||||
//- Write using stream options
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const;
|
||||
};
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -222,9 +222,7 @@ void Foam::motionSolver::updateMesh(const mapPolyMesh& mpm)
|
||||
|
||||
bool Foam::motionSolver::writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption,
|
||||
const bool valid
|
||||
) const
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -170,12 +170,10 @@ public:
|
||||
//- Update local data for topology changes
|
||||
virtual void updateMesh(const mapPolyMesh&) = 0;
|
||||
|
||||
//- Write state using given format, version and compression
|
||||
//- Write state using stream options
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const;
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -912,9 +912,7 @@ void Foam::fvMesh::updateMesh(const mapPolyMesh& mpm)
|
||||
|
||||
bool Foam::fvMesh::writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const
|
||||
{
|
||||
@ -932,7 +930,7 @@ bool Foam::fvMesh::writeObject
|
||||
ok = V0Ptr_->write(valid);
|
||||
}
|
||||
|
||||
return ok && polyMesh::writeObject(fmt, ver, cmp, valid);
|
||||
return ok && polyMesh::writeObject(streamOpt, valid);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -455,9 +455,7 @@ public:
|
||||
//- Write the underlying polyMesh and other data
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const;
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -247,13 +247,11 @@ public:
|
||||
// this level.
|
||||
virtual void writeFields() const;
|
||||
|
||||
//- Write using given format, version and compression.
|
||||
//- Write using stream options.
|
||||
// Only writes the cloud file if the Cloud isn't empty
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const;
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -121,9 +121,7 @@ void Foam::Cloud<ParticleType>::writeCloudUniformProperties() const
|
||||
|
||||
uniformPropsDict.writeObject
|
||||
(
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
time().writeCompression(),
|
||||
IOstreamOption(IOstream::ASCII, time().writeCompression()),
|
||||
true
|
||||
);
|
||||
}
|
||||
@ -252,16 +250,14 @@ void Foam::Cloud<ParticleType>::writeFields() const
|
||||
template<class ParticleType>
|
||||
bool Foam::Cloud<ParticleType>::writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool
|
||||
) const
|
||||
{
|
||||
writeCloudUniformProperties();
|
||||
|
||||
writeFields();
|
||||
return cloud::writeObject(fmt, ver, cmp, this->size());
|
||||
return cloud::writeObject(streamOpt, this->size());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -251,9 +251,11 @@ void Foam::KinematicCloud<CloudType>::postEvolve()
|
||||
{
|
||||
outputProperties_.writeObject
|
||||
(
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
this->db().time().writeCompression(),
|
||||
IOstreamOption
|
||||
(
|
||||
IOstream::ASCII,
|
||||
this->db().time().writeCompression()
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -443,18 +443,14 @@ bool Foam::coordinateSystems::writeData(Ostream& os) const
|
||||
|
||||
bool Foam::coordinateSystems::writeObject
|
||||
(
|
||||
IOstream::streamFormat,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType,
|
||||
IOstreamOption,
|
||||
const bool valid
|
||||
) const
|
||||
{
|
||||
// Force ASCII writing
|
||||
// Force ASCII, uncompressed
|
||||
return regIOobject::writeObject
|
||||
(
|
||||
IOstream::ASCII,
|
||||
ver,
|
||||
IOstream::UNCOMPRESSED,
|
||||
IOstreamOption(IOstream::ASCII),
|
||||
valid
|
||||
);
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -176,12 +176,10 @@ public:
|
||||
//- Write data
|
||||
bool writeData(Ostream& os) const;
|
||||
|
||||
//- Write data
|
||||
//- Write using stream options
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstream::streamFormat,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid = true
|
||||
) const;
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -1239,9 +1239,7 @@ void Foam::triSurfaceMesh::getVolumeType
|
||||
|
||||
bool Foam::triSurfaceMesh::writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption,
|
||||
const bool valid
|
||||
) const
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -331,12 +331,10 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
//- Write using given format, version and compression
|
||||
//- Write using stream options
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const;
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -229,16 +229,14 @@ Foam::label Foam::cellZoneSet::maxSize(const polyMesh& mesh) const
|
||||
|
||||
bool Foam::cellZoneSet::writeObject
|
||||
(
|
||||
IOstream::streamFormat s,
|
||||
IOstream::versionNumber v,
|
||||
IOstream::compressionType c,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const
|
||||
{
|
||||
// Write shadow cellSet
|
||||
word oldTypeName = typeName;
|
||||
const_cast<word&>(type()) = cellSet::typeName;
|
||||
bool ok = cellSet::writeObject(s, v, c, valid);
|
||||
bool ok = cellSet::writeObject(streamOpt, valid);
|
||||
const_cast<word&>(type()) = oldTypeName;
|
||||
|
||||
// Modify cellZone
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -139,12 +139,10 @@ public:
|
||||
const label maxLen
|
||||
) const;
|
||||
|
||||
//- Write cellZone
|
||||
//- Write cellZone using stream options
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstream::streamFormat,
|
||||
IOstream::versionNumber,
|
||||
IOstream::compressionType,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const;
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -451,16 +451,14 @@ Foam::label Foam::faceZoneSet::maxSize(const polyMesh& mesh) const
|
||||
|
||||
bool Foam::faceZoneSet::writeObject
|
||||
(
|
||||
IOstream::streamFormat s,
|
||||
IOstream::versionNumber v,
|
||||
IOstream::compressionType c,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const
|
||||
{
|
||||
// Write shadow faceSet
|
||||
word oldTypeName = typeName;
|
||||
const_cast<word&>(type()) = faceSet::typeName;
|
||||
bool ok = faceSet::writeObject(s, v, c, valid);
|
||||
bool ok = faceSet::writeObject(streamOpt, valid);
|
||||
const_cast<word&>(type()) = oldTypeName;
|
||||
|
||||
// Modify faceZone
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -154,12 +154,10 @@ public:
|
||||
const label maxLen
|
||||
) const;
|
||||
|
||||
//- Write faceZone
|
||||
//- Write faceZone using stream options
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstream::streamFormat,
|
||||
IOstream::versionNumber,
|
||||
IOstream::compressionType,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const;
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -229,16 +229,14 @@ Foam::label Foam::pointZoneSet::maxSize(const polyMesh& mesh) const
|
||||
|
||||
bool Foam::pointZoneSet::writeObject
|
||||
(
|
||||
IOstream::streamFormat s,
|
||||
IOstream::versionNumber v,
|
||||
IOstream::compressionType c,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const
|
||||
{
|
||||
// Write shadow pointSet
|
||||
word oldTypeName = typeName;
|
||||
const_cast<word&>(type()) = pointSet::typeName;
|
||||
bool ok = pointSet::writeObject(s, v, c, valid);
|
||||
bool ok = pointSet::writeObject(streamOpt, valid);
|
||||
const_cast<word&>(type()) = oldTypeName;
|
||||
|
||||
// Modify pointZone
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -140,12 +140,10 @@ public:
|
||||
const label maxLen
|
||||
) const;
|
||||
|
||||
//- Write pointZone
|
||||
//- Write pointZone using stream options
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstream::streamFormat,
|
||||
IOstream::versionNumber,
|
||||
IOstream::compressionType,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const;
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2007-2019 PCOpt/NTUA
|
||||
Copyright (C) 2013-2019 FOSS GP
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -206,9 +206,7 @@ Foam::lineSearch& Foam::lineSearch::operator++()
|
||||
lineSearchDict_.add<label>("iter", iter_, true);
|
||||
lineSearchDict_.regIOobject::writeObject
|
||||
(
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
IOstream::UNCOMPRESSED,
|
||||
IOstreamOption(IOstream::ASCII),
|
||||
true
|
||||
);
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2007-2019 PCOpt/NTUA
|
||||
Copyright (C) 2013-2019 FOSS GP
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -413,9 +413,7 @@ void Foam::updateMethod::write()
|
||||
// (e.g. continuation)
|
||||
optMethodIODict_.regIOobject::writeObject
|
||||
(
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
mesh_.time().writeCompression(),
|
||||
IOstreamOption(IOstream::ASCII, mesh_.time().writeCompression()),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2007-2019 PCOpt/NTUA
|
||||
Copyright (C) 2013-2019 FOSS GP
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -1893,16 +1893,11 @@ void Foam::NURBS3DVolume::writeCpsInDict() const
|
||||
);
|
||||
|
||||
cpsDict.add("controlPoints", cps_);
|
||||
// Always write in ASCII format.
|
||||
// Even when choosing to write in binary through controlDict,
|
||||
// the content is written in ASCII format but with a binary header.
|
||||
// This creates problems when the content is read back in
|
||||
// (e.g. continuation)
|
||||
|
||||
// Always write in ASCII, but allow compression
|
||||
cpsDict.regIOobject::writeObject
|
||||
(
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
mesh_.time().writeCompression(),
|
||||
IOstreamOption(IOstream::ASCII, mesh_.time().writeCompression()),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2014-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2014-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -648,14 +648,12 @@ bool Foam::dynamicOversetFvMesh::interpolateFields()
|
||||
|
||||
bool Foam::dynamicOversetFvMesh::writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const
|
||||
{
|
||||
//bool ok = dynamicMotionSolverFvMesh::writeObject(fmt, ver, cmp, valid);
|
||||
bool ok = dynamicMotionSolverListFvMesh::writeObject(fmt, ver, cmp, valid);
|
||||
//bool ok = dynamicMotionSolverFvMesh::writeObject(streamOpt, valid);
|
||||
bool ok = dynamicMotionSolverListFvMesh::writeObject(streamOpt, valid);
|
||||
|
||||
// For postprocessing : write cellTypes and zoneID
|
||||
{
|
||||
@ -684,7 +682,7 @@ bool Foam::dynamicOversetFvMesh::writeObject
|
||||
volTypes[cellI] = cellTypes[cellI];
|
||||
}
|
||||
volTypes.correctBoundaryConditions();
|
||||
volTypes.writeObject(fmt, ver, cmp, valid);
|
||||
volTypes.writeObject(streamOpt, valid);
|
||||
}
|
||||
{
|
||||
volScalarField volZoneID
|
||||
@ -711,7 +709,7 @@ bool Foam::dynamicOversetFvMesh::writeObject
|
||||
volZoneID[cellI] = zoneID[cellI];
|
||||
}
|
||||
volZoneID.correctBoundaryConditions();
|
||||
volZoneID.writeObject(fmt, ver, cmp, valid);
|
||||
volZoneID.writeObject(streamOpt, valid);
|
||||
}
|
||||
if (debug)
|
||||
{
|
||||
@ -764,7 +762,7 @@ bool Foam::dynamicOversetFvMesh::writeObject
|
||||
}
|
||||
//- Do not correctBoundaryConditions since re-interpolates!
|
||||
//volDonorZoneID.correctBoundaryConditions();
|
||||
volDonorZoneID.writeObject(fmt, ver, cmp, valid);
|
||||
volDonorZoneID.writeObject(streamOpt, valid);
|
||||
}
|
||||
|
||||
return ok;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -350,12 +350,10 @@ public:
|
||||
//- Update fields when mesh is updated
|
||||
virtual bool interpolateFields();
|
||||
|
||||
//- Write using given format, version and compression
|
||||
//- Write using stream options
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstream::streamFormat,
|
||||
IOstream::versionNumber,
|
||||
IOstream::compressionType,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const;
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -4835,9 +4835,7 @@ void Foam::distributedTriSurfaceMesh::distribute
|
||||
|
||||
bool Foam::distributedTriSurfaceMesh::writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const
|
||||
{
|
||||
@ -4871,7 +4869,8 @@ bool Foam::distributedTriSurfaceMesh::writeObject
|
||||
}
|
||||
|
||||
// Dictionary needs to be written in ascii - binary output not supported.
|
||||
bool ok = dict_.writeObject(IOstream::ASCII, ver, cmp, true);
|
||||
streamOpt.format(IOstream::ASCII);
|
||||
bool ok = dict_.writeObject(streamOpt, true);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -577,16 +577,14 @@ public:
|
||||
|
||||
// regIOobject implementation
|
||||
|
||||
//- Write using given format, version and compression
|
||||
//- Write using stream options
|
||||
// Do not use the triSurfaceMesh::writeObject since it
|
||||
// would filter out empty regions. These need to be preserved
|
||||
// in case we want to make decisions based on the number of
|
||||
// regions.
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const;
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2016 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -502,9 +502,7 @@ void Foam::regionModels::regionModel::evolve()
|
||||
{
|
||||
outputProperties().writeObject
|
||||
(
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
time_.writeCompression(),
|
||||
IOstreamOption(IOstream::ASCII, time_.writeCompression()),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -342,12 +342,13 @@ void Foam::rigidBodyMeshMotion::solve()
|
||||
|
||||
bool Foam::rigidBodyMeshMotion::writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const
|
||||
{
|
||||
// Force ASCII writing
|
||||
streamOpt.format(IOstream::ASCII);
|
||||
|
||||
IOdictionary dict
|
||||
(
|
||||
IOobject
|
||||
@ -363,8 +364,7 @@ bool Foam::rigidBodyMeshMotion::writeObject
|
||||
);
|
||||
|
||||
model_.state().write(dict);
|
||||
// Force ascii writing
|
||||
return dict.regIOobject::writeObject(IOstream::ASCII, ver, cmp, valid);
|
||||
return dict.regIOobject::writeObject(streamOpt, valid);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -165,12 +166,10 @@ public:
|
||||
//- Solve for motion
|
||||
virtual void solve();
|
||||
|
||||
//- Write state using given format, version and compression
|
||||
//- Write state using stream options
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const;
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -278,12 +278,13 @@ void Foam::rigidBodyMeshMotionSolver::solve()
|
||||
|
||||
bool Foam::rigidBodyMeshMotionSolver::writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const
|
||||
{
|
||||
// Force ASCII writing
|
||||
streamOpt.format(IOstream::ASCII);
|
||||
|
||||
IOdictionary dict
|
||||
(
|
||||
IOobject
|
||||
@ -299,8 +300,7 @@ bool Foam::rigidBodyMeshMotionSolver::writeObject
|
||||
);
|
||||
|
||||
model_.state().write(dict);
|
||||
// Force ascii writing
|
||||
return dict.regIOobject::writeObject(IOstream::ASCII, ver, cmp, valid);
|
||||
return dict.regIOobject::writeObject(streamOpt, valid);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -49,7 +50,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class rigidBodyMeshMotionSolver Declaration
|
||||
Class rigidBodyMeshMotionSolver Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class rigidBodyMeshMotionSolver
|
||||
@ -155,12 +156,10 @@ public:
|
||||
//- Solve for motion
|
||||
virtual void solve();
|
||||
|
||||
//- Write state using given format, version and compression
|
||||
//- Write state using stream options
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const;
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2013-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -294,9 +294,7 @@ void Foam::sixDoFRigidBodyMotionSolver::solve()
|
||||
|
||||
bool Foam::sixDoFRigidBodyMotionSolver::writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2013-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -141,12 +141,10 @@ public:
|
||||
//- Solve for motion
|
||||
virtual void solve();
|
||||
|
||||
//- Write state using given format, version and compression
|
||||
//- Write state using stream options
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const;
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -102,16 +102,14 @@ void Foam::Detail::MeshedSurfaceIOAllocator::clear()
|
||||
|
||||
bool Foam::Detail::MeshedSurfaceIOAllocator::writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const
|
||||
{
|
||||
return
|
||||
(
|
||||
points_.writeObject(fmt, ver, cmp, valid)
|
||||
&& faces_.writeObject(fmt, ver, cmp, valid)
|
||||
points_.writeObject(streamOpt, valid)
|
||||
&& faces_.writeObject(streamOpt, valid)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -148,15 +148,12 @@ public:
|
||||
|
||||
// Writing
|
||||
|
||||
//- Write using given format, version and compression
|
||||
//- Write using stream options
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -393,12 +393,10 @@ public:
|
||||
|
||||
// Writing
|
||||
|
||||
//- Write all components using given format, version and compression
|
||||
//- Write - this is a no-op
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const;
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -31,9 +31,7 @@ License
|
||||
|
||||
bool Foam::polySurface::writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const
|
||||
{
|
||||
|
||||
@ -351,9 +351,7 @@ public:
|
||||
//- Write all components using given format, version and compression
|
||||
virtual bool writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const;
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -193,17 +193,15 @@ Foam::surfMesh::readUpdateState Foam::surfMesh::readUpdate()
|
||||
|
||||
bool Foam::surfMesh::writeObject
|
||||
(
|
||||
IOstream::streamFormat fmt,
|
||||
IOstream::versionNumber ver,
|
||||
IOstream::compressionType cmp,
|
||||
IOstreamOption streamOpt,
|
||||
const bool valid
|
||||
) const
|
||||
{
|
||||
bool ok = Allocator::writeObject(fmt, ver, cmp, valid);
|
||||
bool ok = Allocator::writeObject(streamOpt, valid);
|
||||
|
||||
if (ok)
|
||||
{
|
||||
surfZones_.writeObject(fmt, ver, cmp, valid);
|
||||
surfZones_.writeObject(streamOpt, valid);
|
||||
}
|
||||
|
||||
return ok;
|
||||
|
||||
Reference in New Issue
Block a user