mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: use auto and cfind to simplify selector usage (issue #512)
This commit is contained in:
@ -35,10 +35,6 @@ defineRunTimeSelectionTable(cellSizeAndAlignmentControl, dictionary);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cellSizeAndAlignmentControl::cellSizeAndAlignmentControl
|
||||
@ -57,7 +53,7 @@ Foam::cellSizeAndAlignmentControl::cellSizeAndAlignmentControl
|
||||
controlFunctionDict.lookupOrDefault<Switch>
|
||||
(
|
||||
"forceInitialPointInsertion",
|
||||
"off"
|
||||
Switch::OFF
|
||||
)
|
||||
),
|
||||
name_(name)
|
||||
@ -76,28 +72,20 @@ Foam::cellSizeAndAlignmentControl::New
|
||||
const scalar& defaultCellSize
|
||||
)
|
||||
{
|
||||
word cellSizeAndAlignmentControlTypeName
|
||||
(
|
||||
controlFunctionDict.lookup("type")
|
||||
);
|
||||
const word controlType(controlFunctionDict.lookup("type"));
|
||||
|
||||
Info<< indent << "Selecting cellSizeAndAlignmentControl "
|
||||
<< cellSizeAndAlignmentControlTypeName << endl;
|
||||
<< controlType << endl;
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find
|
||||
(
|
||||
cellSizeAndAlignmentControlTypeName
|
||||
);
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(controlType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown cellSizeAndAlignmentControl type "
|
||||
<< cellSizeAndAlignmentControlTypeName
|
||||
<< endl << endl
|
||||
<< "Valid cellSizeAndAlignmentControl types are :" << endl
|
||||
<< dictionaryConstructorTablePtr_->toc()
|
||||
<< controlType << nl << nl
|
||||
<< "Valid cellSizeAndAlignmentControl types :" << endl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
@ -121,8 +109,4 @@ Foam::cellSizeAndAlignmentControl::~cellSizeAndAlignmentControl()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -32,10 +32,11 @@ namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(cellSizeFunction, 0);
|
||||
defineRunTimeSelectionTable(cellSizeFunction, dictionary);
|
||||
|
||||
scalar cellSizeFunction::snapToSurfaceTol_ = 1e-10;
|
||||
}
|
||||
|
||||
Foam::scalar Foam::cellSizeFunction::snapToSurfaceTol_ = 1e-10;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cellSizeFunction::cellSizeFunction
|
||||
@ -122,25 +123,23 @@ Foam::autoPtr<Foam::cellSizeFunction> Foam::cellSizeFunction::New
|
||||
const labelList regionIndices
|
||||
)
|
||||
{
|
||||
word cellSizeFunctionTypeName
|
||||
const word functionName
|
||||
(
|
||||
cellSizeFunctionDict.lookup("cellSizeFunction")
|
||||
);
|
||||
|
||||
Info<< indent << "Selecting cellSizeFunction " << cellSizeFunctionTypeName
|
||||
<< endl;
|
||||
Info<< indent << "Selecting cellSizeFunction "
|
||||
<< functionName << endl;
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(cellSizeFunctionTypeName);
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(functionName);
|
||||
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown cellSizeFunction type "
|
||||
<< cellSizeFunctionTypeName
|
||||
<< endl << endl
|
||||
<< "Valid cellSizeFunction types are :" << endl
|
||||
<< dictionaryConstructorTablePtr_->toc()
|
||||
<< functionName << nl << nl
|
||||
<< "Valid cellSizeFunction types :" << endl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
|
||||
@ -60,25 +60,23 @@ Foam::autoPtr<Foam::cellSizeCalculationType> Foam::cellSizeCalculationType::New
|
||||
const scalar& defaultCellSize
|
||||
)
|
||||
{
|
||||
word cellSizeCalculationTypeTypeName
|
||||
const word calculationType
|
||||
(
|
||||
cellSizeCalculationTypeDict.lookup("cellSizeCalculationType")
|
||||
);
|
||||
|
||||
Info<< indent << "Selecting cellSizeCalculationType "
|
||||
<< cellSizeCalculationTypeTypeName << endl;
|
||||
<< calculationType << endl;
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(cellSizeCalculationTypeTypeName);
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(calculationType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown cellSizeCalculationType type "
|
||||
<< cellSizeCalculationTypeTypeName
|
||||
<< endl << endl
|
||||
<< "Valid cellSizeCalculationType types are :" << endl
|
||||
<< dictionaryConstructorTablePtr_->toc()
|
||||
<< calculationType << nl << nl
|
||||
<< "Valid cellSizeCalculationType types :" << endl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
|
||||
@ -34,6 +34,7 @@ namespace Foam
|
||||
defineRunTimeSelectionTable(surfaceCellSizeFunction, dictionary);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::surfaceCellSizeFunction::surfaceCellSizeFunction
|
||||
@ -64,25 +65,23 @@ Foam::autoPtr<Foam::surfaceCellSizeFunction> Foam::surfaceCellSizeFunction::New
|
||||
const scalar& defaultCellSize
|
||||
)
|
||||
{
|
||||
word surfaceCellSizeFunctionTypeName
|
||||
const word functionName
|
||||
(
|
||||
surfaceCellSizeFunctionDict.lookup("surfaceCellSizeFunction")
|
||||
);
|
||||
|
||||
Info<< indent << "Selecting surfaceCellSizeFunction "
|
||||
<< surfaceCellSizeFunctionTypeName << endl;
|
||||
<< functionName << endl;
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(surfaceCellSizeFunctionTypeName);
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(functionName);
|
||||
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown surfaceCellSizeFunction type "
|
||||
<< surfaceCellSizeFunctionTypeName
|
||||
<< endl << endl
|
||||
<< "Valid surfaceCellSizeFunction types are :" << endl
|
||||
<< dictionaryConstructorTablePtr_->toc()
|
||||
<< functionName << nl << nl
|
||||
<< "Valid surfaceCellSizeFunction types :" << endl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
|
||||
@ -26,20 +26,17 @@ License
|
||||
#include "faceAreaWeightModel.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(faceAreaWeightModel, 0);
|
||||
defineRunTimeSelectionTable(faceAreaWeightModel, dictionary);
|
||||
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
faceAreaWeightModel::faceAreaWeightModel
|
||||
Foam::faceAreaWeightModel::faceAreaWeightModel
|
||||
(
|
||||
const word& type,
|
||||
const dictionary& relaxationDict
|
||||
@ -52,30 +49,24 @@ faceAreaWeightModel::faceAreaWeightModel
|
||||
|
||||
// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
|
||||
|
||||
autoPtr<faceAreaWeightModel> faceAreaWeightModel::New
|
||||
Foam::autoPtr<Foam::faceAreaWeightModel> Foam::faceAreaWeightModel::New
|
||||
(
|
||||
const dictionary& relaxationDict
|
||||
)
|
||||
{
|
||||
word faceAreaWeightModelTypeName
|
||||
(
|
||||
relaxationDict.lookup("faceAreaWeightModel")
|
||||
);
|
||||
const word modelType(relaxationDict.lookup("faceAreaWeightModel"));
|
||||
|
||||
Info<< nl << "Selecting faceAreaWeightModel "
|
||||
<< faceAreaWeightModelTypeName << endl;
|
||||
Info<< nl << "Selecting faceAreaWeightModel " << modelType << endl;
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(faceAreaWeightModelTypeName);
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown faceAreaWeightModel type "
|
||||
<< faceAreaWeightModelTypeName
|
||||
<< endl << endl
|
||||
<< "Valid faceAreaWeightModel types are :" << endl
|
||||
<< dictionaryConstructorTablePtr_->toc()
|
||||
<< modelType << nl << nl
|
||||
<< "Valid faceAreaWeightModel types :" << endl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
@ -85,12 +76,8 @@ autoPtr<faceAreaWeightModel> faceAreaWeightModel::New
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
faceAreaWeightModel::~faceAreaWeightModel()
|
||||
Foam::faceAreaWeightModel::~faceAreaWeightModel()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -26,20 +26,17 @@ License
|
||||
#include "initialPointsMethod.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(initialPointsMethod, 0);
|
||||
defineRunTimeSelectionTable(initialPointsMethod, dictionary);
|
||||
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
initialPointsMethod::initialPointsMethod
|
||||
Foam::initialPointsMethod::initialPointsMethod
|
||||
(
|
||||
const word& type,
|
||||
const dictionary& initialPointsDict,
|
||||
@ -73,7 +70,7 @@ initialPointsMethod::initialPointsMethod
|
||||
|
||||
// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
|
||||
|
||||
autoPtr<initialPointsMethod> initialPointsMethod::New
|
||||
Foam::autoPtr<Foam::initialPointsMethod> Foam::initialPointsMethod::New
|
||||
(
|
||||
const dictionary& initialPointsDict,
|
||||
const Time& runTime,
|
||||
@ -83,25 +80,20 @@ autoPtr<initialPointsMethod> initialPointsMethod::New
|
||||
const autoPtr<backgroundMeshDecomposition>& decomposition
|
||||
)
|
||||
{
|
||||
word initialPointsMethodTypeName
|
||||
(
|
||||
initialPointsDict.lookup("initialPointsMethod")
|
||||
);
|
||||
const word methodName(initialPointsDict.lookup("initialPointsMethod"));
|
||||
|
||||
Info<< nl << "Selecting initialPointsMethod "
|
||||
<< initialPointsMethodTypeName << endl;
|
||||
<< methodName << endl;
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(initialPointsMethodTypeName);
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(methodName);
|
||||
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown initialPointsMethod type "
|
||||
<< initialPointsMethodTypeName
|
||||
<< endl << endl
|
||||
<< "Valid initialPointsMethod types are :" << endl
|
||||
<< dictionaryConstructorTablePtr_->toc()
|
||||
<< methodName << nl << nl
|
||||
<< "Valid initialPointsMethod types :" << endl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
@ -123,12 +115,8 @@ autoPtr<initialPointsMethod> initialPointsMethod::New
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
initialPointsMethod::~initialPointsMethod()
|
||||
Foam::initialPointsMethod::~initialPointsMethod()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -26,20 +26,18 @@ License
|
||||
#include "relaxationModel.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(relaxationModel, 0);
|
||||
defineRunTimeSelectionTable(relaxationModel, dictionary);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
relaxationModel::relaxationModel
|
||||
Foam::relaxationModel::relaxationModel
|
||||
(
|
||||
const word& type,
|
||||
const dictionary& relaxationDict,
|
||||
@ -54,31 +52,25 @@ relaxationModel::relaxationModel
|
||||
|
||||
// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
|
||||
|
||||
autoPtr<relaxationModel> relaxationModel::New
|
||||
Foam::autoPtr<Foam::relaxationModel> Foam::relaxationModel::New
|
||||
(
|
||||
const dictionary& relaxationDict,
|
||||
const Time& runTime
|
||||
)
|
||||
{
|
||||
word relaxationModelTypeName
|
||||
(
|
||||
relaxationDict.lookup("relaxationModel")
|
||||
);
|
||||
const word modelType(relaxationDict.lookup("relaxationModel"));
|
||||
|
||||
Info<< nl << "Selecting relaxationModel "
|
||||
<< relaxationModelTypeName << endl;
|
||||
Info<< nl << "Selecting relaxationModel " << modelType << endl;
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(relaxationModelTypeName);
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown relaxationModel type "
|
||||
<< relaxationModelTypeName
|
||||
<< endl << endl
|
||||
<< "Valid relaxationModel types are :" << endl
|
||||
<< dictionaryConstructorTablePtr_->toc()
|
||||
<< modelType << nl << nl
|
||||
<< "Valid relaxationModel types :" << endl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
@ -88,12 +80,8 @@ autoPtr<relaxationModel> relaxationModel::New
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
relaxationModel::~relaxationModel()
|
||||
Foam::relaxationModel::~relaxationModel()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -43,17 +43,16 @@ Foam::searchableSurfaceFeatures::New
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
word searchableSurfaceFeaturesType = surface.type() + "Features";
|
||||
const word featuresType = surface.type() + "Features";
|
||||
|
||||
dictConstructorTable::iterator cstrIter =
|
||||
dictConstructorTablePtr_->find(searchableSurfaceFeaturesType);
|
||||
auto cstrIter = dictConstructorTablePtr_->cfind(featuresType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown searchableSurfaceFeatures type "
|
||||
<< searchableSurfaceFeaturesType << endl << endl
|
||||
<< "Valid searchableSurfaceFeatures types : " << endl
|
||||
<< featuresType << nl << nl
|
||||
<< "Valid searchableSurfaceFeatures types :" << endl
|
||||
<< dictConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
@ -68,15 +68,14 @@ Foam::autoPtr<Foam::faceSelection> Foam::faceSelection::New
|
||||
{
|
||||
const word sampleType(dict.lookup("type"));
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(sampleType);
|
||||
auto cstrIter = dictionaryConstructorTablePtr_->cfind(sampleType);
|
||||
|
||||
if (!cstrIter.found())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown faceSelection type "
|
||||
<< sampleType << nl << nl
|
||||
<< "Valid faceSelection types : " << endl
|
||||
<< "Valid faceSelection types :" << endl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user