Field: Moved FieldMapper mapping functions to FieldMapper and made virtual

This allows easier extension and specialisation of field mapping.
This commit is contained in:
Henry Weller
2019-05-02 15:43:32 +01:00
parent 6afe1b4632
commit 687d56fbf1
54 changed files with 492 additions and 419 deletions

View File

@ -65,8 +65,8 @@ Foam::mixedFixedValueSlipFvPatchField<Type>::mixedFixedValueSlipFvPatchField
)
:
transformFvPatchField<Type>(ptf, p, iF, mapper),
refValue_(ptf.refValue_, mapper),
valueFraction_(ptf.valueFraction_, mapper)
refValue_(mapper(ptf.refValue_)),
valueFraction_(mapper(ptf.valueFraction_))
{}

View File

@ -88,8 +88,8 @@ alphatPhaseChangeWallFunctionFvPatchScalarField
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
dmdt_(ptf.dmdt_, mapper),
mDotL_(ptf.mDotL_, mapper)
dmdt_(mapper(ptf.dmdt_)),
mDotL_(mapper(ptf.mDotL_))
{}

View File

@ -221,9 +221,9 @@ alphatWallBoilingWallFunctionFvPatchScalarField
phaseType_(psf.phaseType_),
relax_(psf.relax_),
AbyV_(psf.AbyV_),
alphatConv_(psf.alphatConv_, mapper),
dDep_(psf.dDep_, mapper),
qq_(psf.qq_, mapper),
alphatConv_(mapper(psf.alphatConv_)),
dDep_(mapper(psf.dDep_)),
qq_(mapper(psf.qq_)),
partitioningModel_(psf.partitioningModel_),
nucleationSiteModel_(psf.nucleationSiteModel_),
departureDiamModel_(psf.departureDiamModel_),

View File

@ -73,7 +73,7 @@ fixedMultiPhaseHeatFluxFvPatchScalarField
)
:
fixedValueFvPatchScalarField(psf, p, iF, mapper),
q_(psf.q_, mapper),
q_(mapper(psf.q_)),
relax_(psf.relax_),
Tmin_(psf.Tmin_)
{}

View File

@ -55,8 +55,8 @@ tractionDisplacementFvPatchVectorField
)
:
fixedGradientFvPatchVectorField(tdpvf, p, iF, mapper),
traction_(tdpvf.traction_, mapper),
pressure_(tdpvf.pressure_, mapper)
traction_(mapper(tdpvf.traction_)),
pressure_(mapper(tdpvf.pressure_))
{}

View File

@ -60,8 +60,8 @@ tractionDisplacementCorrectionFvPatchVectorField
)
:
fixedGradientFvPatchVectorField(tdpvf, p, iF, mapper),
traction_(tdpvf.traction_, mapper),
pressure_(tdpvf.pressure_, mapper)
traction_(mapper(tdpvf.traction_)),
pressure_(mapper(tdpvf.pressure_))
{}

View File

@ -1,3 +0,0 @@
Test-Field.C
EXE = $(FOAM_USER_APPBIN)/Test-Field

View File

@ -1,11 +0,0 @@
#include "Test-Field.H"
int main()
{
Vector<double> v1(1, 2);
Vector<double> v2(2, 3);
std::cout << v1 + v2;
return 0;
}

View File

@ -1,58 +0,0 @@
#include <iostream>
template<class C>
class Vector;
template<class C>
Vector<C> operator+(const Vector<C>& v1, const Vector<C>& v2);
template<class C>
std::ostream& operator<<(std::ostream& os, const Vector<C>& v);
/*---------------------------------------------------------------------------*\
Class Vector Declaration
\*---------------------------------------------------------------------------*/
template<class C>
class Vector
{
double X, Y;
public:
inline Vector(const double x, const double y);
C x() const
{
return X;
}
C y() const
{
return Y;
}
friend Vector<C> operator+ <C>(const Vector<C>& v1, const Vector<C>& v2);
friend std::ostream& operator<<(std::ostream& os, const Vector<C>& v)
{
os << v.X << '\t' << v.Y << '\n';
return os;
}
};
template<class C>
inline Vector<C>::Vector(const double x, const double y)
{
X = x;
Y = y;
}
template<class C>
inline Vector<C> operator+(const Vector<C>& v1, const Vector<C>& v2)
{
return Vector<C>(v1.X+v2.X, v1.Y+v2.Y);
}

View File

@ -31,6 +31,7 @@ Description
#include "IOstreams.H"
#include "PackedBoolList.H"
#include "IStringStream.H"
#include "dictionary.H"
using namespace Foam;