dimensionedType: rationalize lookupOrDefault and lookupOrAddToDict

Now consistent with constructors.
This commit is contained in:
Henry Weller
2015-10-01 17:29:29 +01:00
parent 4096719046
commit a1550cba22
11 changed files with 44 additions and 58 deletions

View File

@ -198,18 +198,10 @@ Foam::dimensioned<Type> Foam::dimensioned<Type>::lookupOrDefault
(
const word& name,
const dictionary& dict,
const Type& defaultValue,
const dimensionSet& dims
const Type& defaultValue
)
{
if (dict.found(name))
{
return dimensioned<Type>(name, dims, dict.lookup(name));
}
else
{
return dimensioned<Type>(name, dims, defaultValue);
}
return lookupOrDefault(name, dict, dimless, defaultValue);
}
@ -232,12 +224,10 @@ Foam::dimensioned<Type> Foam::dimensioned<Type>::lookupOrAddToDict
(
const word& name,
dictionary& dict,
const Type& defaultValue,
const dimensionSet& dims
const Type& defaultValue
)
{
Type value = dict.lookupOrAddDefault<Type>(name, defaultValue);
return dimensioned<Type>(name, dims, value);
return lookupOrAddToDict(name, dict, dimless, defaultValue);
}

View File

@ -132,14 +132,12 @@ public:
const Type& defaultValue = pTraits<Type>::zero
);
//- Construct from dictionary, with default value and dimensions.
// Deprecated, use form with dimensions before value.
//- Construct from dictionary dimensionless with value.
static dimensioned<Type> lookupOrDefault
(
const word&,
const dictionary&,
const Type& defaultValue = pTraits<Type>::zero,
const dimensionSet& dims = dimless
const Type& defaultValue = pTraits<Type>::zero
);
//- Construct from dictionary, with default value.
@ -152,15 +150,13 @@ public:
const Type& defaultValue = pTraits<Type>::zero
);
//- Construct from dictionary, with default value.
//- Construct from dictionary, dimensionless with default value.
// If the value is not found, it is added into the dictionary.
// Deprecated, use form with dimensions before value.
static dimensioned<Type> lookupOrAddToDict
(
const word&,
dictionary&,
const Type& defaultValue = pTraits<Type>::zero,
const dimensionSet& dims = dimless
const Type& defaultValue = pTraits<Type>::zero
);

View File

@ -75,8 +75,8 @@ Foam::LESModel<BasicTurbulenceModel>::LESModel
(
"kMin",
LESDict_,
SMALL,
sqr(dimVelocity)
sqr(dimVelocity),
SMALL
)
),

View File

@ -75,8 +75,8 @@ Foam::RASModel<BasicTurbulenceModel>::RASModel
(
"kMin",
RASDict_,
SMALL,
sqr(dimVelocity)
sqr(dimVelocity),
SMALL
)
),
@ -86,8 +86,8 @@ Foam::RASModel<BasicTurbulenceModel>::RASModel
(
"epsilonMin",
RASDict_,
SMALL,
kMin_.dimensions()/dimTime
kMin_.dimensions()/dimTime,
SMALL
)
),
@ -97,8 +97,8 @@ Foam::RASModel<BasicTurbulenceModel>::RASModel
(
"omegaMin",
RASDict_,
SMALL,
dimless/dimTime
dimless/dimTime,
SMALL
)
)
{