ENH: avoid readScalar, readLabel etc from dictionary (#762, #1033)

- 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:
Mark Olesen
2018-10-12 08:14:47 +02:00
parent 990d00d40d
commit 8eddcc072a
335 changed files with 1007 additions and 1127 deletions

View File

@ -633,8 +633,8 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells
if (checkCollapse)
{
minArea = readScalar(motionDict.lookup("minArea"));
maxNonOrtho = readScalar(motionDict.lookup("maxNonOrtho"));
motionDict.readEntry("minArea", minArea);
motionDict.readEntry("maxNonOrtho", maxNonOrtho);
Info<< "markFacesOnProblemCells :"
<< " Deleting all-anchor surface cells only if"
@ -1205,7 +1205,7 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCellsGeometric
const labelList allFaces(identity(mesh_.nFaces()));
label nWrongFaces = 0;
//const scalar minV(readScalar(motionDict.lookup("minVol", true)));
//const scalar minV(motionDict.get<scalar>("minVol", true));
//if (minV > -GREAT)
//{
// polyMeshGeometry::checkFacePyramids
@ -1234,7 +1234,7 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCellsGeometric
// nWrongFaces = nNewWrongFaces;
//}
scalar minArea(readScalar(motionDict.lookup("minArea")));
scalar minArea(motionDict.get<scalar>("minArea"));
if (minArea > -SMALL)
{
polyMeshGeometry::checkFaceArea
@ -1261,7 +1261,7 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCellsGeometric
nWrongFaces = nNewWrongFaces;
}
scalar minDet(readScalar(motionDict.lookup("minDeterminant")));
scalar minDet(motionDict.get<scalar>("minDeterminant"));
if (minDet > -1)
{
polyMeshGeometry::checkCellDeterminant