STYLE: use guards for dictionary lookup()

This commit is contained in:
Mark Olesen
2020-01-27 13:38:26 +01:00
parent 500a3b62ca
commit ae40bd9f9b
10 changed files with 48 additions and 35 deletions

View File

@ -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<bool>("log10YPlus")),
log10UPlus_(coeffDict_.get<bool>("log10UPlus")),
yPlus_(),
uPlus_(),
log10YPlus_(coeffDict_.lookup("log10YPlus")),
log10UPlus_(coeffDict_.lookup("log10UPlus"))
uPlus_()
{
List<Tuple2<scalar, scalar>> inputTable = coeffDict_.lookup("inputTable");
List<Tuple2<scalar, scalar>> inputTable;
coeffDict_.readEntry("inputTable", inputTable);
if (inputTable.size() < 2)
{
FatalErrorInFunction

View File

@ -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<scalar> yPlus_;
//- Input U+ values
List<scalar> uPlus_;
//- Are y+ values entered as log10(y+)?
Switch log10YPlus_;
//- Are U+ values entered as log10(U+)?
Switch log10UPlus_;
// Protected Member Functions