ENH: use FatalIOErrorInLookup instead of FatalErrorInLookup

This commit is contained in:
Mark Olesen
2019-07-16 10:26:51 +02:00
committed by Andrew Heather
parent 5d0f1788e1
commit f94be1bebb
221 changed files with 1214 additions and 988 deletions

View File

@ -30,39 +30,36 @@ License
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::engineMesh> Foam::engineMesh::New
(
const Foam::IOobject& io
)
Foam::autoPtr<Foam::engineMesh> Foam::engineMesh::New(const IOobject& io)
{
const word modelType
const IOdictionary dict
(
IOdictionary
IOobject
(
IOobject
(
"engineGeometry",
io.time().constant(),
io.db(),
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false // Do not register
)
).get<word>("engineMesh")
"engineGeometry",
io.time().constant(),
io.db(),
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false // Do not register
)
);
const word modelType(dict.get<word>("engineMesh"));
Info<< "Selecting engineMesh " << modelType << endl;
auto cstrIter = IOobjectConstructorTablePtr_->cfind(modelType);
if (!cstrIter.found())
{
FatalErrorInLookup
FatalIOErrorInLookup
(
dict,
"engineMesh",
modelType,
*IOobjectConstructorTablePtr_
) << exit(FatalError);
) << exit(FatalIOError);
}
return autoPtr<engineMesh>(cstrIter()(io));

View File

@ -42,11 +42,11 @@ Foam::autoPtr<Foam::engineTime> Foam::engineTime::New
{
IFstream engineDictFile("."/constantName/dictName);
dictionary engineDict(engineDictFile);
dictionary dict(engineDictFile);
const word engineType
(
engineDict.lookupOrDefault<word>("engineType", "crankConRod")
dict.getOrDefault<word>("engineType", "crankConRod")
);
Info<< "Selecting engine type " << engineType << endl;
@ -55,12 +55,13 @@ Foam::autoPtr<Foam::engineTime> Foam::engineTime::New
if (!cstrIter.found())
{
FatalErrorInLookup
FatalIOErrorInLookup
(
dict,
"engine",
engineType,
*dictionaryConstructorTablePtr_
) << exit(FatalError);
) << exit(FatalIOError);
}
return autoPtr<engineTime>