Skip to content
Snippets Groups Projects
Commit a3abdc5e authored by mattijs's avatar mattijs
Browse files

ENH: Function1: better error message. Fixes #1200.

parent c50ea3cb
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd. \\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
| Copyright (C) 2011-2017 OpenFOAM Foundation | Copyright (C) 2011-2017 OpenFOAM Foundation
...@@ -52,13 +52,13 @@ Foam::autoPtr<Foam::Function1<Type>> Foam::Function1<Type>::New ...@@ -52,13 +52,13 @@ Foam::autoPtr<Foam::Function1<Type>> Foam::Function1<Type>::New
if (!cstrIter.found()) if (!cstrIter.found())
{ {
FatalErrorInFunction FatalIOErrorInFunction(dict)
<< "Unknown Function1 type " << "Unknown Function1 type "
<< Function1Type << " for Function1 " << Function1Type << " for Function1 "
<< entryName << nl << nl << entryName << nl << nl
<< "Valid Function1 types :" << nl << "Valid Function1 types :" << nl
<< dictionaryConstructorTablePtr_->sortedToc() << nl << dictionaryConstructorTablePtr_->sortedToc() << nl
<< exit(FatalError); << exit(FatalIOError);
} }
return cstrIter()(entryName, coeffsDict); return cstrIter()(entryName, coeffsDict);
...@@ -90,23 +90,31 @@ Foam::autoPtr<Foam::Function1<Type>> Foam::Function1<Type>::New ...@@ -90,23 +90,31 @@ Foam::autoPtr<Foam::Function1<Type>> Foam::Function1<Type>::New
Function1Type = firstToken.wordToken(); Function1Type = firstToken.wordToken();
} }
} }
else else if (redirectType != word::null)
{ {
Function1Type = redirectType; Function1Type = redirectType;
} }
else
{
FatalIOErrorInFunction(dict)
<< "Cannot find specification for Function1 "
<< entryName << nl << nl
<< "Valid Function1 types :" << nl
<< dictionaryConstructorTablePtr_->sortedToc() << nl
<< exit(FatalIOError);
}
auto cstrIter = dictionaryConstructorTablePtr_->cfind(Function1Type); auto cstrIter = dictionaryConstructorTablePtr_->cfind(Function1Type);
if (!cstrIter.found()) if (!cstrIter.found())
{ {
FatalErrorInFunction FatalIOErrorInFunction(dict)
<< "Unknown Function1 type " << "Unknown Function1 type "
<< Function1Type << " for Function1 " << Function1Type << " for Function1 "
<< entryName << nl << nl << entryName << nl << nl
<< "Valid Function1 types :" << nl << "Valid Function1 types :" << nl
<< dictionaryConstructorTablePtr_->sortedToc() << nl << dictionaryConstructorTablePtr_->sortedToc() << nl
<< exit(FatalError); << exit(FatalIOError);
} }
return cstrIter() return cstrIter()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment