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

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

View File

@ -42,7 +42,7 @@ Foam::autoPtr<Foam::coordinateRotation> Foam::coordinateRotation::New
{
FatalIOErrorInFunction(dict)
<< "Unknown coordinateRotation type " << rotType << nl << nl
<< "Valid coordinateRotation types are :" << nl
<< "Valid coordinateRotation types :" << nl
<< objectRegistryConstructorTablePtr_->sortedToc()
<< exit(FatalIOError);
}
@ -64,7 +64,7 @@ Foam::autoPtr<Foam::coordinateRotation> Foam::coordinateRotation::New
{
FatalIOErrorInFunction(dict)
<< "Unknown coordinateRotation type " << rotType << nl << nl
<< "Valid coordinateRotation types are :" << nl
<< "Valid coordinateRotation types :" << nl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalIOError);
}

View File

@ -113,12 +113,12 @@ Foam::cylindrical::cylindrical(const tensorField& R)
Foam::cylindrical::cylindrical(const dictionary& dict)
:
Rptr_(),
origin_(),
e3_()
origin_(Zero),
e3_(Zero)
{
FatalErrorInFunction
<< " cylindrical can not be constructed from dictionary "
<< " use the construtctor : "
<< " use the constructor : "
"("
" const dictionary&, const objectRegistry&"
")"

View File

@ -69,7 +69,7 @@ class cylindrical
{
// Private data
//- AutoPtr to transformation tensor
//- An autoPtr to the transformation tensor
autoPtr<tensorField> Rptr_;
//- Origin of the coordinate system

View File

@ -46,7 +46,7 @@ Foam::autoPtr<Foam::coordinateSystem> Foam::coordinateSystem::New
dict
) << "Unknown coordinateSystem type "
<< coordType << nl << nl
<< "Valid coordinateSystem types are :" << nl
<< "Valid coordinateSystem types :" << nl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalIOError);
}

View File

@ -96,14 +96,13 @@ void Foam::edgeMesh::write
const word ext = name.ext();
writefileExtensionMemberFunctionTable::iterator mfIter =
writefileExtensionMemberFunctionTablePtr_->find(ext);
auto mfIter = writefileExtensionMemberFunctionTablePtr_->cfind(ext);
if (!mfIter.found())
{
FatalErrorInFunction
<< "Unknown file extension " << ext << nl << nl
<< "Valid types are :" << endl
<< "Valid types :" << endl
<< writefileExtensionMemberFunctionTablePtr_->sortedToc()
<< exit(FatalError);
}

View File

@ -33,15 +33,14 @@ Foam::autoPtr<Foam::edgeMesh> Foam::edgeMesh::New
const word& ext
)
{
fileExtensionConstructorTable::iterator cstrIter =
fileExtensionConstructorTablePtr_->find(ext);
auto cstrIter = fileExtensionConstructorTablePtr_->cfind(ext);
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown file extension " << ext
<< " for file " << name << nl << nl
<< "Valid extensions are :" << nl
<< "Valid extensions :" << nl
<< fileExtensionConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}

View File

@ -42,15 +42,14 @@ Foam::autoPtr<Foam::extendedEdgeMesh> Foam::extendedEdgeMesh::New
const word& ext
)
{
fileExtensionConstructorTable::iterator cstrIter =
fileExtensionConstructorTablePtr_->find(ext);
auto cstrIter = fileExtensionConstructorTablePtr_->cfind(ext);
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown file extension " << ext
<< " for file " << name << nl << nl
<< "Valid extensions are :" << nl
<< "Valid extensions :" << nl
<< fileExtensionConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}

View File

@ -43,15 +43,14 @@ Foam::autoPtr<Foam::searchableSurface> Foam::searchableSurface::New
const dictionary& dict
)
{
dictConstructorTable::iterator cstrIter =
dictConstructorTablePtr_->find(searchableSurfaceType);
auto cstrIter = dictConstructorTablePtr_->cfind(searchableSurfaceType);
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown searchableSurface type " << searchableSurfaceType
<< endl << endl
<< "Valid searchableSurface types : " << endl
<< "Unknown searchableSurface type "
<< searchableSurfaceType << nl << nl
<< "Valid searchableSurface types :" << endl
<< dictConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}

View File

@ -73,15 +73,14 @@ Foam::autoPtr<Foam::topoSetSource> Foam::topoSetSource::New
const dictionary& dict
)
{
wordConstructorTable::iterator cstrIter =
wordConstructorTablePtr_->find(topoSetSourceType);
auto cstrIter = wordConstructorTablePtr_->cfind(topoSetSourceType);
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown topoSetSource type " << topoSetSourceType
<< endl << endl
<< "Valid topoSetSource types : " << endl
<< "Unknown topoSetSource type "
<< topoSetSourceType << nl << nl
<< "Valid topoSetSource types :" << endl
<< wordConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
@ -97,15 +96,14 @@ Foam::autoPtr<Foam::topoSetSource> Foam::topoSetSource::New
Istream& is
)
{
istreamConstructorTable::iterator cstrIter =
istreamConstructorTablePtr_->find(topoSetSourceType);
auto cstrIter = istreamConstructorTablePtr_->cfind(topoSetSourceType);
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown topoSetSource type " << topoSetSourceType
<< endl << endl
<< "Valid topoSetSource types : " << endl
<< "Unknown topoSetSource type "
<< topoSetSourceType << nl << nl
<< "Valid topoSetSource types :" << endl
<< istreamConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}

View File

@ -51,15 +51,14 @@ Foam::autoPtr<Foam::topoSet> Foam::topoSet::New
writeOption w
)
{
wordConstructorTable::iterator cstrIter =
wordConstructorTablePtr_->find(setType);
auto cstrIter = wordConstructorTablePtr_->cfind(setType);
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown set type " << setType
<< endl << endl
<< "Valid set types : " << endl
<< "Unknown set type "
<< setType << nl << nl
<< "Valid set types :" << endl
<< wordConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
@ -77,15 +76,14 @@ Foam::autoPtr<Foam::topoSet> Foam::topoSet::New
writeOption w
)
{
sizeConstructorTable::iterator cstrIter =
sizeConstructorTablePtr_->find(setType);
auto cstrIter = sizeConstructorTablePtr_->cfind(setType);
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown set type " << setType
<< endl << endl
<< "Valid set types : " << endl
<< "Unknown set type "
<< setType << nl << nl
<< "Valid set types :" << endl
<< sizeConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
@ -103,15 +101,14 @@ Foam::autoPtr<Foam::topoSet> Foam::topoSet::New
writeOption w
)
{
setConstructorTable::iterator cstrIter =
setConstructorTablePtr_->find(setType);
auto cstrIter = setConstructorTablePtr_->cfind(setType);
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown set type " << setType
<< endl << endl
<< "Valid set types : " << endl
<< "Unknown set type "
<< setType << nl << nl
<< "Valid set types :" << endl
<< setConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}