mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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:
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user