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

dimensionedType: Corrected order of dimensions and value in lookupOrDefault and lookupOrAddToDict

Deprecated old versions.
parent 289d67f8
Branches
Tags
No related merge requests found
......@@ -173,6 +173,26 @@ Foam::dimensioned<Type>::dimensioned
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
template<class Type>
Foam::dimensioned<Type> Foam::dimensioned<Type>::lookupOrDefault
(
const word& name,
const dictionary& dict,
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);
}
}
template<class Type>
Foam::dimensioned<Type> Foam::dimensioned<Type>::lookupOrDefault
(
......@@ -193,6 +213,20 @@ Foam::dimensioned<Type> Foam::dimensioned<Type>::lookupOrDefault
}
template<class Type>
Foam::dimensioned<Type> Foam::dimensioned<Type>::lookupOrAddToDict
(
const word& name,
dictionary& dict,
const dimensionSet& dims,
const Type& defaultValue
)
{
Type value = dict.lookupOrAddDefault<Type>(name, defaultValue);
return dimensioned<Type>(name, dims, value);
}
template<class Type>
Foam::dimensioned<Type> Foam::dimensioned<Type>::lookupOrAddToDict
(
......
......@@ -123,7 +123,17 @@ public:
// Static member functions
//- Construct from dictionary, with default value.
//- Construct from dictionary, with default dimensions and value.
static dimensioned<Type> lookupOrDefault
(
const word&,
const dictionary&,
const dimensionSet& dims = dimless,
const Type& defaultValue = pTraits<Type>::zero
);
//- Construct from dictionary, with default value and dimensions.
// Deprecated, use form with dimensions before value.
static dimensioned<Type> lookupOrDefault
(
const word&,
......@@ -135,6 +145,17 @@ public:
//- Construct from dictionary, with default value.
// If the value is not found, it is added into the dictionary.
static dimensioned<Type> lookupOrAddToDict
(
const word&,
dictionary&,
const dimensionSet& dims = dimless,
const Type& defaultValue = pTraits<Type>::zero
);
//- Construct from dictionary, 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&,
......
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