Commit b6b5eb17 authored by Mark Olesen's avatar Mark Olesen
Browse files

dimensionedType gets plain lookupOrDefault() static method

parent 246d569c
......@@ -35,6 +35,20 @@ namespace Foam
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template <class Type>
dimensioned<Type> dimensioned<Type>::lookupOrDefault
(
const word& name,
const dictionary& dict,
const Type& defaultValue,
const dimensionSet& dims
)
{
Type value = dict.lookupOrDefault<Type>(name, defaultValue);
return dimensioned<Type>(name, dims, value);
}
template <class Type>
dimensioned<Type> dimensioned<Type>::lookupOrAddToDict
(
......
......@@ -108,8 +108,17 @@ public:
//- Construct from an Istream with a given name and dimensions
dimensioned(const word&, const dimensionSet&, Istream&);
//- Construct from dictionary, supplying default value so that if the
// value is not found, it is added into the dictionary.
//- Construct from dictionary, with default value.
static dimensioned<Type> lookupOrDefault
(
const word&,
const dictionary&,
const Type& defaultValue = pTraits<Type>::zero,
const dimensionSet& dims = dimless
);
//- Construct from dictionary, with default value.
// If the value is not found, it is added into the dictionary.
static dimensioned<Type> lookupOrAddToDict
(
const word&,
......@@ -148,8 +157,7 @@ public:
//- Return transpose.
dimensioned<Type> T() const;
//- Update the value of the dimensioned<Type> if it is found in the
// dictionary
//- Update the value of dimensioned<Type> if found in the dictionary.
bool readIfPresent(const dictionary&);
......
Supports Markdown
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