From a1a0c249a40e91ff3c7d410d152eb56d4dcafd43 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 17 Feb 2014 16:46:43 +0000 Subject: [PATCH] ENH: mapNearestAMI - added protection for case when srcFace =-1, e.g. if mesh bounds are dissimilar --- .../AMIMethod/mapNearestAMI/mapNearestAMI.C | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/mapNearestAMI/mapNearestAMI.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/mapNearestAMI/mapNearestAMI.C index 61ed01727e..be6f590fa0 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/mapNearestAMI/mapNearestAMI.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/mapNearestAMI/mapNearestAMI.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -310,16 +310,19 @@ void Foam::mapNearestAMI::calculate { label srcFaceI = findMappedSrcFace(tgtFaceI, tgtAddr); - // note - reversed search from src->tgt to tgt->src - findNearestFace - ( - this->tgtPatch_, - this->srcPatch_, - tgtFaceI, - srcFaceI - ); + if (srcFaceI >= 0) + { + // note - reversed search from src->tgt to tgt->src + findNearestFace + ( + this->tgtPatch_, + this->srcPatch_, + tgtFaceI, + srcFaceI + ); - tgtAddr[tgtFaceI].append(srcFaceI); + tgtAddr[tgtFaceI].append(srcFaceI); + } } }