From ae40bd9f9bc378c5181ba90bf62afab27f8d7438 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 27 Jan 2020 13:38:26 +0100 Subject: [PATCH] STYLE: use guards for dictionary lookup() --- .../tabulatedWallFunction/general/general.C | 13 +++++++++---- .../tabulatedWallFunction/general/general.H | 18 +++++++++--------- .../ConeNozzleInjection/ConeNozzleInjection.C | 4 ++-- .../molecule/moleculeCloud/moleculeCloud.C | 5 ++++- .../potential/potential/potential.C | 19 +++++++++++++------ .../mappedPolyPatch/mappedPatchBase.C | 2 -- .../surfaceFeatures/surfaceFeatures.C | 8 ++++---- .../linearAxialAngularSpring.C | 4 ++-- .../prescribedRotation/prescribedRotation.C | 4 ++-- .../linearAxialAngularSpring.C | 6 +++--- 10 files changed, 48 insertions(+), 35 deletions(-) diff --git a/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/general/general.C b/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/general/general.C index ce402a7f14..7b6a0da77e 100644 --- a/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/general/general.C +++ b/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/general/general.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -28,6 +29,7 @@ License #include "general.H" #include "addToRunTimeSelectionTable.H" #include "Tuple2.H" +#include "Switch.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -135,12 +137,15 @@ Foam::tabulatedWallFunctions::general::general : tabulatedWallFunction(dict, mesh, typeName), interpType_(interpolationTypeNames_.get("interpType", coeffDict_)), + log10YPlus_(coeffDict_.get("log10YPlus")), + log10UPlus_(coeffDict_.get("log10UPlus")), yPlus_(), - uPlus_(), - log10YPlus_(coeffDict_.lookup("log10YPlus")), - log10UPlus_(coeffDict_.lookup("log10UPlus")) + uPlus_() { - List> inputTable = coeffDict_.lookup("inputTable"); + List> inputTable; + + coeffDict_.readEntry("inputTable", inputTable); + if (inputTable.size() < 2) { FatalErrorInFunction diff --git a/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/general/general.H b/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/general/general.H index 65e783deff..0ed51852d1 100644 --- a/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/general/general.H +++ b/applications/utilities/preProcessing/wallFunctionTable/tabulatedWallFunction/general/general.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -32,6 +33,7 @@ Description Example dictionary specification: + \verbatim tabulatedWallFunction general; // Output table info @@ -52,9 +54,8 @@ Description ... (yPlusValueN uPlusValueN) ); - } - + \endverbatim SourceFiles general.C @@ -66,7 +67,6 @@ SourceFiles #include "tabulatedWallFunction.H" #include "Enum.H" -#include "Switch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -103,18 +103,18 @@ protected: //- Type of interpolation to apply when inverting the data set interpolationType interpType_; + //- Are y+ values entered as log10(y+)? + bool log10YPlus_; + + //- Are U+ values entered as log10(U+)? + bool log10UPlus_; + //- Input y+ values List yPlus_; //- Input U+ values List uPlus_; - //- Are y+ values entered as log10(y+)? - Switch log10YPlus_; - - //- Are U+ values entered as log10(U+)? - Switch log10UPlus_; - // Protected Member Functions diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C index e96d23bdc7..5e66eef113 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2015-2019 OpenCFD Ltd. + Copyright (C) 2015-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -69,7 +69,7 @@ void Foam::ConeNozzleInjection::setInjectionMethod() case injectionMethod::imPoint: case injectionMethod::imDisc: { - position_ = this->coeffDict().lookup("position"); + this->coeffDict().readEntry("position", position_); break; } case injectionMethod::imMovingPoint: diff --git a/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C index c293d21e35..8571efe9f1 100644 --- a/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C +++ b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C @@ -67,7 +67,10 @@ void Foam::moleculeCloud::buildConstProps() const word& id = idList[i]; const dictionary& molDict = moleculePropertiesDict.subDict(id); - List siteIdNames = molDict.lookup("siteIds"); + List siteIdNames + ( + molDict.lookup("siteIds") + ); List