ENH: avoid raw dictionary lookup in functionObjects (issue #762)

Style changes:
    - use lookupObjectRef instead of using const_cast
    - use tmp::New factory
This commit is contained in:
Mark Olesen
2018-08-04 00:23:18 +02:00
parent 1c354e0906
commit 1036cf9612
81 changed files with 492 additions and 639 deletions

View File

@ -53,7 +53,7 @@ void Foam::functionObjects::mapFields::createInterpolation
)
{
const fvMesh& meshTarget = mesh_;
const word mapRegionName(dict.lookup("mapRegion"));
const word mapRegionName(dict.get<word>("mapRegion"));
Info<< name() << ':' << nl
<< " Reading mesh " << mapRegionName << endl;
@ -71,7 +71,7 @@ void Foam::functionObjects::mapFields::createInterpolation
)
);
const fvMesh& mapRegion = mapRegionPtr_();
const word mapMethodName(dict.lookup("mapMethod"));
const word mapMethodName(dict.get<word>("mapMethod"));
if (!meshToMesh::interpolationMethodNames_.found(mapMethodName))
{
FatalErrorInFunction
@ -100,11 +100,9 @@ void Foam::functionObjects::mapFields::createInterpolation
Info<< " Patch mapping method: " << patchMapMethodName << endl;
}
bool consistent = readBool(dict.lookup("consistent"));
Info<< " Creating mesh to mesh interpolation" << endl;
if (consistent)
if (dict.get<bool>("consistent"))
{
interpPtr_.reset
(
@ -119,8 +117,11 @@ void Foam::functionObjects::mapFields::createInterpolation
}
else
{
HashTable<word> patchMap(dict.lookup("patchMap"));
wordList cuttingPatches(dict.lookup("cuttingPatches"));
HashTable<word> patchMap;
wordList cuttingPatches;
dict.readEntry("patchMap", patchMap);
dict.readEntry("cuttingPatches", cuttingPatches);
interpPtr_.reset
(
@ -162,7 +163,7 @@ bool Foam::functionObjects::mapFields::read(const dictionary& dict)
{
fvMeshFunctionObject::read(dict);
dict.lookup("fields") >> fieldNames_;
dict.readEntry("fields", fieldNames_);
createInterpolation(dict);
return true;
}