mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
- use the dictionary 'get' methods instead of readScalar for
additional checking
Unchecked: readScalar(dict.lookup("key"));
Checked: dict.get<scalar>("key");
- In templated classes that also inherit from a dictionary, an additional
'template' keyword will be required. Eg,
this->coeffsDict().template get<scalar>("key");
For this common use case, the predefined getXXX shortcuts may be
useful. Eg,
this->coeffsDict().getScalar("key");
This commit is contained in:
@ -261,8 +261,8 @@ bool Foam::functionObjects::nearWallFields::read(const dictionary& dict)
|
||||
fvMeshFunctionObject::read(dict);
|
||||
|
||||
dict.readEntry("fields", fieldSet_);
|
||||
dict.readEntry("distance", distance_);
|
||||
patchSet_ = mesh_.boundaryMesh().patchSet(dict.get<wordRes>("patches"));
|
||||
distance_ = dict.get<scalar>("distance");
|
||||
|
||||
|
||||
// Clear out any previously loaded fields
|
||||
|
||||
@ -87,7 +87,7 @@ Foam::functionObjects::valueAverage::valueAverage
|
||||
if (dict.found(fieldName))
|
||||
{
|
||||
const dictionary& valueDict = dict.subDict(fieldName);
|
||||
totalTime_[fieldi] = valueDict.get<scalar>("totalTime");
|
||||
valueDict.readEntry("totalTime", totalTime_[fieldi]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user