fvPatchField, fvsPatchField, pointPatchField: Generalised in-place mapping
The patch field 'autoMap' and 'rmap' functions have been replaced with a
single 'map' function that can used to do any form of in-place
patch-to-patch mapping. The exact form of mapping is now controlled
entirely by the mapper object.
An example 'map' function is shown below:
void nutkRoughWallFunctionFvPatchScalarField::map
(
const fvPatchScalarField& ptf,
const fvPatchFieldMapper& mapper
)
{
nutkWallFunctionFvPatchScalarField::map(ptf, mapper);
const nutkRoughWallFunctionFvPatchScalarField& nrwfpsf =
refCast<const nutkRoughWallFunctionFvPatchScalarField>(ptf);
mapper(Ks_, nrwfpsf.Ks_);
mapper(Cs_, nrwfpsf.Cs_);
}
This single function replaces these two previous functions:
void nutkRoughWallFunctionFvPatchScalarField::autoMap
(
const fvPatchFieldMapper& m
)
{
nutkWallFunctionFvPatchScalarField::autoMap(m);
m(Ks_, Ks_);
m(Cs_, Cs_);
}
void nutkRoughWallFunctionFvPatchScalarField::rmap
(
const fvPatchScalarField& ptf,
const labelList& addr
)
{
nutkWallFunctionFvPatchScalarField::rmap(ptf, addr);
const nutkRoughWallFunctionFvPatchScalarField& nrwfpsf =
refCast<const nutkRoughWallFunctionFvPatchScalarField>(ptf);
Ks_.rmap(nrwfpsf.Ks_, addr);
Cs_.rmap(nrwfpsf.Cs_, addr);
}
Calls to 'autoMap' should be replaced with calls to 'map' with the same
mapper object and the patch field itself provided as the source. Calls
to 'rmap' should be replaced with calls to 'map' by wrapping the
addressing in a 'reverseFvPatchFieldMapper' (or
'reversePointPatchFieldMapper') object.
This change simplifies the creation of new patch fields and hence
improves extensibility. It also provides more options regarding general
mapping strategies between patches. Previously, general abstracted
mapping was only possible in 'autoMap'; i.e., from a patch to itself.
Now, general mapping is possible between different patches.
This commit is contained in:
@ -781,41 +781,24 @@ alphatWallBoilingWallFunctionFvPatchScalarField
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void alphatWallBoilingWallFunctionFvPatchScalarField::autoMap
|
||||
(
|
||||
const fvPatchFieldMapper& m
|
||||
)
|
||||
{
|
||||
fixedValueFvPatchScalarField::autoMap(m);
|
||||
|
||||
m(wetFraction_, wetFraction_);
|
||||
m(dDeparture_, dDeparture_);
|
||||
m(fDeparture_, fDeparture_);
|
||||
m(nucleationSiteDensity_, nucleationSiteDensity_);
|
||||
m(qQuenching_, qQuenching_);
|
||||
m(qEvaporative_, qEvaporative_);
|
||||
m(dmdtf_, dmdtf_);
|
||||
}
|
||||
|
||||
|
||||
void alphatWallBoilingWallFunctionFvPatchScalarField::rmap
|
||||
void alphatWallBoilingWallFunctionFvPatchScalarField::map
|
||||
(
|
||||
const fvPatchScalarField& ptf,
|
||||
const labelList& addr
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
{
|
||||
fixedValueFvPatchScalarField::rmap(ptf, addr);
|
||||
fixedValueFvPatchScalarField::map(ptf, mapper);
|
||||
|
||||
const alphatWallBoilingWallFunctionFvPatchScalarField& tiptf =
|
||||
refCast<const alphatWallBoilingWallFunctionFvPatchScalarField>(ptf);
|
||||
|
||||
wetFraction_.rmap(tiptf.wetFraction_, addr);
|
||||
dDeparture_.rmap(tiptf.dDeparture_, addr);
|
||||
fDeparture_.rmap(tiptf.fDeparture_, addr);
|
||||
nucleationSiteDensity_.rmap(tiptf.nucleationSiteDensity_, addr);
|
||||
qQuenching_.rmap(tiptf.qQuenching_, addr);
|
||||
qEvaporative_.rmap(tiptf.qEvaporative_, addr);
|
||||
dmdtf_.rmap(tiptf.dmdtf_, addr);
|
||||
mapper(wetFraction_, tiptf.wetFraction_);
|
||||
mapper(dDeparture_, tiptf.dDeparture_);
|
||||
mapper(fDeparture_, tiptf.fDeparture_);
|
||||
mapper(nucleationSiteDensity_, tiptf.nucleationSiteDensity_);
|
||||
mapper(qQuenching_, tiptf.qQuenching_);
|
||||
mapper(qEvaporative_, tiptf.qEvaporative_);
|
||||
mapper(dmdtf_, tiptf.dmdtf_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -400,13 +400,12 @@ public:
|
||||
|
||||
// Mapping functions
|
||||
|
||||
//- Map (and resize as needed) from self given a mapping object
|
||||
// Used to update fields following mesh topology change
|
||||
virtual void autoMap(const fvPatchFieldMapper&);
|
||||
|
||||
//- Reverse map the given fvPatchField onto this fvPatchField
|
||||
// Used to reconstruct fields
|
||||
virtual void rmap(const fvPatchScalarField&, const labelList&);
|
||||
//- Map the given fvPatchField onto this fvPatchField
|
||||
virtual void map
|
||||
(
|
||||
const fvPatchScalarField&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Reset the fvPatchField to the given fvPatchField
|
||||
// Used for mesh to mesh mapping
|
||||
|
||||
@ -135,28 +135,18 @@ Foam::smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::smoluchowskiJumpTFvPatchScalarField::autoMap
|
||||
(
|
||||
const fvPatchFieldMapper& m
|
||||
)
|
||||
{
|
||||
mixedFvPatchScalarField::autoMap(m);
|
||||
m(Twall_, Twall_);
|
||||
}
|
||||
|
||||
|
||||
void Foam::smoluchowskiJumpTFvPatchScalarField::rmap
|
||||
void Foam::smoluchowskiJumpTFvPatchScalarField::map
|
||||
(
|
||||
const fvPatchField<scalar>& ptf,
|
||||
const labelList& addr
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
{
|
||||
mixedFvPatchField<scalar>::rmap(ptf, addr);
|
||||
mixedFvPatchField<scalar>::map(ptf, mapper);
|
||||
|
||||
const smoluchowskiJumpTFvPatchScalarField& ptpsf =
|
||||
refCast<const smoluchowskiJumpTFvPatchScalarField>(ptf);
|
||||
|
||||
Twall_.rmap(ptpsf.Twall_, addr);
|
||||
mapper(Twall_, ptpsf.Twall_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -131,13 +131,12 @@ public:
|
||||
|
||||
// Mapping functions
|
||||
|
||||
//- Map (and resize as needed) from self given a mapping object
|
||||
// Used to update fields following mesh topology change
|
||||
virtual void autoMap(const fvPatchFieldMapper&);
|
||||
|
||||
//- Reverse map the given fvPatchField onto this fvPatchField
|
||||
// Used to reconstruct fields
|
||||
virtual void rmap(const fvPatchScalarField&, const labelList&);
|
||||
//- Map the given fvPatchField onto this fvPatchField
|
||||
virtual void map
|
||||
(
|
||||
const fvPatchScalarField&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Reset the fvPatchField to the given fvPatchField
|
||||
// Used for mesh to mesh mapping
|
||||
|
||||
@ -143,28 +143,18 @@ Foam::maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::maxwellSlipUFvPatchVectorField::autoMap
|
||||
(
|
||||
const fvPatchFieldMapper& m
|
||||
)
|
||||
{
|
||||
mixedFixedValueSlipFvPatchVectorField::autoMap(m);
|
||||
m(Uwall_, Uwall_);
|
||||
}
|
||||
|
||||
|
||||
void Foam::maxwellSlipUFvPatchVectorField::rmap
|
||||
void Foam::maxwellSlipUFvPatchVectorField::map
|
||||
(
|
||||
const fvPatchVectorField& pvf,
|
||||
const labelList& addr
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
{
|
||||
mixedFixedValueSlipFvPatchVectorField::rmap(pvf, addr);
|
||||
mixedFixedValueSlipFvPatchVectorField::map(pvf, mapper);
|
||||
|
||||
const maxwellSlipUFvPatchVectorField& mspvf =
|
||||
refCast<const maxwellSlipUFvPatchVectorField>(pvf);
|
||||
|
||||
Uwall_.rmap(mspvf.Uwall_, addr);
|
||||
mapper(Uwall_, mspvf.Uwall_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -136,13 +136,12 @@ public:
|
||||
|
||||
// Mapping functions
|
||||
|
||||
//- Map (and resize as needed) from self given a mapping object
|
||||
// Used to update fields following mesh topology change
|
||||
virtual void autoMap(const fvPatchFieldMapper&);
|
||||
|
||||
//- Reverse map the given fvPatchField onto this fvPatchField
|
||||
// Used to reconstruct fields
|
||||
virtual void rmap(const fvPatchVectorField&, const labelList&);
|
||||
//- Map the given fvPatchField onto this fvPatchField
|
||||
virtual void map
|
||||
(
|
||||
const fvPatchVectorField&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Reset the fvPatchField to the given fvPatchField
|
||||
// Used for mesh to mesh mapping
|
||||
|
||||
@ -86,31 +86,19 @@ Foam::mixedFixedValueSlipFvPatchField<Type>::mixedFixedValueSlipFvPatchField
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::mixedFixedValueSlipFvPatchField<Type>::autoMap
|
||||
(
|
||||
const fvPatchFieldMapper& m
|
||||
)
|
||||
{
|
||||
m(*this, *this);
|
||||
m(refValue_, refValue_);
|
||||
m(valueFraction_, valueFraction_);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::mixedFixedValueSlipFvPatchField<Type>::rmap
|
||||
void Foam::mixedFixedValueSlipFvPatchField<Type>::map
|
||||
(
|
||||
const fvPatchField<Type>& ptf,
|
||||
const labelList& addr
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
{
|
||||
transformFvPatchField<Type>::rmap(ptf, addr);
|
||||
transformFvPatchField<Type>::map(ptf, mapper);
|
||||
|
||||
const mixedFixedValueSlipFvPatchField<Type>& dmptf =
|
||||
refCast<const mixedFixedValueSlipFvPatchField<Type>>(ptf);
|
||||
|
||||
refValue_.rmap(dmptf.refValue_, addr);
|
||||
valueFraction_.rmap(dmptf.valueFraction_, addr);
|
||||
mapper(refValue_, dmptf.refValue_);
|
||||
mapper(valueFraction_, dmptf.valueFraction_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -85,7 +85,7 @@ public:
|
||||
);
|
||||
|
||||
//- Construct by mapping given mixedFixedValueSlipFvPatchField
|
||||
//- Onto a new patch
|
||||
// onto a new patch
|
||||
mixedFixedValueSlipFvPatchField
|
||||
(
|
||||
const mixedFixedValueSlipFvPatchField<Type>&,
|
||||
@ -132,13 +132,12 @@ public:
|
||||
|
||||
// Mapping functions
|
||||
|
||||
//- Map (and resize as needed) from self given a mapping object
|
||||
// Used to update fields following mesh topology change
|
||||
virtual void autoMap(const fvPatchFieldMapper&);
|
||||
|
||||
//- Reverse map the given fvPatchField onto this fvPatchField
|
||||
// Used to reconstruct fields
|
||||
virtual void rmap(const fvPatchField<Type>&, const labelList&);
|
||||
//- Map the given fvPatchField onto this fvPatchField
|
||||
virtual void map
|
||||
(
|
||||
const fvPatchField<Type>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Reset the fvPatchField to the given fvPatchField
|
||||
// Used for mesh to mesh mapping
|
||||
|
||||
@ -91,28 +91,18 @@ tractionDisplacementFvPatchVectorField
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::tractionDisplacementFvPatchVectorField::autoMap
|
||||
(
|
||||
const fvPatchFieldMapper& m
|
||||
)
|
||||
{
|
||||
fixedGradientFvPatchVectorField::autoMap(m);
|
||||
m(traction_, traction_);
|
||||
}
|
||||
|
||||
|
||||
void Foam::tractionDisplacementFvPatchVectorField::rmap
|
||||
void Foam::tractionDisplacementFvPatchVectorField::map
|
||||
(
|
||||
const fvPatchVectorField& ptf,
|
||||
const labelList& addr
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
{
|
||||
fixedGradientFvPatchVectorField::rmap(ptf, addr);
|
||||
fixedGradientFvPatchVectorField::map(ptf, mapper);
|
||||
|
||||
const tractionDisplacementFvPatchVectorField& dmptf =
|
||||
refCast<const tractionDisplacementFvPatchVectorField>(ptf);
|
||||
|
||||
traction_.rmap(dmptf.traction_, addr);
|
||||
mapper(traction_, dmptf.traction_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -141,13 +141,12 @@ public:
|
||||
|
||||
// Mapping functions
|
||||
|
||||
//- Map (and resize as needed) from self given a mapping object
|
||||
// Used to update fields following mesh topology change
|
||||
virtual void autoMap(const fvPatchFieldMapper&);
|
||||
|
||||
//- Reverse map the given fvPatchField onto this fvPatchField
|
||||
// Used to reconstruct fields
|
||||
virtual void rmap(const fvPatchVectorField&, const labelList&);
|
||||
//- Map the given fvPatchField onto this fvPatchField
|
||||
virtual void map
|
||||
(
|
||||
const fvPatchVectorField&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Reset the fvPatchField to the given fvPatchField
|
||||
// Used for mesh to mesh mapping
|
||||
|
||||
Reference in New Issue
Block a user