Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
2f983f3f
Commit
2f983f3f
authored
Jul 18, 2019
by
Mark OLESEN
Committed by
Andrew Heather
Jul 18, 2019
Browse files
ENH: imbue input streams with label/scalar sizes (#1378)
parent
d25b19f6
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/OpenFOAM/db/IOobject/IOobjectReadHeader.C
View file @
2f983f3f
...
...
@@ -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
{
...
...
src/OpenFOAM/db/IOstreams/IOstreams/Istream.C
View file @
2f983f3f
...
...
@@ -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
...
...
src/OpenFOAM/db/IOstreams/IOstreams/Istream.H
View file @
2f983f3f
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment