mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: avoid faPatch/fvPatch patchInternalField ambiguity
- with alternative faceCell addressing, use the three-parameter version only. This avoids potential future ambiguity with the two-parameter version (eg, with a label type) ENH: add faPatchField patchInternalField() for symmetry with fvPatchField ENH: direct reference to mesh thisDb instead of inferring ENH: pointMesh::boundaryMesh() method (eg, similar to fvMesh)
This commit is contained in:
@ -122,7 +122,7 @@ Foam::tmp<Foam::Field<Type1>>
|
||||
Foam::pointPatchField<Type>::patchInternalField
|
||||
(
|
||||
const Field<Type1>& iF,
|
||||
const labelList& meshPoints
|
||||
const labelUList& meshPoints
|
||||
) const
|
||||
{
|
||||
// Check size
|
||||
@ -194,7 +194,7 @@ void Foam::pointPatchField<Type>::addToInternalField
|
||||
(
|
||||
Field<Type1>& iF,
|
||||
const Field<Type1>& pF,
|
||||
const labelList& points
|
||||
const labelUList& points
|
||||
) const
|
||||
{
|
||||
// Check size
|
||||
@ -233,7 +233,7 @@ void Foam::pointPatchField<Type>::setInInternalField
|
||||
(
|
||||
Field<Type1>& iF,
|
||||
const Field<Type1>& pF,
|
||||
const labelList& meshPoints
|
||||
const labelUList& meshPoints
|
||||
) const
|
||||
{
|
||||
// Check size
|
||||
@ -310,8 +310,4 @@ Foam::Ostream& Foam::operator<<
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "pointPatchFieldNew.C"
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -390,24 +390,27 @@ public:
|
||||
return patch().size();
|
||||
}
|
||||
|
||||
//- Return dimensioned internal field reference
|
||||
//- Return const-reference to the dimensioned internal field
|
||||
const DimensionedField<Type, pointMesh>& internalField()
|
||||
const noexcept
|
||||
{
|
||||
return internalField_;
|
||||
}
|
||||
|
||||
//- Return internal field reference
|
||||
//- Return const-reference to the internal field values
|
||||
const Field<Type>& primitiveField() const noexcept
|
||||
{
|
||||
return internalField_;
|
||||
}
|
||||
|
||||
|
||||
// Evaluation Functions
|
||||
|
||||
//- Return field created from appropriate internal field values
|
||||
tmp<Field<Type>> patchInternalField() const;
|
||||
|
||||
//- Return field created from appropriate internal field values
|
||||
// given internal field reference
|
||||
//- given internal field reference
|
||||
template<class Type1>
|
||||
tmp<Field<Type1>> patchInternalField
|
||||
(
|
||||
@ -415,16 +418,16 @@ public:
|
||||
) const;
|
||||
|
||||
//- Return field created from selected internal field values
|
||||
// given internal field reference
|
||||
//- given internal field reference
|
||||
template<class Type1>
|
||||
tmp<Field<Type1>> patchInternalField
|
||||
(
|
||||
const Field<Type1>& iF,
|
||||
const labelList& meshPoints
|
||||
const labelUList& meshPoints
|
||||
) const;
|
||||
|
||||
//- Given the internal field and a patch field,
|
||||
// add the patch field to the internal field
|
||||
//- add the patch field to the internal field
|
||||
template<class Type1>
|
||||
void addToInternalField
|
||||
(
|
||||
@ -433,27 +436,27 @@ public:
|
||||
) const;
|
||||
|
||||
//- Given the internal field and a patch field,
|
||||
// add selected elements of the patch field to the internal field
|
||||
//- add selected elements of the patch field to the internal field
|
||||
template<class Type1>
|
||||
void addToInternalField
|
||||
(
|
||||
Field<Type1>& iF,
|
||||
const Field<Type1>& pF,
|
||||
const labelList& points
|
||||
const labelUList& points
|
||||
) const;
|
||||
|
||||
//- Given the internal field and a patch field,
|
||||
// set the patch field in the internal field
|
||||
//- set the patch field in the internal field
|
||||
template<class Type1>
|
||||
void setInInternalField
|
||||
(
|
||||
Field<Type1>& iF,
|
||||
const Field<Type1>& pF,
|
||||
const labelList& meshPoints
|
||||
const labelUList& meshPoints
|
||||
) const;
|
||||
|
||||
//- Given the internal field and a patch field,
|
||||
// set the patch field in the internal field
|
||||
//- set the patch field in the internal field
|
||||
template<class Type1>
|
||||
void setInInternalField
|
||||
(
|
||||
@ -581,6 +584,7 @@ const pointPatchField<Type>& operator+
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "pointPatchField.C"
|
||||
#include "pointPatchFieldNew.C"
|
||||
#include "calculatedPointPatchField.H"
|
||||
#include "zeroGradientPointPatchField.H"
|
||||
#endif
|
||||
|
||||
@ -105,7 +105,7 @@ void Foam::pointPatchFieldBase::readDict(const dictionary& dict)
|
||||
|
||||
const Foam::objectRegistry& Foam::pointPatchFieldBase::db() const
|
||||
{
|
||||
return patch_.boundaryMesh().mesh()();
|
||||
return patch_.boundaryMesh().mesh().thisDb();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -67,7 +67,7 @@ Foam::labelList Foam::pointBoundaryMesh::indices
|
||||
const bool useGroups
|
||||
) const
|
||||
{
|
||||
return mesh()().boundaryMesh().indices(matcher, useGroups);
|
||||
return mesh().boundaryMesh().indices(matcher, useGroups);
|
||||
}
|
||||
|
||||
|
||||
@ -77,13 +77,13 @@ Foam::labelList Foam::pointBoundaryMesh::indices
|
||||
const bool useGroups
|
||||
) const
|
||||
{
|
||||
return mesh()().boundaryMesh().indices(matcher, useGroups);
|
||||
return mesh().boundaryMesh().indices(matcher, useGroups);
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::pointBoundaryMesh::findPatchID(const word& patchName) const
|
||||
{
|
||||
return mesh()().boundaryMesh().findPatchID(patchName);
|
||||
return mesh().boundaryMesh().findPatchID(patchName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -112,7 +112,7 @@ public:
|
||||
}
|
||||
|
||||
//- Return reference to boundary mesh
|
||||
const pointBoundaryMesh& boundary() const
|
||||
const pointBoundaryMesh& boundary() const noexcept
|
||||
{
|
||||
return boundary_;
|
||||
}
|
||||
@ -136,7 +136,16 @@ public:
|
||||
}
|
||||
|
||||
|
||||
// Mesh motion
|
||||
// Volume Mesh
|
||||
|
||||
//- Return boundary mesh for underlying volume mesh
|
||||
const polyBoundaryMesh& boundaryMesh() const
|
||||
{
|
||||
return GeoMesh<polyMesh>::mesh_.boundaryMesh();
|
||||
}
|
||||
|
||||
|
||||
// Mesh Motion
|
||||
|
||||
//- Move points
|
||||
bool movePoints();
|
||||
|
||||
@ -321,7 +321,9 @@ Foam::tmp<Foam::labelField> Foam::cyclicFaPatch::interfaceInternalField
|
||||
const labelUList& edgeFaces
|
||||
) const
|
||||
{
|
||||
return patchInternalField(internalData, edgeFaces);
|
||||
auto tpfld = tmp<labelField>::New();
|
||||
patchInternalField(internalData, edgeFaces, tpfld.ref());
|
||||
return tpfld;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -492,7 +492,9 @@ Foam::tmp<Foam::labelField> Foam::processorFaPatch::interfaceInternalField
|
||||
const labelUList& edgeFaces
|
||||
) const
|
||||
{
|
||||
return patchInternalField(internalData, edgeFaces);
|
||||
auto tpfld = tmp<labelField>::New();
|
||||
patchInternalField(internalData, edgeFaces, tpfld.ref());
|
||||
return tpfld;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 Wikki Ltd
|
||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -421,32 +421,42 @@ public:
|
||||
|
||||
// Evaluation
|
||||
|
||||
//- Extract internal field next to patch using edgeFaces mapping
|
||||
//- Extract internal field next to patch using specified addressing
|
||||
// \param internalData The internal field to extract from
|
||||
// \param addressing Addressing from patch into internal field
|
||||
// \param [out] pfld The extracted patch field.
|
||||
// It is always resized according to the patch size(),
|
||||
// which can be smaller than the addressing size
|
||||
template<class Type>
|
||||
inline void patchInternalField
|
||||
(
|
||||
const UList<Type>& f,
|
||||
const labelUList& edgeFaces,
|
||||
const UList<Type>& internalData,
|
||||
const labelUList& addressing,
|
||||
Field<Type>& pfld
|
||||
) const;
|
||||
|
||||
//- Extract internal field next to patch as patch field
|
||||
//- using edgeFaces() mapping.
|
||||
// \param internalData The internal field to extract from
|
||||
// \param [out] pfld The extracted patch field.
|
||||
// It is always resized according to the patch size(),
|
||||
// which can be smaller than the edgeFaces() size
|
||||
template<class Type>
|
||||
void patchInternalField
|
||||
(
|
||||
const UList<Type>& internalData,
|
||||
Field<Type>& pfld
|
||||
) const;
|
||||
|
||||
//- Return given internal field next to patch as patch field
|
||||
//- using edgeFaces() mapping.
|
||||
// \param internalData The internal field to extract from
|
||||
template<class Type>
|
||||
tmp<Field<Type>> patchInternalField(const UList<Type>&) const;
|
||||
|
||||
//- Return given internal field next to patch as patch field
|
||||
//- using provided addressing
|
||||
template<class Type>
|
||||
tmp<Foam::Field<Type>> patchInternalField
|
||||
tmp<Field<Type>> patchInternalField
|
||||
(
|
||||
const UList<Type>& f,
|
||||
const labelUList& edgeFaces
|
||||
const UList<Type>& internalData
|
||||
) const;
|
||||
|
||||
//- Extract internal field next to patch as patch field
|
||||
template<class Type>
|
||||
void patchInternalField(const UList<Type>&, Field<Type>&) const;
|
||||
|
||||
//- Return the patch field of the GeometricField
|
||||
//- corresponding to this patch.
|
||||
template<class GeometricField, class AnyType = bool>
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 Wikki Ltd
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -33,53 +33,42 @@ License
|
||||
template<class Type>
|
||||
void Foam::faPatch::patchInternalField
|
||||
(
|
||||
const UList<Type>& f,
|
||||
const labelUList& edgeFaces,
|
||||
const UList<Type>& internalData,
|
||||
const labelUList& addressing,
|
||||
Field<Type>& pfld
|
||||
) const
|
||||
{
|
||||
pfld.resize(size());
|
||||
const label len = this->size();
|
||||
|
||||
forAll(pfld, i)
|
||||
pfld.resize_nocopy(len);
|
||||
|
||||
for (label i = 0; i < len; ++i)
|
||||
{
|
||||
pfld[i] = f[edgeFaces[i]];
|
||||
pfld[i] = internalData[addressing[i]];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>> Foam::faPatch::patchInternalField
|
||||
(
|
||||
const UList<Type>& f
|
||||
) const
|
||||
{
|
||||
auto tpfld = tmp<Field<Type>>::New(size());
|
||||
patchInternalField(f, this->edgeFaces(), tpfld.ref());
|
||||
return tpfld;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>> Foam::faPatch::patchInternalField
|
||||
(
|
||||
const UList<Type>& f,
|
||||
const labelUList& edgeFaces
|
||||
) const
|
||||
{
|
||||
auto tpfld = tmp<Field<Type>>::New(size());
|
||||
patchInternalField(f, edgeFaces, tpfld.ref());
|
||||
return tpfld;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::faPatch::patchInternalField
|
||||
(
|
||||
const UList<Type>& f,
|
||||
const UList<Type>& internalData,
|
||||
Field<Type>& pfld
|
||||
) const
|
||||
{
|
||||
patchInternalField(f, this->edgeFaces(), pfld);
|
||||
patchInternalField(internalData, this->edgeFaces(), pfld);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>> Foam::faPatch::patchInternalField
|
||||
(
|
||||
const UList<Type>& internalData
|
||||
) const
|
||||
{
|
||||
auto tpfld = tmp<Field<Type>>::New();
|
||||
patchInternalField(internalData, this->edgeFaces(), tpfld.ref());
|
||||
return tpfld;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -133,8 +133,7 @@ tmp<Field<Type> > clampedPlateFaPatchField<Type>::valueInternalCoeffs
|
||||
const tmp<scalarField>&
|
||||
) const
|
||||
{
|
||||
return tmp<Field<Type>>
|
||||
(new Field<Type>(this->size(), pTraits<Type>::zero));
|
||||
return tmp<Field<Type>>::New(this->size(), Zero);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -128,14 +128,6 @@ Foam::faPatchField<Type>::faPatchField
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
const Foam::objectRegistry& Foam::faPatchField<Type>::db() const
|
||||
{
|
||||
// Note: Lookup fields from the field DB rather than the mesh
|
||||
return internalField_.db();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::faPatchField<Type>::check(const faPatchField<Type>& rhs) const
|
||||
{
|
||||
@ -158,6 +150,13 @@ Foam::faPatchField<Type>::patchInternalField() const
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::faPatchField<Type>::patchInternalField(Field<Type>& pfld) const
|
||||
{
|
||||
patch().patchInternalField(internalField_, pfld);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::faPatchField<Type>::autoMap(const faPatchFieldMapper& m)
|
||||
{
|
||||
@ -407,8 +406,4 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const faPatchField<Type>& ptf)
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "faPatchFieldNew.C"
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -143,7 +143,7 @@ public:
|
||||
// Access
|
||||
|
||||
//- The associated objectRegistry
|
||||
/// const objectRegistry& db() const;
|
||||
const objectRegistry& db() const;
|
||||
|
||||
//- Return the patch
|
||||
const faPatch& patch() const noexcept
|
||||
@ -394,17 +394,14 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
//- Return local objectRegistry
|
||||
const objectRegistry& db() const;
|
||||
|
||||
//- Return dimensioned internal field reference
|
||||
const DimensionedField<Type, areaMesh>&
|
||||
internalField() const noexcept
|
||||
//- Return const-reference to the dimensioned internal field
|
||||
const DimensionedField<Type, areaMesh>& internalField()
|
||||
const noexcept
|
||||
{
|
||||
return internalField_;
|
||||
}
|
||||
|
||||
//- Return internal field reference
|
||||
//- Return const-reference to the internal field values
|
||||
const Field<Type>& primitiveField() const noexcept
|
||||
{
|
||||
return internalField_;
|
||||
@ -432,9 +429,13 @@ public:
|
||||
//- Return patch-normal gradient
|
||||
virtual tmp<Field<Type>> snGrad() const;
|
||||
|
||||
//- Return internal field next to patch as patch field
|
||||
//- Return internal field next to patch
|
||||
virtual tmp<Field<Type>> patchInternalField() const;
|
||||
|
||||
//- Extract internal field next to patch
|
||||
// \param [out] pfld The extracted patch field.
|
||||
virtual void patchInternalField(Field<Type>& pfld) const;
|
||||
|
||||
//- Return patchField on the opposite patch of a coupled patch
|
||||
virtual tmp<Field<Type>> patchNeighbourField() const
|
||||
{
|
||||
@ -556,6 +557,7 @@ public:
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "faPatchField.C"
|
||||
#include "faPatchFieldNew.C"
|
||||
#include "calculatedFaPatchField.H"
|
||||
#include "zeroGradientFaPatchField.H"
|
||||
#endif
|
||||
|
||||
@ -26,6 +26,8 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "faPatchField.H"
|
||||
#include "faBoundaryMesh.H"
|
||||
#include "faMesh.H"
|
||||
#include "dictionary.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -103,10 +105,10 @@ void Foam::faPatchFieldBase::readDict(const dictionary& dict)
|
||||
}
|
||||
|
||||
|
||||
// const Foam::objectRegistry& Foam::faPatchFieldBase::db() const
|
||||
// {
|
||||
// return patch_.boundaryMesh().mesh().thisDb();
|
||||
// }
|
||||
const Foam::objectRegistry& Foam::faPatchFieldBase::db() const
|
||||
{
|
||||
return patch_.boundaryMesh().mesh().thisDb();
|
||||
}
|
||||
|
||||
|
||||
void Foam::faPatchFieldBase::checkPatch(const faPatchFieldBase& rhs) const
|
||||
|
||||
@ -125,14 +125,6 @@ Foam::faePatchField<Type>::faePatchField
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
const Foam::objectRegistry& Foam::faePatchField<Type>::db() const
|
||||
{
|
||||
// Note: Lookup fields from the field DB rather than the mesh
|
||||
return internalField_.db();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::faePatchField<Type>::check(const faePatchField<Type>& rhs) const
|
||||
{
|
||||
@ -373,8 +365,4 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const faePatchField<Type>& ptf)
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "faePatchFieldNew.C"
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -128,7 +128,7 @@ public:
|
||||
// Access
|
||||
|
||||
//- The associated objectRegistry
|
||||
/// const objectRegistry& db() const;
|
||||
const objectRegistry& db() const;
|
||||
|
||||
//- Return the patch
|
||||
const faPatch& patch() const noexcept
|
||||
@ -358,17 +358,14 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
//- Return local objectRegistry
|
||||
const objectRegistry& db() const;
|
||||
|
||||
//- Return dimensioned internal field reference
|
||||
//- Return const-reference to the dimensioned internal field
|
||||
const DimensionedField<Type, edgeMesh>& internalField()
|
||||
const noexcept
|
||||
{
|
||||
return internalField_;
|
||||
}
|
||||
|
||||
//- Return internal field reference
|
||||
//- Return const-reference to the internal field values
|
||||
const Field<Type>& primitiveField() const noexcept
|
||||
{
|
||||
return internalField_;
|
||||
@ -445,6 +442,7 @@ public:
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "faePatchField.C"
|
||||
#include "faePatchFieldNew.C"
|
||||
#include "calculatedFaePatchField.H"
|
||||
#endif
|
||||
|
||||
|
||||
@ -26,6 +26,8 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "faePatchField.H"
|
||||
#include "faBoundaryMesh.H"
|
||||
#include "faMesh.H"
|
||||
#include "dictionary.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -93,10 +95,10 @@ void Foam::faePatchFieldBase::readDict(const dictionary& dict)
|
||||
{}
|
||||
|
||||
|
||||
// const Foam::objectRegistry& Foam::faePatchFieldBase::db() const
|
||||
// {
|
||||
// return patch_.boundaryMesh().mesh().thisDb();
|
||||
// }
|
||||
const Foam::objectRegistry& Foam::faePatchFieldBase::db() const
|
||||
{
|
||||
return patch_.boundaryMesh().mesh().thisDb();
|
||||
}
|
||||
|
||||
|
||||
void Foam::faePatchFieldBase::checkPatch(const faePatchFieldBase& rhs) const
|
||||
|
||||
@ -193,9 +193,9 @@ Foam::fvPatchField<Type>::patchInternalField() const
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::fvPatchField<Type>::patchInternalField(Field<Type>& pif) const
|
||||
void Foam::fvPatchField<Type>::patchInternalField(Field<Type>& pfld) const
|
||||
{
|
||||
patch().patchInternalField(internalField_, pif);
|
||||
patch().patchInternalField(internalField_, pfld);
|
||||
}
|
||||
|
||||
|
||||
@ -552,8 +552,4 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const fvPatchField<Type>& ptf)
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "fvPatchFieldNew.C"
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -461,14 +461,14 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
//- Return dimensioned internal field reference
|
||||
//- Return const-reference to the dimensioned internal field
|
||||
const DimensionedField<Type, volMesh>& internalField()
|
||||
const noexcept
|
||||
{
|
||||
return internalField_;
|
||||
}
|
||||
|
||||
//- Return internal field reference
|
||||
//- Return const-reference to the internal field values
|
||||
const Field<Type>& primitiveField() const noexcept
|
||||
{
|
||||
return internalField_;
|
||||
@ -517,11 +517,12 @@ public:
|
||||
// patches. Sets Updated to true
|
||||
virtual void updateWeightedCoeffs(const scalarField& weights);
|
||||
|
||||
//- Return internal field next to patch as patch field
|
||||
//- Return internal field next to patch
|
||||
virtual tmp<Field<Type>> patchInternalField() const;
|
||||
|
||||
//- Return internal field next to patch as patch field
|
||||
virtual void patchInternalField(Field<Type>&) const;
|
||||
//- Extract internal field next to patch
|
||||
// \param [out] pfld The extracted patch field.
|
||||
virtual void patchInternalField(Field<Type>& pfld) const;
|
||||
|
||||
//- Return patchField on the opposite patch of a coupled patch
|
||||
virtual tmp<Field<Type>> patchNeighbourField() const
|
||||
@ -684,6 +685,7 @@ public:
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "fvPatchField.C"
|
||||
#include "fvPatchFieldNew.C"
|
||||
#include "calculatedFvPatchField.H"
|
||||
#include "zeroGradientFvPatchField.H"
|
||||
#endif
|
||||
|
||||
@ -112,7 +112,7 @@ void Foam::fvPatchFieldBase::readDict(const dictionary& dict)
|
||||
|
||||
const Foam::objectRegistry& Foam::fvPatchFieldBase::db() const
|
||||
{
|
||||
return patch_.boundaryMesh().mesh();
|
||||
return patch_.boundaryMesh().mesh().thisDb();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -365,8 +365,4 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const fvsPatchField<Type>& ptf)
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "fvsPatchFieldNew.C"
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -357,14 +357,14 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
//- Return dimensioned internal field reference
|
||||
//- Return const-reference to the dimensioned internal field
|
||||
const DimensionedField<Type, surfaceMesh>& internalField()
|
||||
const noexcept
|
||||
{
|
||||
return internalField_;
|
||||
}
|
||||
|
||||
//- Return internal field reference
|
||||
//- Return const-reference to the internal field values
|
||||
const Field<Type>& primitiveField() const noexcept
|
||||
{
|
||||
return internalField_;
|
||||
@ -441,6 +441,7 @@ public:
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "fvsPatchField.C"
|
||||
#include "fvsPatchFieldNew.C"
|
||||
#include "calculatedFvsPatchField.H"
|
||||
#endif
|
||||
|
||||
|
||||
@ -83,7 +83,7 @@ void Foam::fvsPatchFieldBase::readDict(const dictionary& dict)
|
||||
|
||||
const Foam::objectRegistry& Foam::fvsPatchFieldBase::db() const
|
||||
{
|
||||
return patch_.boundaryMesh().mesh();
|
||||
return patch_.boundaryMesh().mesh().thisDb();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -108,7 +108,9 @@ Foam::tmp<Foam::labelField> Foam::cyclicFvPatch::interfaceInternalField
|
||||
const labelUList& faceCells
|
||||
) const
|
||||
{
|
||||
return patchInternalField(internalData, faceCells);
|
||||
auto tpfld = tmp<labelField>::New();
|
||||
patchInternalField(internalData, faceCells, tpfld.ref());
|
||||
return tpfld;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019,2022 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -295,7 +295,9 @@ Foam::tmp<Foam::labelField> Foam::cyclicACMIFvPatch::interfaceInternalField
|
||||
const labelUList& faceCells
|
||||
) const
|
||||
{
|
||||
return patchInternalField(internalData, faceCells);
|
||||
auto tpfld = tmp<labelField>::New();
|
||||
patchInternalField(internalData, faceCells, tpfld.ref());
|
||||
return tpfld;
|
||||
}
|
||||
|
||||
|
||||
@ -402,4 +404,5 @@ void Foam::cyclicACMIFvPatch::movePoints()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2020,2022 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -228,7 +228,9 @@ Foam::tmp<Foam::labelField> Foam::cyclicAMIFvPatch::interfaceInternalField
|
||||
const labelUList& faceCells
|
||||
) const
|
||||
{
|
||||
return patchInternalField(internalData, faceCells);
|
||||
auto tpfld = tmp<labelField>::New();
|
||||
patchInternalField(internalData, faceCells, tpfld.ref());
|
||||
return tpfld;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -117,7 +117,9 @@ Foam::tmp<Foam::labelField> Foam::processorFvPatch::interfaceInternalField
|
||||
const labelUList& faceCells
|
||||
) const
|
||||
{
|
||||
return patchInternalField(internalData, faceCells);
|
||||
auto tpfld = tmp<labelField>::New();
|
||||
patchInternalField(internalData, faceCells, tpfld.ref());
|
||||
return tpfld;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -33,6 +33,8 @@ Description
|
||||
SourceFiles
|
||||
fvPatch.C
|
||||
fvPatchNew.C
|
||||
fvPatchTemplates.C
|
||||
fvPatchFvMeshTemplates.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -274,32 +276,42 @@ public:
|
||||
|
||||
// Evaluation Functions
|
||||
|
||||
//- Extract internal field next to patch using faceCells mapping
|
||||
//- Extract internal field next to patch using specified addressing
|
||||
// \param internalData The internal field to extract from
|
||||
// \param addressing Addressing from patch into internal field
|
||||
// \param [out] pfld The extracted patch field.
|
||||
// It is always resized according to the patch size(),
|
||||
// which can be smaller than the addressing size
|
||||
template<class Type>
|
||||
inline void patchInternalField
|
||||
(
|
||||
const UList<Type>& f,
|
||||
const labelUList& faceCells,
|
||||
const UList<Type>& internalData,
|
||||
const labelUList& addressing,
|
||||
Field<Type>& pfld
|
||||
) const;
|
||||
|
||||
//- Extract internal field next to patch as patch field
|
||||
//- using faceCells() mapping.
|
||||
// \param internalData The internal field to extract from
|
||||
// \param [out] pfld The extracted patch field.
|
||||
// It is always resized according to the patch size(),
|
||||
// which can be smaller than the faceCells() size
|
||||
template<class Type>
|
||||
void patchInternalField
|
||||
(
|
||||
const UList<Type>& internalData,
|
||||
Field<Type>& pfld
|
||||
) const;
|
||||
|
||||
//- Return given internal field next to patch as patch field
|
||||
template<class Type>
|
||||
tmp<Field<Type>> patchInternalField(const UList<Type>&) const;
|
||||
|
||||
//- Return given internal field next to patch as patch field
|
||||
//- using provided addressing
|
||||
//- using faceCells() mapping.
|
||||
// \param internalData The internal field to extract from
|
||||
template<class Type>
|
||||
tmp<Field<Type>> patchInternalField
|
||||
(
|
||||
const UList<Type>& f,
|
||||
const labelUList& faceCells
|
||||
const UList<Type>& internalData
|
||||
) const;
|
||||
|
||||
//- Return given internal field next to patch as patch field
|
||||
template<class Type>
|
||||
void patchInternalField(const UList<Type>&, Field<Type>&) const;
|
||||
|
||||
//- Return the patch field of the GeometricField
|
||||
//- corresponding to this patch.
|
||||
template<class GeometricField, class AnyType = bool>
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -33,53 +33,42 @@ License
|
||||
template<class Type>
|
||||
void Foam::fvPatch::patchInternalField
|
||||
(
|
||||
const UList<Type>& f,
|
||||
const labelUList& faceCells,
|
||||
const UList<Type>& internalData,
|
||||
const labelUList& addressing,
|
||||
Field<Type>& pfld
|
||||
) const
|
||||
{
|
||||
pfld.resize(size());
|
||||
const label len = this->size();
|
||||
|
||||
forAll(pfld, i)
|
||||
pfld.resize_nocopy(len);
|
||||
|
||||
for (label i = 0; i < len; ++i)
|
||||
{
|
||||
pfld[i] = f[faceCells[i]];
|
||||
pfld[i] = internalData[addressing[i]];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>> Foam::fvPatch::patchInternalField
|
||||
(
|
||||
const UList<Type>& f
|
||||
) const
|
||||
{
|
||||
auto tpfld = tmp<Field<Type>>::New(size());
|
||||
patchInternalField(f, this->faceCells(), tpfld.ref());
|
||||
return tpfld;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>> Foam::fvPatch::patchInternalField
|
||||
(
|
||||
const UList<Type>& f,
|
||||
const labelUList& faceCells
|
||||
) const
|
||||
{
|
||||
auto tpfld = tmp<Field<Type>>::New(size());
|
||||
patchInternalField(f, faceCells, tpfld.ref());
|
||||
return tpfld;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::fvPatch::patchInternalField
|
||||
(
|
||||
const UList<Type>& f,
|
||||
const UList<Type>& internalData,
|
||||
Field<Type>& pfld
|
||||
) const
|
||||
{
|
||||
patchInternalField(f, this->faceCells(), pfld);
|
||||
patchInternalField(internalData, this->faceCells(), pfld);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>> Foam::fvPatch::patchInternalField
|
||||
(
|
||||
const UList<Type>& internalData
|
||||
) const
|
||||
{
|
||||
auto tpfld = tmp<Field<Type>>::New();
|
||||
patchInternalField(internalData, this->faceCells(), tpfld.ref());
|
||||
return tpfld;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -59,7 +59,9 @@ Foam::tmp<Foam::labelField> Foam::oversetFvPatch::interfaceInternalField
|
||||
const labelUList& faceCells
|
||||
) const
|
||||
{
|
||||
return patchInternalField(internalData, faceCells);
|
||||
auto tpfld = tmp<labelField>::New();
|
||||
patchInternalField(internalData, faceCells, tpfld.ref());
|
||||
return tpfld;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user