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
);
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;

View File

@ -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_;

View File

@ -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<Type>& 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<Type>::zero
);
break;
}
}
}