Commit 79048eb6 authored by Mark Olesen's avatar Mark Olesen
Browse files

STYLE: use writeEntry(), beginBlock(), endBlock() methods

- use dictionary::get<..> instead of lookup in a few more places
parent 81bd0aa0
......@@ -37,11 +37,7 @@
{
forAll(Y, i)
{
const word& name = Y[i].name();
if (fractions.found(name))
{
X0[i] = fractions.get<scalar>(name);
}
fractions.readIfPresent(Y[i].name(), X0[i]);
}
scalar mw = 0.0;
......@@ -61,11 +57,7 @@
{
forAll(Y, i)
{
const word& name = Y[i].name();
if (fractions.found(name))
{
Y0[i] = fractions.get<scalar>(name);
}
fractions.readIfPresent(Y[i].name(), Y0[i]);
}
scalar invW = 0.0;
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018 OpenCFD Ltd
Copyright (C) 2018-2020 OpenCFD Ltd
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -495,11 +495,8 @@ void turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField::write
os.writeEntryIfDifferent<word>("qrNbr", "none", qrNbrName_);
os.writeEntryIfDifferent<word>("qr", "none", qrName_);
os.writeKeyword("region") << regionTypeNames_[regionType_]
<< token::END_STATEMENT << nl;
os.writeKeyword("otherPhase") << otherPhaseName_ << token::END_STATEMENT
<< nl;
os.writeEntry("region", regionTypeNames_[regionType_]);
os.writeEntry("otherPhase", otherPhaseName_);
}
......
......@@ -11,7 +11,7 @@ word continuousPhaseName
mesh,
IOobject::MUST_READ
)
).lookup("continuousPhase")
).get<word>("continuousPhase")
);
Info<< "Reading field U\n" << endl;
......
......@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2018 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -57,9 +58,9 @@ Foam::compressibleInterPhaseTransportModel::compressibleInterPhaseTransportModel
)
);
word simulationType
const word simulationType
(
turbulenceProperties.lookup("simulationType")
turbulenceProperties.get<word>("simulationType")
);
if (simulationType == "twoPhaseTransport")
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -72,43 +72,39 @@ VoFPatchTransfer::VoFPatchTransfer
transferRateCoeff_
(
coeffDict_.lookupOrDefault<scalar>("transferRateCoeff", 0.1)
)
),
patchIDs_(),
patchTransferredMasses_()
{
const polyBoundaryMesh& pbm = film.regionMesh().boundaryMesh();
patchIDs_.setSize
const label nPatches
(
pbm.size() - film.regionMesh().globalData().processorPatches().size()
);
if (coeffDict_.found("patches"))
wordReList patchNames;
if (coeffDict_.readIfPresent("patches", patchNames))
{
const wordReList patchNames(coeffDict_.lookup("patches"));
const labelHashSet patchSet = pbm.patchSet(patchNames);
patchIDs_ = pbm.patchSet(patchNames).sortedToc();
Info<< " applying to patches:" << nl;
Info<< " applying to " << patchIDs_.size() << " patches:" << nl;
label pidi = 0;
for (const label patchi : patchSet)
for (const label patchi : patchIDs_)
{
patchIDs_[pidi++] = patchi;
Info<< " " << pbm[patchi].name() << endl;
}
patchIDs_.setSize(pidi);
patchTransferredMasses_.setSize(pidi, 0);
}
else
{
Info<< " applying to all patches" << endl;
forAll(patchIDs_, patchi)
{
patchIDs_[patchi] = patchi;
}
patchTransferredMasses_.setSize(patchIDs_.size(), 0);
patchIDs_ = identity(nPatches);
}
if (!patchIDs_.size())
patchTransferredMasses_.resize(patchIDs_.size(), Zero);
if (patchIDs_.empty())
{
FatalErrorInFunction
<< "No patches selected"
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -191,7 +191,7 @@ void Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>::solveYi
const dictionary& MULEScontrols = mesh.solverDict(alpha1.name());
scalar cAlpha(readScalar(MULEScontrols.lookup("cYi")));
scalar cAlpha(MULEScontrols.get<scalar>("cYi"));
PtrList<surfaceScalarField> phiYiCorrs(species_.size());
const surfaceScalarField& phi = this->fluid().phi();
......
......@@ -220,7 +220,7 @@ Foam::phaseSystem::phaseSystem
dimensionedScalar(dimViscosity*dimDensity, Zero),
calculatedFvPatchScalarField::typeName
),
phaseNames_(lookup("phases")),
phaseNames_(get<wordList>("phases")),
phi_
(
IOobject
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -64,9 +64,9 @@ Foam::incompressibleThreePhaseMixture::incompressibleThreePhaseMixture
)
),
phase1Name_(wordList(lookup("phases"))[0]),
phase2Name_(wordList(lookup("phases"))[1]),
phase3Name_(wordList(lookup("phases"))[2]),
phase1Name_(get<wordList>("phases")[0]),
phase2Name_(get<wordList>("phases")[1]),
phase3Name_(get<wordList>("phases")[2]),
alpha1_
(
......
......@@ -98,7 +98,7 @@ Foam::RASModels::kineticTheoryModel::kineticTheoryModel
)
),
equilibrium_(coeffDict_.lookup("equilibrium")),
equilibrium_(coeffDict_.get<bool>("equilibrium")),
e_("e", dimless, coeffDict_),
alphaMax_("alphaMax", dimless, coeffDict_),
alphaMinFriction_("alphaMinFriction", dimless, coeffDict_),
......
......@@ -109,7 +109,7 @@ class kineticTheoryModel
// Kinetic Theory Model coefficients
//- Use equilibrium approximation: generation == dissipation
Switch equilibrium_;
bool equilibrium_;
//- Coefficient of restitution
dimensionedScalar e_;
......
......@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2014 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -54,7 +55,7 @@ Foam::blendingMethods::noBlending::noBlending
)
:
blendingMethod(dict),
continuousPhase_(dict.lookup("continuousPhase"))
continuousPhase_(dict.get<word>("continuousPhase"))
{}
......
......@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013-2018 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -75,14 +76,14 @@ Foam::twoPhaseSystem::twoPhaseSystem
(
*this,
*this,
wordList(lookup("phases"))[0]
this->get<wordList>("phases")[0]
),
phase2_
(
*this,
*this,
wordList(lookup("phases"))[1]
this->get<wordList>("phases")[1]
),
phi_
......@@ -109,7 +110,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("dgdt", dimless/dimTime, 0)
dimensionedScalar("dgdt", dimless/dimTime, Zero)
)
{
phase2_.volScalarField::operator=(scalar(1) - phase1_);
......@@ -124,7 +125,7 @@ Foam::twoPhaseSystem::twoPhaseSystem
blendingMethod::New
(
iter().dict(),
wordList(lookup("phases"))
this->get<wordList>("phases")
)
);
}
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2019 OpenCFD Ltd.
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -63,7 +63,7 @@ int main(int argc, char *argv[])
keyType keyre("x.*", keyType::REGEX);
wordReList wordrelist
wordRes wordrelist
{
{"this", wordRe::LITERAL},
{"x.*", wordRe::REGEX},
......
......@@ -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.
......@@ -308,8 +308,7 @@ int main(int argc, char *argv[])
<< exit(FatalError);
}
fileName sourceCasePath(dict.lookup("sourceCase"));
sourceCasePath.expand();
fileName sourceCasePath(dict.get<fileName>("sourceCase").expand());
fileName sourceRootDir = sourceCasePath.path();
fileName sourceCaseDir = sourceCasePath.name();
if (Pstream::parRun())
......@@ -758,8 +757,7 @@ int main(int argc, char *argv[])
else
{
// Read from surface
fileName surfName(dict.lookup("surface"));
surfName.expand();
fileName surfName(dict.get<fileName>("surface").expand());
Info<< "Extruding surfaceMesh read from file " << surfName << nl
<< endl;
......
......@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -50,7 +51,7 @@ Foam::faceSelections::faceZoneSelection::faceZoneSelection
)
:
faceSelection(name, mesh, dict),
zoneName_(dict_.lookup("zoneName"))
zoneName_(dict_.get<word>("zoneName"))
{}
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2016-2018 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -54,7 +54,7 @@ Description
#include "IOPtrList.H"
#include "polyTopoChange.H"
#include "polyModifyFace.H"
#include "wordReList.H"
#include "wordRes.H"
#include "processorMeshes.H"
#include "IOdictionary.H"
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2015-2018 OpenCFD Ltd.
Copyright (C) 2015-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -378,16 +378,17 @@ int main(int argc, char *argv[])
"from the body reference frame to the global "
"reference frame, i.e.:" << nl
<< "globalVector = orientation & bodyLocalVector"
<< endl;
<< nl;
Info<< nl
<< "Entries for sixDoFRigidBodyDisplacement boundary condition:"
<< nl
<< " mass " << m << token::END_STATEMENT << nl
<< " centreOfMass " << cM << token::END_STATEMENT << nl
<< " momentOfInertia " << eVal << token::END_STATEMENT << nl
<< " orientation " << eVec.T() << token::END_STATEMENT
<< endl;
<< nl;
Info()
.writeEntry("mass", m)
.writeEntry("centreOfMass", cM)
.writeEntry("momentOfInertia", eVal)
.writeEntry("orientation", eVec.T());
}
if (calcAroundRefPt)
......
......@@ -275,7 +275,7 @@ Foam::searchableSurfaceModifiers::cut::cut
)
:
searchableSurfaceModifier(geometry, dict),
cutterNames_(dict_.lookup("cutters"))
cutterNames_(dict_.get<wordRes>("cutters"))
{}
......
......@@ -197,7 +197,7 @@ bool Foam::functionObjectList::readFunctionObject
word funcName(funcNameArgs);
int argLevel = 0;
wordReList args;
wordRes args;
List<Tuple2<word, string>> namedArgs;
bool hasNamedArg = false;
......
......@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -59,7 +60,7 @@ Foam::porosityModels::powerLawLopesdaCostaZone::powerLawLopesdaCostaZone
dictionary coeffs(dict.optionalSubDict(modelType + "Coeffs"));
// Vertical direction within porous region
vector zDir(coeffs.lookup("zDir"));
vector zDir(coeffs.get<vector>("zDir"));
// Span of the search for the cells in the porous region
scalar searchSpan(coeffs.get<scalar>("searchSpan"));
......@@ -69,7 +70,7 @@ Foam::porosityModels::powerLawLopesdaCostaZone::powerLawLopesdaCostaZone
// List of the ground patches defining the lower surface
// of the porous region
List<wordRe> groundPatches(coeffs.lookup("groundPatches"));
wordRes groundPatches(coeffs.get<wordRes>("groundPatches"));
// Functional form of the porosity surface area per unit volume as a
// function of the normalized vertical position
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment