functionObjects: Emit warning messages only for field names which do not exist for any type

Resolves bug-report https://bugs.openfoam.org/view.php?id=3583
This commit is contained in:
Henry Weller
2020-10-27 20:03:19 +00:00
parent efbf198022
commit f7848e62a1
27 changed files with 140 additions and 123 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2016-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -40,6 +40,17 @@ namespace functionObjects
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
void Foam::functionObjects::regionFunctionObject::cannotFindObject
(
const word& fieldName
)
{
Warning
<< " functionObjects::" << type() << " " << name()
<< " cannot find required object " << fieldName << endl;
}
bool Foam::functionObjects::regionFunctionObject::writeObject
(
const word& fieldName

View File

@ -78,6 +78,13 @@ protected:
template<class ObjectType>
bool foundObject(const word& fieldName) const;
//- Prints a warning message that fieldName cannot be found
template<class ObjectType>
void cannotFindObject(const word& fieldName);
//- Prints a warning message that fieldName cannot be found
void cannotFindObject(const word& fieldName);
//- Lookup object from the objectRegistry
template<class ObjectType>
const ObjectType& lookupObject(const word& fieldName) const;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2016-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2016-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -38,6 +38,19 @@ bool Foam::functionObjects::regionFunctionObject::foundObject
}
template<class Type>
void Foam::functionObjects::regionFunctionObject::cannotFindObject
(
const word& fieldName
)
{
Warning
<< " functionObjects::" << type() << " " << name()
<< " cannot find required object " << fieldName << " of type "
<< Type::typeName << endl;
}
template<class ObjectType>
const ObjectType& Foam::functionObjects::regionFunctionObject::lookupObject
(