From 9ca28aee18b43b25fdba057f37378afc26ee2c15 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 11 Nov 2011 09:26:17 +0000 Subject: [PATCH] ENH: AMIInterpolation: parallel running improvements --- .../AMIInterpolation/AMIInterpolation.C | 67 +++++++++++++++++-- 1 file changed, 60 insertions(+), 7 deletions(-) diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C index 083d622c04..a0965ff941 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C @@ -47,7 +47,7 @@ void Foam::AMIInterpolation::writeIntersectionOBJ const pointField f1pts = f1.points(f1Points); const pointField f2pts = f2.points(f2Points); - Info<< "Face intersection area (" << count << "):" << nl + Pout<< "Face intersection area (" << count << "):" << nl << " f1 face = " << f1 << nl << " f1 pts = " << f1pts << nl << " f2 face = " << f2 << nl @@ -95,7 +95,12 @@ void Foam::AMIInterpolation::checkPatches // check bounds of source and target boundBox bbSrc(srcPatch.points(), srcPatch.meshPoints()); + reduce(bbSrc.min(), minOp()); + reduce(bbSrc.max(), maxOp()); + boundBox bbTgt(tgtPatch.points(), tgtPatch.meshPoints()); + reduce(bbTgt.min(), minOp()); + reduce(bbTgt.max(), maxOp()); boundBox bbTgtInf(bbTgt); bbTgtInf.inflate(maxBoundsError); @@ -222,7 +227,7 @@ void Foam::AMIInterpolation::distributePatches pp.points() ); - if (debug) + if (debug & 2) { Pout<< "distributePatches: to processor " << domain << " sending faces " << subPatch.faceCentres() << endl; @@ -253,7 +258,7 @@ void Foam::AMIInterpolation::distributePatches ); // Receive - if (debug) + if (debug & 2) { Pout<< "distributePatches: to processor " << Pstream::myProcNo() << " sending faces " << subPatch.faceCentres() << endl; @@ -441,6 +446,18 @@ Foam::AMIInterpolation::calcProcMap Pstream::gatherList(procBb); Pstream::scatterList(procBb); + + if (debug) + { + Info<< "Determining extent of srcPatch per processor:" << nl + << "\tproc\tbb" << endl; + forAll(procBb, procI) + { + Info<< '\t' << procI << '\t' << procBb[procI] << endl; + } + } + + // Determine which faces of tgtPatch overlaps srcPatch per proc const faceList& faces = tgtPatch.localFaces(); const pointField& points = tgtPatch.localPoints(); @@ -481,6 +498,17 @@ Foam::AMIInterpolation::calcProcMap } } + // Debug printing + if (debug) + { + Pout<< "Of my " << faces.size() << " I need to send to:" << nl + << "\tproc\tfaces" << endl; + forAll(sendMap, procI) + { + Pout<< '\t' << procI << '\t' << sendMap[procI].size() << endl; + } + } + // Send over how many faces I need to receive labelListList sendSizes(Pstream::nProcs()); @@ -616,7 +644,7 @@ Foam::label Foam::AMIInterpolation::findTargetFace if (debug) { - Info<< "Source point = " << srcPt << ", Sample point = " + Pout<< "Source point = " << srcPt << ", Sample point = " << sample.hitPoint() << ", Sample index = " << sample.index() << endl; } @@ -753,7 +781,7 @@ void Foam::AMIInterpolation::setNextFaces // perform new search to find match if (debug) { - Info<< "Advancing front stalled: searching for new " + Pout<< "Advancing front stalled: searching for new " << "target face" << endl; } @@ -854,6 +882,21 @@ void Foam::AMIInterpolation::calcAddressing << srcPatch.size() << ", target faces = " << tgtPatch.size() << endl; } + } + + if (!srcPatch.size()) + { + return; + } + else if (!tgtPatch.size()) + { + WarningIn + ( + "AMIInterpolation::calcAddressing" + "(const primitivePatch&, const primitivePatch&, " + " label, label)" + ) << "Have " << srcPatch.size() << " source faces but no target faces." + << endl; return; } @@ -901,7 +944,7 @@ void Foam::AMIInterpolation::calcAddressing if (debug) { - Info<< "AMI: initial target face = " << tgtFaceI << endl; + Pout<< "AMI: initial target face = " << tgtFaceI << endl; } @@ -1312,7 +1355,7 @@ void Foam::AMIInterpolation::agglomerate "source", srcAddress, srcWeights, - true + false ); } @@ -1716,6 +1759,16 @@ void Foam::AMIInterpolation::update normaliseWeights(srcMagSf_, "source", srcAddress_, srcWeights_, true); normaliseWeights(tgtMagSf_, "target", tgtAddress_, tgtWeights_, true); } + + if (debug) + { + Info<< "AMIInterpolation : Constructed addressing and weights." << nl + << " triMode :" << triMode_ << nl + << " singlePatchProc:" << singlePatchProc_ << nl + << " srcMagSf :" << gSum(srcMagSf_) << nl + << " tgtMagSf :" << gSum(tgtMagSf_) << nl + << endl; + } }