diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam.C b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam.C index aacc4b6d498c6ed237edb6b656107dd184ab8e57..d0285dc3577663755f2c91ebc84c26bb783db424 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam.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 diff --git a/applications/utilities/parallelProcessing/decomposePar/dimFieldDecomposer.H b/applications/utilities/parallelProcessing/decomposePar/dimFieldDecomposer.H index ac3700d8cd8c1146e9edea3b0f22a7663f953718..5de57330139e8cebda5a7add4837a895c1dba2f6 100644 --- a/applications/utilities/parallelProcessing/decomposePar/dimFieldDecomposer.H +++ b/applications/utilities/parallelProcessing/decomposePar/dimFieldDecomposer.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 @@ -37,7 +37,6 @@ SourceFiles #define dimFieldDecomposer_H #include "fvMesh.H" -#include "fvPatchFieldMapper.H" #include "surfaceFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/utilities/parallelProcessing/decomposePar/pointFieldDecomposer.C b/applications/utilities/parallelProcessing/decomposePar/pointFieldDecomposer.C index c978cd4f0a5d003260c3bf28ee0b39f29d7afea5..3934fdc021d3f289b2ef33040f69ac51e8184030 100644 --- a/applications/utilities/parallelProcessing/decomposePar/pointFieldDecomposer.C +++ b/applications/utilities/parallelProcessing/decomposePar/pointFieldDecomposer.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 @@ -39,7 +39,8 @@ Foam::pointFieldDecomposer::patchFieldDecomposer::patchFieldDecomposer completeMeshPatch, procMeshPatch ), - directAddressing_(procMeshPatch.size(), -1) + directAddressing_(procMeshPatch.size(), -1), + hasUnmapped_(false) { // Create the inverse-addressing of the patch point labels. labelList pointMap(completeMeshPatch.boundaryMesh().mesh().size(), -1); @@ -64,6 +65,8 @@ Foam::pointFieldDecomposer::patchFieldDecomposer::patchFieldDecomposer // Check that all the patch point addresses are set if (directAddressing_.size() && min(directAddressing_) < 0) { + hasUnmapped_ = true; + FatalErrorIn ( "pointFieldDecomposer::patchFieldDecomposer()" diff --git a/applications/utilities/parallelProcessing/decomposePar/pointFieldDecomposer.H b/applications/utilities/parallelProcessing/decomposePar/pointFieldDecomposer.H index efe328833bcc010b9b0f03a56f1aeca73a054c82..7214b9419aff1eb4bdf2f0900351e29bd6229262 100644 --- a/applications/utilities/parallelProcessing/decomposePar/pointFieldDecomposer.H +++ b/applications/utilities/parallelProcessing/decomposePar/pointFieldDecomposer.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 @@ -63,6 +63,9 @@ public: labelList directAddressing_; + //- Does map contain any unmapped values + bool hasUnmapped_; + public: // Constructors @@ -88,6 +91,11 @@ public: return true; } + bool hasUnmapped() const + { + return hasUnmapped_; + } + const labelUList& directAddressing() const { return directAddressing_; diff --git a/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C b/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C index b83b7ba1a1f9290328a7cd48e8e695a77d2354e8..38ccae1243c5920a38b025bb48496c7b11f64f7d 100644 --- a/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C +++ b/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C @@ -27,6 +27,7 @@ License #include "linePointRef.H" #include "OFstream.H" #include "ListOps.H" +#include "memInfo.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -2383,12 +2384,14 @@ Foam::indexedOctree<Type>::indexedOctree contents_(0), nodeTypes_(0) { + int oldMemSize = 0; if (debug) { Pout<< "indexedOctree<Type>::indexedOctree:" << nl << " shapes:" << shapes.size() << nl << " bb:" << bb << nl << endl; + oldMemSize = memInfo().size(); } if (shapes.size() == 0) @@ -2503,6 +2506,9 @@ Foam::indexedOctree<Type>::indexedOctree nEntries += contents_[i].size(); } + label memSize = memInfo().size(); + + Pout<< "indexedOctree<Type>::indexedOctree" << " : finished construction of tree of:" << shapes.typeName << nl @@ -2515,6 +2521,7 @@ Foam::indexedOctree<Type>::indexedOctree << scalar(nEntries)/contents.size() << nl << " per shape (duplicity):" << scalar(nEntries)/shapes.size() << nl + << " total memory:" << memSize-oldMemSize << endl; } } diff --git a/src/OpenFOAM/fields/Fields/Field/Field.C b/src/OpenFOAM/fields/Fields/Field/Field.C index 334eba8e418962b2c39e6d4b114b09ce21736e7a..118de048b300ca864684e81aae7483503a1c5c2e 100644 --- a/src/OpenFOAM/fields/Fields/Field/Field.C +++ b/src/OpenFOAM/fields/Fields/Field/Field.C @@ -124,6 +124,34 @@ Foam::Field<Type>::Field } +template<class Type> +Foam::Field<Type>::Field +( + const UList<Type>& mapF, + const FieldMapper& mapper, + const Type& defaultValue +) +: + List<Type>(mapper.size(), defaultValue) +{ + map(mapF, mapper); +} + + +template<class Type> +Foam::Field<Type>::Field +( + const UList<Type>& mapF, + const FieldMapper& mapper, + const UList<Type>& defaultValues +) +: + List<Type>(defaultValues) +{ + map(mapF, mapper); +} + + template<class Type> Foam::Field<Type>::Field ( @@ -137,6 +165,34 @@ Foam::Field<Type>::Field } +template<class Type> +Foam::Field<Type>::Field +( + const tmp<Field<Type> >& tmapF, + const FieldMapper& mapper, + const Type& defaultValue +) +: + List<Type>(mapper.size(), defaultValue) +{ + map(tmapF, mapper); +} + + +template<class Type> +Foam::Field<Type>::Field +( + const tmp<Field<Type> >& tmapF, + const FieldMapper& mapper, + const UList<Type>& defaultValues +) +: + List<Type>(defaultValues) +{ + map(tmapF, mapper); +} + + template<class Type> Foam::Field<Type>::Field(const Field<Type>& f) : diff --git a/src/OpenFOAM/fields/Fields/Field/Field.H b/src/OpenFOAM/fields/Fields/Field/Field.H index 9b4088a4ebca5ec4978f2219604f4d672b31d6a4..dd3dbabeaef98b513e5db0686eda8637a830f7a2 100644 --- a/src/OpenFOAM/fields/Fields/Field/Field.H +++ b/src/OpenFOAM/fields/Fields/Field/Field.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 @@ -160,6 +160,22 @@ public: const FieldMapper& map ); + //- Construct by mapping from the given field + Field + ( + const UList<Type>& mapF, + const FieldMapper& map, + const Type& defaultValue + ); + + //- Construct by mapping from the given field + Field + ( + const UList<Type>& mapF, + const FieldMapper& map, + const UList<Type>& defaultValues + ); + //- Construct by mapping from the given tmp field Field ( @@ -167,6 +183,24 @@ public: const FieldMapper& map ); + //- Construct by mapping from the given tmp field. Supplied uniform + // value for unmapped items + Field + ( + const tmp<Field<Type> >& tmapF, + const FieldMapper& map, + const Type& defaultValue + ); + + //- Construct by mapping from the given tmp field. Supplied values + // for unmapped items + Field + ( + const tmp<Field<Type> >& tmapF, + const FieldMapper& map, + const UList<Type>& defaultValues + ); + //- Construct as copy Field(const Field<Type>&); diff --git a/src/OpenFOAM/fields/Fields/Field/FieldMapper.H b/src/OpenFOAM/fields/Fields/Field/FieldMapper.H index 319c8f0575ed6a21d8753d98bc8fe44cf094bea1..f463f97c5765188731a4c028d7a2e40a4ab6773f 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 | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -64,6 +64,10 @@ public: virtual bool direct() const = 0; + //- Are there unmapped values? I.e. do all size() elements get + // get value + virtual bool hasUnmapped() const = 0; + virtual const labelUList& directAddressing() const { FatalErrorIn("FieldMapper::directAddressing() const") diff --git a/src/OpenFOAM/fields/Fields/Field/directFieldMapper.H b/src/OpenFOAM/fields/Fields/Field/directFieldMapper.H new file mode 100644 index 0000000000000000000000000000000000000000..34c8935c44550c89793ab7a7960a42778bcc9579 --- /dev/null +++ b/src/OpenFOAM/fields/Fields/Field/directFieldMapper.H @@ -0,0 +1,104 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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::directFieldMapper + +Description + FieldMapper with direct mapping. + +\*---------------------------------------------------------------------------*/ + +#ifndef directFieldMapper_H +#define directFieldMapper_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class directFieldMapper Declaration +\*---------------------------------------------------------------------------*/ + +class directFieldMapper +: + public FieldMapper +{ + const labelUList& directAddressing_; + + bool hasUnmapped_; + +public: + + // Constructors + + //- Construct given addressing + patchFieldSubset(const labelUList& directAddressing) + : + directAddressing_(directAddressing), + hasUnmapped_(false) + { + if (directAddressing_.size() && min(directAddressing_) < 0) + { + hasUnmapped_ = true; + } + } + + //- Destructor + virtual ~directFieldMapper() + {} + + + // Member Functions + + label size() const + { + return directAddressing_.size(); + } + + bool direct() const + { + return true; + } + + bool hasUnmapped() const + { + return hasUnmapped_; + } + + const labelUList& directAddressing() const + { + return directAddressing_; + } +}; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/directPointPatchFieldMapper.H b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/directPointPatchFieldMapper.H new file mode 100644 index 0000000000000000000000000000000000000000..4990061219a92e55d566380e93fe2069807b4e97 --- /dev/null +++ b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/directPointPatchFieldMapper.H @@ -0,0 +1,111 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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::directPointPatchFieldMapper + +Description + direct pointPatchFieldMapper + +\*---------------------------------------------------------------------------*/ + +#ifndef directPointPatchFieldMapper_H +#define directPointPatchFieldMapper_H + +#include "pointPatchFieldMapper.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class directPointPatchFieldMapper Declaration +\*---------------------------------------------------------------------------*/ + +class directPointPatchFieldMapper +: + public pointPatchFieldMapper +{ + + //- Addressing from new back to old + const labelUList& directAddressing_; + + //- Does map contain any unmapped values + bool hasUnmapped_; + + +public: + + // Constructors + + //- Construct given addressing + directPointPatchFieldMapper(const labelUList& directAddressing) + : + directAddressing_(directAddressing), + hasUnmapped_(false) + { + if (directAddressing_.size() && min(directAddressing_) < 0) + { + hasUnmapped_ = true; + } + } + + //- Destructor + virtual ~directPointPatchFieldMapper() + {} + + + // Member Functions + + label size() const + { + return directAddressing_.size(); + } + + bool direct() const + { + return true; + } + + bool hasUnmapped() const + { + return hasUnmapped_; + } + + const labelUList& directAddressing() const + { + return directAddressing_; + } +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/meshes/pointMesh/pointMeshMapper/pointMapper.H b/src/OpenFOAM/meshes/pointMesh/pointMeshMapper/pointMapper.H index 4900c7e07498eee50b874d118e0afc3f180ad8b6..4435edf3d733366eeac6e1f771a1be857e39ae7c 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointMeshMapper/pointMapper.H +++ b/src/OpenFOAM/meshes/pointMesh/pointMeshMapper/pointMapper.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 @@ -129,6 +129,13 @@ public: return direct_; } + //- Are there unmapped values? I.e. do all size() elements get + // get value + virtual bool hasUnmapped() const + { + return insertedObjects(); + } + //- Return direct addressing virtual const labelUList& directAddressing() const; diff --git a/src/OpenFOAM/meshes/pointMesh/pointMeshMapper/pointPatchMapper.C b/src/OpenFOAM/meshes/pointMesh/pointMeshMapper/pointPatchMapper.C index 542455775fdd29a9911430e2a62f09c916391bc4..624897bc098eb1d10398bed27a499129bd0f912e 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointMeshMapper/pointPatchMapper.C +++ b/src/OpenFOAM/meshes/pointMesh/pointMeshMapper/pointPatchMapper.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 @@ -47,6 +47,8 @@ void Foam::pointPatchMapper::calcAddressing() const << abort(FatalError); } + hasUnmapped_ = false; + if (direct()) { // Direct mapping. @@ -57,7 +59,7 @@ void Foam::pointPatchMapper::calcAddressing() const { if (addr[i] < 0) { - addr[i] = 0; + hasUnmapped_ = true; } } } @@ -87,9 +89,11 @@ void Foam::pointPatchMapper::calcAddressing() const } else { - // Inserted point. Map from point0 (arbitrary choice) - addr[i] = labelList(1, label(0)); - w[i] = scalarList(1, 1.0); + // Inserted point. + ///// Map from point0 (arbitrary choice) + //addr[i] = labelList(1, label(0)); + //w[i] = scalarList(1, 1.0); + hasUnmapped_ = true; } } } @@ -101,6 +105,7 @@ void Foam::pointPatchMapper::clearOut() deleteDemandDrivenData(directAddrPtr_); deleteDemandDrivenData(interpolationAddrPtr_); deleteDemandDrivenData(weightsPtr_); + hasUnmapped_ = false; } @@ -124,6 +129,7 @@ Foam::pointPatchMapper::pointPatchMapper ? mpm_.oldPatchNMeshPoints()[patch_.index()] : 0 ), + hasUnmapped_(false), directAddrPtr_(NULL), interpolationAddrPtr_(NULL), weightsPtr_(NULL) diff --git a/src/OpenFOAM/meshes/pointMesh/pointMeshMapper/pointPatchMapper.H b/src/OpenFOAM/meshes/pointMesh/pointMeshMapper/pointPatchMapper.H index 575d6f6bc9448f1f96520d6679571a75341d8298..54d89cbdefe87141897b59777adf6748c78d8538 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointMeshMapper/pointPatchMapper.H +++ b/src/OpenFOAM/meshes/pointMesh/pointMeshMapper/pointPatchMapper.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 @@ -74,6 +74,8 @@ class pointPatchMapper // Demand-driven private data + mutable bool hasUnmapped_; + //- Direct addressing (only one for of addressing is used) mutable labelList* directAddrPtr_; @@ -130,6 +132,11 @@ public: return patch_.size(); } + virtual bool hasUnmapped() const + { + return hasUnmapped_; + } + //- Return size of field before mapping virtual label sizeBeforeMapping() const { diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/cellMapper/cellMapper.H b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/cellMapper/cellMapper.H index 67c82e4353711bf409861cb47f2f044e4eea4c67..03da8e0821be42cd02ac68289610ec4504780533 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/cellMapper/cellMapper.H +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/cellMapper/cellMapper.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 @@ -130,6 +130,11 @@ public: return direct_; } + virtual bool hasUnmapped() const + { + return insertedObjects(); + } + //- Return direct addressing virtual const labelUList& directAddressing() const; @@ -140,13 +145,13 @@ public: virtual const scalarListList& weights() const; //- Are there any inserted cells - bool insertedObjects() const + virtual bool insertedObjects() const { return insertedCells_; } //- Return list of inserted cells - const labelList& insertedObjectLabels() const; + const virtual labelList& insertedObjectLabels() const; }; diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/faceMapper/faceMapper.H b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/faceMapper/faceMapper.H index ad48462250e6fd79a7126db37cdc9ec67debca31..199481ea710e7fe03e8e84227193055d3ef8f710 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/faceMapper/faceMapper.H +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/faceMapper/faceMapper.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 @@ -134,6 +134,11 @@ public: return direct_; } + virtual bool hasUnmapped() const + { + return insertedObjects(); + } + //- Return direct addressing virtual const labelUList& directAddressing() const; diff --git a/src/dynamicMesh/fvMeshAdder/fvMeshAdder.H b/src/dynamicMesh/fvMeshAdder/fvMeshAdder.H index f246a1887f14e6070342c62724738590d05b7842..1247e68623fd3c61c4eb7e09240d04c726b42b9f 100644 --- a/src/dynamicMesh/fvMeshAdder/fvMeshAdder.H +++ b/src/dynamicMesh/fvMeshAdder/fvMeshAdder.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 @@ -67,53 +67,6 @@ class fvMeshAdder private: - - // Private class - - class directFvPatchFieldMapper - : - public fvPatchFieldMapper - { - // Private data - - const labelList& directAddressing_; - - public: - - // Constructors - - //- Construct from components - directFvPatchFieldMapper(const labelList& directAddressing) - : - fvPatchFieldMapper(), - directAddressing_(directAddressing) - {} - - - //- Destructor - virtual ~directFvPatchFieldMapper() - {} - - - // Member Functions - - label size() const - { - return directAddressing_.size(); - } - - bool direct() const - { - return true; - } - - const labelUList& directAddressing() const - { - return directAddressing_; - } - }; - - // Private Member Functions //- Calculate map from new patch faces to old patch faces. -1 where diff --git a/src/dynamicMesh/fvMeshAdder/fvMeshAdderTemplates.C b/src/dynamicMesh/fvMeshAdder/fvMeshAdderTemplates.C index bb01e2fa833baa6ab36826620b9f1e27cf24279f..d5afadb9b39d7965b86d51fcd2833a789df8f340 100644 --- a/src/dynamicMesh/fvMeshAdder/fvMeshAdderTemplates.C +++ b/src/dynamicMesh/fvMeshAdder/fvMeshAdderTemplates.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 @@ -23,10 +23,10 @@ License \*---------------------------------------------------------------------------*/ - #include "volFields.H" #include "surfaceFields.H" #include "emptyFvPatchField.H" +#include "directFvPatchFieldMapper.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // diff --git a/src/finiteVolume/fields/fvPatchFields/basic/directionMixed/directionMixedFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/directionMixed/directionMixedFvPatchField.C index 1a185a514f1168de6ed543581cbeb9d05c7a6e59..ec66616b44124b9b4637defec76b90de90269aad 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/directionMixed/directionMixedFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/directionMixed/directionMixedFvPatchField.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 @@ -55,7 +55,25 @@ Foam::directionMixedFvPatchField<Type>::directionMixedFvPatchField refValue_(ptf.refValue_, mapper), refGrad_(ptf.refGrad_, mapper), valueFraction_(ptf.valueFraction_, mapper) -{} +{ + if (mapper.hasUnmapped()) + { + WarningIn + ( + "directionMixedFvPatchField<Type>::directionMixedFvPatchField\n" + "(\n" + " const directionMixedFvPatchField<Type>&,\n" + " const fvPatch&,\n" + " const DimensionedField<Type, volMesh>&,\n" + " const fvPatchFieldMapper&\n" + ")\n" + ) << "On field " << iF.name() << " patch " << p.name() + << " patchField " << this->type() + << " : mapper does not map all values." << nl + << " To avoid this warning fully specify the mapping in derived" + << " patch fields." << endl; + } +} template<class Type> diff --git a/src/finiteVolume/fields/fvPatchFields/basic/fixedGradient/fixedGradientFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/fixedGradient/fixedGradientFvPatchField.C index dd10411a4f36e7637f10a087e4bb52f752459b91..9c46ecb089dfbb5d7087a78bd29b2b9b43c81c77 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/fixedGradient/fixedGradientFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/fixedGradient/fixedGradientFvPatchField.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 @@ -56,7 +56,25 @@ fixedGradientFvPatchField<Type>::fixedGradientFvPatchField : fvPatchField<Type>(ptf, p, iF, mapper), gradient_(ptf.gradient_, mapper) -{} +{ + if (mapper.hasUnmapped()) + { + WarningIn + ( + "fixedGradientFvPatchField<Type>::fixedGradientFvPatchField\n" + "(\n" + " const fixedGradientFvPatchField<Type>&,\n" + " const fvPatch&,\n" + " const DimensionedField<Type, volMesh>&,\n" + " const fvPatchFieldMapper&\n" + ")\n" + ) << "On field " << iF.name() << " patch " << p.name() + << " patchField " << this->type() + << " : mapper does not map all values." << nl + << " To avoid this warning fully specify the mapping in derived" + << " patch fields." << endl; + } +} template<class Type> diff --git a/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.C index a401ede3ef42c027f3ffe8aa0720f02149637bc2..4fcf0863aa59e8430dbcb3b89ef9011d0ef9ab32 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.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 @@ -65,7 +65,25 @@ fixedValueFvPatchField<Type>::fixedValueFvPatchField ) : fvPatchField<Type>(ptf, p, iF, mapper) -{} +{ + if (mapper.hasUnmapped()) + { + WarningIn + ( + "fixedValueFvPatchField<Type>::fixedValueFvPatchField\n" + "(\n" + " const fixedGradientFvPatchField<Type>&,\n" + " const fvPatch&,\n" + " const DimensionedField<Type, volMesh>&,\n" + " const fvPatchFieldMapper&\n" + ")\n" + ) << "On field " << iF.name() << " patch " << p.name() + << " patchField " << this->type() + << " : mapper does not map all values." << nl + << " To avoid this warning fully specify the mapping in derived" + << " patch fields." << endl; + } +} template<class Type> diff --git a/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.C index b716d486864972f4ccb5f416a6d1f542dff94d04..378b5bbcf78419ba9e4cffc21041c085e06ca4f0 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.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 @@ -59,7 +59,25 @@ mixedFvPatchField<Type>::mixedFvPatchField refValue_(ptf.refValue_, mapper), refGrad_(ptf.refGrad_, mapper), valueFraction_(ptf.valueFraction_, mapper) -{} +{ + if (mapper.hasUnmapped()) + { + WarningIn + ( + "mixedFvPatchField<Type>::mixedFvPatchField\n" + "(\n" + " const mixedFvPatchField<Type>&,\n" + " const fvPatch&,\n" + " const DimensionedField<Type, volMesh>&,\n" + " const fvPatchFieldMapper&\n" + ")\n" + ) << "On field " << iF.name() << " patch " << p.name() + << " patchField " << this->type() + << " : mapper does not map all values." << nl + << " To avoid this warning fully specify the mapping in derived" + << " patch fields." << endl; + } +} template<class Type> diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C index ccdfaa8e8ec6124c6214d0d23b254e647f145053..2df4bf7ffb55c1615388777f84b2a1c8c4a9eda2 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C @@ -53,6 +53,8 @@ Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField fixedGradientFvPatchScalarField(p, iF), curTimeIndex_(-1) { + patchType() = ptf.patchType(); + // Map gradient. Set unmapped values and overwrite with mapped ptf gradient() = 0.0; gradient().map(ptf.gradient(), mapper); diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/directFvPatchFieldMapper.H b/src/finiteVolume/fields/fvPatchFields/fvPatchField/directFvPatchFieldMapper.H new file mode 100644 index 0000000000000000000000000000000000000000..7a87d1ad5349beabce50719a40ad785e167ad088 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/directFvPatchFieldMapper.H @@ -0,0 +1,111 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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::directFvPatchFieldMapper + +Description + direct fvPatchFieldMapper + +\*---------------------------------------------------------------------------*/ + +#ifndef directFvPatchFieldMapper_H +#define directFvPatchFieldMapper_H + +#include "fvPatchFieldMapper.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class directFvPatchFieldMapper Declaration +\*---------------------------------------------------------------------------*/ + +class directFvPatchFieldMapper +: + public fvPatchFieldMapper +{ + + //- Addressing from new back to old + const labelUList& directAddressing_; + + //- Does map contain any unmapped values + bool hasUnmapped_; + + +public: + + // Constructors + + //- Construct given addressing + directFvPatchFieldMapper(const labelUList& directAddressing) + : + directAddressing_(directAddressing), + hasUnmapped_(false) + { + if (directAddressing_.size() && min(directAddressing_) < 0) + { + hasUnmapped_ = true; + } + } + + //- Destructor + virtual ~directFvPatchFieldMapper() + {} + + + // Member Functions + + label size() const + { + return directAddressing_.size(); + } + + bool direct() const + { + return true; + } + + bool hasUnmapped() const + { + return hasUnmapped_; + } + + const labelUList& directAddressing() const + { + return directAddressing_; + } +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C index 3059eb5eeac6b1b3fdf5d82ede07742440069aee..23d3ef9c2b296bd738e84446a28662b3a0e86970 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C @@ -47,6 +47,23 @@ Foam::fvPatchField<Type>::fvPatchField {} +template<class Type> +Foam::fvPatchField<Type>::fvPatchField +( + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF, + const word& patchType +) +: + Field<Type>(p.size()), + patch_(p), + internalField_(iF), + updated_(false), + manipulatedMatrix_(false), + patchType_(patchType) +{} + + template<class Type> Foam::fvPatchField<Type>::fvPatchField ( @@ -73,7 +90,7 @@ Foam::fvPatchField<Type>::fvPatchField const fvPatchFieldMapper& mapper ) : - Field<Type>(ptf, mapper), + Field<Type>(p.size()), patch_(p), internalField_(iF), updated_(false), @@ -83,44 +100,9 @@ Foam::fvPatchField<Type>::fvPatchField // For unmapped faces set to internal field value (zero-gradient) if (&iF && iF.size()) { - Field<Type>& f = *this; - - if - ( - mapper.direct() - && &mapper.directAddressing() - && mapper.directAddressing().size() - ) - { - Field<Type> pif(this->patchInternalField()); - - const labelList& mapAddressing = mapper.directAddressing(); - - forAll(mapAddressing, i) - { - if (mapAddressing[i] < 0) - { - f[i] = pif[i]; - } - } - } - else if (!mapper.direct() && mapper.addressing().size()) - { - Field<Type> pif(this->patchInternalField()); - - const labelListList& mapAddressing = mapper.addressing(); - - forAll(mapAddressing, i) - { - const labelList& localAddrs = mapAddressing[i]; - - if (!localAddrs.size()) - { - f[i] = pif[i]; - } - } - } + fvPatchField<Type>::operator=(this->patchInternalField()); } + this->map(ptf, mapper); } diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H index 3b9d54a2d33267c362a88d9ff92d1f8a76cde667..5e9682634f6f1d84c3d7fc50ed253b77e73d8bec 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H @@ -166,6 +166,14 @@ public: const DimensionedField<Type, volMesh>& ); + //- Construct from patch and internal field and patch type + fvPatchField + ( + const fvPatch&, + const DimensionedField<Type, volMesh>&, + const word& patchType + ); + //- Construct from patch and internal field and patch field fvPatchField ( diff --git a/src/finiteVolume/fvMesh/fvMeshMapper/fvPatchMapper.C b/src/finiteVolume/fvMesh/fvMeshMapper/fvPatchMapper.C index 6a3e337357cb053f7367aee8085e1951c47f0c03..ada0749df300c386f6f4e451f1f6d841367980a3 100644 --- a/src/finiteVolume/fvMesh/fvMeshMapper/fvPatchMapper.C +++ b/src/finiteVolume/fvMesh/fvMeshMapper/fvPatchMapper.C @@ -55,6 +55,8 @@ void Foam::fvPatchMapper::calcAddressing() const const label oldPatchEnd = oldPatchStart + faceMap_.oldPatchSizes()[patch_.index()]; + hasUnmapped_ = false; + // Assemble the maps: slice to patch if (direct()) { @@ -84,6 +86,7 @@ void Foam::fvPatchMapper::calcAddressing() const { //addr[faceI] = 0; addr[faceI] = -1; + hasUnmapped_ = true; } } @@ -175,6 +178,10 @@ void Foam::fvPatchMapper::calcAddressing() const { newWeights /= sum(newWeights); } + else + { + hasUnmapped_ = true; + } // Reset addressing and weights curAddr = newAddr; @@ -206,6 +213,7 @@ void Foam::fvPatchMapper::clearOut() deleteDemandDrivenData(directAddrPtr_); deleteDemandDrivenData(interpolationAddrPtr_); deleteDemandDrivenData(weightsPtr_); + hasUnmapped_ = false; } @@ -221,6 +229,7 @@ Foam::fvPatchMapper::fvPatchMapper patch_(patch), faceMap_(faceMap), sizeBeforeMapping_(faceMap.oldPatchSizes()[patch_.index()]), + hasUnmapped_(false), directAddrPtr_(NULL), interpolationAddrPtr_(NULL), weightsPtr_(NULL) diff --git a/src/finiteVolume/fvMesh/fvMeshMapper/fvPatchMapper.H b/src/finiteVolume/fvMesh/fvMeshMapper/fvPatchMapper.H index aa169fa082a6d5364ff47c199c5caf88fe545ed7..bcfd49566b7c18666079bf2dc938088bdf47f3ae 100644 --- a/src/finiteVolume/fvMesh/fvMeshMapper/fvPatchMapper.H +++ b/src/finiteVolume/fvMesh/fvMeshMapper/fvPatchMapper.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 @@ -71,6 +71,8 @@ class fvPatchMapper // Demand-driven private data + mutable bool hasUnmapped_; + //- Direct addressing (only one for of addressing is used) mutable labelList* directAddrPtr_; @@ -138,6 +140,11 @@ public: return faceMap_.direct(); } + virtual bool hasUnmapped() const + { + return hasUnmapped_; + } + //- Return direct addressing virtual const labelUList& directAddressing() const; diff --git a/src/finiteVolume/fvMesh/fvMeshMapper/fvSurfaceMapper.H b/src/finiteVolume/fvMesh/fvMeshMapper/fvSurfaceMapper.H index c144bb99603f2115efc180d72ec833d78eece063..bf47b1f55c4b1c6f69d0212f7cd7ab0cbfa048fd 100644 --- a/src/finiteVolume/fvMesh/fvMeshMapper/fvSurfaceMapper.H +++ b/src/finiteVolume/fvMesh/fvMeshMapper/fvSurfaceMapper.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 @@ -133,6 +133,12 @@ public: return faceMap_.direct(); } + //- Has unmapped elements + virtual bool hasUnmapped() const + { + return insertedObjects(); + } + //- Return direct addressing virtual const labelUList& directAddressing() const; diff --git a/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubset.H b/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubset.H index 2406da5db5277b0a34e2a59120b50d5f36077e4f..5f2a281d06596dc735a98af6eeb6453ebbaa765c 100644 --- a/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubset.H +++ b/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubset.H @@ -56,8 +56,6 @@ SourceFiles #include "fvMesh.H" #include "pointMesh.H" -#include "fvPatchFieldMapper.H" -#include "pointPatchFieldMapper.H" #include "GeometricField.H" #include "HashSet.H" #include "surfaceMesh.H" @@ -74,90 +72,6 @@ namespace Foam class fvMeshSubset { -public: - - //- Patch-field subset interpolation class - class patchFieldSubset - : - public fvPatchFieldMapper - { - const labelList& directAddressing_; - - public: - - // Constructors - - //- Construct given addressing - patchFieldSubset(const labelList& directAddressing) - : - directAddressing_(directAddressing) - {} - - //- Destructor - virtual ~patchFieldSubset() - {} - - - // Member Functions - - label size() const - { - return directAddressing_.size(); - } - - bool direct() const - { - return true; - } - - const labelUList& directAddressing() const - { - return directAddressing_; - } - }; - - - //- Patch-field subset interpolation class - class pointPatchFieldSubset - : - public pointPatchFieldMapper - { - const labelList& directAddressing_; - - public: - - // Constructors - - //- Construct given addressing - pointPatchFieldSubset(const labelList& directAddressing) - : - directAddressing_(directAddressing) - {} - - //- Destructor - virtual ~pointPatchFieldSubset() - {} - - - // Member Functions - - label size() const - { - return directAddressing_.size(); - } - - bool direct() const - { - return true; - } - - const labelUList& directAddressing() const - { - return directAddressing_; - } - }; - - private: // Private data diff --git a/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubsetInterpolate.C b/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubsetInterpolate.C index 130b08072a88f22bb315d3cb105329cdd087b6a1..78811948187039baf4636ed948981f6c620d85e5 100644 --- a/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubsetInterpolate.C +++ b/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubsetInterpolate.C @@ -27,6 +27,8 @@ License #include "emptyFvsPatchField.H" #include "emptyPointPatchField.H" #include "emptyFvPatchFields.H" +#include "directFvPatchFieldMapper.H" +#include "directPointPatchFieldMapper.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -70,8 +72,9 @@ tmp<GeometricField<Type, fvPatchField, volMesh> > fvMeshSubset::interpolate patchFields.set ( patchI, - new calculatedFvPatchField<Type> + fvPatchField<Type>::New ( + calculatedFvPatchField<Type>::typeName, sMesh.boundary()[patchI], DimensionedField<Type, volMesh>::null() ) @@ -142,7 +145,7 @@ tmp<GeometricField<Type, fvPatchField, volMesh> > fvMeshSubset::interpolate vf.boundaryField()[patchMap[patchI]], subPatch, resF.dimensionedInternalField(), - patchFieldSubset(directAddressing) + directFvPatchFieldMapper(directAddressing) ) ); } @@ -203,8 +206,9 @@ tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > fvMeshSubset::interpolate patchFields.set ( patchI, - new calculatedFvsPatchField<Type> + fvsPatchField<Type>::New ( + calculatedFvsPatchField<Type>::typeName, sMesh.boundary()[patchI], DimensionedField<Type, surfaceMesh>::null() ) @@ -285,7 +289,7 @@ tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > fvMeshSubset::interpolate vf.boundaryField()[patchMap[patchI]], subPatch, resF.dimensionedInternalField(), - patchFieldSubset(directAddressing) + directFvPatchFieldMapper(directAddressing) ) ); @@ -348,10 +352,7 @@ fvMeshSubset::interpolate const labelList& pointMap ) { - // Create and map the internal-field values - Field<Type> internalField(vf.internalField(), pointMap); - - // Create and map the patch field values + // 1. Create the complete field with dummy patch fields PtrList<pointPatchField<Type> > patchFields(patchMap.size()); forAll(patchFields, patchI) @@ -372,6 +373,54 @@ fvMeshSubset::interpolate ); } else + { + patchFields.set + ( + patchI, + pointPatchField<Type>::New + ( + calculatedPointPatchField<Type>::typeName, + sMesh.boundary()[patchI], + DimensionedField<Type, pointMesh>::null() + ) + ); + } + } + + // Create the complete field from the pieces + tmp<GeometricField<Type, pointPatchField, pointMesh> > tresF + ( + new GeometricField<Type, pointPatchField, pointMesh> + ( + IOobject + ( + "subset"+vf.name(), + sMesh.time().timeName(), + sMesh.thisDb(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + sMesh, + vf.dimensions(), + Field<Type>(vf.internalField(), pointMap), + patchFields + ) + ); + GeometricField<Type, pointPatchField, pointMesh>& resF = tresF(); + + + // 2. Change the pointPatchFields to the correct type using a mapper + // constructor (with reference to the now correct internal field) + + typename GeometricField<Type, pointPatchField, pointMesh>:: + GeometricBoundaryField& bf = resF.boundaryField(); + + forAll(bf, patchI) + { + // Set the first one by hand as it corresponds to the + // exposed internal faces. Additional interpolation can be put here + // as necessary. + if (patchMap[patchI] != -1) { // Construct addressing const pointPatch& basePatch = @@ -406,40 +455,20 @@ fvMeshSubset::interpolate } } - patchFields.set + bf.set ( patchI, pointPatchField<Type>::New ( vf.boundaryField()[patchMap[patchI]], subPatch, - DimensionedField<Type, pointMesh>::null(), - pointPatchFieldSubset(directAddressing) + resF.dimensionedInternalField(), + directPointPatchFieldMapper(directAddressing) ) ); } } - // Create the complete field from the pieces - tmp<GeometricField<Type, pointPatchField, pointMesh> > tresF - ( - new GeometricField<Type, pointPatchField, pointMesh> - ( - IOobject - ( - "subset"+vf.name(), - vf.time().timeName(), - sMesh.thisDb(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - sMesh, - vf.dimensions(), - internalField, - patchFields - ) - ); - return tresF; } diff --git a/src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMesh.H b/src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMesh.H index 7ee6c37b687597df61e8630db4604057b3c7cd1e..036e4f24c93e05fefa532754f9a143d3f5373cea 100644 --- a/src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMesh.H +++ b/src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMesh.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 @@ -87,39 +87,6 @@ class singleCellFvMesh public: - //- Patch field mapper class for non-agglomerated meshes - class directPatchFieldMapper - : - public fvPatchFieldMapper - { - // Private data - - const labelUList& directAddressing_; - - public: - - //- Construct given addressing - directPatchFieldMapper(const labelUList& directAddressing) - : - directAddressing_(directAddressing) - {} - - virtual label size() const - { - return directAddressing_.size(); - } - - virtual bool direct() const - { - return true; - } - - virtual const labelUList& directAddressing() const - { - return directAddressing_; - } - }; - //- Patch field mapper class for agglomerated meshes class agglomPatchFieldMapper : @@ -129,6 +96,7 @@ public: const labelListList& addressing_; const scalarListList& weights_; + bool hasUnmapped_; public: @@ -140,8 +108,18 @@ public: ) : addressing_(addressing), - weights_(weights) - {} + weights_(weights), + hasUnmapped_(false) + { + forAll(addressing_, i) + { + if (addressing_[i].empty()) + { + hasUnmapped_ = true; + break; + } + } + } virtual label size() const { @@ -153,6 +131,11 @@ public: return false; } + bool hasUnmapped() const + { + return hasUnmapped_; + } + virtual const labelListList& addressing() const { return addressing_; diff --git a/src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMeshInterpolate.C b/src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMeshInterpolate.C index 33e8316ac7f110dfc7e213eea8177e522c8bca4e..93ef66101f49f913c94ae92b4d4b2d3465589c41 100644 --- a/src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMeshInterpolate.C +++ b/src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMeshInterpolate.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 @@ -24,6 +24,8 @@ License \*---------------------------------------------------------------------------*/ #include "singleCellFvMesh.H" +#include "calculatedFvPatchFields.H" +#include "directFvPatchFieldMapper.H" #include "Time.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -39,12 +41,51 @@ tmp<GeometricField<Type, fvPatchField, volMesh> > singleCellFvMesh::interpolate const GeometricField<Type, fvPatchField, volMesh>& vf ) const { - // Create internal-field values - Field<Type> internalField(1, gAverage(vf)); - - // Create and map the patch field values + // 1. Create the complete field with dummy patch fields PtrList<fvPatchField<Type> > patchFields(vf.boundaryField().size()); + forAll(patchFields, patchI) + { + patchFields.set + ( + patchI, + fvPatchField<Type>::New + ( + calculatedFvPatchField<Type>::typeName, + boundary()[patchI], + DimensionedField<Type, volMesh>::null() + ) + ); + } + + // Create the complete field from the pieces + tmp<GeometricField<Type, fvPatchField, volMesh> > tresF + ( + new GeometricField<Type, fvPatchField, volMesh> + ( + IOobject + ( + vf.name(), + time().timeName(), + *this, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + *this, + vf.dimensions(), + Field<Type>(1, gAverage(vf)), + patchFields + ) + ); + GeometricField<Type, fvPatchField, volMesh>& resF = tresF(); + + + // 2. Change the fvPatchFields to the correct type using a mapper + // constructor (with reference to the now correct internal field) + + typename GeometricField<Type, fvPatchField, volMesh>:: + GeometricBoundaryField& bf = resF.boundaryField(); + if (agglomerate()) { forAll(vf.boundaryField(), patchI) @@ -67,14 +108,14 @@ tmp<GeometricField<Type, fvPatchField, volMesh> > singleCellFvMesh::interpolate ); } - patchFields.set + bf.set ( patchI, fvPatchField<Type>::New ( vf.boundaryField()[patchI], boundary()[patchI], - DimensionedField<Type, volMesh>::null(), + resF.dimensionedInternalField(), agglomPatchFieldMapper(coarseToFine, coarseWeights) ) ); @@ -86,40 +127,20 @@ tmp<GeometricField<Type, fvPatchField, volMesh> > singleCellFvMesh::interpolate { labelList map(identity(vf.boundaryField()[patchI].size())); - patchFields.set + bf.set ( patchI, fvPatchField<Type>::New ( vf.boundaryField()[patchI], boundary()[patchI], - DimensionedField<Type, volMesh>::null(), - directPatchFieldMapper(map) + resF.dimensionedInternalField(), + directFvPatchFieldMapper(map) ) ); } } - // Create the complete field from the pieces - tmp<GeometricField<Type, fvPatchField, volMesh> > tresF - ( - new GeometricField<Type, fvPatchField, volMesh> - ( - IOobject - ( - vf.name(), - time().timeName(), - *this, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - *this, - vf.dimensions(), - internalField, - patchFields - ) - ); - return tresF; } diff --git a/src/parallel/decompose/decompose/fvFieldDecomposer.H b/src/parallel/decompose/decompose/fvFieldDecomposer.H index 899b45b4b7550369f031279310f0456174cd9edc..0bf83369e6245ebe4afa7fc3d9920ca8330c0cb2 100644 --- a/src/parallel/decompose/decompose/fvFieldDecomposer.H +++ b/src/parallel/decompose/decompose/fvFieldDecomposer.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 @@ -88,6 +88,12 @@ public: return true; } + //- Are there unmapped values + bool hasUnmapped() const + { + return false; + } + const labelUList& directAddressing() const { return directAddressing_; @@ -128,6 +134,12 @@ public: return true; } + //- Are there unmapped values + bool hasUnmapped() const + { + return false; + } + const labelUList& directAddressing() const { return directAddressing_; @@ -165,6 +177,12 @@ public: return false; } + //- Are there unmapped values + bool hasUnmapped() const + { + return false; + } + const labelListList& addressing() const { return addressing_; diff --git a/src/parallel/decompose/decompose/fvFieldDecomposerDecomposeFields.C b/src/parallel/decompose/decompose/fvFieldDecomposerDecomposeFields.C index ca9d0e31b5eaa8f2c361864c93e32ee5e6fd452c..c72ceedfb89bc20e7dc29891eefa0091382621e4 100644 --- a/src/parallel/decompose/decompose/fvFieldDecomposerDecomposeFields.C +++ b/src/parallel/decompose/decompose/fvFieldDecomposerDecomposeFields.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 @@ -40,37 +40,76 @@ Foam::fvFieldDecomposer::decomposeField const bool allowUnknownPatchFields ) const { - // Create and map the internal field values - Field<Type> internalField(field.internalField(), cellAddressing_); - - // Create and map the patch field values + // 1. Create the complete field with dummy patch fields PtrList<fvPatchField<Type> > patchFields(boundaryAddressing_.size()); forAll(boundaryAddressing_, patchi) + { + patchFields.set + ( + patchi, + fvPatchField<Type>::New + ( + calculatedFvPatchField<Type>::typeName, + procMesh_.boundary()[patchi], + DimensionedField<Type, volMesh>::null() + ) + ); + } + + // Create the field for the processor + tmp<GeometricField<Type, fvPatchField, volMesh> > tresF + ( + new GeometricField<Type, fvPatchField, volMesh> + ( + IOobject + ( + field.name(), + procMesh_.time().timeName(), + procMesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + procMesh_, + field.dimensions(), + Field<Type>(field.internalField(), cellAddressing_), + patchFields + ) + ); + GeometricField<Type, fvPatchField, volMesh>& resF = tresF(); + + + // 2. Change the fvPatchFields to the correct type using a mapper + // constructor (with reference to the now correct internal field) + + typename GeometricField<Type, fvPatchField, volMesh>:: + GeometricBoundaryField& bf = resF.boundaryField(); + + forAll(bf, patchi) { if (patchFieldDecomposerPtrs_[patchi]) { - patchFields.set + bf.set ( patchi, fvPatchField<Type>::New ( field.boundaryField()[boundaryAddressing_[patchi]], procMesh_.boundary()[patchi], - DimensionedField<Type, volMesh>::null(), + resF.dimensionedInternalField(), *patchFieldDecomposerPtrs_[patchi] ) ); } else if (isA<processorCyclicFvPatch>(procMesh_.boundary()[patchi])) { - patchFields.set + bf.set ( patchi, new processorCyclicFvPatchField<Type> ( procMesh_.boundary()[patchi], - DimensionedField<Type, volMesh>::null(), + resF.dimensionedInternalField(), Field<Type> ( field.internalField(), @@ -81,13 +120,13 @@ Foam::fvFieldDecomposer::decomposeField } else if (isA<processorFvPatch>(procMesh_.boundary()[patchi])) { - patchFields.set + bf.set ( patchi, new processorFvPatchField<Type> ( procMesh_.boundary()[patchi], - DimensionedField<Type, volMesh>::null(), + resF.dimensionedInternalField(), Field<Type> ( field.internalField(), @@ -98,13 +137,13 @@ Foam::fvFieldDecomposer::decomposeField } else if (allowUnknownPatchFields) { - patchFields.set + bf.set ( patchi, new emptyFvPatchField<Type> ( procMesh_.boundary()[patchi], - DimensionedField<Type, volMesh>::null() + resF.dimensionedInternalField() ) ); } @@ -116,24 +155,7 @@ Foam::fvFieldDecomposer::decomposeField } // Create the field for the processor - return tmp<GeometricField<Type, fvPatchField, volMesh> > - ( - new GeometricField<Type, fvPatchField, volMesh> - ( - IOobject - ( - field.name(), - procMesh_.time().timeName(), - procMesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - procMesh_, - field.dimensions(), - internalField, - patchFields - ) - ); + return tresF; } @@ -188,34 +210,76 @@ Foam::fvFieldDecomposer::decomposeField } } - // Create and map the patch field values + + // 1. Create the complete field with dummy patch fields PtrList<fvsPatchField<Type> > patchFields(boundaryAddressing_.size()); + forAll(boundaryAddressing_, patchi) + { + patchFields.set + ( + patchi, + fvsPatchField<Type>::New + ( + calculatedFvsPatchField<Type>::typeName, + procMesh_.boundary()[patchi], + DimensionedField<Type, surfaceMesh>::null() + ) + ); + } + + tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tresF + ( + new GeometricField<Type, fvsPatchField, surfaceMesh> + ( + IOobject + ( + field.name(), + procMesh_.time().timeName(), + procMesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + procMesh_, + field.dimensions(), + Field<Type>(field.internalField(), mapAddr), + patchFields + ) + ); + GeometricField<Type, fvsPatchField, surfaceMesh>& resF = tresF(); + + + // 2. Change the fvsPatchFields to the correct type using a mapper + // constructor (with reference to the now correct internal field) + + typename GeometricField<Type, fvsPatchField, surfaceMesh>:: + GeometricBoundaryField& bf = resF.boundaryField(); + forAll(boundaryAddressing_, patchi) { if (patchFieldDecomposerPtrs_[patchi]) { - patchFields.set + bf.set ( patchi, fvsPatchField<Type>::New ( field.boundaryField()[boundaryAddressing_[patchi]], procMesh_.boundary()[patchi], - DimensionedField<Type, surfaceMesh>::null(), + resF.dimensionedInternalField(), *patchFieldDecomposerPtrs_[patchi] ) ); } else if (isA<processorCyclicFvPatch>(procMesh_.boundary()[patchi])) { - patchFields.set + bf.set ( patchi, new processorCyclicFvsPatchField<Type> ( procMesh_.boundary()[patchi], - DimensionedField<Type, surfaceMesh>::null(), + resF.dimensionedInternalField(), Field<Type> ( allFaceField, @@ -226,13 +290,13 @@ Foam::fvFieldDecomposer::decomposeField } else if (isA<processorFvPatch>(procMesh_.boundary()[patchi])) { - patchFields.set + bf.set ( patchi, new processorFvsPatchField<Type> ( procMesh_.boundary()[patchi], - DimensionedField<Type, surfaceMesh>::null(), + resF.dimensionedInternalField(), Field<Type> ( allFaceField, @@ -249,24 +313,7 @@ Foam::fvFieldDecomposer::decomposeField } // Create the field for the processor - return tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > - ( - new GeometricField<Type, fvsPatchField, surfaceMesh> - ( - IOobject - ( - field.name(), - procMesh_.time().timeName(), - procMesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - procMesh_, - field.dimensions(), - internalField, - patchFields - ) - ); + return tresF; } diff --git a/src/parallel/reconstruct/reconstruct/fvFieldReconstructor.H b/src/parallel/reconstruct/reconstruct/fvFieldReconstructor.H index 43469d24b4f0b6899b08833516ee84e44b3bd709..0ee1decbb4c632959aae1e0df63211d3f6e9dc95 100644 --- a/src/parallel/reconstruct/reconstruct/fvFieldReconstructor.H +++ b/src/parallel/reconstruct/reconstruct/fvFieldReconstructor.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 @@ -116,6 +116,11 @@ public: return true; } + bool hasUnmapped() const + { + return false; + } + const labelUList& directAddressing() const { return labelUList::null(); diff --git a/src/parallel/reconstruct/reconstruct/pointFieldReconstructor.H b/src/parallel/reconstruct/reconstruct/pointFieldReconstructor.H index 47ad5b23c2dd780711145af3b3552a9ea467a924..c15b7111da8203dbbc4077c3ef85e93b69ab4df6 100644 --- a/src/parallel/reconstruct/reconstruct/pointFieldReconstructor.H +++ b/src/parallel/reconstruct/reconstruct/pointFieldReconstructor.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 @@ -112,6 +112,11 @@ public: return true; } + bool hasUnmapped() const + { + return false; + } + const labelUList& directAddressing() const { return labelUList::null(); diff --git a/src/postProcessing/functionObjects/IO/controlDict b/src/postProcessing/functionObjects/IO/controlDict index aed0d13d014bcda4f000a120e78ae01273c4fe88..df7960250a08cc209a0d186c725160dea993646e 100644 --- a/src/postProcessing/functionObjects/IO/controlDict +++ b/src/postProcessing/functionObjects/IO/controlDict @@ -86,34 +86,36 @@ functions dumpObjects { - // Forcibly write registered objects. E.g. fields that have been - // created with NO_WRITE. + // Forcibly write registered objects type writeRegisteredObject; // Where to load it from functionObjectLibs ("libIOFunctionObjects.so"); - // Execute upon outputTime: - // timeStep - // outputTime + // When to write: + // timeStep (with optional outputInterval) + // outputTime (with optional outputInterval) // adjustableTime // runTime // clockTime // cpuTime outputControl outputTime; - // Is the object written by this function Object alone - exclusiveWriting true; + // Write every writeInterval (only valid for timeStemp, outputTime) + outputInterval 1; - // Interval of time (sec) to write down( - writeInterval 10.5 //(adjustableTime, runTime, clockTime, cpuTime) - - // Write as normal every writeInterval'th outputTime. - outputInterval 1; // (timeStep, outputTime) + // Interval of time (valid for adjustableTime, runTime, clockTime, + // cpuTime) + writeInterval 10.5; // Objects to write objectNames (); + + + // Is the object written by this function Object alone + // (default is false) + //exclusiveWriting true; } } diff --git a/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObject.C b/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObject.C index c05abb5b2f4491c194f2644beaa0834dd204dba5..efffb9e2f9f115fa71ce07bef77c6c41381c2dba 100644 --- a/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObject.C +++ b/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObject.C @@ -46,7 +46,7 @@ Foam::writeRegisteredObject::writeRegisteredObject ) : name_(name), - exclusiveWriting_(true), + exclusiveWriting_(false), obr_(obr), objectNames_() { diff --git a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.H b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.H index 0905176adf59b8866781b522920d89e056d7097a..5382fecb3711831294ed3aa58b844b756eece151 100644 --- a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.H +++ b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.H @@ -26,6 +26,7 @@ License #include "thermoSingleLayer.H" #include "heatTransferModel.H" #include "filmRadiationModel.H" +#include "phaseChangeModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/sampling/meshToMeshInterpolation/meshToMesh/meshToMesh.H b/src/sampling/meshToMeshInterpolation/meshToMesh/meshToMesh.H index b99c0629ccb2fc5646367c3732da84bf33a78fcb..bfedab7433d33f91e2f995e905cf6683a3ba1bc3 100644 --- a/src/sampling/meshToMeshInterpolation/meshToMesh/meshToMesh.H +++ b/src/sampling/meshToMeshInterpolation/meshToMesh/meshToMesh.H @@ -175,48 +175,6 @@ public: ~meshToMesh(); - //- Patch-field interpolation class - class patchFieldInterpolator - : - public fvPatchFieldMapper - { - const labelList& directAddressing_; - - public: - - // Constructors - - //- Construct given addressing - patchFieldInterpolator(const labelList& addr) - : - directAddressing_(addr) - {} - - - //- Destructor - virtual ~patchFieldInterpolator() - {} - - - // Member Functions - - label size() const - { - return directAddressing_.size(); - } - - bool direct() const - { - return true; - } - - const labelList& directAddressing() const - { - return directAddressing_; - } - }; - - // Member Functions // Access diff --git a/src/sampling/meshToMeshInterpolation/meshToMesh/meshToMeshInterpolate.C b/src/sampling/meshToMeshInterpolation/meshToMesh/meshToMeshInterpolate.C index 372194e322549a3c8554336b907b0d4bd7f9f7c5..42a5269cd2d6d70c16377f092b7996fa4188057f 100644 --- a/src/sampling/meshToMeshInterpolation/meshToMesh/meshToMeshInterpolate.C +++ b/src/sampling/meshToMeshInterpolation/meshToMesh/meshToMeshInterpolate.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 @@ -28,6 +28,7 @@ License #include "interpolationCellPoint.H" #include "SubField.H" #include "mixedFvPatchField.H" +#include "directFvPatchFieldMapper.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -408,7 +409,7 @@ Foam::meshToMesh::interpolate << exit(FatalError); } - // Create and map the patch field values + // 1. Create the complete field with dummy patch fields PtrList<fvPatchField<Type> > patchFields ( boundaryAddressing_.size() @@ -421,13 +422,9 @@ Foam::meshToMesh::interpolate patchI, fvPatchField<Type>::New ( - fromVf.boundaryField()[patchI], + calculatedFvPatchField<Type>::typeName, toMesh_.boundary()[patchI], - DimensionedField<Type, volMesh>::null(), - patchFieldInterpolator - ( - boundaryAddressing_[patchI] - ) + DimensionedField<Type, volMesh>::null() ) ); } @@ -452,6 +449,31 @@ Foam::meshToMesh::interpolate patchFields ) ); + GeometricField<Type, fvPatchField, volMesh>& toF = ttoF(); + + // 2. Change the fvPatchFields to the correct type using a mapper + // constructor (with reference to the now correct internal field) + + typename GeometricField<Type, fvPatchField, volMesh>:: + GeometricBoundaryField& bf = toF.boundaryField(); + + forAll(boundaryAddressing_, patchI) + { + bf.set + ( + patchI, + fvPatchField<Type>::New + ( + fromVf.boundaryField()[patchI], + toMesh_.boundary()[patchI], + toF.dimensionedInternalField(), + directFvPatchFieldMapper + ( + boundaryAddressing_[patchI] + ) + ) + ); + } return ttoF; }