mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
STYLE: avoid unrestricted dictionary lookup in conversion, sampling, surfMesh
- aids with detection of excess tokens (issue #762) - deprecated dictionary::operator[] in favour of the lookup() method which offers more flexibilty and clarity of purpose. Additionally, the read<> and get<> forms should generally be used instead anyhow.
This commit is contained in:
@ -21,23 +21,8 @@
|
||||
|
||||
if (io.typeHeaderOk<IOdictionary>(true))
|
||||
{
|
||||
IOdictionary timeObject
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"time",
|
||||
runTime.timeName(),
|
||||
"uniform",
|
||||
runTime,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
);
|
||||
|
||||
label index;
|
||||
timeObject.lookup("index") >> index;
|
||||
timeName = Foam::name(index);
|
||||
const label timeIndex = IOdictionary(io).get<label>("index");
|
||||
timeName = Foam::name(timeIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -46,4 +31,3 @@
|
||||
}
|
||||
|
||||
Info<< "\nTime [" << timeName << "] = " << runTime.timeName() << nl;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user