mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: use FatalIOErrorInLookup instead of FatalErrorInLookup
This commit is contained in:
committed by
Andrew Heather
parent
5d0f1788e1
commit
f94be1bebb
@ -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));
|
||||
|
||||
@ -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>
|
||||
|
||||
Reference in New Issue
Block a user