STYLE: use auto and cfind to simplify selector usage (issue #512)

This commit is contained in:
Mark Olesen
2017-07-03 10:36:03 +02:00
parent a09815fae2
commit bc1f2fa97e
246 changed files with 1109 additions and 1481 deletions

View File

@ -39,16 +39,16 @@ Foam::autoPtr<Foam::meshToMeshMethod> Foam::meshToMeshMethod::New
Info<< "Selecting AMIMethod " << methodName << endl;
}
componentsConstructorTable::iterator cstrIter =
componentsConstructorTablePtr_->find(methodName);
auto cstrIter = componentsConstructorTablePtr_->cfind(methodName);
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown meshToMesh type "
<< methodName << nl << nl
<< "Valid meshToMesh types are:" << nl
<< componentsConstructorTablePtr_->sortedToc() << exit(FatalError);
<< "Valid meshToMesh types :" << nl
<< componentsConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<meshToMeshMethod>(cstrIter()(src, tgt));

View File

@ -448,8 +448,7 @@ Foam::autoPtr<Foam::sampledSet> Foam::sampledSet::New
{
const word sampleType(dict.lookup("type"));
wordConstructorTable::iterator cstrIter =
wordConstructorTablePtr_->find(sampleType);
auto cstrIter = wordConstructorTablePtr_->cfind(sampleType);
if (!cstrIter.found())
{

View File

@ -33,8 +33,7 @@ Foam::autoPtr<Foam::surfaceReader> Foam::surfaceReader::New
const fileName& fName
)
{
fileNameConstructorTable::iterator cstrIter =
fileNameConstructorTablePtr_->find(readerType);
auto cstrIter = fileNameConstructorTablePtr_->cfind(readerType);
if (!cstrIter.found())
{

View File

@ -61,15 +61,14 @@ Foam::autoPtr<Foam::sampledSurface> Foam::sampledSurface::New
Info<< "Selecting sampledType " << sampleType << endl;
}
wordConstructorTable::iterator cstrIter =
wordConstructorTablePtr_->find(sampleType);
auto cstrIter = wordConstructorTablePtr_->cfind(sampleType);
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown sample type "
<< sampleType << nl << nl
<< "Valid sample types : " << endl
<< "Valid sample types :" << endl
<< wordConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}

View File

@ -54,8 +54,7 @@ namespace Foam
Foam::autoPtr<Foam::surfaceWriter>
Foam::surfaceWriter::New(const word& writeType)
{
wordConstructorTable::iterator cstrIter =
wordConstructorTablePtr_->find(writeType);
auto cstrIter = wordConstructorTablePtr_->cfind(writeType);
if (!cstrIter.found())
{
@ -86,8 +85,7 @@ Foam::autoPtr<Foam::surfaceWriter>
Foam::surfaceWriter::New(const word& writeType, const dictionary& optDict)
{
// find constructors with dictionary options
wordDictConstructorTable::iterator cstrIter =
wordDictConstructorTablePtr_->find(writeType);
auto cstrIter = wordDictConstructorTablePtr_->cfind(writeType);
if (!cstrIter.found())
{

View File

@ -78,8 +78,7 @@ Foam::surfMeshSampler::New
{
const word sampleType(dict.lookup("type"));
wordConstructorTable::iterator cstrIter =
wordConstructorTablePtr_->find(sampleType);
auto cstrIter = wordConstructorTablePtr_->cfind(sampleType);
if (!cstrIter.found())
{