From 26ee1bb51ee490cf32f5fd24fdb68f587c09ba65 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 27 Feb 2012 11:54:52 +0000 Subject: [PATCH] BUG: mappedPatchBase: reverseDistribute using local, not remote size --- .../mappedPolyPatch/mappedPatchBase.H | 4 +++ .../mappedPolyPatch/mappedPatchBaseI.H | 33 ++++++++++++++++++- .../mappedPatchBaseTemplates.C | 9 ++--- 3 files changed, 41 insertions(+), 5 deletions(-) diff --git a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.H b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.H index 96d7958528..71afd2fba6 100644 --- a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.H +++ b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.H @@ -244,6 +244,7 @@ protected: const label size ); + public: //- Runtime type information @@ -319,6 +320,9 @@ public: //- Patch (only if NEARESTPATCHFACE) inline const word& samplePatch() const; + //- Return size of mapped mesh/patch/boundary + inline label sampleSize() const; + //- Offset vector (from patch faces to destination mesh objects) inline const vector& offset() const; diff --git a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBaseI.H b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBaseI.H index 5814a1e824..928fa86ad7 100644 --- a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBaseI.H +++ b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBaseI.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -42,6 +42,37 @@ inline const Foam::word& Foam::mappedPatchBase::samplePatch() const } +inline Foam::label Foam::mappedPatchBase::sampleSize() const +{ + switch (mode_) + { + case NEARESTPATCHFACEAMI: + { + return samplePolyPatch().size(); + } + case NEARESTCELL: + { + return sampleMesh().nCells(); + } + case NEARESTPATCHFACE: + { + return samplePolyPatch().size(); + } + case NEARESTFACE: + { + const polyMesh& mesh = sampleMesh(); + return mesh.nFaces() - mesh.nInternalFaces(); + } + default: + { + FatalErrorIn("mappedPatchBase::sampleSize()") + << "problem." << abort(FatalError); + return -1; + } + } +} + + inline const Foam::vector& Foam::mappedPatchBase::offset() const { return offset_; diff --git a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBaseTemplates.C b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBaseTemplates.C index 47067b00f6..a4e36ff457 100644 --- a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBaseTemplates.C +++ b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBaseTemplates.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -89,8 +89,8 @@ void Foam::mappedPatchBase::reverseDistribute(List& lst) const } default: { - label cSize = patch_.size(); - map().reverseDistribute(cSize, lst); + map().reverseDistribute(sampleSize(), lst); + break; } } } @@ -116,7 +116,7 @@ void Foam::mappedPatchBase::reverseDistribute } default: { - label cSize = patch_.size(); + label cSize = sampleSize(); map().distribute ( Pstream::defaultCommsType, @@ -128,6 +128,7 @@ void Foam::mappedPatchBase::reverseDistribute bop, pTraits::zero ); + break; } } }