BUG: mappedPatchBase: reverseDistribute using local, not remote size

This commit is contained in:
mattijs
2012-02-27 11:54:52 +00:00
parent faf7e023c1
commit 26ee1bb51e
3 changed files with 41 additions and 5 deletions

View File

@ -244,6 +244,7 @@ protected:
const label size const label size
); );
public: public:
//- Runtime type information //- Runtime type information
@ -319,6 +320,9 @@ public:
//- Patch (only if NEARESTPATCHFACE) //- Patch (only if NEARESTPATCHFACE)
inline const word& samplePatch() const; 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) //- Offset vector (from patch faces to destination mesh objects)
inline const vector& offset() const; inline const vector& offset() const;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License 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 inline const Foam::vector& Foam::mappedPatchBase::offset() const
{ {
return offset_; return offset_;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -89,8 +89,8 @@ void Foam::mappedPatchBase::reverseDistribute(List<Type>& lst) const
} }
default: default:
{ {
label cSize = patch_.size(); map().reverseDistribute(sampleSize(), lst);
map().reverseDistribute(cSize, lst); break;
} }
} }
} }
@ -116,7 +116,7 @@ void Foam::mappedPatchBase::reverseDistribute
} }
default: default:
{ {
label cSize = patch_.size(); label cSize = sampleSize();
map().distribute map().distribute
( (
Pstream::defaultCommsType, Pstream::defaultCommsType,
@ -128,6 +128,7 @@ void Foam::mappedPatchBase::reverseDistribute
bop, bop,
pTraits<Type>::zero pTraits<Type>::zero
); );
break;
} }
} }
} }