mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Added templated binary ops to AMI interpolation functions
This commit is contained in:
@ -1333,11 +1333,12 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
|
|||||||
|
|
||||||
|
|
||||||
template<class SourcePatch, class TargetPatch>
|
template<class SourcePatch, class TargetPatch>
|
||||||
template<class Type>
|
template<class Type, class BinaryOp>
|
||||||
Foam::tmp<Foam::Field<Type> >
|
Foam::tmp<Foam::Field<Type> >
|
||||||
Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource
|
Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource
|
||||||
(
|
(
|
||||||
const Field<Type>& fld
|
const Field<Type>& fld,
|
||||||
|
const BinaryOp& bop
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (fld.size() != tgtAddress_.size())
|
if (fld.size() != tgtAddress_.size())
|
||||||
@ -1377,7 +1378,7 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource
|
|||||||
|
|
||||||
forAll(faces, i)
|
forAll(faces, i)
|
||||||
{
|
{
|
||||||
result[faceI] += work[faces[i]]*weights[i];
|
result[faceI] = bop(result[faceI], work[faces[i]]*weights[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1390,7 +1391,7 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource
|
|||||||
|
|
||||||
forAll(faces, i)
|
forAll(faces, i)
|
||||||
{
|
{
|
||||||
result[faceI] += fld[faces[i]]*weights[i];
|
result[faceI] = bop(result[faceI], fld[faces[i]]*weights[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1400,24 +1401,26 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource
|
|||||||
|
|
||||||
|
|
||||||
template<class SourcePatch, class TargetPatch>
|
template<class SourcePatch, class TargetPatch>
|
||||||
template<class Type>
|
template<class Type, class BinaryOp>
|
||||||
Foam::tmp<Foam::Field<Type> >
|
Foam::tmp<Foam::Field<Type> >
|
||||||
Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource
|
Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource
|
||||||
(
|
(
|
||||||
const tmp<Field<Type> >& tFld
|
const tmp<Field<Type> >& tFld,
|
||||||
|
const BinaryOp& bop
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return interpolateToSource(tFld());
|
return interpolateToSource(tFld(), bop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class SourcePatch, class TargetPatch>
|
template<class SourcePatch, class TargetPatch>
|
||||||
template<class Type>
|
template<class Type, class BinaryOp>
|
||||||
Foam::tmp<Foam::Field<Type> >
|
Foam::tmp<Foam::Field<Type> >
|
||||||
Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget
|
Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget
|
||||||
(
|
(
|
||||||
const Field<Type>& fld
|
const Field<Type>& fld,
|
||||||
|
const BinaryOp& bop
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (fld.size() != srcAddress_.size())
|
if (fld.size() != srcAddress_.size())
|
||||||
@ -1457,7 +1460,7 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget
|
|||||||
|
|
||||||
forAll(faces, i)
|
forAll(faces, i)
|
||||||
{
|
{
|
||||||
result[faceI] += work[faces[i]]*weights[i];
|
result[faceI] = bop(result[faceI], work[faces[i]]*weights[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1470,7 +1473,7 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget
|
|||||||
|
|
||||||
forAll(faces, i)
|
forAll(faces, i)
|
||||||
{
|
{
|
||||||
result[faceI] += fld[faces[i]]*weights[i];
|
result[faceI] = bop(result[faceI], fld[faces[i]]*weights[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1479,6 +1482,55 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class SourcePatch, class TargetPatch>
|
||||||
|
template<class Type, class BinaryOp>
|
||||||
|
Foam::tmp<Foam::Field<Type> >
|
||||||
|
Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget
|
||||||
|
(
|
||||||
|
const tmp<Field<Type> >& tFld,
|
||||||
|
const BinaryOp& bop
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return interpolateToTarget(tFld(), bop);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class SourcePatch, class TargetPatch>
|
||||||
|
template<class Type>
|
||||||
|
Foam::tmp<Foam::Field<Type> >
|
||||||
|
Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource
|
||||||
|
(
|
||||||
|
const Field<Type>& fld
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return interpolateToSource(fld, sumOp<Type>());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class SourcePatch, class TargetPatch>
|
||||||
|
template<class Type>
|
||||||
|
Foam::tmp<Foam::Field<Type> >
|
||||||
|
Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource
|
||||||
|
(
|
||||||
|
const tmp<Field<Type> >& tFld
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return interpolateToSource(tFld, sumOp<Type>());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class SourcePatch, class TargetPatch>
|
||||||
|
template<class Type>
|
||||||
|
Foam::tmp<Foam::Field<Type> >
|
||||||
|
Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget
|
||||||
|
(
|
||||||
|
const Field<Type>& fld
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return interpolateToSource(fld, sumOp<Type>());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class SourcePatch, class TargetPatch>
|
template<class SourcePatch, class TargetPatch>
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::tmp<Foam::Field<Type> >
|
Foam::tmp<Foam::Field<Type> >
|
||||||
@ -1487,7 +1539,7 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget
|
|||||||
const tmp<Field<Type> >& tFld
|
const tmp<Field<Type> >& tFld
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return interpolateToTarget(tFld());
|
return interpolateToSource(tFld, sumOp<Type>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -53,6 +53,7 @@ SourceFiles
|
|||||||
#include "treeBoundBox.H"
|
#include "treeBoundBox.H"
|
||||||
#include "treeBoundBoxList.H"
|
#include "treeBoundBoxList.H"
|
||||||
#include "globalIndex.H"
|
#include "globalIndex.H"
|
||||||
|
#include "ops.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -345,11 +346,46 @@ public:
|
|||||||
|
|
||||||
// Evaluation
|
// Evaluation
|
||||||
|
|
||||||
|
//- Interpolate from target to source with supplied op
|
||||||
|
template<class Type, class BinaryOp>
|
||||||
|
tmp<Field<Type> > interpolateToSource
|
||||||
|
(
|
||||||
|
const Field<Type>& fld,
|
||||||
|
const BinaryOp& bop
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Interpolate from target tmp field to source with supplied op
|
||||||
|
template<class Type, class BinaryOp>
|
||||||
|
tmp<Field<Type> > interpolateToSource
|
||||||
|
(
|
||||||
|
const tmp<Field<Type> >& tFld,
|
||||||
|
const BinaryOp& bop
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Interpolate from source to target with supplied op
|
||||||
|
template<class Type, class BinaryOp>
|
||||||
|
tmp<Field<Type> > interpolateToTarget
|
||||||
|
(
|
||||||
|
const Field<Type>& fld,
|
||||||
|
const BinaryOp& bop
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Interpolate from source tmp field to target with supplied op
|
||||||
|
template<class Type, class BinaryOp>
|
||||||
|
tmp<Field<Type> > interpolateToTarget
|
||||||
|
(
|
||||||
|
const tmp<Field<Type> >& tFld,
|
||||||
|
const BinaryOp& bop
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Interpolate from target to source
|
//- Interpolate from target to source
|
||||||
template<class Type>
|
template<class Type>
|
||||||
tmp<Field<Type> > interpolateToSource(const Field<Type>& fld) const;
|
tmp<Field<Type> > interpolateToSource
|
||||||
|
(
|
||||||
|
const Field<Type>& fld
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Interpolate from target tmp field to source
|
//- Interpolate from target tmp field
|
||||||
template<class Type>
|
template<class Type>
|
||||||
tmp<Field<Type> > interpolateToSource
|
tmp<Field<Type> > interpolateToSource
|
||||||
(
|
(
|
||||||
@ -358,9 +394,12 @@ public:
|
|||||||
|
|
||||||
//- Interpolate from source to target
|
//- Interpolate from source to target
|
||||||
template<class Type>
|
template<class Type>
|
||||||
tmp<Field<Type> > interpolateToTarget(const Field<Type>& fld) const;
|
tmp<Field<Type> > interpolateToTarget
|
||||||
|
(
|
||||||
|
const Field<Type>& fld
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Interpolate from source tmp field to target
|
//- Interpolate from source tmp field
|
||||||
template<class Type>
|
template<class Type>
|
||||||
tmp<Field<Type> > interpolateToTarget
|
tmp<Field<Type> > interpolateToTarget
|
||||||
(
|
(
|
||||||
|
|||||||
Reference in New Issue
Block a user