STYLE: default construct empty dictionaries

- some code used copy construct from dictionary::null instead.
  The result is the same but suggests that something else may be intended.
  Only need dictionary::null for const-ref usage.
This commit is contained in:
Mark Olesen 2021-04-19 10:44:14 +02:00
parent d2311437ef
commit 385f92732b
26 changed files with 89 additions and 90 deletions

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -39,7 +40,7 @@ Foam::doxygenXmlParser::doxygenXmlParser
const word& ext
)
:
dictionary(dictionary::null)
dictionary()
{
// Pre-construct and compile regular expressions
const regExp nameRe(".*.H");
@ -155,7 +156,7 @@ Foam::doxygenXmlParser::doxygenXmlParser
// preferentially take exact match if it exists
if (exactMatch && (tName + "." + ext) == name)
{
dictionary dict(dictionary::null);
dictionary dict;
dict.add("name", name);
dict.add("filename", fName + ".html");
dict.add("path", path);
@ -168,7 +169,7 @@ Foam::doxygenXmlParser::doxygenXmlParser
&& regExp(".*" + tName + ".*").match(name)
)
{
dictionary dict(dictionary::null);
dictionary dict;
dict.add("name", name);
dict.add("filename", fName + ".html");
dict.add("path", path);

View File

@ -53,7 +53,6 @@ class doxygenXmlParser
:
public dictionary
{
public:
//- Construct from components

View File

@ -40,8 +40,8 @@ Foam::boundaryTemplates::boundaryTemplates
const word& solverType
)
:
templates_(dictionary::null),
options_(dictionary::null)
templates_(),
options_()
{
Info<< " Reading boundary templates" << endl;
@ -62,8 +62,8 @@ Foam::boundaryTemplates::boundaryTemplates
const word& regionType = dEntry.keyword();
wordList patchTypes(regionBCs.lookup(regionType));
dictionary regionTemplate = dictionary::null;
dictionary regionOptions = dictionary::null;
dictionary regionTemplate;
dictionary regionOptions;
// read general boundary types
forAll(patchTypes, i)
@ -250,8 +250,8 @@ Foam::dictionary Foam::boundaryTemplates::generatePatchDict
// look for field name
if (patchDict.found(fieldName))
{
dictionary dict(dictionary::null);
const dictionary& fieldDict(patchDict.subDict(fieldName));
dictionary dict;
const dictionary& fieldDict = patchDict.subDict(fieldName);
for (const entry& dEntry : fieldDict)
{

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation
Copyright (C) 2015 OpenCFD Ltd.
Copyright (C) 2015-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -194,7 +194,7 @@ Foam::dictionary Foam::caseInfo::generateBoundaryField
const boundaryTemplates& bcTemplates
) const
{
dictionary boundaryField = dictionary::null;
dictionary boundaryField;
forAll(boundaryInfo_.names(), j)
{
@ -202,7 +202,7 @@ Foam::dictionary Foam::caseInfo::generateBoundaryField
if (boundaryInfo_.constraint()[j])
{
dictionary patchDict = dictionary::null;
dictionary patchDict;
patchDict.add("type", boundaryInfo_.types()[j]);
// Add value for processor patches
@ -228,7 +228,7 @@ Foam::dictionary Foam::caseInfo::generateBoundaryField
const word& patchType = patchTypes_[conditionI];
dictionary optionDict = dictionary::null;
dictionary optionDict;
if (bcTemplates.optionsRequired(regionPrefix, category, patchType))
{
optionDict = bcDict_.subDict(condition).subDict("options");

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -135,13 +135,13 @@ Foam::solution::solution
IOobject::NO_WRITE
)
),
cache_(dictionary::null),
cache_(),
caching_(false),
fieldRelaxDict_(dictionary::null),
eqnRelaxDict_(dictionary::null),
fieldRelaxDict_(),
eqnRelaxDict_(),
fieldRelaxDefault_(0),
eqnRelaxDefault_(0),
solvers_(dictionary::null)
solvers_()
{
if
(
@ -179,13 +179,13 @@ Foam::solution::solution
),
dict
),
cache_(dictionary::null),
cache_(),
caching_(false),
fieldRelaxDict_(dictionary::null),
eqnRelaxDict_(dictionary::null),
fieldRelaxDict_(),
eqnRelaxDict_(),
fieldRelaxDefault_(0),
eqnRelaxDefault_(0),
solvers_(dictionary::null)
solvers_()
{
if
(

View File

@ -40,12 +40,12 @@ bool Foam::subModelBase::subModelBase::inLine() const
Foam::subModelBase::subModelBase(dictionary& properties)
:
modelName_(word::null),
modelName_(),
properties_(properties),
dict_(dictionary::null),
baseName_(word::null),
modelType_(word::null),
coeffDict_(dictionary::null)
dict_(),
baseName_(),
modelType_(),
coeffDict_()
{}
@ -58,7 +58,7 @@ Foam::subModelBase::subModelBase
const word& dictExt
)
:
modelName_(word::null),
modelName_(),
properties_(properties),
dict_(dict),
baseName_(baseName),

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2018-2019 OpenCFD Ltd.
Copyright (C) 2018-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -99,13 +99,10 @@ Foam::label Foam::ptscotchDecomp::decompose
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::ptscotchDecomp::ptscotchDecomp
(
const dictionary& decompDict
)
Foam::ptscotchDecomp::ptscotchDecomp(const dictionary& decompDict)
:
decompositionMethod(decompDict),
coeffsDict_(dictionary::null)
coeffsDict_()
{}
@ -116,7 +113,7 @@ Foam::ptscotchDecomp::ptscotchDecomp
)
:
decompositionMethod(decompDict, regionName),
coeffsDict_(dictionary::null)
coeffsDict_()
{}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2017 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -47,7 +48,7 @@ Foam::trimModel::trimModel
:
rotor_(rotor),
name_(name),
coeffs_(dictionary::null)
coeffs_()
{
read(dict);
}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -32,9 +33,9 @@ License
template<class CloudType>
Foam::WallInteractionModel<CloudType>::WallInteractionModel(CloudType& owner)
:
dict_(dictionary::null),
owner_(owner),
coeffDict_(dictionary::null)
dict_(dictionary::null),
coeffDict_()
{}
@ -46,8 +47,8 @@ Foam::WallInteractionModel<CloudType>::WallInteractionModel
const word& type
)
:
dict_(dict),
owner_(owner),
dict_(dict),
coeffDict_(dict.subDict(type + "Coeffs"))
{}

View File

@ -56,12 +56,12 @@ class WallInteractionModel
{
// Private data
//- The cloud dictionary
const dictionary& dict_;
// reference to the owner cloud class
//- Reference to the owner cloud class
CloudType& owner_;
//- Reference to the cloud dictionary
const dictionary& dict_;
//- The coefficients dictionary
const dictionary coeffDict_;

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2016-2020 OpenCFD Ltd.
Copyright (C) 2016-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -588,7 +588,7 @@ Foam::KinematicCloud<CloudType>::KinematicCloud
),
solution_(mesh),
constProps_(),
subModelProperties_(dictionary::null),
subModelProperties_(),
rndGen_(),
cellOccupancyPtr_(nullptr),
cellLengthScale_(c.cellLengthScale_),

View File

@ -388,7 +388,7 @@ public:
//- Return access to the constant properties
inline typename parcelType::constantProperties& constProps();
//- Return reference to the sub-models dictionary
//- Return reference to the sub-models dictionary
inline const dictionary& subModelProperties() const;

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
Copyright (C) 2020-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -97,7 +97,7 @@ Foam::cloudSolution::cloudSolution(const cloudSolution& cs)
Foam::cloudSolution::cloudSolution(const fvMesh& mesh)
:
mesh_(mesh),
dict_(dictionary::null),
dict_(),
active_(false),
transient_(false),
calcFrequency_(0),

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2016-2020 OpenCFD Ltd.
Copyright (C) 2016-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -132,14 +132,14 @@ public:
// Constructors
//- Null constructor
constantProperties();
//- Default construct
inline constantProperties();
//- Copy constructor
constantProperties(const constantProperties& cp);
inline constantProperties(const constantProperties& cp);
//- Construct from dictionary
constantProperties(const dictionary& parentDict);
inline constantProperties(const dictionary& parentDict);
// Member Functions

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2016-2020 OpenCFD Ltd.
Copyright (C) 2016-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -36,7 +36,7 @@ template<class ParcelType>
inline
Foam::KinematicParcel<ParcelType>::constantProperties::constantProperties()
:
dict_(dictionary::null),
dict_(),
parcelTypeId_(dict_, -1),
rhoMin_(dict_, 0.0),
rho0_(dict_, 0.0),

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
Copyright (C) 2020-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -39,7 +39,7 @@ Foam::CloudFunctionObjectList<CloudType>::CloudFunctionObjectList
:
PtrList<CloudFunctionObject<CloudType>>(),
owner_(owner),
dict_(dictionary::null)
dict_()
{}
@ -57,23 +57,19 @@ Foam::CloudFunctionObjectList<CloudType>::CloudFunctionObjectList
{
if (readFields)
{
wordList modelNames(dict.toc());
Info<< "Constructing cloud functions" << endl;
if (modelNames.size() > 0)
this->resize(dict.size());
label count = 0;
for (const word& modelName : dict.toc())
{
this->setSize(modelNames.size());
const dictionary& modelDict = dict.subDict(modelName);
forAll(modelNames, i)
{
const word& modelName = modelNames[i];
const dictionary& modelDict(dict.subDict(modelName));
this->set
(
i,
count,
CloudFunctionObject<CloudType>::New
(
modelDict,
@ -83,8 +79,10 @@ Foam::CloudFunctionObjectList<CloudType>::CloudFunctionObjectList
)
);
}
++count;
}
else
if (!count)
{
Info<< " none" << endl;
}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -40,7 +41,7 @@ Foam::ParticleForceList<CloudType>::ParticleForceList
PtrList<ParticleForce<CloudType>>(),
owner_(owner),
mesh_(mesh),
dict_(dictionary::null),
dict_(),
calcCoupled_(true),
calcNonCoupled_(true)
{}
@ -71,7 +72,7 @@ Foam::ParticleForceList<CloudType>::ParticleForceList
label count = 0;
for (const entry& dEntry : dict)
{
const word& model = dEntry.keyword();
const word& modelName = dEntry.keyword();
if (dEntry.isDict())
{
this->set
@ -82,7 +83,7 @@ Foam::ParticleForceList<CloudType>::ParticleForceList
owner,
mesh,
dEntry.dict(),
model
modelName
)
);
}
@ -96,11 +97,10 @@ Foam::ParticleForceList<CloudType>::ParticleForceList
owner,
mesh,
dict,
model
modelName
)
);
}
++count;
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -45,7 +45,7 @@ thermalShellFvPatchScalarField::thermalShellFvPatchScalarField
:
fixedValueFvPatchField<scalar>(p, iF),
baffle_(),
dict_(dictionary::null)
dict_()
{}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -43,7 +43,7 @@ vibrationShellFvPatchScalarField::vibrationShellFvPatchScalarField
:
mixedFvPatchField<scalar>(p, iF),
baffle_(),
dict_(dictionary::null)
dict_()
{
refValue() = 0;
refGrad() = 0;

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2016-2020 OpenCFD Ltd.
Copyright (C) 2016-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -360,7 +360,7 @@ Foam::regionModels::regionModel::regionModel
active_(false),
infoOutput_(false),
modelName_("none"),
coeffs_(dictionary::null),
coeffs_(),
outputPropertiesPtr_(nullptr),
primaryPatchIDs_(),
intCoupledPatchIDs_(),

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2017 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -46,7 +47,7 @@ Foam::regionModels::regionModelFunctionObject::regionModelFunctionObject
regionModel& region
)
:
dict_(dictionary::null),
dict_(),
regionModel_(region),
modelType_("modelType")
{}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2017 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -36,7 +37,7 @@ Foam::regionModels::regionModelFunctionObjectList::regionModelFunctionObjectList
:
PtrList<regionModelFunctionObject>(),
regionModel_(region),
dict_(dictionary::null)
dict_()
{}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd
Copyright (C) 2020-2021 OpenCFD Ltd
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -50,7 +50,7 @@ thermalBaffleFvPatchScalarField::thermalBaffleFvPatchScalarField
owner_(false),
internal_(true),
baffle_(),
dict_(dictionary::null),
dict_(),
extrudeMeshPtr_()
{}

View File

@ -73,13 +73,13 @@ Foam::IOobject Foam::radiation::radiationModel::createIOobject
if (io.typeHeaderOk<IOdictionary>(true))
{
io.readOpt(IOobject::MUST_READ_IF_MODIFIED);
return io;
}
else
{
io.readOpt(IOobject::NO_READ);
return io;
}
return io;
}
@ -129,7 +129,7 @@ Foam::radiation::radiationModel::radiationModel(const volScalarField& T)
time_(T.time()),
T_(T),
radiation_(false),
coeffs_(dictionary::null),
coeffs_(),
solverFreq_(0),
firstIter_(true),
absorptionEmission_(nullptr),

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -42,7 +42,7 @@ Foam::ReactionList<ThermoType>::ReactionList
SLPtrList<Reaction<ThermoType>>(),
species_(species),
thermoDb_(thermoDb),
dict_(dictionary::null)
dict_()
{}

View File

@ -81,7 +81,7 @@ public:
// Constructors
//- Construct null
//- Default construct
ReactionList
(
const speciesTable& species,