mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
- instead of dict.lookup(name) >> val;
can use dict.readEntry(name, val);
for checking of input token sizes.
This helps catch certain types of input errors:
{
key1 ; // <- Missing value
key2 1234 // <- Missing ';' terminator
key3 val;
}
STYLE: readIfPresent() instead of 'if found ...' in a few more places.
This commit is contained in:
@ -51,8 +51,8 @@ Foam::functionObjects::FUNCTIONOBJECT::FUNCTIONOBJECT
|
||||
:
|
||||
fvMeshFunctionObject(name, runTime, dict),
|
||||
wordData_(dict.lookupOrDefault<word>("wordData", "defaultWord")),
|
||||
scalarData_(readScalar(dict.lookup("scalarData"))),
|
||||
labelData_(readLabel(dict.lookup("labelData")))
|
||||
scalarData_(dict.get<scalar>("scalarData")),
|
||||
labelData_(dict.get<label>("labelData"))
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
@ -69,8 +69,9 @@ Foam::functionObjects::FUNCTIONOBJECT::~FUNCTIONOBJECT()
|
||||
bool Foam::functionObjects::FUNCTIONOBJECT::read(const dictionary& dict)
|
||||
{
|
||||
dict.readIfPresent("wordData", wordData_);
|
||||
dict.lookup("scalarData") >> scalarData_;
|
||||
dict.lookup("labelData") >> labelData_;
|
||||
|
||||
dict.readEntry("scalarData", scalarData_);
|
||||
dict.readEntry("labelData", labelData_);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user