Commit 50a2e36c authored by Henry's avatar Henry
Browse files

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;
parent da42029f
......@@ -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);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment