diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index dc8e946baaa521831ae24613b400dc5f9d249d78..033dd4f62c9fa5d76b5aef01198c171fc6b0e385 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -367,6 +367,8 @@ $(cellShape)/cellShapeIOList.C meshes/Identifiers/patch/patchIdentifier.C +meshes/MeshObject/meshObject.C + polyMesh = meshes/polyMesh polyPatches = $(polyMesh)/polyPatches diff --git a/src/OpenFOAM/containers/Lists/PtrList/PtrListI.H b/src/OpenFOAM/containers/Lists/PtrList/PtrListI.H index 3f29e9238f3cfa971f5711667501d76d1e15f45e..979e862d4a7c59e8eeb26e69d741bcbf750cd19e 100644 --- a/src/OpenFOAM/containers/Lists/PtrList/PtrListI.H +++ b/src/OpenFOAM/containers/Lists/PtrList/PtrListI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -132,7 +132,9 @@ inline const T& Foam::PtrList<T>::operator[](const label i) const if (!ptrs_[i]) { FatalErrorIn("PtrList::operator[] const") - << "hanging pointer, cannot dereference" + << "hanging pointer at index " << i + << " (size " << size() + << "), cannot dereference" << abort(FatalError); } @@ -146,7 +148,9 @@ inline T& Foam::PtrList<T>::operator[](const label i) if (!ptrs_[i]) { FatalErrorIn("PtrList::operator[]") - << "hanging pointer, cannot dereference" + << "hanging pointer at index " << i + << " (size " << size() + << "), cannot dereference" << abort(FatalError); } diff --git a/src/OpenFOAM/containers/Lists/UPtrList/UPtrListI.H b/src/OpenFOAM/containers/Lists/UPtrList/UPtrListI.H index dceeb1f279689244ad354d32499c951b5f43450e..38bb43093148519ad6353b9fd4fd423267fa3ff5 100644 --- a/src/OpenFOAM/containers/Lists/UPtrList/UPtrListI.H +++ b/src/OpenFOAM/containers/Lists/UPtrList/UPtrListI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -107,7 +107,9 @@ inline const T& Foam::UPtrList<T>::operator[](const label i) const if (!ptrs_[i]) { FatalErrorIn("UPtrList::operator[] const") - << "hanging pointer, cannot dereference" + << "hanging pointer at index " << i + << " (size " << size() + << "), cannot dereference" << abort(FatalError); } @@ -121,7 +123,9 @@ inline T& Foam::UPtrList<T>::operator[](const label i) if (!ptrs_[i]) { FatalErrorIn("UPtrList::operator[]") - << "hanging pointer, cannot dereference" + << "hanging pointer at index " << i + << " (size " << size() + << "), cannot dereference" << abort(FatalError); } diff --git a/src/OpenFOAM/meshes/MeshObject/MeshObject.C b/src/OpenFOAM/meshes/MeshObject/MeshObject.C index 8f25049242ab9fcb1ce33f5458ede1f52c20ef0b..01e86da379045050f220dc211d2c4e5ba2a7beb5 100644 --- a/src/OpenFOAM/meshes/MeshObject/MeshObject.C +++ b/src/OpenFOAM/meshes/MeshObject/MeshObject.C @@ -25,6 +25,7 @@ License #include "MeshObject.H" #include "objectRegistry.H" +#include "IOstreams.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -59,6 +60,11 @@ const Type& Foam::MeshObject<Mesh, MeshObjectType, Type>::New } else { + if (meshObject::debug) + { + Pout<< "MeshObject::New(const Mesh&) : constructing new " + << Type::typeName << endl; + } return regIOobject::store(new Type(mesh)); } } @@ -87,6 +93,11 @@ const Type& Foam::MeshObject<Mesh, MeshObjectType, Type>::New } else { + if (meshObject::debug) + { + Pout<< "MeshObject::New(const Mesh&) : constructing new " + << Type::typeName << endl; + } return regIOobject::store(new Type(mesh, d)); } } @@ -116,6 +127,11 @@ const Type& Foam::MeshObject<Mesh, MeshObjectType, Type>::New } else { + if (meshObject::debug) + { + Pout<< "MeshObject(const Mesh&) : constructing new " + << Type::typeName << endl; + } return regIOobject::store(new Type(mesh, d1, d2)); } } @@ -146,6 +162,11 @@ const Type& Foam::MeshObject<Mesh, MeshObjectType, Type>::New } else { + if (meshObject::debug) + { + Pout<< "MeshObject(const Mesh&) : constructing new " + << Type::typeName << endl; + } return regIOobject::store(new Type(mesh, d1, d2, d3)); } } @@ -177,6 +198,11 @@ const Type& Foam::MeshObject<Mesh, MeshObjectType, Type>::New } else { + if (meshObject::debug) + { + Pout<< "MeshObject(const Mesh&) : constructing new " + << Type::typeName << endl; + } return regIOobject::store(new Type(mesh, d1, d2, d3, d4)); } } @@ -195,6 +221,12 @@ bool Foam::MeshObject<Mesh, MeshObjectType, Type>::Delete(const Mesh& mesh) ) ) { + if (meshObject::debug) + { + Pout<< "MeshObject::Delete(const Mesh&) : deleting " + << Type::typeName << endl; + } + return mesh.thisDb().checkOut ( const_cast<Type&> @@ -237,10 +269,22 @@ void Foam::meshObject::movePoints(objectRegistry& obr) { if (isA<MoveableMeshObject<Mesh> >(*iter())) { + if (meshObject::debug) + { + Pout<< "meshObject::movePoints(objectRegistry&) :" + << " movePoints on " + << iter()->name() << endl; + } dynamic_cast<MoveableMeshObject<Mesh>*>(iter())->movePoints(); } else { + if (meshObject::debug) + { + Pout<< "meshObject::movePoints(objectRegistry&) :" + << " destroying " + << iter()->name() << endl; + } obr.checkOut(*iter()); } } @@ -264,10 +308,21 @@ void Foam::meshObject::updateMesh(objectRegistry& obr, const mapPolyMesh& mpm) { if (isA<UpdateableMeshObject<Mesh> >(*iter())) { + if (meshObject::debug) + { + Pout<< "meshObject::updateMesh(objectRegistry&) :" + << " updateMesh on " + << iter()->name() << endl; + } dynamic_cast<UpdateableMeshObject<Mesh>*>(iter())->updateMesh(mpm); } else { + if (meshObject::debug) + { + Pout<< "meshObject::updateMesh(objectRegistry&) : destroying " + << iter()->name() << endl; + } obr.checkOut(*iter()); } } @@ -284,6 +339,11 @@ void Foam::meshObject::clear(objectRegistry& obr) forAllIter(typename HashTable<MeshObjectType<Mesh>*>, meshObjects, iter) { + if (meshObject::debug) + { + Pout<< "meshObject::clear(objectRegistry&) : destroying " + << iter()->name() << endl; + } obr.checkOut(*iter()); } } diff --git a/src/OpenFOAM/meshes/MeshObject/MeshObject.H b/src/OpenFOAM/meshes/MeshObject/MeshObject.H index 8efa89f944e9ac5e3ddd5aa6a8ac292db0aa3e18..b95c631e52fe1147c297d3d2645ad93130fe6d2a 100644 --- a/src/OpenFOAM/meshes/MeshObject/MeshObject.H +++ b/src/OpenFOAM/meshes/MeshObject/MeshObject.H @@ -164,20 +164,12 @@ class meshObject { public: + // Declare name of the class and its debug switch + ClassName("meshObject"); + // Constructors - meshObject(const word& typeName, const objectRegistry& obr) - : - regIOobject - ( - IOobject - ( - typeName, - obr.instance(), - obr - ) - ) - {} + meshObject(const word& typeName, const objectRegistry& obr); // Static member functions diff --git a/src/OpenFOAM/meshes/MeshObject/meshObject.C b/src/OpenFOAM/meshes/MeshObject/meshObject.C new file mode 100644 index 0000000000000000000000000000000000000000..7130f38b5dfd738ff2d9ef9b4c6f2316dc24badd --- /dev/null +++ b/src/OpenFOAM/meshes/MeshObject/meshObject.C @@ -0,0 +1,52 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2013 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "MeshObject.H" + +/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */ + +namespace Foam +{ + defineTypeNameAndDebug(meshObject, 0); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::meshObject::meshObject(const word& typeName, const objectRegistry& obr) +: + regIOobject + ( + IOobject + ( + typeName, + obr.instance(), + obr + ) + ) +{} + + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedFieldFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedFieldFvPatchField.C index bd15d4764ad68e6b1de1b23dcb2558de80e89348..5d359bc691550b2a9c65b443acf2d5bbf4937571 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedFieldFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedFieldFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -42,12 +42,9 @@ mappedFieldFvPatchField<Type>::mappedFieldFvPatchField const DimensionedField<Type, volMesh>& iF ) : - mappedPatchBase(p.patch()), fixedValueFvPatchField<Type>(p, iF), - fieldName_(iF.name()), - setAverage_(false), - average_(pTraits<Type>::zero), - interpolationScheme_(interpolationCell<Type>::typeName) + mappedPatchBase(p.patch()), + mappedPatchFieldBase<Type>(*this, *this) {} @@ -60,12 +57,9 @@ mappedFieldFvPatchField<Type>::mappedFieldFvPatchField const fvPatchFieldMapper& mapper ) : - mappedPatchBase(p.patch(), ptf), fixedValueFvPatchField<Type>(ptf, p, iF, mapper), - fieldName_(ptf.fieldName_), - setAverage_(ptf.setAverage_), - average_(ptf.average_), - interpolationScheme_(ptf.interpolationScheme_) + mappedPatchBase(p.patch(), ptf), + mappedPatchFieldBase<Type>(*this, *this, ptf) {} @@ -77,18 +71,10 @@ mappedFieldFvPatchField<Type>::mappedFieldFvPatchField const dictionary& dict ) : - mappedPatchBase(p.patch(), dict), fixedValueFvPatchField<Type>(p, iF, dict), - fieldName_(dict.template lookupOrDefault<word>("fieldName", iF.name())), - setAverage_(readBool(dict.lookup("setAverage"))), - average_(pTraits<Type>(dict.lookup("average"))), - interpolationScheme_(interpolationCell<Type>::typeName) -{ - if (mode() == mappedPatchBase::NEARESTCELL) - { - dict.lookup("interpolationScheme") >> interpolationScheme_; - } -} + mappedPatchBase(p.patch(), dict), + mappedPatchFieldBase<Type>(*this, *this, dict) +{} template<class Type> @@ -110,6 +96,7 @@ mappedFieldFvPatchField<Type>::mappedFieldFvPatchField const word& interpolationScheme ) : + fixedValueFvPatchField<Type>(p, iF), mappedPatchBase ( p.patch(), @@ -118,11 +105,15 @@ mappedFieldFvPatchField<Type>::mappedFieldFvPatchField samplePatch, distance ), - fixedValueFvPatchField<Type>(p, iF), - fieldName_(fieldName), - setAverage_(setAverage), - average_(average), - interpolationScheme_(interpolationScheme) + mappedPatchFieldBase<Type> + ( + *this, + *this, + fieldName, + setAverage, + average, + interpolationScheme + ) {} @@ -132,12 +123,9 @@ mappedFieldFvPatchField<Type>::mappedFieldFvPatchField const mappedFieldFvPatchField<Type>& ptf ) : - mappedPatchBase(ptf.patch().patch(), ptf), fixedValueFvPatchField<Type>(ptf), - fieldName_(ptf.fieldName_), - setAverage_(ptf.setAverage_), - average_(ptf.average_), - interpolationScheme_(ptf.interpolationScheme_) + mappedPatchBase(ptf.patch().patch(), ptf), + mappedPatchFieldBase<Type>(ptf) {} @@ -148,65 +136,14 @@ mappedFieldFvPatchField<Type>::mappedFieldFvPatchField const DimensionedField<Type, volMesh>& iF ) : - mappedPatchBase(ptf.patch().patch(), ptf), fixedValueFvPatchField<Type>(ptf, iF), - fieldName_(ptf.fieldName_), - setAverage_(ptf.setAverage_), - average_(ptf.average_), - interpolationScheme_(ptf.interpolationScheme_) + mappedPatchBase(ptf.patch().patch(), ptf), + mappedPatchFieldBase<Type>(*this, *this, ptf) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template<class Type> -const GeometricField<Type, fvPatchField, volMesh>& -mappedFieldFvPatchField<Type>::sampleField() const -{ - typedef GeometricField<Type, fvPatchField, volMesh> fieldType; - - const fvMesh& nbrMesh = refCast<const fvMesh>(sampleMesh()); - - if (sameRegion()) - { - if (fieldName_ == this->dimensionedInternalField().name()) - { - // Optimisation: bypass field lookup - return - dynamic_cast<const fieldType&> - ( - this->dimensionedInternalField() - ); - } - else - { - const fvMesh& thisMesh = this->patch().boundaryMesh().mesh(); - return thisMesh.template lookupObject<fieldType>(fieldName_); - } - } - else - { - return nbrMesh.template lookupObject<fieldType>(fieldName_); - } -} - - -template<class Type> -const interpolation<Type>& -mappedFieldFvPatchField<Type>::interpolator() const -{ - if (!interpolator_.valid()) - { - interpolator_ = interpolation<Type>::New - ( - interpolationScheme_, - sampleField() - ); - } - return interpolator_(); -} - - template<class Type> void mappedFieldFvPatchField<Type>::updateCoeffs() { @@ -215,132 +152,7 @@ void mappedFieldFvPatchField<Type>::updateCoeffs() return; } - typedef GeometricField<Type, fvPatchField, volMesh> fieldType; - - // Since we're inside initEvaluate/evaluate there might be processor - // comms underway. Change the tag we use. - int oldTag = UPstream::msgType(); - UPstream::msgType() = oldTag + 1; - - const fvMesh& thisMesh = this->patch().boundaryMesh().mesh(); - const fvMesh& nbrMesh = refCast<const fvMesh>(sampleMesh()); - - // Result of obtaining remote values - Field<Type> newValues; - - switch (mode()) - { - case NEARESTCELL: - { - const mapDistribute& mapDist = this->mappedPatchBase::map(); - - if (interpolationScheme_ != interpolationCell<Type>::typeName) - { - // Need to do interpolation so need cells to sample - - // Send back sample points to the processor that holds the cell - vectorField samples(samplePoints()); - mapDist.reverseDistribute - ( - (sameRegion() ? thisMesh.nCells() : nbrMesh.nCells()), - point::max, - samples - ); - - const interpolation<Type>& interp = interpolator(); - - newValues.setSize(samples.size(), pTraits<Type>::max); - forAll(samples, cellI) - { - if (samples[cellI] != point::max) - { - newValues[cellI] = interp.interpolate - ( - samples[cellI], - cellI - ); - } - } - } - else - { - newValues = sampleField(); - } - - mapDist.distribute(newValues); - - break; - } - case NEARESTPATCHFACE: case NEARESTPATCHFACEAMI: - { - const label nbrPatchID = - nbrMesh.boundaryMesh().findPatchID(samplePatch()); - if (nbrPatchID < 0) - { - FatalErrorIn - ( - "void mappedFieldFvPatchField<Type>::updateCoeffs()" - )<< "Unable to find sample patch " << samplePatch() - << " in region " << sampleRegion() - << " for patch " << this->patch().name() << nl - << abort(FatalError); - } - - const fieldType& nbrField = sampleField(); - - newValues = nbrField.boundaryField()[nbrPatchID]; - this->distribute(newValues); - - break; - } - case NEARESTFACE: - { - Field<Type> allValues(nbrMesh.nFaces(), pTraits<Type>::zero); - - const fieldType& nbrField = sampleField(); - - forAll(nbrField.boundaryField(), patchI) - { - const fvPatchField<Type>& pf = - nbrField.boundaryField()[patchI]; - label faceStart = pf.patch().patch().start(); - - forAll(pf, faceI) - { - allValues[faceStart++] = pf[faceI]; - } - } - - this->distribute(allValues); - newValues.transfer(allValues); - - break; - } - default: - { - FatalErrorIn("mappedFieldFvPatchField<Type>::updateCoeffs()") - << "Unknown sampling mode: " << mode() - << nl << abort(FatalError); - } - } - - if (setAverage_) - { - Type averagePsi = - gSum(this->patch().magSf()*newValues) - /gSum(this->patch().magSf()); - - if (mag(averagePsi)/mag(average_) > 0.5) - { - newValues *= mag(average_)/mag(averagePsi); - } - else - { - newValues += (average_ - averagePsi); - } - } - - this->operator==(newValues); + this->operator==(this->mappedField()); if (debug) { @@ -352,9 +164,6 @@ void mappedFieldFvPatchField<Type>::updateCoeffs() << endl; } - // Restore tag - UPstream::msgType() = oldTag; - fixedValueFvPatchField<Type>::updateCoeffs(); } @@ -364,11 +173,7 @@ void mappedFieldFvPatchField<Type>::write(Ostream& os) const { fvPatchField<Type>::write(os); mappedPatchBase::write(os); - os.writeKeyword("fieldName") << fieldName_ << token::END_STATEMENT << nl; - os.writeKeyword("setAverage") << setAverage_ << token::END_STATEMENT << nl; - os.writeKeyword("average") << average_ << token::END_STATEMENT << nl; - os.writeKeyword("interpolationScheme") << interpolationScheme_ - << token::END_STATEMENT << nl; + mappedPatchFieldBase<Type>::write(os); this->writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedFieldFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedFieldFvPatchField.H index 6dd9f3efb5c8579b8c9c966394d4aa34a5e8685a..983df12eb4aec8ecf35dceb4476bd3922c279613 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedFieldFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedFieldFvPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -75,6 +75,7 @@ SourceFiles #define mappedFieldFvPatchField_H #include "mappedPatchBase.H" +#include "mappedPatchFieldBase.H" #include "fixedValueFvPatchFields.H" #include "interpolation.H" @@ -90,37 +91,10 @@ namespace Foam template<class Type> class mappedFieldFvPatchField : + public fixedValueFvPatchField<Type>, public mappedPatchBase, - public fixedValueFvPatchField<Type> + public mappedPatchFieldBase<Type> { - // Private data - - //- Name of field to sample - defaults to field associated with this - // patchField if not specified - word fieldName_; - - //- If true adjust the mapped field to maintain average value average_ - const bool setAverage_; - - //- Average value the mapped field is adjusted to maintain if - // setAverage_ is set true - const Type average_; - - //- Interpolation scheme to use for nearestCell mode - word interpolationScheme_; - - //- Pointer to the cell interpolator - mutable autoPtr<interpolation<Type> > interpolator_; - - - // Private Member Functions - - //- Field to sample. Either on my or nbr mesh - const GeometricField<Type, fvPatchField, volMesh>& sampleField() const; - - //- Access the interpolation method - const interpolation<Type>& interpolator() const; - public: diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedPatchFieldBase.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedPatchFieldBase.C new file mode 100644 index 0000000000000000000000000000000000000000..291fe316dce70579cc6353b3380f1713888f2990 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedPatchFieldBase.C @@ -0,0 +1,340 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "mappedPatchFieldBase.H" +#include "mappedPatchBase.H" +#include "interpolationCell.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class Type> +mappedPatchFieldBase<Type>::mappedPatchFieldBase +( + const mappedPatchBase& mapper, + const fvPatchField<Type>& patchField, + const word& fieldName, + const bool setAverage, + const Type average, + const word& interpolationScheme +) +: + mapper_(mapper), + patchField_(patchField), + fieldName_(fieldName), + setAverage_(setAverage), + average_(average), + interpolationScheme_(interpolationScheme) +{} + + +template<class Type> +mappedPatchFieldBase<Type>::mappedPatchFieldBase +( + const mappedPatchBase& mapper, + const fvPatchField<Type>& patchField, + const dictionary& dict +) +: + mapper_(mapper), + patchField_(patchField), + fieldName_ + ( + dict.template lookupOrDefault<word> + ( + "fieldName", + patchField_.dimensionedInternalField().name() + ) + ), + setAverage_(readBool(dict.lookup("setAverage"))), + average_(pTraits<Type>(dict.lookup("average"))), + interpolationScheme_(interpolationCell<Type>::typeName) +{ + if (mapper_.mode() == mappedPatchBase::NEARESTCELL) + { + dict.lookup("interpolationScheme") >> interpolationScheme_; + } +} + + +template<class Type> +mappedPatchFieldBase<Type>::mappedPatchFieldBase +( + const mappedPatchBase& mapper, + const fvPatchField<Type>& patchField +) +: + mapper_(mapper), + patchField_(patchField), + fieldName_(patchField_.dimensionedInternalField().name()), + setAverage_(false), + average_(pTraits<Type>::zero), + interpolationScheme_(interpolationCell<Type>::typeName) +{} + + +template<class Type> +mappedPatchFieldBase<Type>::mappedPatchFieldBase +( + const mappedPatchFieldBase<Type>& mapper +) +: + mapper_(mapper.mapper_), + patchField_(mapper.patchField_), + fieldName_(mapper.fieldName_), + setAverage_(mapper.setAverage_), + average_(mapper.average_), + interpolationScheme_(mapper.interpolationScheme_) +{} + + +template<class Type> +mappedPatchFieldBase<Type>::mappedPatchFieldBase +( + const mappedPatchBase& mapper, + const fvPatchField<Type>& patchField, + const mappedPatchFieldBase<Type>& base +) +: + mapper_(mapper), + patchField_(patchField), + fieldName_(base.fieldName_), + setAverage_(base.setAverage_), + average_(base.average_), + interpolationScheme_(base.interpolationScheme_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class Type> +const GeometricField<Type, fvPatchField, volMesh>& +mappedPatchFieldBase<Type>::sampleField() const +{ + typedef GeometricField<Type, fvPatchField, volMesh> fieldType; + + const fvMesh& nbrMesh = refCast<const fvMesh>(mapper_.sampleMesh()); + + if (mapper_.sameRegion()) + { + if (fieldName_ == patchField_.dimensionedInternalField().name()) + { + // Optimisation: bypass field lookup + return + dynamic_cast<const fieldType&> + ( + patchField_.dimensionedInternalField() + ); + } + else + { + const fvMesh& thisMesh = patchField_.patch().boundaryMesh().mesh(); + return thisMesh.template lookupObject<fieldType>(fieldName_); + } + } + else + { + return nbrMesh.template lookupObject<fieldType>(fieldName_); + } +} + + +template<class Type> +const interpolation<Type>& mappedPatchFieldBase<Type>::interpolator() const +{ + if (!interpolator_.valid()) + { + interpolator_ = interpolation<Type>::New + ( + interpolationScheme_, + sampleField() + ); + } + return interpolator_(); +} + + +template<class Type> +tmp<Field<Type> > mappedPatchFieldBase<Type>::mappedField() const +{ + typedef GeometricField<Type, fvPatchField, volMesh> fieldType; + + // Since we're inside initEvaluate/evaluate there might be processor + // comms underway. Change the tag we use. + int oldTag = UPstream::msgType(); + UPstream::msgType() = oldTag + 1; + + const fvMesh& thisMesh = patchField_.patch().boundaryMesh().mesh(); + const fvMesh& nbrMesh = refCast<const fvMesh>(mapper_.sampleMesh()); + + // Result of obtaining remote values + tmp<Field<Type> > tnewValues(new Field<Type>(0)); + Field<Type>& newValues = tnewValues(); + + switch (mapper_.mode()) + { + case mappedPatchBase::NEARESTCELL: + { + const mapDistribute& distMap = mapper_.map(); + + if (interpolationScheme_ != interpolationCell<Type>::typeName) + { + // Send back sample points to the processor that holds the cell + vectorField samples(mapper_.samplePoints()); + distMap.reverseDistribute + ( + ( + mapper_.sameRegion() + ? thisMesh.nCells() + : nbrMesh.nCells() + ), + point::max, + samples + ); + + const interpolation<Type>& interp = interpolator(); + + newValues.setSize(samples.size(), pTraits<Type>::max); + forAll(samples, cellI) + { + if (samples[cellI] != point::max) + { + newValues[cellI] = interp.interpolate + ( + samples[cellI], + cellI + ); + } + } + } + else + { + newValues = sampleField(); + } + + distMap.distribute(newValues); + + break; + } + case mappedPatchBase::NEARESTPATCHFACE: + case mappedPatchBase::NEARESTPATCHFACEAMI: + { + const label nbrPatchID = + nbrMesh.boundaryMesh().findPatchID(mapper_.samplePatch()); + + if (nbrPatchID < 0) + { + FatalErrorIn + ( + "void mappedPatchFieldBase<Type>::updateCoeffs()" + )<< "Unable to find sample patch " << mapper_.samplePatch() + << " in region " << mapper_.sampleRegion() + << " for patch " << patchField_.patch().name() << nl + << abort(FatalError); + } + + const fieldType& nbrField = sampleField(); + + newValues = nbrField.boundaryField()[nbrPatchID]; + mapper_.distribute(newValues); + + break; + } + case mappedPatchBase::NEARESTFACE: + { + Field<Type> allValues(nbrMesh.nFaces(), pTraits<Type>::zero); + + const fieldType& nbrField = sampleField(); + + forAll(nbrField.boundaryField(), patchI) + { + const fvPatchField<Type>& pf = + nbrField.boundaryField()[patchI]; + label faceStart = pf.patch().start(); + + forAll(pf, faceI) + { + allValues[faceStart++] = pf[faceI]; + } + } + + mapper_.distribute(allValues); + newValues.transfer(allValues); + + break; + } + default: + { + FatalErrorIn + ( + "mappedPatchFieldBase<Type>::updateCoeffs()" + )<< "Unknown sampling mode: " << mapper_.mode() + << nl << abort(FatalError); + } + } + + if (setAverage_) + { + Type averagePsi = + gSum(patchField_.patch().magSf()*newValues) + /gSum(patchField_.patch().magSf()); + + if (mag(averagePsi)/mag(average_) > 0.5) + { + newValues *= mag(average_)/mag(averagePsi); + } + else + { + newValues += (average_ - averagePsi); + } + } + + // Restore tag + UPstream::msgType() = oldTag; + + return tnewValues; +} + + +template<class Type> +void mappedPatchFieldBase<Type>::write(Ostream& os) const +{ + os.writeKeyword("fieldName") << fieldName_ << token::END_STATEMENT << nl; + os.writeKeyword("setAverage") << setAverage_ << token::END_STATEMENT << nl; + os.writeKeyword("average") << average_ << token::END_STATEMENT << nl; + os.writeKeyword("interpolationScheme") << interpolationScheme_ + << token::END_STATEMENT << nl; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedPatchFieldBase.H b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedPatchFieldBase.H new file mode 100644 index 0000000000000000000000000000000000000000..50728410949b23ae732b5110718dfc7a3b2642c3 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedPatchFieldBase.H @@ -0,0 +1,166 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 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 <http://www.gnu.org/licenses/>. + +Class + Foam::mappedPatchFieldBase + +Description + Functionality for sampling fields using mappedPatchBase. + +SourceFiles + mappedPatchFieldBase.C + +\*---------------------------------------------------------------------------*/ + +#ifndef mappedPatchFieldBase_H +#define mappedPatchFieldBase_H + +#include "fixedValueFvPatchFields.H" +#include "volFieldsFwd.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class mappedPatchBase; +template<class> class interpolation; + +/*---------------------------------------------------------------------------*\ + Class mappedPatchFieldBase Declaration +\*---------------------------------------------------------------------------*/ + +template<class Type> +class mappedPatchFieldBase +{ + +protected: + + // Protected data + + //- Mapping engine + const mappedPatchBase& mapper_; + + //- Underlying patch field + const fvPatchField<Type>& patchField_; + + //- Name of field to sample + word fieldName_; + + //- If true adjust the mapped field to maintain average value average_ + const bool setAverage_; + + //- Average value the mapped field is adjusted to maintain if + // setAverage_ is set true + const Type average_; + + //- Interpolation scheme to use for nearestcell mode + word interpolationScheme_; + + mutable autoPtr<interpolation<Type> > interpolator_; + + + // Protected Member Functions + + +public: + + // Constructors + + //- Construct from components + mappedPatchFieldBase + ( + const mappedPatchBase& mapper, + const fvPatchField<Type>& patchField, + const word& fieldName, + const bool setAverage, + const Type average, + const word& interpolationScheme + ); + + //- Construct from dictionary + mappedPatchFieldBase + ( + const mappedPatchBase& mapper, + const fvPatchField<Type>& patchField, + const dictionary& dict + ); + + //- Construct empty + mappedPatchFieldBase + ( + const mappedPatchBase& mapper, + const fvPatchField<Type>& patchField + ); + + //- Construct copy + mappedPatchFieldBase + ( + const mappedPatchFieldBase<Type>& mapper + ); + + //- Construct copy, resetting patch and field + mappedPatchFieldBase + ( + const mappedPatchBase& mapper, + const fvPatchField<Type>& patchField, + const mappedPatchFieldBase<Type>& base + ); + + + //- Destructor + virtual ~mappedPatchFieldBase<Type>() + {} + + + // Member functions + + //- Field to sample. Either on my or nbr mesh + const GeometricField<Type, fvPatchField, volMesh>& sampleField() const; + + //- Access the interpolation method + const interpolation<Type>& interpolator() const; + + //- Map sampleField onto *this patch + virtual tmp<Field<Type> > mappedField() const; + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "mappedPatchFieldBase.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedValue/mappedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedValue/mappedFixedValueFvPatchField.C index 77cc8d61a9d8dad64d7cf0935df71d716bf1d167..851344194b554ac57457754983d74cddc289eb59 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedValue/mappedFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedValue/mappedFixedValueFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -26,7 +26,6 @@ License #include "mappedFixedValueFvPatchField.H" #include "mappedPatchBase.H" #include "volFields.H" -#include "interpolationCell.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -43,10 +42,7 @@ mappedFixedValueFvPatchField<Type>::mappedFixedValueFvPatchField ) : fixedValueFvPatchField<Type>(p, iF), - fieldName_(iF.name()), - setAverage_(false), - average_(pTraits<Type>::zero), - interpolationScheme_(interpolationCell<Type>::typeName) + mappedPatchFieldBase<Type>(this->mapper(p, iF), *this) {} @@ -60,31 +56,8 @@ mappedFixedValueFvPatchField<Type>::mappedFixedValueFvPatchField ) : fixedValueFvPatchField<Type>(ptf, p, iF, mapper), - fieldName_(ptf.fieldName_), - setAverage_(ptf.setAverage_), - average_(ptf.average_), - interpolationScheme_(ptf.interpolationScheme_) -{ - if (!isA<mappedPatchBase>(this->patch().patch())) - { - FatalErrorIn - ( - "mappedFixedValueFvPatchField<Type>::" - "mappedFixedValueFvPatchField\n" - "(\n" - " const mappedFixedValueFvPatchField<Type>&,\n" - " const fvPatch&,\n" - " const Field<Type>&,\n" - " const fvPatchFieldMapper&\n" - ")\n" - ) << "\n patch type '" << p.type() - << "' not type '" << mappedPatchBase::typeName << "'" - << "\n for patch " << p.name() - << " of field " << this->dimensionedInternalField().name() - << " in file " << this->dimensionedInternalField().objectPath() - << exit(FatalError); - } -} + mappedPatchFieldBase<Type>(this->mapper(p, iF), *this, ptf) +{} template<class Type> @@ -96,39 +69,8 @@ mappedFixedValueFvPatchField<Type>::mappedFixedValueFvPatchField ) : fixedValueFvPatchField<Type>(p, iF, dict), - fieldName_(dict.lookupOrDefault<word>("fieldName", iF.name())), - setAverage_(readBool(dict.lookup("setAverage"))), - average_(pTraits<Type>(dict.lookup("average"))), - interpolationScheme_(interpolationCell<Type>::typeName) -{ - if (!isA<mappedPatchBase>(this->patch().patch())) - { - FatalErrorIn - ( - "mappedFixedValueFvPatchField<Type>::" - "mappedFixedValueFvPatchField\n" - "(\n" - " const fvPatch& p,\n" - " const DimensionedField<Type, volMesh>& iF,\n" - " const dictionary& dict\n" - ")\n" - ) << "\n patch type '" << p.type() - << "' not type '" << mappedPatchBase::typeName << "'" - << "\n for patch " << p.name() - << " of field " << this->dimensionedInternalField().name() - << " in file " << this->dimensionedInternalField().objectPath() - << exit(FatalError); - } - - const mappedPatchBase& mpp = refCast<const mappedPatchBase> - ( - mappedFixedValueFvPatchField<Type>::patch().patch() - ); - if (mpp.mode() == mappedPatchBase::NEARESTCELL) - { - dict.lookup("interpolationScheme") >> interpolationScheme_; - } -} + mappedPatchFieldBase<Type>(this->mapper(p, iF), *this, dict) +{} template<class Type> @@ -138,10 +80,7 @@ mappedFixedValueFvPatchField<Type>::mappedFixedValueFvPatchField ) : fixedValueFvPatchField<Type>(ptf), - fieldName_(ptf.fieldName_), - setAverage_(ptf.setAverage_), - average_(ptf.average_), - interpolationScheme_(ptf.interpolationScheme_) + mappedPatchFieldBase<Type>(ptf) {} @@ -153,64 +92,32 @@ mappedFixedValueFvPatchField<Type>::mappedFixedValueFvPatchField ) : fixedValueFvPatchField<Type>(ptf, iF), - fieldName_(ptf.fieldName_), - setAverage_(ptf.setAverage_), - average_(ptf.average_), - interpolationScheme_(ptf.interpolationScheme_) + mappedPatchFieldBase<Type>(this->mapper(this->patch(), iF), *this, ptf) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> -const GeometricField<Type, fvPatchField, volMesh>& -mappedFixedValueFvPatchField<Type>::sampleField() const -{ - typedef GeometricField<Type, fvPatchField, volMesh> fieldType; - - const mappedPatchBase& mpp = refCast<const mappedPatchBase> - ( - mappedFixedValueFvPatchField<Type>::patch().patch() - ); - const fvMesh& nbrMesh = refCast<const fvMesh>(mpp.sampleMesh()); - - if (mpp.sameRegion()) - { - if (fieldName_ == this->dimensionedInternalField().name()) - { - // Optimisation: bypass field lookup - return - dynamic_cast<const fieldType&> - ( - this->dimensionedInternalField() - ); - } - else - { - const fvMesh& thisMesh = this->patch().boundaryMesh().mesh(); - return thisMesh.lookupObject<fieldType>(fieldName_); - } - } - else - { - return nbrMesh.lookupObject<fieldType>(fieldName_); - } -} - - -template<class Type> -const interpolation<Type>& -mappedFixedValueFvPatchField<Type>::interpolator() const +const mappedPatchBase& mappedFixedValueFvPatchField<Type>::mapper +( + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF +) { - if (!interpolator_.valid()) + if (!isA<mappedPatchBase>(p.patch())) { - interpolator_ = interpolation<Type>::New + FatalErrorIn ( - interpolationScheme_, - sampleField() - ); + "mappedFixedValueFvPatchField<Type>::mapper()" + ) << "\n patch type '" << p.patch().type() + << "' not type '" << mappedPatchBase::typeName << "'" + << "\n for patch " << p.patch().name() + << " of field " << iF.name() + << " in file " << iF.objectPath() + << exit(FatalError); } - return interpolator_(); + return refCast<const mappedPatchBase>(p.patch()); } @@ -222,140 +129,7 @@ void mappedFixedValueFvPatchField<Type>::updateCoeffs() return; } - typedef GeometricField<Type, fvPatchField, volMesh> fieldType; - - // Since we're inside initEvaluate/evaluate there might be processor - // comms underway. Change the tag we use. - int oldTag = UPstream::msgType(); - UPstream::msgType() = oldTag + 1; - - // Get the scheduling information from the mappedPatchBase - const mappedPatchBase& mpp = refCast<const mappedPatchBase> - ( - mappedFixedValueFvPatchField<Type>::patch().patch() - ); - - const fvMesh& thisMesh = this->patch().boundaryMesh().mesh(); - const fvMesh& nbrMesh = refCast<const fvMesh>(mpp.sampleMesh()); - - // Result of obtaining remote values - Field<Type> newValues; - - switch (mpp.mode()) - { - case mappedPatchBase::NEARESTCELL: - { - const mapDistribute& distMap = mpp.map(); - - if (interpolationScheme_ != interpolationCell<Type>::typeName) - { - // Send back sample points to the processor that holds the cell - vectorField samples(mpp.samplePoints()); - distMap.reverseDistribute - ( - (mpp.sameRegion() ? thisMesh.nCells() : nbrMesh.nCells()), - point::max, - samples - ); - - const interpolation<Type>& interp = interpolator(); - - newValues.setSize(samples.size(), pTraits<Type>::max); - forAll(samples, cellI) - { - if (samples[cellI] != point::max) - { - newValues[cellI] = interp.interpolate - ( - samples[cellI], - cellI - ); - } - } - } - else - { - newValues = sampleField(); - } - - distMap.distribute(newValues); - - break; - } - case mappedPatchBase::NEARESTPATCHFACE: - case mappedPatchBase::NEARESTPATCHFACEAMI: - { - const label nbrPatchID = - nbrMesh.boundaryMesh().findPatchID(mpp.samplePatch()); - - if (nbrPatchID < 0) - { - FatalErrorIn - ( - "void mappedFixedValueFvPatchField<Type>::updateCoeffs()" - )<< "Unable to find sample patch " << mpp.samplePatch() - << " in region " << mpp.sampleRegion() - << " for patch " << this->patch().name() << nl - << abort(FatalError); - } - - const fieldType& nbrField = sampleField(); - - newValues = nbrField.boundaryField()[nbrPatchID]; - mpp.distribute(newValues); - - break; - } - case mappedPatchBase::NEARESTFACE: - { - Field<Type> allValues(nbrMesh.nFaces(), pTraits<Type>::zero); - - const fieldType& nbrField = sampleField(); - - forAll(nbrField.boundaryField(), patchI) - { - const fvPatchField<Type>& pf = - nbrField.boundaryField()[patchI]; - label faceStart = pf.patch().start(); - - forAll(pf, faceI) - { - allValues[faceStart++] = pf[faceI]; - } - } - - mpp.distribute(allValues); - newValues.transfer(allValues); - - break; - } - default: - { - FatalErrorIn - ( - "mappedFixedValueFvPatchField<Type>::updateCoeffs()" - )<< "Unknown sampling mode: " << mpp.mode() - << nl << abort(FatalError); - } - } - - if (setAverage_) - { - Type averagePsi = - gSum(this->patch().magSf()*newValues) - /gSum(this->patch().magSf()); - - if (mag(averagePsi)/mag(average_) > 0.5) - { - newValues *= mag(average_)/mag(averagePsi); - } - else - { - newValues += (average_ - averagePsi); - } - } - - this->operator==(newValues); + this->operator==(this->mappedField()); if (debug) { @@ -368,9 +142,6 @@ void mappedFixedValueFvPatchField<Type>::updateCoeffs() << endl; } - // Restore tag - UPstream::msgType() = oldTag; - fixedValueFvPatchField<Type>::updateCoeffs(); } @@ -379,11 +150,7 @@ template<class Type> void mappedFixedValueFvPatchField<Type>::write(Ostream& os) const { fvPatchField<Type>::write(os); - os.writeKeyword("fieldName") << fieldName_ << token::END_STATEMENT << nl; - os.writeKeyword("setAverage") << setAverage_ << token::END_STATEMENT << nl; - os.writeKeyword("average") << average_ << token::END_STATEMENT << nl; - os.writeKeyword("interpolationScheme") << interpolationScheme_ - << token::END_STATEMENT << nl; + mappedPatchFieldBase<Type>::write(os); this->writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedValue/mappedFixedValueFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedValue/mappedFixedValueFvPatchField.H index dd52f2a2b635b725368edc81cf7654ccdeab7485..6267e88ab228791cf362cdeeb494351f7e5653fc 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedValue/mappedFixedValueFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedValue/mappedFixedValueFvPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -83,7 +83,8 @@ SourceFiles #define mappedFixedValueFvPatchField_H #include "fixedValueFvPatchFields.H" -#include "interpolation.H" +//#include "interpolation.H" +#include "mappedPatchFieldBase.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -97,37 +98,19 @@ namespace Foam template<class Type> class mappedFixedValueFvPatchField : - public fixedValueFvPatchField<Type> + public fixedValueFvPatchField<Type>, + public mappedPatchFieldBase<Type> { protected: - // Protected data - - //- Name of field to sample - defaults to field associated with this - // patchField if not specified - word fieldName_; - - //- If true adjust the mapped field to maintain average value average_ - const bool setAverage_; - - //- Average value the mapped field is adjusted to maintain if - // setAverage_ is set true - const Type average_; - - //- Interpolation scheme to use for nearestcell mode - word interpolationScheme_; - - mutable autoPtr<interpolation<Type> > interpolator_; - - // Protected Member Functions - //- Field to sample. Either on my or nbr mesh - const GeometricField<Type, fvPatchField, volMesh>& sampleField() const; - - //- Access the interpolation method - const interpolation<Type>& interpolator() const; + const mappedPatchBase& mapper + ( + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF + ); public: diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolationScheme/surfaceInterpolationScheme.C b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolationScheme/surfaceInterpolationScheme.C index d1ed7e01c0489d38abfa66be1a1e1b57f9a248b4..1a699590953e2e94da8d701e8f989521169ebf47 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolationScheme/surfaceInterpolationScheme.C +++ b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolationScheme/surfaceInterpolationScheme.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -171,7 +171,10 @@ surfaceInterpolationScheme<Type>::interpolate "(const GeometricField<Type, fvPatchField, volMesh>&, " "const tmp<surfaceScalarField>&, " "const tmp<surfaceScalarField>&) : " - "interpolating volTypeField from cells to faces " + "interpolating " + << vf.type() << " " + << vf.name() + << " from cells to faces " "without explicit correction" << endl; } @@ -252,7 +255,10 @@ surfaceInterpolationScheme<Type>::interpolate Info<< "surfaceInterpolationScheme<Type>::interpolate" "(const GeometricField<Type, fvPatchField, volMesh>&, " "const tmp<surfaceScalarField>&) : " - "interpolating volTypeField from cells to faces " + "interpolating " + << vf.type() << " " + << vf.name() + << " from cells to faces " "without explicit correction" << endl; } @@ -326,7 +332,10 @@ surfaceInterpolationScheme<Type>::interpolate { Info<< "surfaceInterpolationScheme<Type>::interpolate" "(const GeometricField<Type, fvPatchField, volMesh>&) : " - << "interpolating volTypeField from cells to faces" + "interpolating " + << vf.type() << " " + << vf.name() + << " from cells to faces" << endl; }