diff --git a/src/OpenFOAM/db/IOobject/IOobjectReadHeader.C b/src/OpenFOAM/db/IOobject/IOobjectReadHeader.C index 50a2b380202c2f4c3f6832af69290bd5da1ad98f..942ecab110b2048c50cf5e5e8b06965110702ccc 100644 --- a/src/OpenFOAM/db/IOobject/IOobjectReadHeader.C +++ b/src/OpenFOAM/db/IOobject/IOobjectReadHeader.C @@ -108,6 +108,9 @@ bool Foam::IOobject::readHeader(Istream& is) val = foamVersion::scalarByteSize(arch); if (val) scalarByteSize_ = val; } + + is.setLabelByteSize(labelByteSize_); + is.setScalarByteSize(scalarByteSize_); } else { diff --git a/src/OpenFOAM/db/IOstreams/IOstreams/Istream.C b/src/OpenFOAM/db/IOstreams/IOstreams/Istream.C index 41da11ba4c692beba4afe9d9597263a5ec48d696..21961c000aa7d488fc93a0e6320dfb24e0e09f1e 100644 --- a/src/OpenFOAM/db/IOstreams/IOstreams/Istream.C +++ b/src/OpenFOAM/db/IOstreams/IOstreams/Istream.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2016 OpenFOAM Foundation diff --git a/src/OpenFOAM/db/IOstreams/IOstreams/Istream.H b/src/OpenFOAM/db/IOstreams/IOstreams/Istream.H index 12af1ad0e4b251009c266eee983c683e712be18b..6ed2578ac06d0a76ef62f77220dc89052d400320 100644 --- a/src/OpenFOAM/db/IOstreams/IOstreams/Istream.H +++ b/src/OpenFOAM/db/IOstreams/IOstreams/Istream.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2016 OpenFOAM Foundation @@ -69,6 +69,12 @@ class Istream //- The last token put back on the stream token putBackToken_; + //- The label byte-size (could also be stored as byte) + unsigned short labelByteSize_; + + //- The scalar byte-size (could also be stored as byte) + unsigned short scalarByteSize_; + public: @@ -83,7 +89,9 @@ public: ) : IOstream(format, version, compression), - putBack_(false) + putBack_(false), + labelByteSize_(sizeof(Foam::label)), + scalarByteSize_(sizeof(Foam::scalar)) {} @@ -91,7 +99,34 @@ public: virtual ~Istream() = default; - // Member functions + // Member Functions + + // Characteristics + + //- The label byte-size associated with the stream + inline unsigned labelByteSize() const + { + return labelByteSize_; + } + + //- The scalar byte-size associated with the stream + inline unsigned scalarByteSize() const + { + return scalarByteSize_; + } + + //- Associate a label byte-size with the stream + inline void setLabelByteSize(unsigned val) + { + labelByteSize_ = val; + } + + //- Associate a scalar byte-size with the stream + inline void setScalarByteSize(unsigned val) + { + scalarByteSize_ = val; + } + // Read functions