ENH: use IOstreamOption for writeObject() calls.

- reduces the number of parameters that are being passed around
  and allows future additions into the IOstreamOption with mininal
  effort.
This commit is contained in:
Mark Olesen
2020-02-17 19:22:35 +01:00
committed by Mark Olesen
parent 9be1772e0c
commit 42299dca22
74 changed files with 272 additions and 419 deletions

View File

@ -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
);

View File

@ -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
)
)

View File

@ -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()
);

View File

@ -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;
}

View File

@ -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
);
}

View File

@ -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
);
}

View File

@ -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
);

View File

@ -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);
}

View File

@ -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;

View File

@ -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);
}

View File

@ -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;

View File

@ -1140,18 +1140,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());
}

View File

@ -135,12 +135,10 @@ public:
// and that the master data contains a header
virtual bool writeData(Ostream&) 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;

View File

@ -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;

View File

@ -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)

View File

@ -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
);

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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;
};

View File

@ -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);
}
// ************************************************************************* //

View File

@ -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
);

View File

@ -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;

View File

@ -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)
{

View File

@ -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;

View File

@ -2244,9 +2244,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 +2259,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)

View File

@ -697,9 +697,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;

View File

@ -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);
}

View File

@ -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;
};

View File

@ -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
);
}

View File

@ -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);
}

View File

@ -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;

View File

@ -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);

View File

@ -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
);
}

View File

@ -133,9 +133,7 @@ void Foam::meshReader::writeMesh
Info<< "Writing polyMesh" << endl;
mesh.writeObject
(
fmt,
IOstream::currentVersion,
IOstream::UNCOMPRESSED,
IOstreamOption(fmt),
true
);
writeAux(mesh);

View File

@ -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);
}

View File

@ -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)
);

View File

@ -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;
};

View File

@ -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
{

View File

@ -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;

View File

@ -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);
}

View File

@ -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;

View File

@ -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;

View File

@ -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());
}

View File

@ -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
);
}

View File

@ -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
);
}

View File

@ -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;

View File

@ -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
{

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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
);

View File

@ -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
);
}

View File

@ -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
);
}

View File

@ -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;

View File

@ -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;

View File

@ -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)
{

View File

@ -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;

View File

@ -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
);
}

View File

@ -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);
}

View File

@ -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;

View File

@ -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);
}

View File

@ -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;

View File

@ -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
{

View File

@ -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;

View File

@ -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)
);
}

View File

@ -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;
};

View File

@ -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;

View File

@ -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
{

View File

@ -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;

View File

@ -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;