mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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:
committed by
Andrew Heather
parent
c2c00b121e
commit
d14f181529
@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user