ENH: use singleton method for accessing runtime selection

STYLE: use alias to mark partialFaceAreaWeightAMI deprecation after v2012
This commit is contained in:
Mark Olesen
2021-10-12 19:44:00 +02:00
parent 4fc6ec1d1d
commit ba8d6bddcc
337 changed files with 1555 additions and 1542 deletions

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2015 OpenFOAM Foundation
Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -80,9 +80,9 @@ Foam::cellSizeAndAlignmentControl::New
Info<< indent << "Selecting cellSizeAndAlignmentControl "
<< modelType << endl;
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
auto* ctorPtr = dictionaryConstructorTable(modelType);
if (!cstrIter.found())
if (!ctorPtr)
{
FatalIOErrorInLookup
(
@ -95,7 +95,7 @@ Foam::cellSizeAndAlignmentControl::New
return autoPtr<cellSizeAndAlignmentControl>
(
cstrIter()
ctorPtr
(
runTime,
name,

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -134,9 +134,9 @@ Foam::autoPtr<Foam::cellSizeFunction> Foam::cellSizeFunction::New
Info<< indent << "Selecting cellSizeFunction " << modelType << endl;
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
auto* ctorPtr = dictionaryConstructorTable(modelType);
if (!cstrIter.found())
if (!ctorPtr)
{
FatalIOErrorInLookup
(
@ -149,7 +149,7 @@ Foam::autoPtr<Foam::cellSizeFunction> Foam::cellSizeFunction::New
return autoPtr<cellSizeFunction>
(
cstrIter()
ctorPtr
(
dict,
surface,

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2015 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -67,9 +67,9 @@ Foam::autoPtr<Foam::cellSizeCalculationType> Foam::cellSizeCalculationType::New
Info<< indent << "Selecting cellSizeCalculationType " << modelType << endl;
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
auto* ctorPtr = dictionaryConstructorTable(modelType);
if (!cstrIter.found())
if (!ctorPtr)
{
FatalIOErrorInLookup
(
@ -82,7 +82,7 @@ Foam::autoPtr<Foam::cellSizeCalculationType> Foam::cellSizeCalculationType::New
return autoPtr<cellSizeCalculationType>
(
cstrIter()(dict, surface, defaultCellSize)
ctorPtr(dict, surface, defaultCellSize)
);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2017 OpenFOAM Foundation
Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -72,9 +72,9 @@ Foam::autoPtr<Foam::surfaceCellSizeFunction> Foam::surfaceCellSizeFunction::New
Info<< indent << "Selecting surfaceCellSizeFunction " << modelType << endl;
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
auto* ctorPtr = dictionaryConstructorTable(modelType);
if (!cstrIter.found())
if (!ctorPtr)
{
FatalIOErrorInLookup
(
@ -87,7 +87,7 @@ Foam::autoPtr<Foam::surfaceCellSizeFunction> Foam::surfaceCellSizeFunction::New
return autoPtr<surfaceCellSizeFunction>
(
cstrIter()(dict, surface, defaultCellSize)
ctorPtr(dict, surface, defaultCellSize)
);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -61,9 +61,9 @@ Foam::autoPtr<Foam::faceAreaWeightModel> Foam::faceAreaWeightModel::New
Info<< nl << "Selecting faceAreaWeightModel " << modelType << endl;
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
auto* ctorPtr = dictionaryConstructorTable(modelType);
if (!cstrIter.found())
if (!ctorPtr)
{
FatalIOErrorInLookup
(
@ -74,7 +74,7 @@ Foam::autoPtr<Foam::faceAreaWeightModel> Foam::faceAreaWeightModel::New
) << exit(FatalIOError);
}
return autoPtr<faceAreaWeightModel>(cstrIter()(dict));
return autoPtr<faceAreaWeightModel>(ctorPtr(dict));
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -84,9 +84,9 @@ Foam::autoPtr<Foam::initialPointsMethod> Foam::initialPointsMethod::New
Info<< nl << "Selecting initialPointsMethod " << modelType << endl;
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
auto* ctorPtr = dictionaryConstructorTable(modelType);
if (!cstrIter.found())
if (!ctorPtr)
{
FatalIOErrorInLookup
(
@ -100,7 +100,7 @@ Foam::autoPtr<Foam::initialPointsMethod> Foam::initialPointsMethod::New
return
autoPtr<initialPointsMethod>
(
cstrIter()
ctorPtr
(
dict,
runTime,

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -65,9 +65,9 @@ Foam::autoPtr<Foam::relaxationModel> Foam::relaxationModel::New
Info<< nl << "Selecting relaxationModel " << modelType << endl;
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
auto* ctorPtr = dictionaryConstructorTable(modelType);
if (!cstrIter.found())
if (!ctorPtr)
{
FatalIOErrorInLookup
(
@ -78,7 +78,7 @@ Foam::autoPtr<Foam::relaxationModel> Foam::relaxationModel::New
) << exit(FatalIOError);
}
return autoPtr<relaxationModel>(cstrIter()(dict, runTime));
return autoPtr<relaxationModel>(ctorPtr(dict, runTime));
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013-2015 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -48,9 +48,9 @@ Foam::searchableSurfaceFeatures::New
{
const word modelType(surface.type() + "Features");
auto cstrIter = dictConstructorTablePtr_->cfind(modelType);
auto* ctorPtr = dictConstructorTable(modelType);
if (!cstrIter.found())
if (!ctorPtr)
{
FatalIOErrorInLookup
(
@ -61,7 +61,7 @@ Foam::searchableSurfaceFeatures::New
) << exit(FatalIOError);
}
return autoPtr<searchableSurfaceFeatures>(cstrIter()(surface, dict));
return autoPtr<searchableSurfaceFeatures>(ctorPtr(surface, dict));
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -71,9 +71,9 @@ Foam::autoPtr<Foam::faceSelection> Foam::faceSelection::New
{
const word modelType(dict.get<word>("type"));
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
auto* ctorPtr = dictionaryConstructorTable(modelType);
if (!cstrIter.found())
if (!ctorPtr)
{
FatalIOErrorInLookup
(
@ -84,7 +84,7 @@ Foam::autoPtr<Foam::faceSelection> Foam::faceSelection::New
) << exit(FatalIOError);
}
return autoPtr<faceSelection>(cstrIter()(name, mesh, dict));
return autoPtr<faceSelection>(ctorPtr(name, mesh, dict));
}

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.

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2015 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -34,9 +35,9 @@ Foam::autoPtr<Foam::helpType> Foam::helpType::New
const word& helpTypeName
)
{
auto cstrIter = dictionaryConstructorTablePtr_->cfind(helpTypeName);
auto* ctorPtr = dictionaryConstructorTable(helpTypeName);
if (!cstrIter.found())
if (!ctorPtr)
{
// special treatment for -help
// exit without stack trace
@ -61,7 +62,7 @@ Foam::autoPtr<Foam::helpType> Foam::helpType::New
Info<< "Selecting helpType '" << helpTypeName << "'" << endl;
return autoPtr<helpType>(cstrIter()());
return autoPtr<helpType>(ctorPtr());
}

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.
@ -40,7 +40,7 @@ using namespace Foam::constant;
namespace Foam
{
defineMemberFunctionSelectionTable(PDRobstacle, read, dictRead);
defineMemberFunctionSelectionTable(PDRobstacle, read, dictionary);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016 Shell Research Ltd.
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -178,7 +178,7 @@ public:
void,
PDRobstacle,
read,
dictRead,
dictionary,
(
PDRobstacle& obs,
const dictionary& 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.
@ -41,18 +41,20 @@ bool Foam::PDRobstacle::read(Istream& is)
const word obsType(is);
const dictionary dict(is);
const auto mfIter = readdictReadMemberFunctionTablePtr_->cfind(obsType);
auto* mfuncPtr = readdictionaryMemberFunctionTable(obsType);
if (!mfIter.good())
if (!mfuncPtr)
{
FatalIOErrorInFunction(is)
<< "Unknown obstacle type: " << obsType << nl
<< "Valid types:" << nl
<< readdictReadMemberFunctionTablePtr_->sortedToc() << nl
<< exit(FatalIOError);
FatalIOErrorInLookup
(
is,
"obstacle",
obsType,
*readdictionaryMemberFunctionTablePtr_
) << exit(FatalIOError);
}
mfIter()(*this, dict);
mfuncPtr(*this, dict);
return true;
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -45,7 +45,7 @@ using namespace Foam::constant;
PDRobstacle, \
obsType, \
read, \
dictRead, \
dictionary, \
obsName \
); \
} \

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
Copyright (C) 2019-2020 DLR
-------------------------------------------------------------------------------
License
@ -46,9 +46,9 @@ Foam::autoPtr<Foam::implicitFunction> Foam::implicitFunction::New
const dictionary& dict
)
{
auto cstrIter = dictConstructorTablePtr_->cfind(implicitFunctionType);
auto* ctorPtr = dictConstructorTable(implicitFunctionType);
if (!cstrIter.found())
if (!ctorPtr)
{
FatalIOErrorInLookup
(
@ -59,7 +59,7 @@ Foam::autoPtr<Foam::implicitFunction> Foam::implicitFunction::New
) << exit(FatalIOError);
}
return autoPtr<implicitFunction>(cstrIter()(dict));
return autoPtr<implicitFunction>(ctorPtr(dict));
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -41,9 +41,9 @@ Foam::tabulatedWallFunctions::tabulatedWallFunction::New
Info<< "Selecting tabulatedWallFunction " << functionName << endl;
auto cstrIter = dictionaryConstructorTablePtr_->cfind(functionName);
auto* ctorPtr = dictionaryConstructorTable(functionName);
if (!cstrIter.found())
if (!ctorPtr)
{
FatalIOErrorInLookup
(
@ -54,7 +54,7 @@ Foam::tabulatedWallFunctions::tabulatedWallFunction::New
) << exit(FatalIOError);
}
return autoPtr<tabulatedWallFunction>(cstrIter()(dict, mesh));
return autoPtr<tabulatedWallFunction>(ctorPtr(dict, mesh));
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
Copyright (C) 2017-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -72,9 +72,9 @@ Foam::surfaceFeaturesExtraction::method::New
{
const word modelType(dict.get<word>("extractionMethod"));
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
auto* ctorPtr = dictionaryConstructorTable(modelType);
if (!cstrIter.found())
if (!ctorPtr)
{
FatalIOErrorInLookup
(
@ -85,7 +85,7 @@ Foam::surfaceFeaturesExtraction::method::New
) << exit(FatalIOError);
}
return autoPtr<method>(cstrIter.val()(dict));
return autoPtr<method>(ctorPtr(dict));
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2014 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -67,9 +67,9 @@ Foam::searchableSurfaceModifier::New
const dictionary& dict
)
{
auto cstrIter = dictionaryConstructorTablePtr_->cfind(type);
auto* ctorPtr = dictionaryConstructorTable(type);
if (!cstrIter.found())
if (!ctorPtr)
{
FatalIOErrorInLookup
(
@ -80,7 +80,7 @@ Foam::searchableSurfaceModifier::New
) << exit(FatalIOError);
}
return autoPtr<searchableSurfaceModifier>(cstrIter()(geometry, dict));
return autoPtr<searchableSurfaceModifier>(ctorPtr(geometry, dict));
}