diff --git a/src/genericPatchFields/Make/files b/src/genericPatchFields/Make/files index 17ebcb95fa..031ed5e4b7 100644 --- a/src/genericPatchFields/Make/files +++ b/src/genericPatchFields/Make/files @@ -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 diff --git a/src/genericPatchFields/genericPatchFieldBase/genericPatchFieldBase.C b/src/genericPatchFields/common/genericPatchFieldBase.C similarity index 62% rename from src/genericPatchFields/genericPatchFieldBase/genericPatchFieldBase.C rename to src/genericPatchFields/common/genericPatchFieldBase.C index b5bd0c839e..e37cc4af16 100644 --- a/src/genericPatchFields/genericPatchFieldBase/genericPatchFieldBase.C +++ b/src/genericPatchFields/common/genericPatchFieldBase.C @@ -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::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>::typeName - ) - { - auto fPtr = autoPtr::New(); - fPtr->transfer - ( - dynamicCast>> - ( - 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>::typeName \ + ) \ + { \ + auto fPtr = autoPtr>::New(); \ + \ + fPtr->transfer \ + ( \ + dynamicCast>> \ + ( \ + 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>::typeName - ) - { - auto fPtr = autoPtr::New(); - fPtr->transfer - ( - dynamicCast>> - ( - 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>::typeName - ) - { - auto fPtr = autoPtr::New(); - - fPtr->transfer - ( - dynamicCast>> - ( - tok.transferCompoundToken(is) - ) - ); - - if (!FIELDSIZE_CHECK(fPtr->size())) - { - return false; - } - - sphTensorFields_.insert(key, fPtr); - } - else if - ( - tok.compoundToken().type() - == token::Compound>::typeName - ) - { - auto fPtr = autoPtr::New(); - - fPtr->transfer - ( - dynamicCast>> - ( - tok.transferCompoundToken(is) - ) - ); - - if (!FIELDSIZE_CHECK(fPtr->size())) - { - return false; - } - - symmTensorFields_.insert(key, fPtr); - } - else if - ( - tok.compoundToken().type() - == token::Compound>::typeName - ) - { - auto fPtr = autoPtr::New(); - - fPtr->transfer - ( - dynamicCast>> - ( - 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 } diff --git a/src/genericPatchFields/genericPatchFieldBase/genericPatchFieldBase.H b/src/genericPatchFields/common/genericPatchFieldBase.H similarity index 94% rename from src/genericPatchFields/genericPatchFieldBase/genericPatchFieldBase.H rename to src/genericPatchFields/common/genericPatchFieldBase.H index f22346c7de..91e4e96b59 100644 --- a/src/genericPatchFields/genericPatchFieldBase/genericPatchFieldBase.H +++ b/src/genericPatchFields/common/genericPatchFieldBase.H @@ -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 scalarFields_; + HashPtrTable vectorFields_; + HashPtrTable sphTensorFields_; + HashPtrTable symmTensorFields_; + HashPtrTable 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 scalarFields_; - HashPtrTable vectorFields_; - HashPtrTable sphTensorFields_; - HashPtrTable symmTensorFields_; - HashPtrTable tensorFields_; - - // Protected Member Functions //- Add error message to FatalError about solving with diff --git a/src/genericPatchFields/genericPatchFieldBase/genericPatchFieldBaseTemplates.C b/src/genericPatchFields/common/genericPatchFieldBaseTemplates.C similarity index 51% rename from src/genericPatchFields/genericPatchFieldBase/genericPatchFieldBaseTemplates.C rename to src/genericPatchFields/common/genericPatchFieldBaseTemplates.C index 9b1041ab45..86e44e7de3 100644 --- a/src/genericPatchFields/genericPatchFieldBase/genericPatchFieldBaseTemplates.C +++ b/src/genericPatchFields/common/genericPatchFieldBaseTemplates.C @@ -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::New(*iter(), mapper) - ); + #undef doLocalCode + #define doLocalCode(ValueType, Member) \ + forAllIters(rhs.Member, iter) \ + { \ + this->Member.insert \ + ( \ + iter.key(), \ + autoPtr>::New(*iter.val(), mapper) \ + ); \ } - forAllConstIters(rhs.vectorFields_, iter) - { - vectorFields_.insert - ( - iter.key(), - autoPtr::New(*iter(), mapper) - ); - } - - forAllConstIters(rhs.sphTensorFields_, iter) - { - sphTensorFields_.insert - ( - iter.key(), - autoPtr::New(*iter(), mapper) - ); - } - - forAllConstIters(rhs.symmTensorFields_, iter) - { - symmTensorFields_.insert - ( - iter.key(), - autoPtr::New(*iter(), mapper) - ); - } - - forAllConstIters(rhs.tensorFields_, iter) - { - tensorFields_.insert - ( - iter.key(), - autoPtr::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 } diff --git a/src/genericPatchFields/genericFaPatchField/genericFaPatchField.C b/src/genericPatchFields/genericFaPatchField/genericFaPatchField.C index 88bc831f56..e60212bf5d 100644 --- a/src/genericPatchFields/genericFaPatchField/genericFaPatchField.C +++ b/src/genericPatchFields/genericFaPatchField/genericFaPatchField.C @@ -41,7 +41,7 @@ Foam::genericFaPatchField::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::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::valueInternalCoeffs ) const { FatalErrorInFunction - << "Cannot be called for a genericFaPatchField"; + << "Cannot be called for a generic patchField"; genericFatalSolveError ( @@ -169,7 +169,7 @@ Foam::genericFaPatchField::valueBoundaryCoeffs ) const { FatalErrorInFunction - << "Cannot be called for a genericFaPatchField"; + << "Cannot be called for a generic patchField"; genericFatalSolveError ( @@ -187,7 +187,7 @@ Foam::tmp> Foam::genericFaPatchField::gradientInternalCoeffs() const { FatalErrorInFunction - << "Cannot be called for a genericFaPatchField"; + << "Cannot be called for a generic patchField"; genericFatalSolveError ( @@ -205,7 +205,7 @@ Foam::tmp> Foam::genericFaPatchField::gradientBoundaryCoeffs() const { FatalErrorInFunction - << "Cannot be called for a genericFaPatchField"; + << "Cannot be called for a generic patchField"; genericFatalSolveError ( diff --git a/src/genericPatchFields/genericFaPatchField/genericFaPatchFields.C b/src/genericPatchFields/genericFaPatchField/genericFaPatchFields.C index fd92f4be98..d1c16d1590 100644 --- a/src/genericPatchFields/genericFaPatchField/genericFaPatchFields.C +++ b/src/genericPatchFields/genericFaPatchField/genericFaPatchFields.C @@ -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); +} // ************************************************************************* // diff --git a/src/genericPatchFields/genericFaPatchField/genericFaPatchFields.H b/src/genericPatchFields/genericFaPatchField/genericFaPatchFields.H index 06ac62d2a5..0e57579fe8 100644 --- a/src/genericPatchFields/genericFaPatchField/genericFaPatchFields.H +++ b/src/genericPatchFields/genericFaPatchField/genericFaPatchFields.H @@ -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" diff --git a/src/genericPatchFields/genericFaePatchField/genericFaePatchField.C b/src/genericPatchFields/genericFaePatchField/genericFaePatchField.C new file mode 100644 index 0000000000..3bc19c68e8 --- /dev/null +++ b/src/genericPatchFields/genericFaePatchField/genericFaePatchField.C @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#include "genericFaePatchField.H" +#include "faPatchFieldMapper.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::genericFaePatchField::genericFaePatchField +( + const faPatch& p, + const DimensionedField& iF +) +: + parent_bctype(p, iF) +{ + FatalErrorInFunction + << "Trying to construct generic patchField on patch " + << this->patch().name() + << " of field " << this->internalField().name() + << abort(FatalError); +} + + +template +Foam::genericFaePatchField::genericFaePatchField +( + const faPatch& p, + const DimensionedField& 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 +Foam::genericFaePatchField::genericFaePatchField +( + const genericFaePatchField& rhs, + const faPatch& p, + const DimensionedField& iF, + const faPatchFieldMapper& mapper +) +: + parent_bctype(rhs, p, iF, mapper), + genericPatchFieldBase(zero{}, rhs) +{ + this->mapGeneric(rhs, mapper); +} + + +template +Foam::genericFaePatchField::genericFaePatchField +( + const genericFaePatchField& rhs, + const DimensionedField& iF +) +: + parent_bctype(rhs, iF), + genericPatchFieldBase(rhs) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::genericFaePatchField::write(Ostream& os) const +{ + // Handle "value" separately + genericPatchFieldBase::writeGeneric(os, true); + faePatchField::writeValueEntry(os); +} + + +template +void Foam::genericFaePatchField::autoMap +( + const faPatchFieldMapper& m +) +{ + parent_bctype::autoMap(m); + this->autoMapGeneric(m); +} + + +template +void Foam::genericFaePatchField::rmap +( + const faePatchField& rhs, + const labelList& addr +) +{ + parent_bctype::rmap(rhs, addr); + + const auto* base = isA(rhs); + if (base) + { + this->rmapGeneric(*base, addr); + } +} + + +// ************************************************************************* // diff --git a/src/genericPatchFields/genericFaePatchField/genericFaePatchField.H b/src/genericPatchFields/genericFaePatchField/genericFaePatchField.H new file mode 100644 index 0000000000..48c6cc59ce --- /dev/null +++ b/src/genericPatchFields/genericFaePatchField/genericFaePatchField.H @@ -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 . + +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 genericFaePatchField +: + public calculatedFaePatchField, + public genericPatchFieldBase +{ + //- The parent boundary condition type + typedef calculatedFaePatchField parent_bctype; + + +public: + + //- Runtime type information + TypeName("generic"); + + + // Constructors + + //- Construct from patch and internal field + genericFaePatchField + ( + const faPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + genericFaePatchField + ( + const faPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given patch field onto a new patch + genericFaePatchField + ( + const genericFaePatchField&, + const faPatch&, + const DimensionedField&, + const faPatchFieldMapper& + ); + + //- Default copy construct + genericFaePatchField(const genericFaePatchField&) = default; + + //- Construct and return a clone + virtual tmp> clone() const + { + return tmp> + ( + new genericFaePatchField(*this) + ); + } + + //- Construct as copy setting internal field reference + genericFaePatchField + ( + const genericFaePatchField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp> clone + ( + const DimensionedField& iF + ) const + { + return tmp> + ( + new genericFaePatchField(*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&, + const labelList& + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "genericFaePatchField.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/genericPatchFields/genericFaePatchField/genericFaePatchFields.C b/src/genericPatchFields/genericFaePatchField/genericFaePatchFields.C new file mode 100644 index 0000000000..66f5fbc9b1 --- /dev/null +++ b/src/genericPatchFields/genericFaePatchField/genericFaePatchFields.C @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#include "genericFaePatchFields.H" +#include "addToRunTimeSelectionTable.H" +#include "edgeFields.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + makeFaePatchFields(generic); +} + +// ************************************************************************* // diff --git a/src/genericPatchFields/genericFaePatchField/genericFaePatchFields.H b/src/genericPatchFields/genericFaePatchField/genericFaePatchFields.H new file mode 100644 index 0000000000..8f7d32bf23 --- /dev/null +++ b/src/genericPatchFields/genericFaePatchField/genericFaePatchFields.H @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#ifndef Foam_genericFaePatchFields_H +#define Foam_genericFaePatchFields_H + +#include "genericFaePatchField.H" +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makeFaePatchTypeFieldTypedefs(generic); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/genericPatchFields/genericFvPatchField/genericFvPatchField.C b/src/genericPatchFields/genericFvPatchField/genericFvPatchField.C index 122e534d31..33e9f8dc66 100644 --- a/src/genericPatchFields/genericFvPatchField/genericFvPatchField.C +++ b/src/genericPatchFields/genericFvPatchField/genericFvPatchField.C @@ -41,7 +41,7 @@ Foam::genericFvPatchField::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::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::valueInternalCoeffs ) const { FatalErrorInFunction - << "Cannot be called for a genericFvPatchField"; + << "Cannot be called for a generic patchField"; genericFatalSolveError ( @@ -169,7 +169,7 @@ Foam::genericFvPatchField::valueBoundaryCoeffs ) const { FatalErrorInFunction - << "Cannot be called for a genericFvPatchField"; + << "Cannot be called for a generic patchField"; genericFatalSolveError ( @@ -187,7 +187,7 @@ Foam::tmp> Foam::genericFvPatchField::gradientInternalCoeffs() const { FatalErrorInFunction - << "Cannot be called for a genericFvPatchField"; + << "Cannot be called for a generic patchField"; genericFatalSolveError ( @@ -204,7 +204,7 @@ Foam::tmp> Foam::genericFvPatchField::gradientBoundaryCoeffs() const { FatalErrorInFunction - << "Cannot be called for a genericFvPatchField"; + << "Cannot be called for a generic patchField"; genericFatalSolveError ( diff --git a/src/genericPatchFields/genericFvPatchField/genericFvPatchFields.C b/src/genericPatchFields/genericFvPatchField/genericFvPatchFields.C index 9bce301420..de4b0ba85b 100644 --- a/src/genericPatchFields/genericFvPatchField/genericFvPatchFields.C +++ b/src/genericPatchFields/genericFvPatchField/genericFvPatchFields.C @@ -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); +} // ************************************************************************* // diff --git a/src/genericPatchFields/genericFvPatchField/genericFvPatchFields.H b/src/genericPatchFields/genericFvPatchField/genericFvPatchFields.H index 24cce8a482..e3734a11bd 100644 --- a/src/genericPatchFields/genericFvPatchField/genericFvPatchFields.H +++ b/src/genericPatchFields/genericFvPatchField/genericFvPatchFields.H @@ -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" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/genericPatchFields/genericFvsPatchField/genericFvsPatchField.C b/src/genericPatchFields/genericFvsPatchField/genericFvsPatchField.C index fbf1504573..eeefc2ea6d 100644 --- a/src/genericPatchFields/genericFvsPatchField/genericFvsPatchField.C +++ b/src/genericPatchFields/genericFvsPatchField/genericFvsPatchField.C @@ -40,7 +40,7 @@ Foam::genericFvsPatchField::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::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::valueInternalCoeffs ) const { FatalErrorInFunction - << "Cannot be called for a genericFvsPatchField"; + << "Cannot be called for a generic patchField"; genericFatalSolveError ( @@ -169,7 +169,7 @@ Foam::genericFvsPatchField::valueBoundaryCoeffs ) const { FatalErrorInFunction - << "Cannot be called for a genericFvsPatchField"; + << "Cannot be called for a generic patchField"; genericFatalSolveError ( @@ -187,7 +187,7 @@ Foam::tmp> Foam::genericFvsPatchField::gradientInternalCoeffs() const { FatalErrorInFunction - << "Cannot be called for a genericFvsPatchField"; + << "Cannot be called for a generic patchField"; genericFatalSolveError ( @@ -204,7 +204,7 @@ Foam::tmp> Foam::genericFvsPatchField::gradientBoundaryCoeffs() const { FatalErrorInFunction - << "Cannot be called for a genericFvsPatchField"; + << "Cannot be called for a generic patchField"; genericFatalSolveError ( diff --git a/src/genericPatchFields/genericFvsPatchField/genericFvsPatchFields.C b/src/genericPatchFields/genericFvsPatchField/genericFvsPatchFields.C index 97538f2f56..03d59edfe7 100644 --- a/src/genericPatchFields/genericFvsPatchField/genericFvsPatchFields.C +++ b/src/genericPatchFields/genericFvsPatchField/genericFvsPatchFields.C @@ -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); +} // ************************************************************************* // diff --git a/src/genericPatchFields/genericFvsPatchField/genericFvsPatchFields.H b/src/genericPatchFields/genericFvsPatchField/genericFvsPatchFields.H index 74b0a93a79..78f3f3806b 100644 --- a/src/genericPatchFields/genericFvsPatchField/genericFvsPatchFields.H +++ b/src/genericPatchFields/genericFvsPatchField/genericFvsPatchFields.H @@ -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 diff --git a/src/genericPatchFields/genericPointPatchField/genericPointPatchField.C b/src/genericPatchFields/genericPointPatchField/genericPointPatchField.C index 7352d82c5c..5a8aa41099 100644 --- a/src/genericPatchFields/genericPointPatchField/genericPointPatchField.C +++ b/src/genericPatchFields/genericPointPatchField/genericPointPatchField.C @@ -41,7 +41,7 @@ Foam::genericPointPatchField::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); diff --git a/src/genericPatchFields/genericPointPatchField/genericPointPatchField.H b/src/genericPatchFields/genericPointPatchField/genericPointPatchField.H index f772014971..c91f40202f 100644 --- a/src/genericPatchFields/genericPointPatchField/genericPointPatchField.H +++ b/src/genericPatchFields/genericPointPatchField/genericPointPatchField.H @@ -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" diff --git a/src/genericPatchFields/genericPointPatchField/genericPointPatchFields.C b/src/genericPatchFields/genericPointPatchField/genericPointPatchFields.C index 8e5b0f3270..cc054649d7 100644 --- a/src/genericPatchFields/genericPointPatchField/genericPointPatchFields.C +++ b/src/genericPatchFields/genericPointPatchField/genericPointPatchFields.C @@ -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); +} // ************************************************************************* // diff --git a/src/genericPatchFields/genericPointPatchField/genericPointPatchFields.H b/src/genericPatchFields/genericPointPatchField/genericPointPatchFields.H index 3793b4e29d..5cdd68329e 100644 --- a/src/genericPatchFields/genericPointPatchField/genericPointPatchFields.H +++ b/src/genericPatchFields/genericPointPatchField/genericPointPatchFields.H @@ -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"