ENH: add tracking of label/scalar size when reading IOobject header

- extracts values from the arch "LSB;label=32;scalar=64" header entry
  to provision for managing dissimilar primitive sizes.

  Compensate for the additional IOobject members by narrowing the types
  for the (objectState, readOption, writeOption) enumerations
This commit is contained in:
Mark Olesen
2019-04-16 12:23:01 +02:00
committed by Andrew Heather
parent c2c00b121e
commit d14f181529
7 changed files with 144 additions and 17 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -36,6 +36,17 @@ Description
using namespace Foam;
// Test extraction
void testExtraction(const std::string& str)
{
Info<< "Extract: " << str << " =>"
<< " label: " << foamVersion::labelByteSize(str) << " bytes"
<< " scalar: " << foamVersion::scalarByteSize(str) << " bytes"
<< nl;
}
int main()
{
Info
@ -70,6 +81,29 @@ int main()
<< "macro " << long(Foam::FOAMversion) << nl
<< "namespace " << long(&(foamVersion::version[0])) << nl;
// Test extraction
{
Info<< "\nTest size extraction routines" << nl;
for
(
const std::string& str :
{
"MSB;label=32;scalar=64",
"LSB;label=64;scalar=32",
"LSB;label=;scalar=junk",
"LSB;label==;scalar=128",
"",
"LSB;label;scalar",
"LSB label=32 scalar=64",
}
)
{
testExtraction(str);
}
}
Info
<< "\nEnd\n" << endl;