mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +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:
@ -76,7 +76,7 @@ bool Foam::waveModels::irregularWaveModel::readDict
|
||||
{
|
||||
if (waveGenerationModel::readDict(overrideDict))
|
||||
{
|
||||
rampTime_ = get<scalar>("rampTime");
|
||||
readEntry("rampTime", rampTime_);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -95,7 +95,8 @@ bool Foam::waveModels::regularWaveModel::readDict
|
||||
waveHeight_ = readWaveHeight();
|
||||
waveAngle_ = readWaveAngle();
|
||||
|
||||
wavePeriod_ = get<scalar>("wavePeriod");
|
||||
readEntry("wavePeriod", wavePeriod_);
|
||||
|
||||
if (wavePeriod_ < 0)
|
||||
{
|
||||
FatalIOErrorInFunction(*this)
|
||||
|
||||
@ -88,7 +88,7 @@ bool Foam::waveModels::waveGenerationModel::readDict
|
||||
{
|
||||
if (waveModel::readDict(overrideDict))
|
||||
{
|
||||
activeAbsorption_ = get<bool>("activeAbsorption");
|
||||
readEntry("activeAbsorption", activeAbsorption_);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user