Skip to content
Snippets Groups Projects
Commit 027909c7 authored by Henry Weller's avatar Henry Weller
Browse files

dimensionedType: rationalize lookupOrDefault and lookupOrAddToDict

Now consistent with constructors.
parent 81e083fc
No related branches found
No related tags found
No related merge requests found
Showing
with 44 additions and 58 deletions
......@@ -45,8 +45,8 @@ dimensionedScalar rhoMax
(
"rhoMax",
pimple.dict(),
GREAT,
dimDensity
dimDensity,
GREAT
)
);
......@@ -56,8 +56,8 @@ dimensionedScalar rhoMin
(
"rhoMin",
pimple.dict(),
0,
dimDensity
dimDensity,
0
)
);
......
......@@ -52,8 +52,8 @@ dimensionedScalar rhoMax
(
"rhoMax",
simple.dict(),
GREAT,
dimDensity
dimDensity,
GREAT
)
);
......@@ -63,8 +63,8 @@ dimensionedScalar rhoMin
(
"rhoMin",
simple.dict(),
0,
dimDensity
dimDensity,
0
)
);
......
......@@ -51,8 +51,8 @@ dimensionedScalar rhoMax
(
"rhoMax",
simple.dict(),
GREAT,
dimDensity
dimDensity,
GREAT
)
);
......@@ -62,8 +62,8 @@ dimensionedScalar rhoMin
(
"rhoMin",
simple.dict(),
0,
dimDensity
dimDensity,
0
)
);
......
......@@ -187,8 +187,8 @@ forAll(fluidRegions, i)
(
"rhoMax",
simpleDict,
GREAT,
dimDensity
dimDensity,
GREAT
)
)
);
......@@ -202,8 +202,8 @@ forAll(fluidRegions, i)
(
"rhoMin",
simpleDict,
0,
dimDensity
dimDensity,
0
)
)
);
......
......@@ -64,8 +64,8 @@ dimensionedScalar rhoMax
(
"rhoMax",
pimple.dict(),
GREAT,
dimDensity
dimDensity,
GREAT
)
);
......@@ -75,8 +75,8 @@ dimensionedScalar rhoMin
(
"rhoMin",
pimple.dict(),
0,
dimDensity
dimDensity,
0
)
);
......
......@@ -64,8 +64,8 @@ dimensionedScalar rhoMax
(
"rhoMax",
simple.dict(),
GREAT,
dimDensity
dimDensity,
GREAT
)
);
......@@ -75,8 +75,8 @@ dimensionedScalar rhoMin
(
"rhoMin",
simple.dict(),
0,
dimDensity
dimDensity,
0
)
);
......
......@@ -64,8 +64,8 @@ dimensionedScalar rhoMax
(
"rhoMax",
pimple.dict(),
GREAT,
dimDensity
dimDensity,
GREAT
)
);
......@@ -75,8 +75,8 @@ dimensionedScalar rhoMin
(
"rhoMin",
pimple.dict(),
0,
dimDensity
dimDensity,
0
)
);
......
......@@ -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);
}
......
......@@ -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
);
......
......@@ -75,8 +75,8 @@ Foam::LESModel<BasicTurbulenceModel>::LESModel
(
"kMin",
LESDict_,
SMALL,
sqr(dimVelocity)
sqr(dimVelocity),
SMALL
)
),
......
......@@ -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
)
)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment