patchSummary: Added printing of the actual patchField types

Now for the wall in the simpleFoam pitzDaily tutorial case the following
patchField types are printed

group   : wall
    scalar              v2              v2WallFunction
    scalar              nut             nutkWallFunction
    scalar              k               kqRWallFunction
    scalar              nuTilda         zeroGradient
    scalar              p               zeroGradient
    scalar              omega           omegaWallFunction
    scalar              f               fWallFunction
    scalar              epsilon         epsilonWallFunction
    vector              U               noSlip

instead of

group   : wall
    scalar              v2              generic
    scalar              nut             generic
    scalar              k               generic
    scalar              nuTilda         zeroGradient
    scalar              p               zeroGradient
    scalar              omega           generic
    scalar              f               generic
    scalar              epsilon         generic
    vector              U               noSlip
This commit is contained in:
Henry Weller
2019-09-08 16:39:45 +01:00
parent a9bfb223ff
commit 107b5d161d
10 changed files with 172 additions and 20 deletions

View File

@ -1,5 +1,6 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/genericPatchFields/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude -I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \ EXE_LIBS = \

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,10 +24,25 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "patchSummaryTemplates.H" #include "patchSummaryTemplates.H"
#include "genericPatchField.H"
#include "IOmanip.H" #include "IOmanip.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class PatchField>
Foam::word Foam::patchFieldType(const PatchField& pf)
{
if (isA<genericPatchField>(pf))
{
return refCast<const genericPatchField>(pf).actualTypeName();
}
else
{
return pf.type();
}
}
template<class GeoField> template<class GeoField>
void Foam::addToFieldList void Foam::addToFieldList
( (
@ -63,7 +78,8 @@ void Foam::outputFieldList
Info<< " " << pTraits<typename GeoField::value_type>::typeName Info<< " " << pTraits<typename GeoField::value_type>::typeName
<< tab << tab << tab << tab
<< fieldList[fieldi].name() << tab << tab << fieldList[fieldi].name() << tab << tab
<< fieldList[fieldi].boundaryField()[patchi].type() << nl; << patchFieldType(fieldList[fieldi].boundaryField()[patchi])
<< nl;
} }
} }
} }
@ -84,7 +100,7 @@ void Foam::collectFieldList
fieldToType.insert fieldToType.insert
( (
fieldList[fieldi].name(), fieldList[fieldi].name(),
fieldList[fieldi].boundaryField()[patchi].type() patchFieldType(fieldList[fieldi].boundaryField()[patchi])
); );
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -33,6 +33,9 @@ License
namespace Foam namespace Foam
{ {
template<class PatchField>
word patchFieldType(const PatchField& pf);
template<class GeoField> template<class GeoField>
void addToFieldList void addToFieldList
( (

View File

@ -1,3 +1,4 @@
genericPatchField/genericPatchField.C
genericFvPatchField/genericFvPatchFields.C genericFvPatchField/genericFvPatchFields.C
genericPointPatchField/genericPointPatchFields.C genericPointPatchField/genericPointPatchFields.C

View File

@ -53,8 +53,8 @@ Foam::genericFvPatchField<Type>::genericFvPatchField
const dictionary& dict const dictionary& dict
) )
: :
genericPatchField(dict.lookup("type")),
calculatedFvPatchField<Type>(p, iF, dict), calculatedFvPatchField<Type>(p, iF, dict),
actualTypeName_(dict.lookup("type")),
dict_(dict) dict_(dict)
{ {
if (!dict.found("value")) if (!dict.found("value"))
@ -69,7 +69,7 @@ Foam::genericFvPatchField<Type>::genericFvPatchField
<< nl << nl
<< " which is required to set the" << " which is required to set the"
" values of the generic patch field." << nl " values of the generic patch field." << nl
<< " (Actual type " << actualTypeName_ << ")" << nl << " (Actual type " << actualTypeName() << ")" << nl
<< "\n Please add the 'value' entry to the write function " << "\n Please add the 'value' entry to the write function "
"of the user-defined boundary-condition\n" "of the user-defined boundary-condition\n"
<< exit(FatalIOError); << exit(FatalIOError);
@ -420,8 +420,8 @@ Foam::genericFvPatchField<Type>::genericFvPatchField
const fvPatchFieldMapper& mapper const fvPatchFieldMapper& mapper
) )
: :
genericPatchField(ptf),
calculatedFvPatchField<Type>(ptf, p, iF, mapper), calculatedFvPatchField<Type>(ptf, p, iF, mapper),
actualTypeName_(ptf.actualTypeName_),
dict_(ptf.dict_) dict_(ptf.dict_)
{ {
forAllConstIter forAllConstIter
@ -502,8 +502,8 @@ Foam::genericFvPatchField<Type>::genericFvPatchField
const genericFvPatchField<Type>& ptf const genericFvPatchField<Type>& ptf
) )
: :
genericPatchField(ptf),
calculatedFvPatchField<Type>(ptf), calculatedFvPatchField<Type>(ptf),
actualTypeName_(ptf.actualTypeName_),
dict_(ptf.dict_), dict_(ptf.dict_),
scalarFields_(ptf.scalarFields_), scalarFields_(ptf.scalarFields_),
vectorFields_(ptf.vectorFields_), vectorFields_(ptf.vectorFields_),
@ -520,8 +520,8 @@ Foam::genericFvPatchField<Type>::genericFvPatchField
const DimensionedField<Type, volMesh>& iF const DimensionedField<Type, volMesh>& iF
) )
: :
genericPatchField(ptf),
calculatedFvPatchField<Type>(ptf, iF), calculatedFvPatchField<Type>(ptf, iF),
actualTypeName_(ptf.actualTypeName_),
dict_(ptf.dict_), dict_(ptf.dict_),
scalarFields_(ptf.scalarFields_), scalarFields_(ptf.scalarFields_),
vectorFields_(ptf.vectorFields_), vectorFields_(ptf.vectorFields_),
@ -696,7 +696,7 @@ Foam::genericFvPatchField<Type>::valueInternalCoeffs
{ {
FatalErrorInFunction FatalErrorInFunction
<< "cannot be called for a genericFvPatchField" << "cannot be called for a genericFvPatchField"
" (actual type " << actualTypeName_ << ")" " (actual type " << actualTypeName() << ")"
<< "\n on patch " << this->patch().name() << "\n on patch " << this->patch().name()
<< " of field " << this->internalField().name() << " of field " << this->internalField().name()
<< " in file " << this->internalField().objectPath() << " in file " << this->internalField().objectPath()
@ -717,7 +717,7 @@ Foam::genericFvPatchField<Type>::valueBoundaryCoeffs
{ {
FatalErrorInFunction FatalErrorInFunction
<< "cannot be called for a genericFvPatchField" << "cannot be called for a genericFvPatchField"
" (actual type " << actualTypeName_ << ")" " (actual type " << actualTypeName() << ")"
<< "\n on patch " << this->patch().name() << "\n on patch " << this->patch().name()
<< " of field " << this->internalField().name() << " of field " << this->internalField().name()
<< " in file " << this->internalField().objectPath() << " in file " << this->internalField().objectPath()
@ -735,7 +735,7 @@ Foam::genericFvPatchField<Type>::gradientInternalCoeffs() const
{ {
FatalErrorInFunction FatalErrorInFunction
<< "cannot be called for a genericFvPatchField" << "cannot be called for a genericFvPatchField"
" (actual type " << actualTypeName_ << ")" " (actual type " << actualTypeName() << ")"
<< "\n on patch " << this->patch().name() << "\n on patch " << this->patch().name()
<< " of field " << this->internalField().name() << " of field " << this->internalField().name()
<< " in file " << this->internalField().objectPath() << " in file " << this->internalField().objectPath()
@ -752,7 +752,7 @@ Foam::genericFvPatchField<Type>::gradientBoundaryCoeffs() const
{ {
FatalErrorInFunction FatalErrorInFunction
<< "cannot be called for a genericFvPatchField" << "cannot be called for a genericFvPatchField"
" (actual type " << actualTypeName_ << ")" " (actual type " << actualTypeName() << ")"
<< "\n on patch " << this->patch().name() << "\n on patch " << this->patch().name()
<< " of field " << this->internalField().name() << " of field " << this->internalField().name()
<< " in file " << this->internalField().objectPath() << " in file " << this->internalField().objectPath()
@ -767,7 +767,7 @@ Foam::genericFvPatchField<Type>::gradientBoundaryCoeffs() const
template<class Type> template<class Type>
void Foam::genericFvPatchField<Type>::write(Ostream& os) const void Foam::genericFvPatchField<Type>::write(Ostream& os) const
{ {
writeEntry(os, "type", actualTypeName_); writeEntry(os, "type", actualTypeName());
forAllConstIter(dictionary, dict_, iter) forAllConstIter(dictionary, dict_, iter)
{ {

View File

@ -40,6 +40,7 @@ SourceFiles
#ifndef genericFvPatchField_H #ifndef genericFvPatchField_H
#define genericFvPatchField_H #define genericFvPatchField_H
#include "genericPatchField.H"
#include "calculatedFvPatchField.H" #include "calculatedFvPatchField.H"
#include "HashPtrTable.H" #include "HashPtrTable.H"
@ -55,11 +56,11 @@ namespace Foam
template<class Type> template<class Type>
class genericFvPatchField class genericFvPatchField
: :
public genericPatchField,
public calculatedFvPatchField<Type> public calculatedFvPatchField<Type>
{ {
// Private Data // Private Data
word actualTypeName_;
dictionary dict_; dictionary dict_;
HashPtrTable<scalarField> scalarFields_; HashPtrTable<scalarField> scalarFields_;

View File

@ -0,0 +1,35 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "genericPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(genericPatchField, 0);
}
// ************************************************************************* //

View File

@ -0,0 +1,94 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::genericPatchField
Description
SourceFiles
genericPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef genericPatchField_H
#define genericPatchField_H
#include "typeInfo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class genericFvPatch Declaration
\*---------------------------------------------------------------------------*/
class genericPatchField
{
// Private Data
word actualTypeName_;
public:
//- Runtime type information
TypeName("generic");
// Constructors
genericPatchField()
{}
genericPatchField(const word& atn)
:
actualTypeName_(atn)
{}
//- Destructor
virtual ~genericPatchField()
{}
// Member Functions
//- Return the actual type name
word actualTypeName() const
{
return actualTypeName_;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -49,8 +49,8 @@ Foam::genericPointPatchField<Type>::genericPointPatchField
const dictionary& dict const dictionary& dict
) )
: :
genericPatchField(dict.lookup("type")),
calculatedPointPatchField<Type>(p, iF, dict), calculatedPointPatchField<Type>(p, iF, dict),
actualTypeName_(dict.lookup("type")),
dict_(dict) dict_(dict)
{ {
forAllConstIter(dictionary, dict_, iter) forAllConstIter(dictionary, dict_, iter)
@ -311,8 +311,8 @@ Foam::genericPointPatchField<Type>::genericPointPatchField
const pointPatchFieldMapper& mapper const pointPatchFieldMapper& mapper
) )
: :
genericPatchField(ptf),
calculatedPointPatchField<Type>(ptf, p, iF, mapper), calculatedPointPatchField<Type>(ptf, p, iF, mapper),
actualTypeName_(ptf.actualTypeName_),
dict_(ptf.dict_) dict_(ptf.dict_)
{ {
forAllConstIter forAllConstIter
@ -394,8 +394,8 @@ Foam::genericPointPatchField<Type>::genericPointPatchField
const DimensionedField<Type, pointMesh>& iF const DimensionedField<Type, pointMesh>& iF
) )
: :
genericPatchField(ptf),
calculatedPointPatchField<Type>(ptf, iF), calculatedPointPatchField<Type>(ptf, iF),
actualTypeName_(ptf.actualTypeName_),
dict_(ptf.dict_), dict_(ptf.dict_),
scalarFields_(ptf.scalarFields_), scalarFields_(ptf.scalarFields_),
vectorFields_(ptf.vectorFields_), vectorFields_(ptf.vectorFields_),
@ -560,7 +560,7 @@ void Foam::genericPointPatchField<Type>::rmap
template<class Type> template<class Type>
void Foam::genericPointPatchField<Type>::write(Ostream& os) const void Foam::genericPointPatchField<Type>::write(Ostream& os) const
{ {
writeEntry(os, "type", actualTypeName_); writeEntry(os, "type", actualTypeName());
forAllConstIter(dictionary, dict_, iter) forAllConstIter(dictionary, dict_, iter)
{ {

View File

@ -36,6 +36,7 @@ SourceFiles
#ifndef genericPointPatchField_H #ifndef genericPointPatchField_H
#define genericPointPatchField_H #define genericPointPatchField_H
#include "genericPatchField.H"
#include "calculatedPointPatchField.H" #include "calculatedPointPatchField.H"
#include "HashPtrTable.H" #include "HashPtrTable.H"
@ -51,11 +52,11 @@ namespace Foam
template<class Type> template<class Type>
class genericPointPatchField class genericPointPatchField
: :
public genericPatchField,
public calculatedPointPatchField<Type> public calculatedPointPatchField<Type>
{ {
// Private Data // Private Data
word actualTypeName_;
dictionary dict_; dictionary dict_;
HashPtrTable<scalarField> scalarFields_; HashPtrTable<scalarField> scalarFields_;