ENH: use GeometricField type aliases in sampling and expressions

This commit is contained in:
Mark Olesen
2022-02-14 21:21:15 +01:00
parent a67f6bf7ae
commit 2a25b356b9
26 changed files with 311 additions and 433 deletions

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2021 OpenCFD Ltd.
Copyright (C) 2021-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -43,7 +43,7 @@ void Foam::Function1Types::Sample<Type>::setSampleCell() const
{
pointEventNo_ = points.eventNo();
celli_ = this->template mesh<fvMesh>().findCell(position_);
celli_ = mesh.findCell(position_);
if (!returnReduce(celli_ != -1, orOp<bool>()))
{
@ -104,18 +104,17 @@ Foam::Function1Types::Sample<Type>::Sample(const Sample& s)
template<class Type>
Type Foam::Function1Types::Sample<Type>::value(const scalar x) const
{
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
const auto& mesh = this->template mesh<fvMesh>();
const auto* fieldPtr = mesh.template cfindObject<VolFieldType>(fieldName_);
const auto* fieldPtr =
mesh.template cfindObject<VolumeField<Type>>(fieldName_);
if (!fieldPtr)
{
FatalErrorInFunction
<< "Unable to find field " << fieldName_ << " on the mesh database"
<< ". Valid " << VolFieldType::typeName << " fields are:"
<< mesh.names(VolFieldType::typeName)
<< ". Valid " << VolumeField<Type>::typeName << " fields are:"
<< mesh.template sortedNames<VolumeField<Type>>()
<< exit(FatalError);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2017 OpenFOAM Foundation
Copyright (C) 2015-2020 OpenCFD Ltd.
Copyright (C) 2015-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -73,9 +73,9 @@ Foam::meshToMesh::procMapMethodNames_
template<>
void Foam::meshToMesh::mapInternalSrcToTgt
(
const GeometricField<sphericalTensor, fvPatchField, volMesh>& field,
const VolumeField<sphericalTensor>& field,
const plusEqOp<sphericalTensor>& cop,
GeometricField<sphericalTensor, fvPatchField, volMesh>& result,
VolumeField<sphericalTensor>& result,
const bool secondOrder
) const
{
@ -86,9 +86,9 @@ void Foam::meshToMesh::mapInternalSrcToTgt
template<>
void Foam::meshToMesh::mapInternalSrcToTgt
(
const GeometricField<sphericalTensor, fvPatchField, volMesh>& field,
const VolumeField<sphericalTensor>& field,
const minusEqOp<sphericalTensor>& cop,
GeometricField<sphericalTensor, fvPatchField, volMesh>& result,
VolumeField<sphericalTensor>& result,
const bool secondOrder
) const
{
@ -99,9 +99,9 @@ void Foam::meshToMesh::mapInternalSrcToTgt
template<>
void Foam::meshToMesh::mapInternalSrcToTgt
(
const GeometricField<symmTensor, fvPatchField, volMesh>& field,
const VolumeField<symmTensor>& field,
const plusEqOp<symmTensor>& cop,
GeometricField<symmTensor, fvPatchField, volMesh>& result,
VolumeField<symmTensor>& result,
const bool secondOrder
) const
{
@ -112,9 +112,9 @@ void Foam::meshToMesh::mapInternalSrcToTgt
template<>
void Foam::meshToMesh::mapInternalSrcToTgt
(
const GeometricField<symmTensor, fvPatchField, volMesh>& field,
const VolumeField<symmTensor>& field,
const minusEqOp<symmTensor>& cop,
GeometricField<symmTensor, fvPatchField, volMesh>& result,
VolumeField<symmTensor>& result,
const bool secondOrder
) const
{
@ -125,9 +125,9 @@ void Foam::meshToMesh::mapInternalSrcToTgt
template<>
void Foam::meshToMesh::mapInternalSrcToTgt
(
const GeometricField<tensor, fvPatchField, volMesh>& field,
const VolumeField<tensor>& field,
const plusEqOp<tensor>& cop,
GeometricField<tensor, fvPatchField, volMesh>& result,
VolumeField<tensor>& result,
const bool secondOrder
) const
{
@ -138,9 +138,9 @@ void Foam::meshToMesh::mapInternalSrcToTgt
template<>
void Foam::meshToMesh::mapInternalSrcToTgt
(
const GeometricField<tensor, fvPatchField, volMesh>& field,
const VolumeField<tensor>& field,
const minusEqOp<tensor>& cop,
GeometricField<tensor, fvPatchField, volMesh>& result,
VolumeField<tensor>& result,
const bool secondOrder
) const
{
@ -151,9 +151,9 @@ void Foam::meshToMesh::mapInternalSrcToTgt
template<>
void Foam::meshToMesh::mapInternalTgtToSrc
(
const GeometricField<sphericalTensor, fvPatchField, volMesh>& field,
const VolumeField<sphericalTensor>& field,
const plusEqOp<sphericalTensor>& cop,
GeometricField<sphericalTensor, fvPatchField, volMesh>& result,
VolumeField<sphericalTensor>& result,
const bool secondOrder
) const
{
@ -164,9 +164,9 @@ void Foam::meshToMesh::mapInternalTgtToSrc
template<>
void Foam::meshToMesh::mapInternalTgtToSrc
(
const GeometricField<sphericalTensor, fvPatchField, volMesh>& field,
const VolumeField<sphericalTensor>& field,
const minusEqOp<sphericalTensor>& cop,
GeometricField<sphericalTensor, fvPatchField, volMesh>& result,
VolumeField<sphericalTensor>& result,
const bool secondOrder
) const
{
@ -177,9 +177,9 @@ void Foam::meshToMesh::mapInternalTgtToSrc
template<>
void Foam::meshToMesh::mapInternalTgtToSrc
(
const GeometricField<symmTensor, fvPatchField, volMesh>& field,
const VolumeField<symmTensor>& field,
const plusEqOp<symmTensor>& cop,
GeometricField<symmTensor, fvPatchField, volMesh>& result,
VolumeField<symmTensor>& result,
const bool secondOrder
) const
{
@ -190,9 +190,9 @@ void Foam::meshToMesh::mapInternalTgtToSrc
template<>
void Foam::meshToMesh::mapInternalTgtToSrc
(
const GeometricField<symmTensor, fvPatchField, volMesh>& field,
const VolumeField<symmTensor>& field,
const minusEqOp<symmTensor>& cop,
GeometricField<symmTensor, fvPatchField, volMesh>& result,
VolumeField<symmTensor>& result,
const bool secondOrder
) const
{
@ -203,9 +203,9 @@ void Foam::meshToMesh::mapInternalTgtToSrc
template<>
void Foam::meshToMesh::mapInternalTgtToSrc
(
const GeometricField<tensor, fvPatchField, volMesh>& field,
const VolumeField<tensor>& field,
const plusEqOp<tensor>& cop,
GeometricField<tensor, fvPatchField, volMesh>& result,
VolumeField<tensor>& result,
const bool secondOrder
) const
{
@ -216,9 +216,9 @@ void Foam::meshToMesh::mapInternalTgtToSrc
template<>
void Foam::meshToMesh::mapInternalTgtToSrc
(
const GeometricField<tensor, fvPatchField, volMesh>& field,
const VolumeField<tensor>& field,
const minusEqOp<tensor>& cop,
GeometricField<tensor, fvPatchField, volMesh>& result,
VolumeField<tensor>& result,
const bool secondOrder
) const
{

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2015-2018 OpenCFD Ltd.
Copyright (C) 2015-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -42,8 +42,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef meshToMesh_H
#define meshToMesh_H
#ifndef Foam_meshToMesh_H
#define Foam_meshToMesh_H
#include "polyMesh.H"
#include "treeBoundBox.H"
@ -159,9 +159,9 @@ private:
template<class Type, class CombineOp>
void mapInternalSrcToTgt
(
const GeometricField<Type, fvPatchField, volMesh>& field,
const VolumeField<Type>& field,
const CombineOp& cop,
GeometricField<Type, fvPatchField, volMesh>& result,
VolumeField<Type>& result,
const bool secondOrder
) const;
@ -170,9 +170,9 @@ private:
template<class Type, class CombineOp>
void mapInternalTgtToSrc
(
const GeometricField<Type, fvPatchField, volMesh>& field,
const VolumeField<Type>& field,
const CombineOp& cop,
GeometricField<Type, fvPatchField, volMesh>& result,
VolumeField<Type>& result,
const bool secondOrder
) const;
@ -550,18 +550,18 @@ public:
template<class Type, class CombineOp>
void mapSrcToTgt
(
const GeometricField<Type, fvPatchField, volMesh>& field,
const VolumeField<Type>& field,
const CombineOp& cop,
GeometricField<Type, fvPatchField, volMesh>& result,
VolumeField<Type>& result,
const bool secondOrder = true
) const;
//- Interpolate a field with a defined operation. The initial
// values of the result are set to zero
template<class Type, class CombineOp>
tmp<GeometricField<Type, fvPatchField, volMesh>> mapSrcToTgt
tmp<VolumeField<Type>> mapSrcToTgt
(
const GeometricField<Type, fvPatchField, volMesh>& field,
const VolumeField<Type>& field,
const CombineOp& cop,
const bool secondOrder = true
) const;
@ -569,10 +569,9 @@ public:
//- Interpolate a tmp field with a defined operation. The
// initial values of the result are set to zero
template<class Type, class CombineOp>
tmp<GeometricField<Type, fvPatchField, volMesh>> mapSrcToTgt
tmp<VolumeField<Type>> mapSrcToTgt
(
const tmp<GeometricField<Type, fvPatchField, volMesh>>&
tfield,
const tmp<VolumeField<Type>>& tfield,
const CombineOp& cop,
const bool secondOrder = true
) const;
@ -580,19 +579,18 @@ public:
//- Convenience function to map a field with a default
// operation (plusEqOp)
template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh>> mapSrcToTgt
tmp<VolumeField<Type>> mapSrcToTgt
(
const GeometricField<Type, fvPatchField, volMesh>& field,
const VolumeField<Type>& field,
const bool secondOrder = true
) const;
//- Convenience function to map a tmp field with a default
// operation (plusEqOp)
template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh>> mapSrcToTgt
tmp<VolumeField<Type>> mapSrcToTgt
(
const tmp<GeometricField<Type, fvPatchField, volMesh>>&
tfield,
const tmp<VolumeField<Type>>& tfield,
const bool secondOrder = true
) const;
@ -606,18 +604,18 @@ public:
template<class Type, class CombineOp>
void mapTgtToSrc
(
const GeometricField<Type, fvPatchField, volMesh>& field,
const VolumeField<Type>& field,
const CombineOp& cop,
GeometricField<Type, fvPatchField, volMesh>& result,
VolumeField<Type>& result,
const bool secondOrder = true
) const;
//- Interpolate a field with a defined operation. The initial
// values of the result are set to zero
template<class Type, class CombineOp>
tmp<GeometricField<Type, fvPatchField, volMesh>> mapTgtToSrc
tmp<VolumeField<Type>> mapTgtToSrc
(
const GeometricField<Type, fvPatchField, volMesh>& field,
const VolumeField<Type>& field,
const CombineOp& cop,
const bool secondOrder = true
) const;
@ -625,9 +623,9 @@ public:
//- Interpolate a tmp field with a defined operation. The
// initial values of the result are set to zero
template<class Type, class CombineOp>
tmp<GeometricField<Type, fvPatchField, volMesh>> mapTgtToSrc
tmp<VolumeField<Type>> mapTgtToSrc
(
const tmp<GeometricField<Type, fvPatchField, volMesh>>&
const tmp<VolumeField<Type>>&
tfield,
const CombineOp& cop,
const bool secondOrder = true
@ -636,19 +634,18 @@ public:
//- Convenience function to map a field with a default
// operation (plusEqOp)
template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh>> mapTgtToSrc
tmp<VolumeField<Type>> mapTgtToSrc
(
const GeometricField<Type, fvPatchField, volMesh>& field,
const VolumeField<Type>& field,
const bool secondOrder = true
) const;
//- Convenience function to map a tmp field with a default
// operation (plusEqOp)
template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh>> mapTgtToSrc
tmp<VolumeField<Type>> mapTgtToSrc
(
const tmp<GeometricField<Type, fvPatchField, volMesh>>&
tfield,
const tmp<VolumeField<Type>>& tfield,
const bool secondOrder = true
) const;
};
@ -661,97 +658,97 @@ public:
template<>
void meshToMesh::mapInternalSrcToTgt
(
const GeometricField<sphericalTensor, fvPatchField, volMesh>&,
const VolumeField<sphericalTensor>&,
const plusEqOp<sphericalTensor>&,
GeometricField<sphericalTensor, fvPatchField, volMesh>&,
VolumeField<sphericalTensor>&,
const bool
) const;
template<>
void meshToMesh::mapInternalSrcToTgt
(
const GeometricField<sphericalTensor, fvPatchField, volMesh>&,
const VolumeField<sphericalTensor>&,
const minusEqOp<sphericalTensor>&,
GeometricField<sphericalTensor, fvPatchField, volMesh>&,
VolumeField<sphericalTensor>&,
const bool
) const;
template<>
void meshToMesh::mapInternalSrcToTgt
(
const GeometricField<symmTensor, fvPatchField, volMesh>&,
const VolumeField<symmTensor>&,
const plusEqOp<symmTensor>&,
GeometricField<symmTensor, fvPatchField, volMesh>&,
VolumeField<symmTensor>&,
const bool
) const;
template<>
void meshToMesh::mapInternalSrcToTgt
(
const GeometricField<symmTensor, fvPatchField, volMesh>&,
const VolumeField<symmTensor>&,
const minusEqOp<symmTensor>&,
GeometricField<symmTensor, fvPatchField, volMesh>&,
VolumeField<symmTensor>&,
const bool
) const;
template<>
void meshToMesh::mapInternalSrcToTgt
(
const GeometricField<tensor, fvPatchField, volMesh>&,
const VolumeField<tensor>&,
const plusEqOp<tensor>&,
GeometricField<tensor, fvPatchField, volMesh>&,
VolumeField<tensor>&,
const bool
) const;
template<>
void meshToMesh::mapInternalSrcToTgt
(
const GeometricField<tensor, fvPatchField, volMesh>&,
const VolumeField<tensor>&,
const minusEqOp<tensor>&,
GeometricField<tensor, fvPatchField, volMesh>&,
VolumeField<tensor>&,
const bool
) const;
template<>
void meshToMesh::mapInternalTgtToSrc
(
const GeometricField<sphericalTensor, fvPatchField, volMesh>&,
const VolumeField<sphericalTensor>&,
const plusEqOp<sphericalTensor>&,
GeometricField<sphericalTensor, fvPatchField, volMesh>&,
VolumeField<sphericalTensor>&,
const bool
) const;
template<>
void meshToMesh::mapInternalTgtToSrc
(
const GeometricField<sphericalTensor, fvPatchField, volMesh>&,
const VolumeField<sphericalTensor>&,
const minusEqOp<sphericalTensor>&,
GeometricField<sphericalTensor, fvPatchField, volMesh>&,
VolumeField<sphericalTensor>&,
const bool
) const;
template<>
void meshToMesh::mapInternalTgtToSrc
(
const GeometricField<symmTensor, fvPatchField, volMesh>&,
const VolumeField<symmTensor>&,
const plusEqOp<symmTensor>&,
GeometricField<symmTensor, fvPatchField, volMesh>&,
VolumeField<symmTensor>&,
const bool
) const;
template<>
void meshToMesh::mapInternalTgtToSrc
(
const GeometricField<symmTensor, fvPatchField, volMesh>&,
const VolumeField<symmTensor>&,
const minusEqOp<symmTensor>&,
GeometricField<symmTensor, fvPatchField, volMesh>&,
VolumeField<symmTensor>&,
const bool
) const;
template<>
void meshToMesh::mapInternalTgtToSrc
(
const GeometricField<tensor, fvPatchField, volMesh>&,
const VolumeField<tensor>&,
const plusEqOp<tensor>&,
GeometricField<tensor, fvPatchField, volMesh>&,
VolumeField<tensor>&,
const bool
) const;
template<>
void meshToMesh::mapInternalTgtToSrc
(
const GeometricField<tensor, fvPatchField, volMesh>&,
const VolumeField<tensor>&,
const minusEqOp<tensor>&,
GeometricField<tensor, fvPatchField, volMesh>&,
VolumeField<tensor>&,
const bool
) const;

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2015 OpenCFD Ltd.
Copyright (C) 2015-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -472,9 +472,9 @@ Foam::tmp<Foam::Field<Type>> Foam::meshToMesh::mapTgtToSrc
template<class Type, class CombineOp>
void Foam::meshToMesh::mapInternalSrcToTgt
(
const GeometricField<Type, fvPatchField, volMesh>& field,
const VolumeField<Type>& field,
const CombineOp& cop,
GeometricField<Type, fvPatchField, volMesh>& result,
VolumeField<Type>& result,
const bool secondOrder
) const
{
@ -519,9 +519,9 @@ void Foam::meshToMesh::mapAndOpSrcToTgt
template<class Type, class CombineOp>
void Foam::meshToMesh::mapSrcToTgt
(
const GeometricField<Type, fvPatchField, volMesh>& field,
const VolumeField<Type>& field,
const CombineOp& cop,
GeometricField<Type, fvPatchField, volMesh>& result,
VolumeField<Type>& result,
const bool secondOrder
) const
{
@ -529,8 +529,7 @@ void Foam::meshToMesh::mapSrcToTgt
const PtrList<AMIPatchToPatchInterpolation>& AMIList = patchAMIs();
typename GeometricField<Type, fvPatchField, volMesh>::
Boundary& resultBf = result.boundaryFieldRef();
auto& resultBf = result.boundaryFieldRef();
forAll(AMIList, i)
{
@ -581,21 +580,18 @@ void Foam::meshToMesh::mapSrcToTgt
template<class Type, class CombineOp>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>>
Foam::tmp<Foam::VolumeField<Type>>
Foam::meshToMesh::mapSrcToTgt
(
const GeometricField<Type, fvPatchField, volMesh>& field,
const VolumeField<Type>& field,
const CombineOp& cop,
const bool secondOrder
) const
{
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
const fvMesh& tgtMesh = static_cast<const fvMesh&>(tgtRegion_);
const fvBoundaryMesh& tgtBm = tgtMesh.boundary();
const typename fieldType::Boundary& srcBfld =
field.boundaryField();
const auto& srcBfld = field.boundaryField();
PtrList<fvPatchField<Type>> tgtPatchFields(tgtBm.size());
@ -646,9 +642,8 @@ Foam::meshToMesh::mapSrcToTgt
}
}
tmp<fieldType> tresult
(
new fieldType
auto tresult =
tmp<VolumeField<Type>>::New
(
IOobject
(
@ -662,8 +657,7 @@ Foam::meshToMesh::mapSrcToTgt
field.dimensions(),
Field<Type>(tgtMesh.nCells(), Zero),
tgtPatchFields
)
);
);
mapSrcToTgt(field, cop, tresult.ref(), secondOrder);
@ -672,10 +666,10 @@ Foam::meshToMesh::mapSrcToTgt
template<class Type, class CombineOp>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>>
Foam::tmp<Foam::VolumeField<Type>>
Foam::meshToMesh::mapSrcToTgt
(
const tmp<GeometricField<Type, fvPatchField, volMesh>>& tfield,
const tmp<VolumeField<Type>>& tfield,
const CombineOp& cop,
const bool secondOrder
) const
@ -685,10 +679,10 @@ Foam::meshToMesh::mapSrcToTgt
template<class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>>
Foam::tmp<Foam::VolumeField<Type>>
Foam::meshToMesh::mapSrcToTgt
(
const GeometricField<Type, fvPatchField, volMesh>& field,
const VolumeField<Type>& field,
const bool secondOrder
) const
{
@ -697,10 +691,10 @@ Foam::meshToMesh::mapSrcToTgt
template<class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>>
Foam::tmp<Foam::VolumeField<Type>>
Foam::meshToMesh::mapSrcToTgt
(
const tmp<GeometricField<Type, fvPatchField, volMesh>>& tfield,
const tmp<VolumeField<Type>>& tfield,
const bool secondOrder
) const
{
@ -711,9 +705,9 @@ Foam::meshToMesh::mapSrcToTgt
template<class Type, class CombineOp>
void Foam::meshToMesh::mapInternalTgtToSrc
(
const GeometricField<Type, fvPatchField, volMesh>& field,
const VolumeField<Type>& field,
const CombineOp& cop,
GeometricField<Type, fvPatchField, volMesh>& result,
VolumeField<Type>& result,
const bool secondOrder
) const
{
@ -758,9 +752,9 @@ void Foam::meshToMesh::mapAndOpTgtToSrc
template<class Type, class CombineOp>
void Foam::meshToMesh::mapTgtToSrc
(
const GeometricField<Type, fvPatchField, volMesh>& field,
const VolumeField<Type>& field,
const CombineOp& cop,
GeometricField<Type, fvPatchField, volMesh>& result,
VolumeField<Type>& result,
const bool secondOrder
) const
{
@ -817,21 +811,18 @@ void Foam::meshToMesh::mapTgtToSrc
template<class Type, class CombineOp>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>>
Foam::tmp<Foam::VolumeField<Type>>
Foam::meshToMesh::mapTgtToSrc
(
const GeometricField<Type, fvPatchField, volMesh>& field,
const VolumeField<Type>& field,
const CombineOp& cop,
const bool secondOrder
) const
{
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
const fvMesh& srcMesh = static_cast<const fvMesh&>(srcRegion_);
const fvBoundaryMesh& srcBm = srcMesh.boundary();
const typename fieldType::Boundary& tgtBfld =
field.boundaryField();
const auto& tgtBfld = field.boundaryField();
PtrList<fvPatchField<Type>> srcPatchFields(srcBm.size());
@ -882,9 +873,8 @@ Foam::meshToMesh::mapTgtToSrc
}
}
tmp<fieldType> tresult
(
new fieldType
auto tresult =
tmp<VolumeField<Type>>::New
(
IOobject
(
@ -898,8 +888,7 @@ Foam::meshToMesh::mapTgtToSrc
field.dimensions(),
Field<Type>(srcMesh.nCells(), Zero),
srcPatchFields
)
);
);
mapTgtToSrc(field, cop, tresult.ref(), secondOrder);
@ -908,10 +897,10 @@ Foam::meshToMesh::mapTgtToSrc
template<class Type, class CombineOp>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>>
Foam::tmp<Foam::VolumeField<Type>>
Foam::meshToMesh::mapTgtToSrc
(
const tmp<GeometricField<Type, fvPatchField, volMesh>>& tfield,
const tmp<VolumeField<Type>>& tfield,
const CombineOp& cop,
const bool secondOrder
) const
@ -921,10 +910,10 @@ Foam::meshToMesh::mapTgtToSrc
template<class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>>
Foam::tmp<Foam::VolumeField<Type>>
Foam::meshToMesh::mapTgtToSrc
(
const GeometricField<Type, fvPatchField, volMesh>& field,
const VolumeField<Type>& field,
const bool secondOrder
) const
{
@ -933,10 +922,10 @@ Foam::meshToMesh::mapTgtToSrc
template<class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>>
Foam::tmp<Foam::VolumeField<Type>>
Foam::meshToMesh::mapTgtToSrc
(
const tmp<GeometricField<Type, fvPatchField, volMesh>>& tfield,
const tmp<VolumeField<Type>>& tfield,
const bool secondOrder
) const
{

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2020 OpenFOAM Foundation
Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -31,7 +31,7 @@ Description
Serial mesh to mesh interpolation class.
Note
This class is due to be deprecated in favour of meshToMesh0New
This class is due to be deprecated in favour of meshToMesh
SourceFiles
meshToMesh0.C
@ -41,8 +41,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef meshToMesh0_H
#define meshToMesh0_H
#ifndef Foam_meshToMesh0_H
#define Foam_meshToMesh0_H
#include "fvMesh.H"
#include "HashTable.H"
@ -271,7 +271,7 @@ public:
void interpolateField
(
Field<Type>&,
const GeometricField<Type, fvPatchField, volMesh>&,
const VolumeField<Type>&,
const labelList& adr,
const scalarListList& weights,
const CombineOp& cop
@ -282,7 +282,7 @@ public:
void interpolateField
(
Field<Type>&,
const GeometricField<Type, fvPatchField, volMesh>&,
const VolumeField<Type>&,
const labelListList& adr,
const scalarListList& weights,
const CombineOp& cop
@ -294,7 +294,7 @@ public:
void interpolateField
(
Field<Type>&,
const GeometricField<Type, fvPatchField, volMesh>&,
const VolumeField<Type>&,
const labelList& adr,
const vectorField& centres,
const CombineOp& cop
@ -306,7 +306,7 @@ public:
void interpolateInternalField
(
Field<Type>&,
const GeometricField<Type, fvPatchField, volMesh>&,
const VolumeField<Type>&,
order=INTERPOLATE,
const CombineOp& cop = eqOp<Type>()
) const;
@ -315,7 +315,7 @@ public:
void interpolateInternalField
(
Field<Type>&,
const tmp<GeometricField<Type, fvPatchField, volMesh>>&,
const tmp<VolumeField<Type>>&,
order=INTERPOLATE,
const CombineOp& cop = eqOp<Type>()
) const;
@ -325,8 +325,8 @@ public:
template<class Type, class CombineOp>
void interpolate
(
GeometricField<Type, fvPatchField, volMesh>&,
const GeometricField<Type, fvPatchField, volMesh>&,
VolumeField<Type>&,
const VolumeField<Type>&,
order=INTERPOLATE,
const CombineOp& cop = eqOp<Type>()
) const;
@ -334,8 +334,8 @@ public:
template<class Type, class CombineOp>
void interpolate
(
GeometricField<Type, fvPatchField, volMesh>&,
const tmp<GeometricField<Type, fvPatchField, volMesh>>&,
VolumeField<Type>&,
const tmp<VolumeField<Type>>&,
order=INTERPOLATE,
const CombineOp& cop = eqOp<Type>()
) const;
@ -343,17 +343,17 @@ public:
//- Interpolate volume field
template<class Type, class CombineOp>
tmp<GeometricField<Type, fvPatchField, volMesh>> interpolate
tmp<VolumeField<Type>> interpolate
(
const GeometricField<Type, fvPatchField, volMesh>&,
const VolumeField<Type>&,
order=INTERPOLATE,
const CombineOp& cop = eqOp<Type>()
) const;
template<class Type, class CombineOp>
tmp<GeometricField<Type, fvPatchField, volMesh>> interpolate
tmp<VolumeField<Type>> interpolate
(
const tmp<GeometricField<Type, fvPatchField, volMesh>>&,
const tmp<VolumeField<Type>>&,
order=INTERPOLATE,
const CombineOp& cop = eqOp<Type>()
) const;

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -60,7 +61,7 @@ template<class Type, class CombineOp>
void Foam::meshToMesh0::interpolateField
(
Field<Type>& toF,
const GeometricField<Type, fvPatchField, volMesh>& fromVf,
const VolumeField<Type>& fromVf,
const labelListList& adr,
const scalarListList& weights,
const CombineOp& cop
@ -87,7 +88,7 @@ template<class Type, class CombineOp>
void Foam::meshToMesh0::interpolateField
(
Field<Type>& toF,
const GeometricField<Type, fvPatchField, volMesh>& fromVf,
const VolumeField<Type>& fromVf,
const labelList& adr,
const scalarListList& weights,
const CombineOp& cop
@ -122,7 +123,7 @@ template<class Type, class CombineOp>
void Foam::meshToMesh0::interpolateField
(
Field<Type>& toF,
const GeometricField<Type, fvPatchField, volMesh>& fromVf,
const VolumeField<Type>& fromVf,
const labelList& adr,
const vectorField& centres,
const CombineOp& cop
@ -153,7 +154,7 @@ template<class Type, class CombineOp>
void Foam::meshToMesh0::interpolateInternalField
(
Field<Type>& toF,
const GeometricField<Type, fvPatchField, volMesh>& fromVf,
const VolumeField<Type>& fromVf,
meshToMesh0::order ord,
const CombineOp& cop
) const
@ -234,7 +235,7 @@ template<class Type, class CombineOp>
void Foam::meshToMesh0::interpolateInternalField
(
Field<Type>& toF,
const tmp<GeometricField<Type, fvPatchField, volMesh>>& tfromVf,
const tmp<VolumeField<Type>>& tfromVf,
meshToMesh0::order ord,
const CombineOp& cop
) const
@ -247,16 +248,15 @@ void Foam::meshToMesh0::interpolateInternalField
template<class Type, class CombineOp>
void Foam::meshToMesh0::interpolate
(
GeometricField<Type, fvPatchField, volMesh>& toVf,
const GeometricField<Type, fvPatchField, volMesh>& fromVf,
VolumeField<Type>& toVf,
const VolumeField<Type>& fromVf,
meshToMesh0::order ord,
const CombineOp& cop
) const
{
interpolateInternalField(toVf, fromVf, ord, cop);
typename GeometricField<Type, fvPatchField, volMesh>::
Boundary& toVfBf = toVf.boundaryFieldRef();
auto& toVfBf = toVf.boundaryFieldRef();
forAll(toMesh_.boundaryMesh(), patchi)
{
@ -346,8 +346,8 @@ void Foam::meshToMesh0::interpolate
template<class Type, class CombineOp>
void Foam::meshToMesh0::interpolate
(
GeometricField<Type, fvPatchField, volMesh>& toVf,
const tmp<GeometricField<Type, fvPatchField, volMesh>>& tfromVf,
VolumeField<Type>& toVf,
const tmp<VolumeField<Type>>& tfromVf,
meshToMesh0::order ord,
const CombineOp& cop
) const
@ -358,10 +358,10 @@ void Foam::meshToMesh0::interpolate
template<class Type, class CombineOp>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>>
Foam::tmp<Foam::VolumeField<Type>>
Foam::meshToMesh0::interpolate
(
const GeometricField<Type, fvPatchField, volMesh>& fromVf,
const VolumeField<Type>& fromVf,
meshToMesh0::order ord,
const CombineOp& cop
) const
@ -406,9 +406,8 @@ Foam::meshToMesh0::interpolate
// Create the complete field from the pieces
tmp<GeometricField<Type, fvPatchField, volMesh>> ttoF
(
new GeometricField<Type, fvPatchField, volMesh>
return
tmp<VolumeField<Type>>::New
(
IOobject
(
@ -422,24 +421,20 @@ Foam::meshToMesh0::interpolate
fromVf.dimensions(),
internalField,
patchFields
)
);
return ttoF;
);
}
template<class Type, class CombineOp>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>>
Foam::tmp<Foam::VolumeField<Type>>
Foam::meshToMesh0::interpolate
(
const tmp<GeometricField<Type, fvPatchField, volMesh>>& tfromVf,
const tmp<VolumeField<Type>>& tfromVf,
meshToMesh0::order ord,
const CombineOp& cop
) const
{
tmp<GeometricField<Type, fvPatchField, volMesh>> tint =
interpolate(tfromVf(), ord, cop);
tmp<VolumeField<Type>> tint = interpolate(tfromVf(), ord, cop);
tfromVf.clear();
return tint;

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -89,8 +89,8 @@ Foam::sampledDistanceSurface::sampleOnIsoSurfacePoints
// Assume volPointInterpolation for the point field!
const auto& volFld = interpolator.psi();
tmp<GeometricField<Type, fvPatchField, volMesh>> tvolFld(volFld);
tmp<GeometricField<Type, pointPatchField, pointMesh>> tpointFld;
tmp<VolumeField<Type>> tvolFld(volFld);
tmp<PointField<Type>> tpointFld;
// Interpolated point field
tpointFld.reset

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2020 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -93,8 +93,8 @@ Foam::sampledIsoSurface::sampleOnIsoSurfacePoints
// Assume volPointInterpolation for the point field!
const auto& volFld = interpolator.psi();
tmp<GeometricField<Type, fvPatchField, volMesh>> tvolFld(volFld);
tmp<GeometricField<Type, pointPatchField, pointMesh>> tpointFld;
tmp<VolumeField<Type>> tvolFld(volFld);
tmp<PointField<Type>> tpointFld;
if (subMeshPtr_)
{

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2020 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -67,8 +67,8 @@ Foam::sampledCuttingPlane::sampleOnIsoSurfacePoints
// Assume volPointInterpolation for the point field!
const auto& volFld = interpolator.psi();
tmp<GeometricField<Type, fvPatchField, volMesh>> tvolFld(volFld);
tmp<GeometricField<Type, pointPatchField, pointMesh>> tpointFld;
tmp<VolumeField<Type>> tvolFld(volFld);
tmp<PointField<Type>> tpointFld;
if (subMeshPtr_)
{

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020-2021 OpenCFD Ltd.
Copyright (C) 2020-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -58,8 +58,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef sampledFaceZone_H
#define sampledFaceZone_H
#ifndef Foam_sampledFaceZone_H
#define Foam_sampledFaceZone_H
#include "sampledSurface.H"
#include "MeshedSurfaces.H"
@ -116,7 +116,7 @@ class sampledFaceZone
template<class Type>
tmp<Field<Type>> sampleOnFaces
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& sField
const SurfaceField<Type>& sField
) const;
//- Interpolate volume/boundary field onto surface points

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd.
Copyright (C) 2020-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -72,7 +72,7 @@ template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::sampledFaceZone::sampleOnFaces
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& sField
const SurfaceField<Type>& sField
) const
{
// One value per face

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2021 OpenCFD Ltd.
Copyright (C) 2016-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -58,8 +58,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef sampledPatch_H
#define sampledPatch_H
#ifndef Foam_sampledPatch_H
#define Foam_sampledPatch_H
#include "sampledSurface.H"
#include "MeshedSurfaces.H"
@ -119,7 +119,7 @@ class sampledPatch
template<class Type>
tmp<Field<Type>> sampleOnFaces
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& sField
const SurfaceField<Type>& sField
) const;
//- Interpolate boundary field (from volume field) onto surface points

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2020 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -59,7 +59,7 @@ template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::sampledPatch::sampleOnFaces
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& sField
const SurfaceField<Type>& sField
) const
{
// One value per face

View File

@ -71,8 +71,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef sampledSurface_H
#define sampledSurface_H
#ifndef Foam_sampledSurface_H
#define Foam_sampledSurface_H
#include "polySurface.H"
#include "typeInfo.H"
@ -148,9 +148,9 @@ protected:
//- Create cell values by averaging the point values
template<class Type>
static tmp<GeometricField<Type, fvPatchField, volMesh>> pointAverage
static tmp<VolumeField<Type>> pointAverage
(
const GeometricField<Type, pointPatchField, pointMesh>& pfld
const PointField<Type>& pfld
);

View File

@ -125,15 +125,15 @@ Foam::sampledSurface::sampleOnPoints
template<class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>>
Foam::tmp<Foam::VolumeField<Type>>
Foam::sampledSurface::pointAverage
(
const GeometricField<Type, pointPatchField, pointMesh>& pfld
const PointField<Type>& pfld
)
{
const fvMesh& mesh = dynamic_cast<const fvMesh&>(pfld.mesh()());
auto tcellAvg = tmp<GeometricField<Type, fvPatchField, volMesh>>::New
auto tcellAvg = tmp<VolumeField<Type>>::New
(
IOobject
(

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2021 OpenCFD Ltd.
Copyright (C) 2016-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -130,8 +130,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef distanceSurface_H
#define distanceSurface_H
#ifndef Foam_distanceSurface_H
#define Foam_distanceSurface_H
#include "sampledSurface.H"
#include "searchableSurface.H"
@ -249,7 +249,7 @@ protected:
template<class Type>
tmp<Field<Type>> isoSurfaceInterpolate
(
const GeometricField<Type, fvPatchField, volMesh>& cellValues,
const VolumeField<Type>& cellValues,
const Field<Type>& pointValues
) const
{

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019-2021 OpenCFD Ltd.
Copyright (C) 2019-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -40,8 +40,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef isoSurfaceBase_H
#define isoSurfaceBase_H
#ifndef Foam_isoSurfaceBase_H
#define Foam_isoSurfaceBase_H
#include "isoSurfaceParams.H"
#include "bitSet.H"
@ -139,7 +139,7 @@ protected:
template<class Type>
tmp<Field<Type>> interpolateTemplate
(
const GeometricField<Type, fvPatchField, volMesh>& cellValues,
const VolumeField<Type>& cellValues,
const Field<Type>& pointValues
) const
{
@ -274,7 +274,7 @@ public:
virtual tmp<Field<Type>> \
interpolate \
( \
const GeometricField<Type, fvPatchField, volMesh>& cellValues, \
const VolumeField<Type>& cellValues, \
const Field<Type>& pointValues \
) const;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd.
Copyright (C) 2020-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -31,8 +31,8 @@ Description
\*---------------------------------------------------------------------------*/
#ifndef isoSurfaceBaseMethods_H
#define isoSurfaceBaseMethods_H
#ifndef Foam_isoSurfaceBaseMethods_H
#define Foam_isoSurfaceBaseMethods_H
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -43,7 +43,7 @@ Description
#define defineIsoSurfaceInterpolateMethod(ThisClass, Type) \
Foam::tmp<Foam::Field<Type>> ThisClass::interpolate \
( \
const GeometricField<Type, fvPatchField, volMesh>& cellValues, \
const VolumeField<Type>& cellValues, \
const Field<Type>& pointValues \
) const \
{ \

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2020 OpenCFD Ltd.
Copyright (C) 2016-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -63,8 +63,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef isoSurfacePoint_H
#define isoSurfacePoint_H
#ifndef Foam_isoSurfacePoint_H
#define Foam_isoSurfacePoint_H
#include "bitSet.H"
#include "volFields.H"
@ -206,12 +206,8 @@ class isoSurfacePoint
//- Return input field with coupled (and empty) patch values rewritten
template<class Type>
tmp<SlicedGeometricField
<Type, fvPatchField, slicedFvPatchField, volMesh>>
adaptPatchFields
(
const GeometricField<Type, fvPatchField, volMesh>& fld
) const;
tmp<VolumeSliceField<Type>>
adaptPatchFields(const VolumeField<Type>& fld) const;
//- Generate single point by interpolation or snapping
template<class Type>
@ -263,7 +259,7 @@ class isoSurfacePoint
const volScalarField& cVals,
const scalarField& pVals,
const GeometricField<Type, fvPatchField, volMesh>& cCoords,
const VolumeField<Type>& cCoords,
const Field<Type>& pCoords,
const DynamicList<Type>& snappedPoints,
@ -286,7 +282,7 @@ class isoSurfacePoint
const volScalarField& cVals,
const scalarField& pVals,
const GeometricField<Type, fvPatchField, volMesh>& cCoords,
const VolumeField<Type>& cCoords,
const Field<Type>& pCoords,
const DynamicList<Type>& snappedPoints,
@ -360,7 +356,7 @@ class isoSurfacePoint
template<class Type>
tmp<Field<Type>> interpolateTemplate
(
const GeometricField<Type, fvPatchField, volMesh>& cCoords,
const VolumeField<Type>& cCoords,
const Field<Type>& pCoords
) const;

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2021 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -36,27 +36,13 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type>
Foam::tmp<Foam::SlicedGeometricField
<
Type,
Foam::fvPatchField,
Foam::slicedFvPatchField,
Foam::volMesh
>>
Foam::tmp<Foam::VolumeSliceField<Type>>
Foam::isoSurfacePoint::adaptPatchFields
(
const GeometricField<Type, fvPatchField, volMesh>& fld
const VolumeField<Type>& fld
) const
{
typedef SlicedGeometricField
<
Type,
fvPatchField,
slicedFvPatchField,
volMesh
> FieldType;
auto tslice = tmp<FieldType>::New
auto tslice = tmp<VolumeSliceField<Type>>::New
(
IOobject
(
@ -448,7 +434,7 @@ Foam::label Foam::isoSurfacePoint::generateFaceTriPoints
const volScalarField& cVals,
const scalarField& pVals,
const GeometricField<Type, fvPatchField, volMesh>& cCoords,
const VolumeField<Type>& cCoords,
const Field<Type>& pCoords,
const DynamicList<Type>& snappedPoints,
@ -531,7 +517,7 @@ void Foam::isoSurfacePoint::generateTriPoints
const volScalarField& cVals,
const scalarField& pVals,
const GeometricField<Type, fvPatchField, volMesh>& cCoords,
const VolumeField<Type>& cCoords,
const Field<Type>& pCoords,
const DynamicList<Type>& snappedPoints,
@ -809,18 +795,12 @@ template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::isoSurfacePoint::interpolateTemplate
(
const GeometricField<Type, fvPatchField, volMesh>& cCoords,
const VolumeField<Type>& cCoords,
const Field<Type>& pCoords
) const
{
// Recalculate boundary values
tmp<SlicedGeometricField
<
Type,
fvPatchField,
slicedFvPatchField,
volMesh
>> c2(adaptPatchFields(cCoords));
tmp<VolumeSliceField<Type>> c2(adaptPatchFields(cCoords));
DynamicList<Type> triPoints(3*nCutCells_);