Commit 5cfa9762 authored by Mark Olesen's avatar Mark Olesen
Browse files

STYLE: more consistent New methods, use unregistered IOobject where appropriate

parent 9707e5c1
......@@ -27,7 +27,8 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::PDRDragModel> Foam::PDRDragModel::New
Foam::autoPtr<Foam::PDRDragModel>
Foam::PDRDragModel::New
(
const dictionary& PDRProperties,
const compressible::RASModel& turbulence,
......@@ -36,12 +37,15 @@ Foam::autoPtr<Foam::PDRDragModel> Foam::PDRDragModel::New
const surfaceScalarField& phi
)
{
word PDRDragModelTypeName = PDRProperties.lookup("PDRDragModel");
const word modelType
(
PDRProperties.lookup("PDRDragModel")
);
Info<< "Selecting flame-wrinkling model " << PDRDragModelTypeName << endl;
Info<< "Selecting flame-wrinkling model " << modelType << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(PDRDragModelTypeName);
dictionaryConstructorTablePtr_->find(modelType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
......@@ -49,7 +53,7 @@ Foam::autoPtr<Foam::PDRDragModel> Foam::PDRDragModel::New
(
"PDRDragModel::New"
) << "Unknown PDRDragModel type "
<< PDRDragModelTypeName << endl << endl
<< modelType << nl << nl
<< "Valid PDRDragModels are : " << endl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
......
......@@ -27,7 +27,8 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::XiEqModel> Foam::XiEqModel::New
Foam::autoPtr<Foam::XiEqModel>
Foam::XiEqModel::New
(
const dictionary& XiEqProperties,
const hhuCombustionThermo& thermo,
......@@ -35,12 +36,15 @@ Foam::autoPtr<Foam::XiEqModel> Foam::XiEqModel::New
const volScalarField& Su
)
{
word XiEqModelTypeName = XiEqProperties.lookup("XiEqModel");
const word modelType
(
XiEqProperties.lookup("XiEqModel")
);
Info<< "Selecting flame-wrinkling model " << XiEqModelTypeName << endl;
Info<< "Selecting flame-wrinkling model " << modelType << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(XiEqModelTypeName);
dictionaryConstructorTablePtr_->find(modelType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
......@@ -53,8 +57,8 @@ Foam::autoPtr<Foam::XiEqModel> Foam::XiEqModel::New
" const volScalarField& Su"
")"
) << "Unknown XiEqModel type "
<< XiEqModelTypeName << endl << endl
<< "Valid XiEqModels are : " << endl
<< modelType << nl << nl
<< "Valid XiEqModels are : " << endl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
......
......@@ -27,7 +27,8 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::XiGModel> Foam::XiGModel::New
Foam::autoPtr<Foam::XiGModel>
Foam::XiGModel::New
(
const dictionary& XiGProperties,
const hhuCombustionThermo& thermo,
......@@ -35,12 +36,15 @@ Foam::autoPtr<Foam::XiGModel> Foam::XiGModel::New
const volScalarField& Su
)
{
word XiGModelTypeName = XiGProperties.lookup("XiGModel");
const word modelType
(
XiGProperties.lookup("XiGModel")
);
Info<< "Selecting flame-wrinkling model " << XiGModelTypeName << endl;
Info<< "Selecting flame-wrinkling model " << modelType << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(XiGModelTypeName);
dictionaryConstructorTablePtr_->find(modelType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
......@@ -53,8 +57,8 @@ Foam::autoPtr<Foam::XiGModel> Foam::XiGModel::New
" const volScalarField& Su"
")"
) << "Unknown XiGModel type "
<< XiGModelTypeName << endl << endl
<< "Valid XiGModels are : " << endl
<< modelType << nl << nl
<< "Valid XiGModels are : " << endl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
......
......@@ -27,7 +27,8 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::XiModel> Foam::XiModel::New
Foam::autoPtr<Foam::XiModel>
Foam::XiModel::New
(
const dictionary& XiProperties,
const hhuCombustionThermo& thermo,
......@@ -38,12 +39,15 @@ Foam::autoPtr<Foam::XiModel> Foam::XiModel::New
const surfaceScalarField& phi
)
{
word XiModelTypeName = XiProperties.lookup("XiModel");
const word modelType
(
XiProperties.lookup("XiModel")
);
Info<< "Selecting flame-wrinkling model " << XiModelTypeName << endl;
Info<< "Selecting flame-wrinkling model " << modelType << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(XiModelTypeName);
dictionaryConstructorTablePtr_->find(modelType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
......@@ -51,8 +55,8 @@ Foam::autoPtr<Foam::XiModel> Foam::XiModel::New
(
"XiModel::New"
) << "Unknown XiModel type "
<< XiModelTypeName << endl << endl
<< "Valid XiModels are : " << endl
<< modelType << nl << nl
<< "Valid XiModels are : " << endl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
......
......@@ -27,7 +27,8 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::combustionModel> Foam::combustionModel::New
Foam::autoPtr<Foam::combustionModel>
Foam::combustionModel::New
(
const dictionary& combustionProperties,
const hsCombustionThermo& thermo,
......@@ -36,15 +37,18 @@ Foam::autoPtr<Foam::combustionModel> Foam::combustionModel::New
const volScalarField& rho
)
{
word combustionModelTypeName = combustionProperties.lookup
const word modelType
(
"combustionModel"
combustionProperties.lookup
(
"combustionModel"
)
);
Info<< "Selecting combustion model " << combustionModelTypeName << endl;
Info<< "Selecting combustion model " << modelType << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(combustionModelTypeName);
dictionaryConstructorTablePtr_->find(modelType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
......@@ -52,8 +56,8 @@ Foam::autoPtr<Foam::combustionModel> Foam::combustionModel::New
(
"combustionModel::New"
) << "Unknown combustionModel type "
<< combustionModelTypeName << endl << endl
<< "Valid combustionModels are : " << endl
<< modelType << nl << nl
<< "Valid combustionModels are : " << endl
<< dictionaryConstructorTablePtr_->toc()
<< exit(FatalError);
}
......
......@@ -11,7 +11,7 @@
basicMultiComponentMixture& composition = thermo.composition();
PtrList<volScalarField>& Y = composition.Y();
word inertSpecie(thermo.lookup("inertSpecie"));
const word inertSpecie(thermo.lookup("inertSpecie"));
if (!composition.contains(inertSpecie))
{
......
......@@ -11,7 +11,7 @@
basicMultiComponentMixture& composition = thermo.composition();
PtrList<volScalarField>& Y = composition.Y();
word inertSpecie(thermo.lookup("inertSpecie"));
const word inertSpecie(thermo.lookup("inertSpecie"));
if (!composition.contains(inertSpecie))
{
......
......@@ -11,7 +11,7 @@
basicMultiComponentMixture& composition = thermo.composition();
PtrList<volScalarField>& Y = composition.Y();
word inertSpecie(thermo.lookup("inertSpecie"));
const word inertSpecie(thermo.lookup("inertSpecie"));
volScalarField& p = thermo.p();
volScalarField& hs = thermo.hs();
......
......@@ -11,7 +11,7 @@
basicMultiComponentMixture& composition = thermo.composition();
PtrList<volScalarField>& Y = composition.Y();
word inertSpecie(thermo.lookup("inertSpecie"));
const word inertSpecie(thermo.lookup("inertSpecie"));
if (!composition.contains(inertSpecie))
{
......
......@@ -36,22 +36,21 @@ Foam::phaseChangeTwoPhaseMixture::New
const word& alpha1Name
)
{
IOdictionary transportPropertiesDict
// get model name, but do not register the dictionary
const word phaseChangeTwoPhaseMixtureTypeName
(
IOobject
IOdictionary
(
"transportProperties",
U.time().constant(),
U.db(),
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
word phaseChangeTwoPhaseMixtureTypeName
(
transportPropertiesDict.lookup("phaseChangeTwoPhaseMixture")
IOobject
(
"transportProperties",
U.time().constant(),
U.db(),
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
).lookup("phaseChangeTwoPhaseMixture")
);
Info<< "Selecting phaseChange model "
......@@ -67,8 +66,8 @@ Foam::phaseChangeTwoPhaseMixture::New
(
"phaseChangeTwoPhaseMixture::New"
) << "Unknown phaseChangeTwoPhaseMixture type "
<< phaseChangeTwoPhaseMixtureTypeName << endl << endl
<< "Valid phaseChangeTwoPhaseMixtures are : " << endl
<< phaseChangeTwoPhaseMixtureTypeName << nl << nl
<< "Valid phaseChangeTwoPhaseMixture types are : " << endl
<< componentsConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
......
......@@ -159,7 +159,7 @@
Info<< "Selecting Drift-Flux model " << endl;
word VdjModel(transportProperties.lookup("VdjModel"));
const word VdjModel(transportProperties.lookup("VdjModel"));
Info<< tab << VdjModel << " selected\n" << endl;
......
......@@ -27,7 +27,8 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::dragModel> Foam::dragModel::New
Foam::autoPtr<Foam::dragModel>
Foam::dragModel::New
(
const dictionary& interfaceDict,
const volScalarField& alpha,
......@@ -35,7 +36,7 @@ Foam::autoPtr<Foam::dragModel> Foam::dragModel::New
const phaseModel& phaseb
)
{
word dragModelType
const word modelType
(
interfaceDict.lookup("dragModel" + phasea.name())
);
......@@ -43,20 +44,21 @@ Foam::autoPtr<Foam::dragModel> Foam::dragModel::New
Info<< "Selecting dragModel for phase "
<< phasea.name()
<< ": "
<< dragModelType << endl;
<< modelType << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(dragModelType);
dictionaryConstructorTablePtr_->find(modelType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalError
<< "dragModel::New : " << endl
<< " unknown dragModelType type "
<< dragModelType
<< ", constructor not in hash table" << endl << endl
<< " Valid dragModel types are : " << endl;
Info<< dictionaryConstructorTablePtr_->sortedToc() << abort(FatalError);
FatalErrorIn
(
"dragModel::New(...)"
) << "Unknown dragModel type "
<< modelType << nl << nl
<< "Valid dragModel types are : " << endl
<< dictionaryConstructorTablePtr_->sortedToc()
<< abort(FatalError);
}
return cstrIter()(interfaceDict, alpha, phasea, phaseb);
......
......@@ -27,28 +27,32 @@ License
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::conductivityModel> Foam::conductivityModel::New
Foam::autoPtr<Foam::conductivityModel>
Foam::conductivityModel::New
(
const dictionary& dict
)
{
word conductivityModelType(dict.lookup("conductivityModel"));
const word modelType
(
dict.lookup("conductivityModel")
);
Info<< "Selecting conductivityModel "
<< conductivityModelType << endl;
Info<< "Selecting conductivityModel " << modelType << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(conductivityModelType);
dictionaryConstructorTablePtr_->find(modelType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalError
<< "conductivityModel::New(const dictionary&) : " << endl
<< " unknown conductivityModelType type "
<< conductivityModelType
<< ", constructor not in hash table" << endl << endl
<< " Valid conductivityModelType types are :" << endl;
Info<< dictionaryConstructorTablePtr_->sortedToc() << abort(FatalError);
FatalErrorIn
(
"conductivityModel::New(const dictionary&)"
) << "Unknown conductivityModel type "
<< modelType << nl << nl
<< "Valid conductivityModel types are :" << endl
<< dictionaryConstructorTablePtr_->sortedToc()
<< abort(FatalError);
}
return autoPtr<conductivityModel>(cstrIter()(dict));
......
......@@ -27,28 +27,33 @@ License
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::frictionalStressModel> Foam::frictionalStressModel::New
Foam::autoPtr<Foam::frictionalStressModel>
Foam::frictionalStressModel::New
(
const dictionary& dict
)
{
word frictionalStressModelType(dict.lookup("frictionalStressModel"));
const word modelType
(
dict.lookup("frictionalStressModel")
);
Info<< "Selecting frictionalStressModel "
<< frictionalStressModelType << endl;
Info<< "Selecting frictionalStressModel " << modelType << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(frictionalStressModelType);
dictionaryConstructorTablePtr_->find(modelType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalError
<< "frictionalStressModel::New(const dictionary&) : " << endl
<< " unknown frictionalStressModelType type "
<< frictionalStressModelType
<< ", constructor not in hash table" << endl << endl
<< " Valid frictionalStressModelType types are :" << endl;
Info<< dictionaryConstructorTablePtr_->sortedToc() << abort(FatalError);
FatalErrorIn
(
"frictionalStressModel::New(const dictionary&)"
)
<< "Unknown frictionalStressModel type "
<< modelType << nl << nl
<< "Valid frictionalStressModel types are :" << endl
<< dictionaryConstructorTablePtr_->sortedToc()
<< abort(FatalError);
}
return autoPtr<frictionalStressModel>(cstrIter()(dict));
......
......@@ -27,28 +27,32 @@ License
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::granularPressureModel> Foam::granularPressureModel::New
Foam::autoPtr<Foam::granularPressureModel>
Foam::granularPressureModel::New
(
const dictionary& dict
)
{
word granularPressureModelType(dict.lookup("granularPressureModel"));
const word modelType
(
dict.lookup("granularPressureModel")
);
Info<< "Selecting granularPressureModel "
<< granularPressureModelType << endl;
Info<< "Selecting granularPressureModel " << modelType << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(granularPressureModelType);
dictionaryConstructorTablePtr_->find(modelType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalError
<< "granularPressureModel::New(const dictionary&) : " << endl
<< " unknown granularPressureModelType type "
<< granularPressureModelType
<< ", constructor not in hash table" << endl << endl
<< " Valid granularPressureModelType types are :" << endl;
Info<< dictionaryConstructorTablePtr_->sortedToc() << abort(FatalError);
FatalErrorIn
(
"granularPressureModel::New(const dictionary&)"
) << "Unknown granularPressureModel type "
<< modelType << nl << nl
<< "Valid granularPressureModel types are :" << endl
<< dictionaryConstructorTablePtr_->sortedToc()
<< abort(FatalError);
}
return autoPtr<granularPressureModel>(cstrIter()(dict));
......
......@@ -27,28 +27,33 @@ License
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::radialModel> Foam::radialModel::New
Foam::autoPtr<Foam::radialModel>
Foam::radialModel::New
(
const dictionary& dict
)
{
word radialModelType(dict.lookup("radialModel"));
const word modelType
(
dict.lookup("radialModel")
);
Info<< "Selecting radialModel "
<< radialModelType << endl;
Info<< "Selecting radialModel " << modelType << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(radialModelType);
dictionaryConstructorTablePtr_->find(modelType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalError
<< "radialModel::New(const dictionary&) : " << endl
<< " unknown radialModelType type "
<< radialModelType
<< ", constructor not in hash table" << endl << endl
<< " Valid radialModelType types are :" << endl;
Info<< dictionaryConstructorTablePtr_->sortedToc() << abort(FatalError);
FatalErrorIn
(
"radialModel::New(const dictionary&)"
)
<< "Unknown radialModel type "
<< modelType << nl << nl
<< "Valid radialModel types are :" << endl
<< dictionaryConstructorTablePtr_->sortedToc()
<< abort(FatalError);
}
return autoPtr<radialModel>(cstrIter()(dict));
......
......@@ -33,23 +33,26 @@ Foam::kineticTheoryModels::viscosityModel::New
const dictionary& dict
)
{
word viscosityModelType(dict.lookup("viscosityModel"));
const word modelType
(
dict.lookup("viscosityModel")
);
Info<< "Selecting viscosityModel "
<< viscosityModelType << endl;
Info<< "Selecting viscosityModel " << modelType << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(viscosityModelType);
dictionaryConstructorTablePtr_->find(modelType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalError
<< "viscosityModel::New(const dictionary&) : " << endl
<< " unknown viscosityModelType type "
<< viscosityModelType
<< ", constructor not in hash table" << endl << endl