ENH: simplify generic patch field code

This commit is contained in:
Mark Olesen
2023-02-22 15:33:25 +01:00
parent 899d59686c
commit 9938a13b2a
21 changed files with 579 additions and 347 deletions

View File

@ -1,6 +1,7 @@
genericPatchFieldBase/genericPatchFieldBase.C
common/genericPatchFieldBase.C
genericFaPatchField/genericFaPatchFields.C
/* not yet needed: genericFaePatchField/genericFaePatchFields.C */
genericFvPatchField/genericFvPatchFields.C
genericFvsPatchField/genericFvsPatchFields.C
genericPointPatchField/genericPointPatchFields.C

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2021 OpenCFD Ltd.
Copyright (C) 2021-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -88,7 +88,7 @@ void Foam::genericPatchFieldBase::genericFatalSolveError
) const
{
FatalError
<< " (actual type " << actualTypeName_ << ')'
<< " (Actual type " << actualTypeName_ << ')'
<< "\n on patch " << patchName
<< " of field " << io.name() << " in file " << io.objectPath() << nl
<< nl
@ -161,10 +161,6 @@ bool Foam::genericPatchFieldBase::processEntry
return false;
}
#undef FIELDSIZE_CHECK
#define FIELDSIZE_CHECK(fieldLen) \
checkFieldSize(fieldLen, patchSize, patchName, key, io)
// First token
token tok(is);
@ -179,6 +175,7 @@ bool Foam::genericPatchFieldBase::processEntry
// without a compound type.
// Just treat as scalar and hope for the best.
scalarFields_.insert(key, autoPtr<scalarField>::New());
return true;
}
else if (!tok.isCompound())
{
@ -190,130 +187,50 @@ bool Foam::genericPatchFieldBase::processEntry
<< exit(FatalIOError);
return false;
}
else if
(
tok.compoundToken().type()
== token::Compound<List<scalar>>::typeName
)
{
auto fPtr = autoPtr<scalarField>::New();
fPtr->transfer
(
dynamicCast<token::Compound<List<scalar>>>
(
tok.transferCompoundToken(is)
)
);
if (!FIELDSIZE_CHECK(fPtr->size()))
{
return false;
}
scalarFields_.insert(key, fPtr);
#undef doLocalCode
#define doLocalCode(ValueType, Member) \
if \
( \
tok.compoundToken().type() \
== token::Compound<List<ValueType>>::typeName \
) \
{ \
auto fPtr = autoPtr<Field<ValueType>>::New(); \
\
fPtr->transfer \
( \
dynamicCast<token::Compound<List<ValueType>>> \
( \
tok.transferCompoundToken(is) \
) \
); \
\
if (!checkFieldSize(fPtr->size(), patchSize, patchName, key, io)) \
{ \
return false; \
} \
\
this->Member.insert(key, fPtr); \
return true; \
}
else if
(
tok.compoundToken().type()
== token::Compound<List<vector>>::typeName
)
{
auto fPtr = autoPtr<vectorField>::New();
fPtr->transfer
(
dynamicCast<token::Compound<List<vector>>>
(
tok.transferCompoundToken(is)
)
);
//doLocalCode(label, labelFields_);
doLocalCode(scalar, scalarFields_);
doLocalCode(vector, vectorFields_);
doLocalCode(sphericalTensor, sphTensorFields_);
doLocalCode(symmTensor, symmTensorFields_);
doLocalCode(tensor, tensorFields_);
#undef doLocalCode
if (!FIELDSIZE_CHECK(fPtr->size()))
{
return false;
}
vectorFields_.insert(key, fPtr);
}
else if
(
tok.compoundToken().type()
== token::Compound<List<sphericalTensor>>::typeName
)
{
auto fPtr = autoPtr<sphericalTensorField>::New();
fPtr->transfer
(
dynamicCast<token::Compound<List<sphericalTensor>>>
(
tok.transferCompoundToken(is)
)
);
if (!FIELDSIZE_CHECK(fPtr->size()))
{
return false;
}
sphTensorFields_.insert(key, fPtr);
}
else if
(
tok.compoundToken().type()
== token::Compound<List<symmTensor>>::typeName
)
{
auto fPtr = autoPtr<symmTensorField>::New();
fPtr->transfer
(
dynamicCast<token::Compound<List<symmTensor>>>
(
tok.transferCompoundToken(is)
)
);
if (!FIELDSIZE_CHECK(fPtr->size()))
{
return false;
}
symmTensorFields_.insert(key, fPtr);
}
else if
(
tok.compoundToken().type()
== token::Compound<List<tensor>>::typeName
)
{
auto fPtr = autoPtr<tensorField>::New();
fPtr->transfer
(
dynamicCast<token::Compound<List<tensor>>>
(
tok.transferCompoundToken(is)
)
);
if (!FIELDSIZE_CHECK(fPtr->size()))
{
return false;
}
tensorFields_.insert(key, fPtr);
}
else
{
FatalIOErrorInFunction(dict_)
<< "\n unsupported compound " << tok.compoundToken()
<< "\n on patch " << patchName << " of field "
<< io.name() << " in file "
<< io.objectPath() << nl
<< exit(FatalIOError);
return false;
}
// Fall-through
FatalIOErrorInFunction(dict_)
<< "\n unsupported compound " << tok.compoundToken() << nl
<< "\n on patch " << patchName << " of field "
<< io.name() << " in file "
<< io.objectPath() << nl
<< exit(FatalIOError);
return false;
}
else if (tok.isWord("uniform"))
{
@ -321,6 +238,9 @@ bool Foam::genericPatchFieldBase::processEntry
if (!tok.isPunctuation())
{
// Unfortunately cannot distinguish between
// labelField and scalarField...
scalarFields_.insert
(
key,
@ -413,8 +333,6 @@ bool Foam::genericPatchFieldBase::processEntry
}
}
#undef FIELDSIZE_CHECK
return true;
}
@ -430,30 +348,27 @@ void Foam::genericPatchFieldBase::putEntry
if
(
e.isStream()
&& e.stream().size()
&& e.stream()[0].isWord("nonuniform")
&& e.stream().peek().isWord("nonuniform")
)
{
if (scalarFields_.found(key))
{
scalarFields_.cfind(key)()->writeEntry(key, os);
}
else if (vectorFields_.found(key))
{
vectorFields_.cfind(key)()->writeEntry(key, os);
}
else if (sphTensorFields_.found(key))
{
sphTensorFields_.cfind(key)()->writeEntry(key, os);
}
else if (symmTensorFields_.found(key))
{
symmTensorFields_.cfind(key)()->writeEntry(key, os);
}
else if (tensorFields_.found(key))
{
tensorFields_.cfind(key)()->writeEntry(key, os);
#undef doLocalCode
#define doLocalCode(ValueType, Member) \
{ \
const auto iter = this->Member.cfind(key); \
if (iter.good()) \
{ \
iter.val()->writeEntry(key, os); \
return; \
} \
}
//doLocalCode(label, labelFields_);
doLocalCode(scalar, scalarFields_);
doLocalCode(vector, vectorFields_);
doLocalCode(sphericalTensor, sphTensorFields_);
doLocalCode(symmTensor, symmTensorFields_);
doLocalCode(tensor, tensorFields_);
#undef doLocalCode
}
else
{
@ -492,55 +407,25 @@ void Foam::genericPatchFieldBase::rmapGeneric
const labelList& addr
)
{
forAllIters(scalarFields_, iter)
{
const auto iter2 = rhs.scalarFields_.cfind(iter.key());
if (iter2.good())
{
(*iter)->rmap(*iter2(), addr);
}
#undef doLocalCode
#define doLocalCode(ValueType, Member) \
forAllIters(this->Member, iter) \
{ \
const auto iter2 = rhs.Member.cfind(iter.key()); \
\
if (iter2.good()) \
{ \
iter.val()->rmap(*iter2.val(), addr); \
} \
}
forAllIters(vectorFields_, iter)
{
const auto iter2 = rhs.vectorFields_.cfind(iter.key());
if (iter2.good())
{
(*iter)->rmap(*iter2(), addr);
}
}
forAllIters(sphTensorFields_, iter)
{
const auto iter2 = rhs.sphTensorFields_.cfind(iter.key());
if (iter2.good())
{
(*iter)->rmap(*iter2(), addr);
}
}
forAllIters(symmTensorFields_, iter)
{
const auto iter2 = rhs.symmTensorFields_.cfind(iter.key());
if (iter2.good())
{
(*iter)->rmap(*iter2(), addr);
}
}
forAllIters(tensorFields_, iter)
{
const auto iter2 = rhs.tensorFields_.find(iter.key());
if (iter2.good())
{
(*iter)->rmap(*iter2(), addr);
}
}
//doLocalCode(label, labelFields_);
doLocalCode(scalar, scalarFields_);
doLocalCode(vector, vectorFields_);
doLocalCode(sphericalTensor, sphTensorFields_);
doLocalCode(symmTensor, symmTensorFields_);
doLocalCode(tensor, tensorFields_);
#undef doLocalCode
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2021 OpenCFD Ltd.
Copyright (C) 2021-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -35,8 +35,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef genericPatchFieldBase_H
#define genericPatchFieldBase_H
#ifndef Foam_genericPatchFieldBase_H
#define Foam_genericPatchFieldBase_H
#include "dictionary.H"
#include "primitiveFields.H"
@ -54,6 +54,26 @@ namespace Foam
class genericPatchFieldBase
{
// Private Data
//- The non-generic patch name
word actualTypeName_;
//- Copy of the input dictionary (used for transcribing)
dictionary dict_;
// The data fields read.
// Do not need to handle generic for 'label' since these
// will be limited to known field types.
HashPtrTable<scalarField> scalarFields_;
HashPtrTable<vectorField> vectorFields_;
HashPtrTable<sphericalTensorField> sphTensorFields_;
HashPtrTable<symmTensorField> symmTensorFields_;
HashPtrTable<tensorField> tensorFields_;
// Private Member Functions
bool checkFieldSize
@ -68,20 +88,6 @@ class genericPatchFieldBase
protected:
// Protected Data
//- The non-generic patch name
word actualTypeName_;
dictionary dict_;
HashPtrTable<scalarField> scalarFields_;
HashPtrTable<vectorField> vectorFields_;
HashPtrTable<sphericalTensorField> sphTensorFields_;
HashPtrTable<symmTensorField> symmTensorFields_;
HashPtrTable<tensorField> tensorFields_;
// Protected Member Functions
//- Add error message to FatalError about solving with

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2021 OpenCFD Ltd.
Copyright (C) 2021-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -36,50 +36,24 @@ void Foam::genericPatchFieldBase::mapGeneric
const MapperType& mapper
)
{
forAllConstIters(rhs.scalarFields_, iter)
{
scalarFields_.insert
(
iter.key(),
autoPtr<scalarField>::New(*iter(), mapper)
);
#undef doLocalCode
#define doLocalCode(ValueType, Member) \
forAllIters(rhs.Member, iter) \
{ \
this->Member.insert \
( \
iter.key(), \
autoPtr<Field<ValueType>>::New(*iter.val(), mapper) \
); \
}
forAllConstIters(rhs.vectorFields_, iter)
{
vectorFields_.insert
(
iter.key(),
autoPtr<vectorField>::New(*iter(), mapper)
);
}
forAllConstIters(rhs.sphTensorFields_, iter)
{
sphTensorFields_.insert
(
iter.key(),
autoPtr<sphericalTensorField>::New(*iter(), mapper)
);
}
forAllConstIters(rhs.symmTensorFields_, iter)
{
symmTensorFields_.insert
(
iter.key(),
autoPtr<symmTensorField>::New(*iter(), mapper)
);
}
forAllConstIters(rhs.tensorFields_, iter)
{
tensorFields_.insert
(
iter.key(),
autoPtr<tensorField>::New(*iter(), mapper)
);
}
//doLocalCode(label, labelFields_);
doLocalCode(scalar, scalarFields_);
doLocalCode(vector, vectorFields_);
doLocalCode(sphericalTensor, sphTensorFields_);
doLocalCode(symmTensor, symmTensorFields_);
doLocalCode(tensor, tensorFields_);
#undef doLocalCode
}
@ -89,30 +63,20 @@ void Foam::genericPatchFieldBase::autoMapGeneric
const MapperType& mapper
)
{
forAllIters(scalarFields_, iter)
{
(*iter)->autoMap(mapper);
#undef doLocalCode
#define doLocalCode(ValueType, Member) \
forAllIters(this->Member, iter) \
{ \
iter.val()->autoMap(mapper); \
}
forAllIters(vectorFields_, iter)
{
(*iter)->autoMap(mapper);
}
forAllIters(sphTensorFields_, iter)
{
(*iter)->autoMap(mapper);
}
forAllIters(symmTensorFields_, iter)
{
(*iter)->autoMap(mapper);
}
forAllIters(tensorFields_, iter)
{
(*iter)->autoMap(mapper);
}
//doLocalCode(label, labelFields_);
doLocalCode(scalar, scalarFields_);
doLocalCode(vector, vectorFields_);
doLocalCode(sphericalTensor, sphTensorFields_);
doLocalCode(symmTensor, symmTensorFields_);
doLocalCode(tensor, tensorFields_);
#undef doLocalCode
}

View File

@ -41,7 +41,7 @@ Foam::genericFaPatchField<Type>::genericFaPatchField
parent_bctype(p, iF)
{
FatalErrorInFunction
<< "Trying to construct genericFaPatchField on patch "
<< "Trying to construct generic patchField on patch "
<< this->patch().name()
<< " of field " << this->internalField().name() << nl
<< abort(FatalError);
@ -63,7 +63,7 @@ Foam::genericFaPatchField<Type>::genericFaPatchField
const word& patchName = this->patch().name();
const IOobject& io = this->internalField();
if (!dict.found("value"))
if (!dict.findEntry("value", keyType::LITERAL))
{
reportMissingEntry("value", patchName, io);
}
@ -148,7 +148,7 @@ Foam::genericFaPatchField<Type>::valueInternalCoeffs
) const
{
FatalErrorInFunction
<< "Cannot be called for a genericFaPatchField";
<< "Cannot be called for a generic patchField";
genericFatalSolveError
(
@ -169,7 +169,7 @@ Foam::genericFaPatchField<Type>::valueBoundaryCoeffs
) const
{
FatalErrorInFunction
<< "Cannot be called for a genericFaPatchField";
<< "Cannot be called for a generic patchField";
genericFatalSolveError
(
@ -187,7 +187,7 @@ Foam::tmp<Foam::Field<Type>>
Foam::genericFaPatchField<Type>::gradientInternalCoeffs() const
{
FatalErrorInFunction
<< "Cannot be called for a genericFaPatchField";
<< "Cannot be called for a generic patchField";
genericFatalSolveError
(
@ -205,7 +205,7 @@ Foam::tmp<Foam::Field<Type>>
Foam::genericFaPatchField<Type>::gradientBoundaryCoeffs() const
{
FatalErrorInFunction
<< "Cannot be called for a genericFaPatchField";
<< "Cannot be called for a generic patchField";
genericFatalSolveError
(

View File

@ -29,17 +29,11 @@ License
#include "addToRunTimeSelectionTable.H"
#include "areaFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makeFaPatchFields(generic);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
makeFaPatchFields(generic);
}
// ************************************************************************* //

View File

@ -25,8 +25,8 @@ License
\*---------------------------------------------------------------------------*/
#ifndef genericFaPatchFields_H
#define genericFaPatchFields_H
#ifndef Foam_genericFaPatchFields_H
#define Foam_genericFaPatchFields_H
#include "genericFaPatchField.H"
#include "fieldTypes.H"

View File

@ -0,0 +1,142 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "genericFaePatchField.H"
#include "faPatchFieldMapper.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::genericFaePatchField<Type>::genericFaePatchField
(
const faPatch& p,
const DimensionedField<Type, edgeMesh>& iF
)
:
parent_bctype(p, iF)
{
FatalErrorInFunction
<< "Trying to construct generic patchField on patch "
<< this->patch().name()
<< " of field " << this->internalField().name()
<< abort(FatalError);
}
template<class Type>
Foam::genericFaePatchField<Type>::genericFaePatchField
(
const faPatch& p,
const DimensionedField<Type, edgeMesh>& iF,
const dictionary& dict
)
:
parent_bctype(p, iF, dict),
genericPatchFieldBase(dict)
{
const label patchSize = this->size();
const word& patchName = this->patch().name();
const IOobject& io = this->internalField();
if (!dict.findEntry("value", keyType::LITERAL))
{
reportMissingEntry("value", patchName, io);
}
// Handle "value" separately
processGeneric(patchSize, patchName, io, true);
}
template<class Type>
Foam::genericFaePatchField<Type>::genericFaePatchField
(
const genericFaePatchField<Type>& rhs,
const faPatch& p,
const DimensionedField<Type, edgeMesh>& iF,
const faPatchFieldMapper& mapper
)
:
parent_bctype(rhs, p, iF, mapper),
genericPatchFieldBase(zero{}, rhs)
{
this->mapGeneric(rhs, mapper);
}
template<class Type>
Foam::genericFaePatchField<Type>::genericFaePatchField
(
const genericFaePatchField<Type>& rhs,
const DimensionedField<Type, edgeMesh>& iF
)
:
parent_bctype(rhs, iF),
genericPatchFieldBase(rhs)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::genericFaePatchField<Type>::write(Ostream& os) const
{
// Handle "value" separately
genericPatchFieldBase::writeGeneric(os, true);
faePatchField<Type>::writeValueEntry(os);
}
template<class Type>
void Foam::genericFaePatchField<Type>::autoMap
(
const faPatchFieldMapper& m
)
{
parent_bctype::autoMap(m);
this->autoMapGeneric(m);
}
template<class Type>
void Foam::genericFaePatchField<Type>::rmap
(
const faePatchField<Type>& rhs,
const labelList& addr
)
{
parent_bctype::rmap(rhs, addr);
const auto* base = isA<genericPatchFieldBase>(rhs);
if (base)
{
this->rmapGeneric(*base, addr);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,165 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
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::genericFaePatchField
Description
This boundary condition provides a generic version of the \c calculated
condition, useful as a fallback for handling unknown patch types. Not
generally applicable as a user-specified condition.
See also
Foam::calculatedFaePatchField
SourceFiles
genericFaePatchField.C
\*---------------------------------------------------------------------------*/
#ifndef genericFaePatchField_H
#define genericFaePatchField_H
#include "calculatedFaePatchField.H"
#include "genericPatchFieldBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class genericFaePatchField Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class genericFaePatchField
:
public calculatedFaePatchField<Type>,
public genericPatchFieldBase
{
//- The parent boundary condition type
typedef calculatedFaePatchField<Type> parent_bctype;
public:
//- Runtime type information
TypeName("generic");
// Constructors
//- Construct from patch and internal field
genericFaePatchField
(
const faPatch&,
const DimensionedField<Type, edgeMesh>&
);
//- Construct from patch, internal field and dictionary
genericFaePatchField
(
const faPatch&,
const DimensionedField<Type, edgeMesh>&,
const dictionary&
);
//- Construct by mapping given patch field onto a new patch
genericFaePatchField
(
const genericFaePatchField<Type>&,
const faPatch&,
const DimensionedField<Type, edgeMesh>&,
const faPatchFieldMapper&
);
//- Default copy construct
genericFaePatchField(const genericFaePatchField<Type>&) = default;
//- Construct and return a clone
virtual tmp<faePatchField<Type>> clone() const
{
return tmp<faePatchField<Type>>
(
new genericFaePatchField<Type>(*this)
);
}
//- Construct as copy setting internal field reference
genericFaePatchField
(
const genericFaePatchField<Type>&,
const DimensionedField<Type, edgeMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<faePatchField<Type>> clone
(
const DimensionedField<Type, edgeMesh>& iF
) const
{
return tmp<faePatchField<Type>>
(
new genericFaePatchField<Type>(*this, iF)
);
}
// Member Functions
//- Write
virtual void write(Ostream&) const;
// Mapping Functions
//- Map (and resize as needed) from self given a mapping object
virtual void autoMap(const faPatchFieldMapper&);
//- Reverse map the given faPatchField onto this faPatchField
virtual void rmap
(
const faePatchField<Type>&,
const labelList&
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "genericFaePatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,39 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "genericFaePatchFields.H"
#include "addToRunTimeSelectionTable.H"
#include "edgeFields.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
makeFaePatchFields(generic);
}
// ************************************************************************* //

View File

@ -0,0 +1,51 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
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/>.
\*---------------------------------------------------------------------------*/
#ifndef Foam_genericFaePatchFields_H
#define Foam_genericFaePatchFields_H
#include "genericFaePatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeFaePatchTypeFieldTypedefs(generic);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -41,7 +41,7 @@ Foam::genericFvPatchField<Type>::genericFvPatchField
parent_bctype(p, iF)
{
FatalErrorInFunction
<< "Trying to construct an genericFvPatchField on patch "
<< "Trying to construct generic patchField on patch "
<< this->patch().name()
<< " of field " << this->internalField().name()
<< abort(FatalError);
@ -63,7 +63,7 @@ Foam::genericFvPatchField<Type>::genericFvPatchField
const word& patchName = this->patch().name();
const IOobject& io = this->internalField();
if (!dict.found("value"))
if (!dict.findEntry("value", keyType::LITERAL))
{
reportMissingEntry("value", patchName, io);
}
@ -148,7 +148,7 @@ Foam::genericFvPatchField<Type>::valueInternalCoeffs
) const
{
FatalErrorInFunction
<< "Cannot be called for a genericFvPatchField";
<< "Cannot be called for a generic patchField";
genericFatalSolveError
(
@ -169,7 +169,7 @@ Foam::genericFvPatchField<Type>::valueBoundaryCoeffs
) const
{
FatalErrorInFunction
<< "Cannot be called for a genericFvPatchField";
<< "Cannot be called for a generic patchField";
genericFatalSolveError
(
@ -187,7 +187,7 @@ Foam::tmp<Foam::Field<Type>>
Foam::genericFvPatchField<Type>::gradientInternalCoeffs() const
{
FatalErrorInFunction
<< "Cannot be called for a genericFvPatchField";
<< "Cannot be called for a generic patchField";
genericFatalSolveError
(
@ -204,7 +204,7 @@ Foam::tmp<Foam::Field<Type>>
Foam::genericFvPatchField<Type>::gradientBoundaryCoeffs() const
{
FatalErrorInFunction
<< "Cannot be called for a genericFvPatchField";
<< "Cannot be called for a generic patchField";
genericFatalSolveError
(

View File

@ -29,17 +29,11 @@ License
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePatchFields(generic);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
makePatchFields(generic);
}
// ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -25,11 +26,10 @@ License
\*---------------------------------------------------------------------------*/
#ifndef genericFvPatchFields_H
#define genericFvPatchFields_H
#ifndef Foam_genericFvPatchFields_H
#define Foam_genericFvPatchFields_H
#include "genericFvPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -40,7 +40,7 @@ Foam::genericFvsPatchField<Type>::genericFvsPatchField
parent_bctype(p, iF)
{
FatalErrorInFunction
<< "Trying to construct an genericFvsPatchField on patch "
<< "Trying to construct generic patchField on patch "
<< this->patch().name()
<< " of field " << this->internalField().name()
<< abort(FatalError);
@ -62,7 +62,7 @@ Foam::genericFvsPatchField<Type>::genericFvsPatchField
const word& patchName = this->patch().name();
const IOobject& io = this->internalField();
if (!dict.found("value"))
if (!dict.findEntry("value", keyType::LITERAL))
{
reportMissingEntry("value", patchName, io);
}
@ -148,7 +148,7 @@ Foam::genericFvsPatchField<Type>::valueInternalCoeffs
) const
{
FatalErrorInFunction
<< "Cannot be called for a genericFvsPatchField";
<< "Cannot be called for a generic patchField";
genericFatalSolveError
(
@ -169,7 +169,7 @@ Foam::genericFvsPatchField<Type>::valueBoundaryCoeffs
) const
{
FatalErrorInFunction
<< "Cannot be called for a genericFvsPatchField";
<< "Cannot be called for a generic patchField";
genericFatalSolveError
(
@ -187,7 +187,7 @@ Foam::tmp<Foam::Field<Type>>
Foam::genericFvsPatchField<Type>::gradientInternalCoeffs() const
{
FatalErrorInFunction
<< "Cannot be called for a genericFvsPatchField";
<< "Cannot be called for a generic patchField";
genericFatalSolveError
(
@ -204,7 +204,7 @@ Foam::tmp<Foam::Field<Type>>
Foam::genericFvsPatchField<Type>::gradientBoundaryCoeffs() const
{
FatalErrorInFunction
<< "Cannot be called for a genericFvsPatchField";
<< "Cannot be called for a generic patchField";
genericFatalSolveError
(

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -30,17 +30,11 @@ License
#include "fvsPatchFields.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makeFvsPatchFields(generic);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
makeFvsPatchFields(generic);
}
// ************************************************************************* //

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -25,8 +25,8 @@ License
\*---------------------------------------------------------------------------*/
#ifndef genericFvsPatchFields_H
#define genericFvsPatchFields_H
#ifndef Foam_genericFvsPatchFields_H
#define Foam_genericFvsPatchFields_H
#include "genericFvsPatchField.H"
#include "fieldTypes.H"
@ -40,6 +40,7 @@ namespace Foam
makeFvsPatchTypeFieldTypedefs(generic);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -41,7 +41,7 @@ Foam::genericPointPatchField<Type>::genericPointPatchField
parent_bctype(p, iF)
{
FatalErrorInFunction
<< "Trying to construct genericPointPatchField on patch "
<< "Trying to construct generic patchField on patch "
<< this->patch().name()
<< " of field " << this->internalField().name() << nl
<< abort(FatalError);

View File

@ -36,8 +36,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef genericPointPatchField_H
#define genericPointPatchField_H
#ifndef Foam_genericPointPatchField_H
#define Foam_genericPointPatchField_H
#include "calculatedPointPatchField.H"
#include "genericPatchFieldBase.H"

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -29,17 +30,11 @@ License
#include "pointPatchFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePointPatchFields(generic);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
makePointPatchFields(generic);
}
// ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -25,8 +26,8 @@ License
\*---------------------------------------------------------------------------*/
#ifndef genericPointPatchFields_H
#define genericPointPatchFields_H
#ifndef Foam_genericPointPatchFields_H
#define Foam_genericPointPatchFields_H
#include "genericPointPatchField.H"
#include "fieldTypes.H"