Function1: Improved error messages when evaluation or integration are undefined

This commit is contained in:
Will Bainbridge
2019-03-15 12:28:16 +00:00
parent 2dd8b51d2a
commit becf7d2905
2 changed files with 11 additions and 4 deletions

View File

@ -67,7 +67,9 @@ void Foam::Function1<Type>::convertTimeBase(const Time&)
template<class Type>
Type Foam::Function1<Type>::value(const scalar x) const
{
NotImplemented;
FatalErrorInFunction
<< "Evaluation is not defined for " << type() << " functions"
<< exit(FatalError);
return Zero;
}
@ -76,7 +78,9 @@ Type Foam::Function1<Type>::value(const scalar x) const
template<class Type>
Type Foam::Function1<Type>::integrate(const scalar x1, const scalar x2) const
{
NotImplemented;
FatalErrorInFunction
<< "Integration is not defined for " << type() << " functions"
<< exit(FatalError);
return Zero;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -74,7 +74,10 @@ Foam::Function1Types::Constant<Foam::label>::integrate
const scalarField& x2
) const
{
NotImplemented;
FatalErrorInFunction
<< "Evaluation is not defined for " << type() << " functions"
<< exit(FatalError);
return tmp<Field<label>>(new Field<label>(x1.size()));
}