diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.C b/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.C index 31dcd90033..c59cb023a4 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.C +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.C @@ -65,8 +65,8 @@ Foam::mixedFixedValueSlipFvPatchField::mixedFixedValueSlipFvPatchField ) : transformFvPatchField(ptf, p, iF, mapper), - refValue_(ptf.refValue_, mapper), - valueFraction_(ptf.valueFraction_, mapper) + refValue_(mapper(ptf.refValue_)), + valueFraction_(mapper(ptf.valueFraction_)) {} diff --git a/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C b/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C index 98ac854868..ba7ff7ee04 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C +++ b/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C @@ -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_)) {} diff --git a/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C b/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C index c3a4c98d41..196b5a1654 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C +++ b/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C @@ -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_), diff --git a/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/fixedMultiPhaseHeatFlux/fixedMultiPhaseHeatFluxFvPatchScalarField.C b/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/fixedMultiPhaseHeatFlux/fixedMultiPhaseHeatFluxFvPatchScalarField.C index 7f28c3d746..a19b766aaf 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/fixedMultiPhaseHeatFlux/fixedMultiPhaseHeatFluxFvPatchScalarField.C +++ b/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/fixedMultiPhaseHeatFlux/fixedMultiPhaseHeatFluxFvPatchScalarField.C @@ -73,7 +73,7 @@ fixedMultiPhaseHeatFluxFvPatchScalarField ) : fixedValueFvPatchScalarField(psf, p, iF, mapper), - q_(psf.q_, mapper), + q_(mapper(psf.q_)), relax_(psf.relax_), Tmin_(psf.Tmin_) {} diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/derivedFvPatchFields/tractionDisplacement/tractionDisplacementFvPatchVectorField.C b/applications/solvers/stressAnalysis/solidDisplacementFoam/derivedFvPatchFields/tractionDisplacement/tractionDisplacementFvPatchVectorField.C index 3138dbc410..c63c7c53b6 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/derivedFvPatchFields/tractionDisplacement/tractionDisplacementFvPatchVectorField.C +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/derivedFvPatchFields/tractionDisplacement/tractionDisplacementFvPatchVectorField.C @@ -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_)) {} diff --git a/applications/solvers/stressAnalysis/solidEquilibriumDisplacementFoam/tractionDisplacementCorrection/tractionDisplacementCorrectionFvPatchVectorField.C b/applications/solvers/stressAnalysis/solidEquilibriumDisplacementFoam/tractionDisplacementCorrection/tractionDisplacementCorrectionFvPatchVectorField.C index d621311e74..73fa4722f9 100644 --- a/applications/solvers/stressAnalysis/solidEquilibriumDisplacementFoam/tractionDisplacementCorrection/tractionDisplacementCorrectionFvPatchVectorField.C +++ b/applications/solvers/stressAnalysis/solidEquilibriumDisplacementFoam/tractionDisplacementCorrection/tractionDisplacementCorrectionFvPatchVectorField.C @@ -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_)) {} diff --git a/applications/test/Field/Make/files b/applications/test/Field/Make/files deleted file mode 100644 index f8f0bb64df..0000000000 --- a/applications/test/Field/Make/files +++ /dev/null @@ -1,3 +0,0 @@ -Test-Field.C - -EXE = $(FOAM_USER_APPBIN)/Test-Field diff --git a/applications/test/Field/Make/options b/applications/test/Field/Make/options deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/applications/test/Field/Test-Field.C b/applications/test/Field/Test-Field.C deleted file mode 100644 index 2e037f6a34..0000000000 --- a/applications/test/Field/Test-Field.C +++ /dev/null @@ -1,11 +0,0 @@ -#include "Test-Field.H" - -int main() -{ - Vector v1(1, 2); - Vector v2(2, 3); - - std::cout << v1 + v2; - - return 0; -} diff --git a/applications/test/Field/Test-Field.H b/applications/test/Field/Test-Field.H deleted file mode 100644 index bd6929f838..0000000000 --- a/applications/test/Field/Test-Field.H +++ /dev/null @@ -1,58 +0,0 @@ -#include - -template -class Vector; - -template -Vector operator+(const Vector& v1, const Vector& v2); - -template -std::ostream& operator<<(std::ostream& os, const Vector& v); - - -/*---------------------------------------------------------------------------*\ - Class Vector Declaration -\*---------------------------------------------------------------------------*/ - -template -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 operator+ (const Vector& v1, const Vector& v2); - - friend std::ostream& operator<<(std::ostream& os, const Vector& v) - { - os << v.X << '\t' << v.Y << '\n'; - return os; - } -}; - -template -inline Vector::Vector(const double x, const double y) -{ - X = x; - Y = y; -} - - -template -inline Vector operator+(const Vector& v1, const Vector& v2) -{ - return Vector(v1.X+v2.X, v1.Y+v2.Y); -} diff --git a/applications/test/PackedList4/Test-PackedList4.C b/applications/test/PackedList4/Test-PackedList4.C index 24c0bf5aa9..88ad8efb4e 100644 --- a/applications/test/PackedList4/Test-PackedList4.C +++ b/applications/test/PackedList4/Test-PackedList4.C @@ -31,6 +31,7 @@ Description #include "IOstreams.H" #include "PackedBoolList.H" #include "IStringStream.H" +#include "dictionary.H" using namespace Foam; diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index 40f528be5e..f48855cbb6 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -611,6 +611,7 @@ fields/cloud/cloud.C Fields = fields/Fields +$(Fields)/Field/FieldMapper.C $(Fields)/labelField/labelField.C $(Fields)/scalarField/scalarField.C $(Fields)/vectorField/vectorField.C diff --git a/src/OpenFOAM/fields/Fields/Field/Field.C b/src/OpenFOAM/fields/Fields/Field/Field.C index de9fe9f20b..cfa6a0d00d 100644 --- a/src/OpenFOAM/fields/Fields/Field/Field.C +++ b/src/OpenFOAM/fields/Fields/Field/Field.C @@ -120,88 +120,6 @@ Foam::Field::Field } -template -Foam::Field::Field -( - const UList& mapF, - const FieldMapper& mapper -) -: - List(mapper.size()) -{ - map(mapF, mapper); -} - - -template -Foam::Field::Field -( - const UList& mapF, - const FieldMapper& mapper, - const Type& defaultValue -) -: - List(mapper.size(), defaultValue) -{ - map(mapF, mapper); -} - - -template -Foam::Field::Field -( - const UList& mapF, - const FieldMapper& mapper, - const UList& defaultValues -) -: - List(defaultValues) -{ - map(mapF, mapper); -} - - -template -Foam::Field::Field -( - const tmp>& tmapF, - const FieldMapper& mapper -) -: - List(mapper.size()) -{ - map(tmapF, mapper); -} - - -template -Foam::Field::Field -( - const tmp>& tmapF, - const FieldMapper& mapper, - const Type& defaultValue -) -: - List(mapper.size(), defaultValue) -{ - map(tmapF, mapper); -} - - -template -Foam::Field::Field -( - const tmp>& tmapF, - const FieldMapper& mapper, - const UList& defaultValues -) -: - List(defaultValues) -{ - map(tmapF, mapper); -} - - template Foam::Field::Field(const Field& f) : @@ -387,7 +305,7 @@ void Foam::Field::map template -void Foam::Field::map +void Foam::Field::doMap ( const UList& mapF, const labelListList& mapAddressing, @@ -396,21 +314,9 @@ void Foam::Field::map { Field& f = *this; - if (f.size() != mapAddressing.size()) - { - f.setSize(mapAddressing.size()); - } - - if (mapWeights.size() != mapAddressing.size()) - { - FatalErrorInFunction - << mapWeights.size() << " map size: " << mapAddressing.size() - << abort(FatalError); - } - forAll(f, i) { - const labelList& localAddrs = mapAddressing[i]; + const labelList& localAddrs = mapAddressing[i]; const scalarList& localWeights = mapWeights[i]; f[i] = Zero; @@ -423,6 +329,38 @@ void Foam::Field::map } +template +void Foam::Field::map +( + const UList& mapF, + const labelListList& mapAddressing, + const scalarListList& mapWeights +) +{ + if (this->size() != mapAddressing.size()) + { + this->setSize(mapAddressing.size()); + } + + if (mapWeights.size() != mapAddressing.size()) + { + FatalErrorInFunction + << mapWeights.size() << " map size: " << mapAddressing.size() + << abort(FatalError); + } + + if (static_cast*>(this) == &mapF) + { + Field mapFcpy(mapF); + doMap(mapFcpy, mapAddressing, mapWeights); + } + else + { + doMap(mapF, mapAddressing, mapWeights); + } +} + + template void Foam::Field::map ( @@ -436,77 +374,6 @@ void Foam::Field::map } -template -void Foam::Field::map -( - const UList& mapF, - const FieldMapper& mapper -) -{ - if (mapper.distributed()) - { - // Fetch remote parts of mapF - const mapDistributeBase& distMap = mapper.distributeMap(); - Field newMapF(mapF); - - // Moved flux "flip" functionality to higher level - // if (applyFlip) - // { - // distMap.distribute(newMapF); - // } - // else - { - distMap.distribute(newMapF, noOp()); - } - - if (mapper.direct() && notNull(mapper.directAddressing())) - { - map(newMapF, mapper.directAddressing()); - } - else if (!mapper.direct()) - { - map(newMapF, mapper.addressing(), mapper.weights()); - } - else if (mapper.direct() && isNull(mapper.directAddressing())) - { - // Special case, no local mapper. Assume ordering already correct - // from distribution. Note: this behaviour is different compared - // to local mapper. - this->transfer(newMapF); - this->setSize(mapper.size()); - } - } - else - { - if - ( - mapper.direct() - && notNull(mapper.directAddressing()) - && mapper.directAddressing().size() - ) - { - map(mapF, mapper.directAddressing()); - } - else if (!mapper.direct() && mapper.addressing().size()) - { - map(mapF, mapper.addressing(), mapper.weights()); - } - } -} - - -template -void Foam::Field::map -( - const tmp>& tmapF, - const FieldMapper& mapper -) -{ - map(tmapF(), mapper); - tmapF.clear(); -} - - template void Foam::Field::autoMap ( @@ -536,7 +403,7 @@ void Foam::Field::autoMap || !mapper.direct() ) { - this->map(fCpy, mapper); + mapper(*this, fCpy); } else if (mapper.direct() && isNull(mapper.directAddressing())) { @@ -560,7 +427,7 @@ void Foam::Field::autoMap ) { Field fCpy(*this); - map(fCpy, mapper); + mapper(*this, fCpy); } else { diff --git a/src/OpenFOAM/fields/Fields/Field/Field.H b/src/OpenFOAM/fields/Fields/Field/Field.H index 3ea3eb4430..150f9a909a 100644 --- a/src/OpenFOAM/fields/Fields/Field/Field.H +++ b/src/OpenFOAM/fields/Fields/Field/Field.H @@ -83,6 +83,15 @@ class Field public tmp>::refCount, public List { + // Private member functions + + void doMap + ( + const UList& mapF, + const labelListList& mapAddressing, + const scalarListList& mapWeights + ); + public: @@ -162,54 +171,6 @@ public: const scalarListList& weights ); - //- Construct by mapping from the given field - Field - ( - const UList& mapF, - const FieldMapper& map - ); - - //- Construct by mapping from the given field - Field - ( - const UList& mapF, - const FieldMapper& map, - const Type& defaultValue - ); - - //- Construct by mapping from the given field - Field - ( - const UList& mapF, - const FieldMapper& map, - const UList& defaultValues - ); - - //- Construct by mapping from the given tmp field - Field - ( - const tmp>& tmapF, - const FieldMapper& map - ); - - //- Construct by mapping from the given tmp field. Supplied uniform - // value for unmapped items - Field - ( - const tmp>& tmapF, - const FieldMapper& map, - const Type& defaultValue - ); - - //- Construct by mapping from the given tmp field. Supplied values - // for unmapped items - Field - ( - const tmp>& tmapF, - const FieldMapper& map, - const UList& defaultValues - ); - //- Construct as copy Field(const Field&); @@ -272,20 +233,6 @@ public: const scalarListList& weights ); - //- Map from the given field - void map - ( - const UList& mapF, - const FieldMapper& map - ); - - //- Map from the given tmp field - void map - ( - const tmp>& tmapF, - const FieldMapper& map - ); - //- Map from self void autoMap(const FieldMapper& map); diff --git a/src/OpenFOAM/fields/Fields/Field/FieldMapper.C b/src/OpenFOAM/fields/Fields/Field/FieldMapper.C new file mode 100644 index 0000000000..c30bb1916a --- /dev/null +++ b/src/OpenFOAM/fields/Fields/Field/FieldMapper.C @@ -0,0 +1,167 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2019 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "Field.H" +#include "FieldMapper.H" + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +const Foam::mapDistributeBase& Foam::FieldMapper::distributeMap() const +{ + FatalErrorInFunction + << "attempt to access null distributeMap" + << abort(FatalError); + return *(new mapDistributeBase()); +} + + +const Foam::labelUList& Foam::FieldMapper::directAddressing() const +{ + FatalErrorInFunction + << "attempt to access null direct addressing" + << abort(FatalError); + + return labelUList::null(); +} + + +const Foam::labelListList& Foam::FieldMapper::addressing() const +{ + FatalErrorInFunction + << "attempt to access null interpolation addressing" + << abort(FatalError); + + return labelListList::null(); +} + + +const Foam::scalarListList& Foam::FieldMapper::weights() const +{ + FatalErrorInFunction + << "attempt to access null interpolation weights" + << abort(FatalError); + + return scalarListList::null(); +} + + +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +Foam::tmp> Foam::FieldMapper::operator() +( + const Field& mapF +) const +{ + return map(mapF); +} + + +Foam::tmp> Foam::FieldMapper::operator() +( + const Field& mapF +) const +{ + return map(mapF); +} + + +Foam::tmp> Foam::FieldMapper::operator() +( + const Field& mapF +) const +{ + return map(mapF); +} + + +Foam::tmp> Foam::FieldMapper::operator() +( + const Field& mapF +) const +{ + return map(mapF); +} + + +Foam::tmp> Foam::FieldMapper::operator() +( + const Field& mapF +) const +{ + return map(mapF); +} + + +void Foam::FieldMapper::operator() +( + Field& f, + const Field& mapF +) const +{ + return map(f, mapF); +} + + +void Foam::FieldMapper::operator() +( + Field& f, + const Field& mapF +) const +{ + return map(f, mapF); +} + + +void Foam::FieldMapper::operator() +( + Field& f, + const Field& mapF +) const +{ + return map(f, mapF); +} + + +void Foam::FieldMapper::operator() +( + Field& f, + const Field& mapF +) const +{ + return map(f, mapF); +} + + +void Foam::FieldMapper::operator() +( + Field& f, + const Field& mapF +) const +{ + return map(f, mapF); +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/fields/Fields/Field/FieldMapper.H b/src/OpenFOAM/fields/Fields/Field/FieldMapper.H index 147722c8cb..fb491f2813 100644 --- a/src/OpenFOAM/fields/Fields/Field/FieldMapper.H +++ b/src/OpenFOAM/fields/Fields/Field/FieldMapper.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -45,6 +45,14 @@ namespace Foam class FieldMapper { + // Private member functions + + template + void map(Field& f, const Field& mapF) const; + + template + tmp> map(const Field& f) const; + public: @@ -71,53 +79,82 @@ public: return false; } - virtual const mapDistributeBase& distributeMap() const - { - FatalErrorInFunction - << "attempt to access null distributeMap" - << abort(FatalError); - return *(new mapDistributeBase()); - } + virtual const mapDistributeBase& distributeMap() const; //- Are there unmapped values? I.e. do all size() elements get // get value virtual bool hasUnmapped() const = 0; - virtual const labelUList& directAddressing() const - { - FatalErrorInFunction - << "attempt to access null direct addressing" - << abort(FatalError); + virtual const labelUList& directAddressing() const; - return labelUList::null(); - } + virtual const labelListList& addressing() const; - virtual const labelListList& addressing() const - { - FatalErrorInFunction - << "attempt to access null interpolation addressing" - << abort(FatalError); - - return labelListList::null(); - } - - virtual const scalarListList& weights() const - { - FatalErrorInFunction - << "attempt to access null interpolation weights" - << abort(FatalError); - - return scalarListList::null(); - } + virtual const scalarListList& weights() const; // Member Operators + virtual void operator() + ( + Field& f, + const Field& mapF + ) const; + + virtual void operator() + ( + Field& f, + const Field& mapF + ) const; + + virtual void operator() + ( + Field& f, + const Field& mapF + ) const; + + virtual void operator() + ( + Field& f, + const Field& mapF + ) const; + + virtual void operator() + ( + Field& f, + const Field& mapF + ) const; + template - tmp> operator()(const Field& f) const - { - return tmp>(new Field(f, *this)); - } + void operator()(Field& f, const tmp>& tmapF) const; + + + virtual tmp> operator() + ( + const Field& mapF + ) const; + + virtual tmp> operator() + ( + const Field& mapF + ) const; + + virtual tmp> operator() + ( + const Field& mapF + ) const; + + virtual tmp> operator() + ( + const Field& mapF + ) const; + + virtual tmp> operator() + ( + const Field& mapF + ) const; + + template + tmp> operator()(const tmp>& tmapF) const; }; @@ -127,6 +164,12 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#ifdef NoRepository + #include "FieldMapperTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif // ************************************************************************* // diff --git a/src/OpenFOAM/fields/Fields/Field/FieldMapperTemplates.C b/src/OpenFOAM/fields/Fields/Field/FieldMapperTemplates.C new file mode 100644 index 0000000000..c504c682f2 --- /dev/null +++ b/src/OpenFOAM/fields/Fields/Field/FieldMapperTemplates.C @@ -0,0 +1,125 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2019 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "FieldMapper.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +void Foam::FieldMapper::map(Field& f, const Field& mapF) const +{ + if (distributed()) + { + // Fetch remote parts of mapF + const mapDistributeBase& distMap = distributeMap(); + Field newMapF(mapF); + + // Moved flux "flip" functionality to higher level + // if (applyFlip) + // { + // distMap.distribute(newMapF); + // } + // else + { + distMap.distribute(newMapF, noOp()); + } + + if (direct() && notNull(directAddressing())) + { + f.map(newMapF, directAddressing()); + } + else if (!direct()) + { + f.map(newMapF, addressing(), weights()); + } + else if (direct() && isNull(directAddressing())) + { + // Special case, no local Assume ordering already correct + // from distribution. Note: this behaviour is different compared + // to local + f.transfer(newMapF); + f.setSize(size()); + } + } + else + { + if + ( + direct() + && notNull(directAddressing()) + && directAddressing().size() + ) + { + f.map(mapF, directAddressing()); + } + else if (!direct() && addressing().size()) + { + f.map(mapF, addressing(), weights()); + } + else + { + f.setSize(size()); + } + } +} + + +template +Foam::tmp> Foam::FieldMapper::map +( + const Field& mapF +) const +{ + tmp> tf(new Field(size())); + map(tf.ref(), mapF); + return tf; +} + + +template +void Foam::FieldMapper::operator() +( + Field& f, + const tmp>& tmapF +) const +{ + map(f, tmapF()); + tmapF.clear(); +} + + +template +Foam::tmp> Foam::FieldMapper::operator() +( + const tmp>& tmapF +) const +{ + tmp> tf(map(tmapF())); + tmapF.clear(); + return tf; +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/fields/pointPatchFields/basic/value/valuePointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/basic/value/valuePointPatchField.C index 6f8379725e..4f8a1fbb1b 100644 --- a/src/OpenFOAM/fields/pointPatchFields/basic/value/valuePointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/basic/value/valuePointPatchField.C @@ -100,7 +100,7 @@ Foam::valuePointPatchField::valuePointPatchField ) : pointPatchField(ptf, p, iF, mapper), - Field(ptf, mapper) + Field(mapper(ptf)) {} diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C index 59145d0f6b..93a2e46aa3 100644 --- a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C +++ b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C @@ -193,14 +193,14 @@ externalWallHeatFluxTemperatureFvPatchScalarField case fixedHeatFlux: { q_.setSize(mapper.size()); - q_.map(ptf.q_, mapper); + mapper(q_, ptf.q_); break; } case fixedHeatTransferCoeff: { h_.setSize(mapper.size()); - h_.map(ptf.h_, mapper); + mapper(h_, ptf.h_); break; } @@ -209,7 +209,7 @@ externalWallHeatFluxTemperatureFvPatchScalarField if (qrName_ != "none") { qrPrevious_.setSize(mapper.size()); - qrPrevious_.map(ptf.qrPrevious_, mapper); + mapper(qrPrevious_, ptf.qrPrevious_); } } diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C index 6f7231a8d9..77412b1a6d 100644 --- a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C +++ b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/thermalBaffle1D/thermalBaffle1DFvPatchScalarField.C @@ -73,11 +73,11 @@ thermalBaffle1DFvPatchScalarField mixedFvPatchScalarField(ptf, p, iF, mapper), TName_(ptf.TName_), baffleActivated_(ptf.baffleActivated_), - thickness_(ptf.thickness_, mapper), - Qs_(ptf.Qs_, mapper), + thickness_(mapper(ptf.thickness_)), + Qs_(mapper(ptf.Qs_)), solidDict_(ptf.solidDict_), solidPtr_(ptf.solidPtr_), - qrPrevious_(ptf.qrPrevious_, mapper), + qrPrevious_(mapper(ptf.qrPrevious_)), qrRelaxation_(ptf.qrRelaxation_), qrName_(ptf.qrName_) {} diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C index 255532c0d9..7a44ec7b22 100644 --- a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C +++ b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C @@ -55,8 +55,8 @@ Foam::wallHeatTransferFvPatchScalarField::wallHeatTransferFvPatchScalarField ) : mixedFvPatchScalarField(ptf, p, iF, mapper), - Tinf_(ptf.Tinf_, mapper), - alphaWall_(ptf.alphaWall_, mapper) + Tinf_(mapper(ptf.Tinf_)), + alphaWall_(mapper(ptf.alphaWall_)) {} diff --git a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.C b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.C index 64e4bd16b6..b7a4e092da 100644 --- a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.C +++ b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.C @@ -148,8 +148,8 @@ nutkRoughWallFunctionFvPatchScalarField::nutkRoughWallFunctionFvPatchScalarField ) : nutkWallFunctionFvPatchScalarField(ptf, p, iF, mapper), - Ks_(ptf.Ks_, mapper), - Cs_(ptf.Cs_, mapper) + Ks_(mapper(ptf.Ks_)), + Cs_(mapper(ptf.Cs_)) {} diff --git a/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.C b/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.C index c3ae704f23..30f76fafed 100644 --- a/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.C +++ b/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.C @@ -140,9 +140,9 @@ Foam::atmBoundaryLayer::atmBoundaryLayer Cmu_(abl.Cmu_), Uref_(abl.Uref_), Zref_(abl.Zref_), - z0_(abl.z0_, mapper), - zGround_(abl.zGround_, mapper), - Ustar_(abl.Ustar_, mapper), + z0_(mapper(abl.z0_)), + zGround_(mapper(abl.zGround_)), + Ustar_(mapper(abl.Ustar_)), offset_(abl.offset_), Ulower_(abl.Ulower_), kLower_(abl.kLower_), diff --git a/src/atmosphericModels/derivedFvPatchFields/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C b/src/atmosphericModels/derivedFvPatchFields/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C index 6b433479b8..66e300d2b8 100644 --- a/src/atmosphericModels/derivedFvPatchFields/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C +++ b/src/atmosphericModels/derivedFvPatchFields/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C @@ -108,7 +108,7 @@ nutkAtmRoughWallFunctionFvPatchScalarField ) : nutkWallFunctionFvPatchScalarField(ptf, p, iF, mapper), - z0_(ptf.z0_, mapper) + z0_(mapper(ptf.z0_)) {} diff --git a/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.C b/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.C index 375b954f09..98685e8a1e 100644 --- a/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.C +++ b/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.C @@ -53,7 +53,7 @@ Foam::SRFVelocityFvPatchVectorField::SRFVelocityFvPatchVectorField : fixedValueFvPatchVectorField(ptf, p, iF, mapper), relative_(ptf.relative_), - inletValue_(ptf.inletValue_, mapper) + inletValue_(mapper(ptf.inletValue_)) {} diff --git a/src/finiteVolume/fields/fvPatchFields/basic/directionMixed/directionMixedFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/directionMixed/directionMixedFvPatchField.C index 2d8bdf8651..f9eeb08593 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/directionMixed/directionMixedFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/directionMixed/directionMixedFvPatchField.C @@ -52,9 +52,9 @@ Foam::directionMixedFvPatchField::directionMixedFvPatchField ) : transformFvPatchField(ptf, p, iF, mapper), - refValue_(ptf.refValue_, mapper), - refGrad_(ptf.refGrad_, mapper), - valueFraction_(ptf.valueFraction_, mapper) + refValue_(mapper(ptf.refValue_)), + refGrad_(mapper(ptf.refGrad_)), + valueFraction_(mapper(ptf.valueFraction_)) { if (notNull(iF) && mapper.hasUnmapped()) { diff --git a/src/finiteVolume/fields/fvPatchFields/basic/fixedGradient/fixedGradientFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/fixedGradient/fixedGradientFvPatchField.C index 6541adfeff..4eeaea1fe9 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/fixedGradient/fixedGradientFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/fixedGradient/fixedGradientFvPatchField.C @@ -65,7 +65,7 @@ Foam::fixedGradientFvPatchField::fixedGradientFvPatchField ) : fvPatchField(ptf, p, iF, mapper), - gradient_(ptf.gradient_, mapper) + gradient_(mapper(ptf.gradient_)) { if (notNull(iF) && mapper.hasUnmapped()) { diff --git a/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.C index 7ae35cb37e..2f42f3f19f 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.C @@ -69,9 +69,9 @@ Foam::mixedFvPatchField::mixedFvPatchField ) : fvPatchField(ptf, p, iF, mapper, mappingRequired), - refValue_(ptf.refValue_, mapper), - refGrad_(ptf.refGrad_, mapper), - valueFraction_(ptf.valueFraction_, mapper) + refValue_(mapper(ptf.refValue_)), + refGrad_(mapper(ptf.refGrad_)), + valueFraction_(mapper(ptf.valueFraction_)) { if (mappingRequired && notNull(iF) && mapper.hasUnmapped()) { diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C index 98735eab08..c2d53e00c9 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C @@ -83,7 +83,7 @@ Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField // Map gradient. Set unmapped values and overwrite with mapped ptf gradient() = 0.0; - gradient().map(ptf.gradient(), mapper); + mapper(gradient(), ptf.gradient()); // Evaluate the value field from the gradient if the internal field is valid if (notNull(iF) && iF.size()) @@ -100,7 +100,7 @@ Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField { // Enforce mapping of values so we have a valid starting value. This // constructor is used when reconstructing fields - this->map(ptf, mapper); + mapper(*this, ptf); } } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C index 071700b641..6536907393 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C @@ -49,7 +49,7 @@ Foam::fixedJumpFvPatchField::fixedJumpFvPatchField ) : jumpCyclicFvPatchField(ptf, p, iF, mapper), - jump_(ptf.jump_, mapper) + jump_(mapper(ptf.jump_)) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.C index d183350386..94d8ef0c7e 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.C @@ -49,7 +49,7 @@ Foam::fixedJumpAMIFvPatchField::fixedJumpAMIFvPatchField ) : jumpCyclicAMIFvPatchField(ptf, p, iF, mapper), - jump_(ptf.jump_, mapper) + jump_(mapper(ptf.jump_)) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.C index 215bfb5ca9..95e16c7f48 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.C @@ -51,7 +51,7 @@ Foam::fixedNormalSlipFvPatchField::fixedNormalSlipFvPatchField ) : transformFvPatchField(ptf, p, iF, mapper), - fixedValue_(ptf.fixedValue_, mapper) + fixedValue_(mapper(ptf.fixedValue_)) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.C index 7614723477..b1f5cc5721 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.C @@ -63,7 +63,7 @@ inletOutletTotalTemperatureFvPatchScalarField UName_(ptf.UName_), psiName_(ptf.psiName_), gamma_(ptf.gamma_), - T0_(ptf.T0_, mapper) + T0_(mapper(ptf.T0_)) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/interstitialInletVelocity/interstitialInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/interstitialInletVelocity/interstitialInletVelocityFvPatchVectorField.C index 8461728013..40d36f05e1 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/interstitialInletVelocity/interstitialInletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/interstitialInletVelocity/interstitialInletVelocityFvPatchVectorField.C @@ -54,7 +54,7 @@ interstitialInletVelocityFvPatchVectorField ) : fixedValueFvPatchVectorField(ptf, p, iF, mapper), - inletVelocity_(ptf.inletVelocity_, mapper), + inletVelocity_(mapper(ptf.inletVelocity_)), alphaName_(ptf.alphaName_) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.C index eb255cc755..8352db43d5 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.C @@ -50,7 +50,7 @@ Foam::partialSlipFvPatchField::partialSlipFvPatchField ) : transformFvPatchField(ptf, p, iF, mapper), - valueFraction_(ptf.valueFraction_, mapper) + valueFraction_(mapper(ptf.valueFraction_)) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressure/pressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressure/pressureFvPatchScalarField.C index 5e39d4d1d5..a1743525d9 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressure/pressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressure/pressureFvPatchScalarField.C @@ -75,7 +75,7 @@ Foam::pressureFvPatchScalarField::pressureFvPatchScalarField ) : fixedValueFvPatchScalarField(ptf, p, iF, mapper), - p_(ptf.p_, mapper) + p_(mapper(ptf.p_)) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.C index 1c2a8e76c6..e7ddccc7e5 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.C @@ -61,7 +61,7 @@ pressureDirectedInletOutletVelocityFvPatchVectorField mixedFvPatchVectorField(ptf, p, iF, mapper), phiName_(ptf.phiName_), rhoName_(ptf.rhoName_), - inletDir_(ptf.inletDir_, mapper) + inletDir_(mapper(ptf.inletDir_)) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.C index 625cf0141c..4540d0601d 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.C @@ -58,7 +58,7 @@ pressureDirectedInletVelocityFvPatchVectorField fixedValueFvPatchVectorField(ptf, p, iF, mapper), phiName_(ptf.phiName_), rhoName_(ptf.rhoName_), - inletDir_(ptf.inletDir_, mapper) + inletDir_(mapper(ptf.inletDir_)) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.C index 4f8858a1e4..5763164792 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.C @@ -67,17 +67,13 @@ surfaceNormalFixedValueFvPatchVectorField ) : fixedValueFvPatchVectorField(p, iF), - refValue_(ptf.refValue_, mapper) + refValue_(mapper(ptf.refValue_)) { // Note: calculate product only on ptf to avoid multiplication on // unset values in reconstructPar. fvPatchVectorField::operator= ( - vectorField - ( - ptf.refValue_*ptf.patch().nf(), - mapper - ) + mapper(ptf.refValue_*ptf.patch().nf()) ); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.C index 3224f0b85a..a05bc36c7e 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.C @@ -91,7 +91,7 @@ Foam::totalPressureFvPatchScalarField::totalPressureFvPatchScalarField rhoName_(ptf.rhoName_), psiName_(ptf.psiName_), gamma_(ptf.gamma_), - p0_(ptf.p0_, mapper) + p0_(mapper(ptf.p0_)) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.C index 70cffaf243..59a00d3d4d 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.C @@ -59,7 +59,7 @@ Foam::totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField phiName_(ptf.phiName_), psiName_(ptf.psiName_), gamma_(ptf.gamma_), - T0_(ptf.T0_, mapper) + T0_(mapper(ptf.T0_)) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentInlet/turbulentInletFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/turbulentInlet/turbulentInletFvPatchField.C index 6c7bf67269..9e1df9eb92 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/turbulentInlet/turbulentInletFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentInlet/turbulentInletFvPatchField.C @@ -84,7 +84,7 @@ Foam::turbulentInletFvPatchField::turbulentInletFvPatchField fixedValueFvPatchField(ptf, p, iF, mapper), ranGen_(label(0)), fluctuationScale_(ptf.fluctuationScale_), - referenceField_(ptf.referenceField_, mapper), + referenceField_(mapper(ptf.referenceField_)), alpha_(ptf.alpha_), curTimeIndex_(-1) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.C index 0440bfb32d..93fdef1e20 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformInletOutlet/uniformInletOutletFvPatchField.C @@ -100,7 +100,7 @@ Foam::uniformInletOutletFvPatchField::uniformInletOutletFvPatchField // Initialize the patch value to the refValue fvPatchField::operator=(this->refValue()); - this->map(ptf, mapper); + mapper(*this, ptf); } diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C index 0748438f56..20174304c9 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C @@ -125,7 +125,7 @@ Foam::fvPatchField::fvPatchField { fvPatchField::operator=(this->patchInternalField()); } - this->map(ptf, mapper); + mapper(*this, ptf); } } diff --git a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.C b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.C index 73e17ab150..c70e51946a 100644 --- a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.C +++ b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.C @@ -66,7 +66,7 @@ Foam::fvsPatchField::fvsPatchField const fvPatchFieldMapper& mapper ) : - Field(ptf, mapper), + Field(mapper(ptf)), patch_(p), internalField_(iF) {} diff --git a/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.C b/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.C index 3ed628c548..c038756523 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.C +++ b/src/fvMotionSolver/pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.C @@ -99,7 +99,7 @@ angularOscillatingDisplacementPointPatchVectorField angle0_(ptf.angle0_), amplitude_(ptf.amplitude_), omega_(ptf.omega_), - p0_(ptf.p0_, mapper) + p0_(mapper(ptf.p0_)) {} diff --git a/src/fvMotionSolver/pointPatchFields/derived/oscillatingVelocity/oscillatingVelocityPointPatchVectorField.C b/src/fvMotionSolver/pointPatchFields/derived/oscillatingVelocity/oscillatingVelocityPointPatchVectorField.C index a184ec4055..db6f0ec003 100644 --- a/src/fvMotionSolver/pointPatchFields/derived/oscillatingVelocity/oscillatingVelocityPointPatchVectorField.C +++ b/src/fvMotionSolver/pointPatchFields/derived/oscillatingVelocity/oscillatingVelocityPointPatchVectorField.C @@ -90,7 +90,7 @@ oscillatingVelocityPointPatchVectorField fixedValuePointPatchField(ptf, p, iF, mapper), amplitude_(ptf.amplitude_), omega_(ptf.omega_), - p0_(ptf.p0_, mapper) + p0_(mapper(ptf.p0_)) {} diff --git a/src/genericPatchFields/genericFvPatchField/genericFvPatchField.C b/src/genericPatchFields/genericFvPatchField/genericFvPatchField.C index 09baeefd51..383dd375cf 100644 --- a/src/genericPatchFields/genericFvPatchField/genericFvPatchField.C +++ b/src/genericPatchFields/genericFvPatchField/genericFvPatchField.C @@ -434,7 +434,7 @@ Foam::genericFvPatchField::genericFvPatchField scalarFields_.insert ( iter.key(), - new scalarField(*iter(), mapper) + mapper(*iter()).ptr() ); } @@ -448,7 +448,7 @@ Foam::genericFvPatchField::genericFvPatchField vectorFields_.insert ( iter.key(), - new vectorField(*iter(), mapper) + mapper(*iter()).ptr() ); } @@ -462,7 +462,7 @@ Foam::genericFvPatchField::genericFvPatchField sphericalTensorFields_.insert ( iter.key(), - new sphericalTensorField(*iter(), mapper) + mapper(*iter()).ptr() ); } @@ -476,7 +476,7 @@ Foam::genericFvPatchField::genericFvPatchField symmTensorFields_.insert ( iter.key(), - new symmTensorField(*iter(), mapper) + mapper(*iter()).ptr() ); } @@ -490,7 +490,7 @@ Foam::genericFvPatchField::genericFvPatchField tensorFields_.insert ( iter.key(), - new tensorField(*iter(), mapper) + mapper(*iter()).ptr() ); } } diff --git a/src/genericPatchFields/genericPointPatchField/genericPointPatchField.C b/src/genericPatchFields/genericPointPatchField/genericPointPatchField.C index 694ed113e2..304084ef1a 100644 --- a/src/genericPatchFields/genericPointPatchField/genericPointPatchField.C +++ b/src/genericPatchFields/genericPointPatchField/genericPointPatchField.C @@ -325,7 +325,7 @@ Foam::genericPointPatchField::genericPointPatchField scalarFields_.insert ( iter.key(), - new scalarField(*iter(), mapper) + mapper(*iter()).ptr() ); } @@ -339,7 +339,7 @@ Foam::genericPointPatchField::genericPointPatchField vectorFields_.insert ( iter.key(), - new vectorField(*iter(), mapper) + mapper(*iter()).ptr() ); } @@ -353,7 +353,7 @@ Foam::genericPointPatchField::genericPointPatchField sphericalTensorFields_.insert ( iter.key(), - new sphericalTensorField(*iter(), mapper) + mapper(*iter()).ptr() ); } @@ -367,7 +367,7 @@ Foam::genericPointPatchField::genericPointPatchField symmTensorFields_.insert ( iter.key(), - new symmTensorField(*iter(), mapper) + mapper(*iter()).ptr() ); } @@ -381,7 +381,7 @@ Foam::genericPointPatchField::genericPointPatchField tensorFields_.insert ( iter.key(), - new tensorField(*iter(), mapper) + mapper(*iter()).ptr() ); } } diff --git a/src/parallel/decompose/decompose/fvFieldDecomposerDecomposeFields.C b/src/parallel/decompose/decompose/fvFieldDecomposerDecomposeFields.C index b433687b24..529045d18e 100644 --- a/src/parallel/decompose/decompose/fvFieldDecomposerDecomposeFields.C +++ b/src/parallel/decompose/decompose/fvFieldDecomposerDecomposeFields.C @@ -146,10 +146,9 @@ Foam::fvFieldDecomposer::decomposeField ( procPatch, resF(), - Field + (*processorVolPatchFieldDecomposerPtrs_[patchi]) ( - field.primitiveField(), - *processorVolPatchFieldDecomposerPtrs_[patchi] + field.primitiveField() ) ) ); @@ -163,10 +162,9 @@ Foam::fvFieldDecomposer::decomposeField ( procPatch, resF(), - Field + (*processorVolPatchFieldDecomposerPtrs_[patchi]) ( - field.primitiveField(), - *processorVolPatchFieldDecomposerPtrs_[patchi] + field.primitiveField() ) ) ); diff --git a/src/radiationModels/derivedFvPatchFields/MarshakRadiationFixedTemperature/MarshakRadiationFixedTemperatureFvPatchScalarField.C b/src/radiationModels/derivedFvPatchFields/MarshakRadiationFixedTemperature/MarshakRadiationFixedTemperatureFvPatchScalarField.C index e704d9d02f..4ce94bed01 100644 --- a/src/radiationModels/derivedFvPatchFields/MarshakRadiationFixedTemperature/MarshakRadiationFixedTemperatureFvPatchScalarField.C +++ b/src/radiationModels/derivedFvPatchFields/MarshakRadiationFixedTemperature/MarshakRadiationFixedTemperatureFvPatchScalarField.C @@ -66,7 +66,7 @@ MarshakRadiationFixedTemperatureFvPatchScalarField ptf.emissivity_, mapper ), - Trad_(ptf.Trad_, mapper) + Trad_(mapper(ptf.Trad_)) {} diff --git a/src/radiationModels/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.C b/src/radiationModels/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.C index 6969ebb4f1..a5bb8cd706 100644 --- a/src/radiationModels/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.C +++ b/src/radiationModels/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.C @@ -61,7 +61,7 @@ greyDiffusiveViewFactorFixedValueFvPatchScalarField ptf.emissivity_, mapper ), - qro_(ptf.qro_, mapper) + qro_(mapper(ptf.qro_)) {} diff --git a/src/radiationModels/derivedFvPatchFields/radiationCoupledBase/radiationCoupledBase.C b/src/radiationModels/derivedFvPatchFields/radiationCoupledBase/radiationCoupledBase.C index 45947c6973..426ba7fdae 100644 --- a/src/radiationModels/derivedFvPatchFields/radiationCoupledBase/radiationCoupledBase.C +++ b/src/radiationModels/derivedFvPatchFields/radiationCoupledBase/radiationCoupledBase.C @@ -81,7 +81,7 @@ Foam::radiationCoupledBase::radiationCoupledBase : patch_(patch), method_(emissivityMethodTypeNames_[calculationType]), - emissivity_(emissivity, mapper) + emissivity_(mapper(emissivity)) {} diff --git a/src/transportModels/twoPhaseProperties/alphaFixedPressure/alphaFixedPressureFvPatchScalarField.C b/src/transportModels/twoPhaseProperties/alphaFixedPressure/alphaFixedPressureFvPatchScalarField.C index 6820eb9275..0f0b70cf7a 100644 --- a/src/transportModels/twoPhaseProperties/alphaFixedPressure/alphaFixedPressureFvPatchScalarField.C +++ b/src/transportModels/twoPhaseProperties/alphaFixedPressure/alphaFixedPressureFvPatchScalarField.C @@ -54,7 +54,7 @@ alphaFixedPressureFvPatchScalarField ) : fixedValueFvPatchScalarField(ptf, p, iF, mapper), - p_(ptf.p_, mapper) + p_(mapper(ptf.p_)) {}