dimensionedType: Extend lookupOrDefault to handle any form of dimensioned type input

e.g.
     Not specified: default used.
     Fully specified: rhoMax          rhoMax [ 1 -3 0 0 0 ] 2.0;
     Without name:    rhoMax          [ 1 -3 0 0 0 ] 2.0;
     Value only:      rhoMax          2.0;
This commit is contained in:
Henry
2015-02-17 10:16:01 +00:00
parent b1ce18096c
commit 181045f8a9

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -38,8 +38,14 @@ Foam::dimensioned<Type> Foam::dimensioned<Type>::lookupOrDefault
const dimensionSet& dims
)
{
Type value = dict.lookupOrDefault<Type>(name, defaultValue);
return dimensioned<Type>(name, dims, value);
if (dict.found(name))
{
return dimensioned<Type>(name, dims, dict.lookup(name));
}
else
{
return dimensioned<Type>(name, dims, defaultValue);
}
}