mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
dimensionedType gets plain lookupOrDefault() static method
This commit is contained in:
@ -35,6 +35,20 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * 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>
|
template <class Type>
|
||||||
dimensioned<Type> dimensioned<Type>::lookupOrAddToDict
|
dimensioned<Type> dimensioned<Type>::lookupOrAddToDict
|
||||||
(
|
(
|
||||||
|
|||||||
@ -108,8 +108,17 @@ public:
|
|||||||
//- Construct from an Istream with a given name and dimensions
|
//- Construct from an Istream with a given name and dimensions
|
||||||
dimensioned(const word&, const dimensionSet&, Istream&);
|
dimensioned(const word&, const dimensionSet&, Istream&);
|
||||||
|
|
||||||
//- Construct from dictionary, supplying default value so that if the
|
//- Construct from dictionary, with default value.
|
||||||
// value is not found, it is added into the dictionary.
|
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
|
static dimensioned<Type> lookupOrAddToDict
|
||||||
(
|
(
|
||||||
const word&,
|
const word&,
|
||||||
@ -148,8 +157,7 @@ public:
|
|||||||
//- Return transpose.
|
//- Return transpose.
|
||||||
dimensioned<Type> T() const;
|
dimensioned<Type> T() const;
|
||||||
|
|
||||||
//- Update the value of the dimensioned<Type> if it is found in the
|
//- Update the value of dimensioned<Type> if found in the dictionary.
|
||||||
// dictionary
|
|
||||||
bool readIfPresent(const dictionary&);
|
bool readIfPresent(const dictionary&);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user