mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: added FatalErrorInLookup, FatalIOErrorInLookup macros (#1362)
- to simplify/unify error handling STYLE: use NotImplemented instead of longer notImplemented(...)
This commit is contained in:
committed by
Andrew Heather
parent
bbc2d4a8b0
commit
ba3f0734c0
@ -524,7 +524,7 @@ public:
|
||||
//- Return the name of the thermo physics
|
||||
virtual word thermoName() const
|
||||
{
|
||||
NotImplemented
|
||||
NotImplemented;
|
||||
return word();
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
@ -353,6 +353,14 @@ extern IOerror FatalIOError;
|
||||
// for FUNCTION_NAME in file __FILE__ at line __LINE__
|
||||
#define FatalErrorInFunction FatalErrorIn(FUNCTION_NAME)
|
||||
|
||||
//- Report an error message using Foam::FatalError
|
||||
// about unknown lookup type in table
|
||||
#define FatalErrorInLookup(lookupTag, lookupName, lookupTable) \
|
||||
::Foam::FatalError(FUNCTION_NAME, __FILE__, __LINE__) \
|
||||
<< "Unknown " << (lookupTag) << " type " << (lookupName) \
|
||||
<< "\n\nValid " << (lookupTag) << " types :\n" \
|
||||
<< ((lookupTable).sortedToc()) << '\n'
|
||||
|
||||
|
||||
//- Report an error message using Foam::FatalIOError
|
||||
// for functionName in file __FILE__ at line __LINE__
|
||||
@ -366,6 +374,15 @@ extern IOerror FatalIOError;
|
||||
#define FatalIOErrorInFunction(ios) FatalIOErrorIn(FUNCTION_NAME, ios)
|
||||
|
||||
|
||||
//- Report an error message using Foam::FatalIOError
|
||||
// about unknown lookup type in table
|
||||
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable) \
|
||||
::Foam::FatalIOError(FUNCTION_NAME, __FILE__, __LINE__, (ios)) \
|
||||
<< "Unknown " << (lookupTag) << " type " << (lookupName) \
|
||||
<< "\n\nValid " << (lookupTag) << " types :\n" \
|
||||
<< ((lookupTable).sortedToc()) << '\n'
|
||||
|
||||
|
||||
//- Report an error message using Foam::FatalIOError
|
||||
// (or cerr if FatalIOError not yet constructed)
|
||||
// for functionName in file __FILE__ at line __LINE__
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2016-2017 Wikki Ltd
|
||||
@ -366,7 +366,7 @@ public:
|
||||
//- Return patchField on the opposite patch of a coupled patch
|
||||
virtual tmp<Field<Type>> patchNeighbourField() const
|
||||
{
|
||||
notImplemented(type() + "patchNeighbourField()");
|
||||
NotImplemented;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -393,11 +393,7 @@ public:
|
||||
const tmp<Field<scalar>>&
|
||||
) const
|
||||
{
|
||||
notImplemented
|
||||
(
|
||||
type()
|
||||
+ "::valueInternalCoeffs(const tmp<Field<scalar>>&)"
|
||||
);
|
||||
NotImplemented;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -408,11 +404,7 @@ public:
|
||||
const tmp<Field<scalar>>&
|
||||
) const
|
||||
{
|
||||
notImplemented
|
||||
(
|
||||
type()
|
||||
+ "::valueBoundaryCoeffs(const tmp<Field<scalar>>&)"
|
||||
);
|
||||
NotImplemented;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -420,7 +412,7 @@ public:
|
||||
// evaluation of the gradient of this patchField
|
||||
virtual tmp<Field<Type>> gradientInternalCoeffs() const
|
||||
{
|
||||
notImplemented(type() + "::gradientInternalCoeffs()");
|
||||
NotImplemented;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -428,7 +420,7 @@ public:
|
||||
// evaluation of the gradient of this patchField
|
||||
virtual tmp<Field<Type>> gradientBoundaryCoeffs() const
|
||||
{
|
||||
notImplemented(type() + "::gradientBoundaryCoeffs()");
|
||||
NotImplemented;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@ -79,8 +79,8 @@ public:
|
||||
//- Return clone
|
||||
autoPtr<optionAdjoint> clone() const
|
||||
{
|
||||
notImplemented("autoPtr<optionAdjoint> clone() const");
|
||||
return autoPtr<optionAdjoint>(nullptr);
|
||||
NotImplemented;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -99,8 +99,8 @@ Foam::diameterModels::sizeGroup::~sizeGroup()
|
||||
Foam::autoPtr<Foam::diameterModels::sizeGroup>
|
||||
Foam::diameterModels::sizeGroup::clone() const
|
||||
{
|
||||
notImplemented("sizeGroup::clone() const");
|
||||
return autoPtr<sizeGroup>(nullptr);
|
||||
NotImplemented;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -120,7 +120,7 @@ public:
|
||||
autoPtr<breakupModel> clone() const
|
||||
{
|
||||
NotImplemented;
|
||||
return autoPtr<breakupModel>(nullptr);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1143,8 +1143,8 @@ Foam::diameterModels::populationBalanceModel::~populationBalanceModel()
|
||||
Foam::autoPtr<Foam::diameterModels::populationBalanceModel>
|
||||
Foam::diameterModels::populationBalanceModel::clone() const
|
||||
{
|
||||
notImplemented("populationBalance::clone() const");
|
||||
return autoPtr<populationBalanceModel>(nullptr);
|
||||
NotImplemented;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user