ENH: AMI - only run parallel distributed if AMI is distributed

This commit is contained in:
andy
2011-09-27 15:40:28 +01:00
parent 2e80e7c6ef
commit c1bb2ac02d
2 changed files with 39 additions and 1 deletions

View File

@ -119,6 +119,37 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::checkPatches
}
template<class SourcePatch, class TargetPatch>
bool Foam::AMIInterpolation<SourcePatch, TargetPatch>::distributed
(
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch
)
{
if (Pstream::parRun())
{
List<label> facesPresentOnProc(Pstream::nProcs(), 0);
if ((srcPatch.size() > 0) || (tgtPatch.size() > 0))
{
facesPresentOnProc[Pstream::myProcNo()] = 1;
}
else
{
facesPresentOnProc[Pstream::myProcNo()] = 0;
}
Pstream::gatherList(facesPresentOnProc);
Pstream::scatterList(facesPresentOnProc);
if (sum(facesPresentOnProc) > 1)
{
return true;
}
}
return false;
}
template<class SourcePatch, class TargetPatch>
Foam::label
Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcOverlappingProcs
@ -1160,7 +1191,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
{
static label patchI = 0;
if (Pstream::parRun())
if (Pstream::parRun() && distributed(srcPatch, tgtPatch))
{
// convert local addressing to global addressing
globalIndex globalSrcFaces(srcPatch.size());

View File

@ -167,6 +167,13 @@ class AMIInterpolation
// Parallel functionality
//- Return true if faces are spread over multiple domains
bool distributed
(
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch
);
label calcOverlappingProcs
(
const List<treeBoundBoxList>& procBb,