From 12fed65820324f4b14f7457b9d263de2ee4937fe Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 11 Apr 2013 14:55:35 +0100 Subject: [PATCH] ENH: Updated AMIInterpolation to use new AMIMethods --- .../AMIInterpolation/AMIInterpolation.C | 874 ++---------------- .../AMIInterpolation/AMIInterpolation.H | 148 +-- .../AMIInterpolation/AMIInterpolationI.H | 10 +- .../AMIMethod/AMIMethod/AMIMethodNew.C | 5 +- .../AMIMethod/directAMI/directAMI.C | 18 +- .../faceAreaWeightAMI/faceAreaWeightAMI.C | 2 +- .../faceAreaWeightAMI/faceAreaWeightAMI.H | 2 +- .../AMIMethod/mapNearestAMI/mapNearestAMI.C | 4 +- .../AMIPatchToPatchInterpolation.C | 44 + src/meshTools/Make/files | 1 + 10 files changed, 197 insertions(+), 911 deletions(-) create mode 100644 src/meshTools/AMIInterpolation/AMIInterpolation/AMIPatchToPatchInterpolation.C diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C index f62ea404d9..291e6a4816 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C @@ -24,128 +24,12 @@ License \*---------------------------------------------------------------------------*/ #include "AMIInterpolation.H" +#include "AMIMethod.H" #include "meshTools.H" #include "mapDistribute.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -template -void Foam::AMIInterpolation::writeIntersectionOBJ -( - const scalar area, - const face& f1, - const face& f2, - const pointField& f1Points, - const pointField& f2Points -) const -{ - static label count = 1; - - const pointField f1pts = f1.points(f1Points); - const pointField f2pts = f2.points(f2Points); - - Pout<< "Face intersection area (" << count << "):" << nl - << " f1 face = " << f1 << nl - << " f1 pts = " << f1pts << nl - << " f2 face = " << f2 << nl - << " f2 pts = " << f2pts << nl - << " area = " << area - << endl; - - OFstream os("areas" + name(count) + ".obj"); - - forAll(f1pts, i) - { - meshTools::writeOBJ(os, f1pts[i]); - } - os<< "l"; - forAll(f1pts, i) - { - os<< " " << i + 1; - } - os<< " 1" << endl; - - - forAll(f2pts, i) - { - meshTools::writeOBJ(os, f2pts[i]); - } - os<< "l"; - forAll(f2pts, i) - { - os<< " " << f1pts.size() + i + 1; - } - os<< " " << f1pts.size() + 1 << endl; - - count++; -} - - -template -void Foam::AMIInterpolation::checkPatches -( - const SourcePatch& srcPatch, - const TargetPatch& tgtPatch -) const -{ - const scalar maxBoundsError = 0.05; - - // check bounds of source and target - boundBox bbSrc(srcPatch.points(), srcPatch.meshPoints(), true); - boundBox bbTgt(tgtPatch.points(), tgtPatch.meshPoints(), true); - - boundBox bbTgtInf(bbTgt); - bbTgtInf.inflate(maxBoundsError); - - if (!bbTgtInf.contains(bbSrc)) - { - WarningIn - ( - "AMIInterpolation::checkPatches" - "(" - "const SourcePatch&, " - "const TargetPatch&" - ")" - ) << "Source and target patch bounding boxes are not similar" << nl - << " source box span : " << bbSrc.span() << nl - << " target box span : " << bbTgt.span() << nl - << " source box : " << bbSrc << nl - << " target box : " << bbTgt << nl - << " inflated target box : " << bbTgtInf << endl; - } -} - - -template -void Foam::AMIInterpolation::resetTree -( - const TargetPatch& tgtPatch -) -{ - // Clear the old octree - treePtr_.clear(); - - - treeBoundBox bb(tgtPatch.points()); - bb.inflate(0.01); - - if (!treePtr_.valid()) - { - treePtr_.reset - ( - new indexedOctree - ( - treeType(false, tgtPatch), - bb, // overall search domain - 8, // maxLevel - 10, // leaf size - 3.0 // duplicity - ) - ); - } -} - - template void Foam::AMIInterpolation::projectPointsToSurface ( @@ -182,7 +66,8 @@ void Foam::AMIInterpolation::projectPointsToSurface { FatalErrorIn ( - "void Foam::projectPointsToSurface" + "void Foam::AMIInterpolation::" + "projectPointsToSurface" "(" "const searchableSurface&, " "pointField&" @@ -195,635 +80,6 @@ void Foam::AMIInterpolation::projectPointsToSurface } -template -Foam::label Foam::AMIInterpolation::findTargetFace -( - const label srcFaceI, - const SourcePatch& srcPatch -) const -{ - label targetFaceI = -1; - - const pointField& srcPts = srcPatch.points(); - const face& srcFace = srcPatch[srcFaceI]; - const point srcPt = srcFace.centre(srcPts); - const scalar srcFaceArea = srcMagSf_[srcFaceI]; - - pointIndexHit sample = treePtr_->findNearest(srcPt, 10.0*srcFaceArea); - - - if (debug) - { - Pout<< "Source point = " << srcPt << ", Sample point = " - << sample.hitPoint() << ", Sample index = " << sample.index() - << endl; - } - - if (sample.hit()) - { - targetFaceI = sample.index(); - } - - return targetFaceI; -} - - -template -void Foam::AMIInterpolation::appendNbrFaces -( - const label faceI, - const TargetPatch& patch, - const DynamicList