diff --git a/src/sampling/Make/files b/src/sampling/Make/files index 693e16d7ec..44943ba1da 100644 --- a/src/sampling/Make/files +++ b/src/sampling/Make/files @@ -62,7 +62,7 @@ $(surfWriters)/vtk/vtkSurfaceWriter.C meshToMesh/meshToMesh.C meshToMesh/meshToMeshParallelOps.C -meshToMesh/distributedWeightedFvPatchFieldMapper.C +meshToMesh/patchToPatchFvPatchFieldMapper.C meshToMeshMethods = meshToMesh/calcMethod $(meshToMeshMethods)/meshToMeshMethod/meshToMeshMethod.C $(meshToMeshMethods)/meshToMeshMethod/meshToMeshMethodNew.C diff --git a/src/sampling/meshToMesh/calcMethod/cellVolumeWeight/cellVolumeWeightMethod.C b/src/sampling/meshToMesh/calcMethod/cellVolumeWeight/cellVolumeWeightMethod.C index f8f2c459bf..a3321b945d 100644 --- a/src/sampling/meshToMesh/calcMethod/cellVolumeWeight/cellVolumeWeightMethod.C +++ b/src/sampling/meshToMesh/calcMethod/cellVolumeWeight/cellVolumeWeightMethod.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "cellVolumeWeightMethod.H" -#include "faceAreaWeightAMI.H" +#include "intersectionPatchToPatch.H" #include "indexedOctree.H" #include "treeDataCell.H" #include "addToRunTimeSelectionTable.H" @@ -316,9 +316,9 @@ Foam::cellVolumeWeightMethod::~cellVolumeWeightMethod() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -const Foam::word& Foam::cellVolumeWeightMethod::AMImethod() const +const Foam::word& Foam::cellVolumeWeightMethod::patchToPatchMethod() const { - return faceAreaWeightAMI::typeName; + return patchToPatches::intersection::typeName; } diff --git a/src/sampling/meshToMesh/calcMethod/cellVolumeWeight/cellVolumeWeightMethod.H b/src/sampling/meshToMesh/calcMethod/cellVolumeWeight/cellVolumeWeightMethod.H index 1b9f9a5314..028a561d26 100644 --- a/src/sampling/meshToMesh/calcMethod/cellVolumeWeight/cellVolumeWeightMethod.H +++ b/src/sampling/meshToMesh/calcMethod/cellVolumeWeight/cellVolumeWeightMethod.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -114,8 +114,9 @@ public: // Member Functions - //- Return the corresponding AMI method for patch interpolation - virtual const word& AMImethod() const; + //- Return the corresponding patchToPatch method for patch + // interpolation + virtual const word& patchToPatchMethod() const; // Evaluate diff --git a/src/sampling/meshToMesh/calcMethod/direct/directMethod.C b/src/sampling/meshToMesh/calcMethod/direct/directMethod.C index a5bc2d1cb4..af063642ea 100644 --- a/src/sampling/meshToMesh/calcMethod/direct/directMethod.C +++ b/src/sampling/meshToMesh/calcMethod/direct/directMethod.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "directMethod.H" -#include "directAMI.H" +#include "matchingPatchToPatch.H" #include "indexedOctree.H" #include "treeDataCell.H" #include "addToRunTimeSelectionTable.H" @@ -238,9 +238,9 @@ Foam::directMethod::~directMethod() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -const Foam::word& Foam::directMethod::AMImethod() const +const Foam::word& Foam::directMethod::patchToPatchMethod() const { - return directAMI::typeName; + return patchToPatches::matching::typeName; } diff --git a/src/sampling/meshToMesh/calcMethod/direct/directMethod.H b/src/sampling/meshToMesh/calcMethod/direct/directMethod.H index 4d6e1afa28..43f8313eaa 100644 --- a/src/sampling/meshToMesh/calcMethod/direct/directMethod.H +++ b/src/sampling/meshToMesh/calcMethod/direct/directMethod.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -119,8 +119,9 @@ public: // Member Functions - //- Return the corresponding AMI method for patch interpolation - virtual const word& AMImethod() const; + //- Return the corresponding patchToPatch method for patch + // interpolation + virtual const word& patchToPatchMethod() const; // Evaluate diff --git a/src/sampling/meshToMesh/calcMethod/mapNearest/mapNearestMethod.C b/src/sampling/meshToMesh/calcMethod/mapNearest/mapNearestMethod.C index cb97cfa12a..df2d8c04a5 100644 --- a/src/sampling/meshToMesh/calcMethod/mapNearest/mapNearestMethod.C +++ b/src/sampling/meshToMesh/calcMethod/mapNearest/mapNearestMethod.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "mapNearestMethod.H" -#include "mapNearestAMI.H" +#include "nearestPatchToPatch.H" #include "pointIndexHit.H" #include "indexedOctree.H" #include "treeDataCell.H" @@ -346,9 +346,9 @@ Foam::mapNearestMethod::~mapNearestMethod() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -const Foam::word& Foam::mapNearestMethod::AMImethod() const +const Foam::word& Foam::mapNearestMethod::patchToPatchMethod() const { - return mapNearestAMI::typeName; + return patchToPatches::nearest::typeName; } diff --git a/src/sampling/meshToMesh/calcMethod/mapNearest/mapNearestMethod.H b/src/sampling/meshToMesh/calcMethod/mapNearest/mapNearestMethod.H index c97aa4f164..4169465120 100644 --- a/src/sampling/meshToMesh/calcMethod/mapNearest/mapNearestMethod.H +++ b/src/sampling/meshToMesh/calcMethod/mapNearest/mapNearestMethod.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -132,8 +132,9 @@ public: // Member Functions - //- Return the corresponding AMI method for patch interpolation - virtual const word& AMImethod() const; + //- Return the corresponding patchToPatch method for patch + // interpolation + virtual const word& patchToPatchMethod() const; // Evaluate diff --git a/src/sampling/meshToMesh/calcMethod/meshToMeshMethod/meshToMeshMethod.H b/src/sampling/meshToMesh/calcMethod/meshToMeshMethod/meshToMeshMethod.H index 72d83e6b81..fedb8968cd 100644 --- a/src/sampling/meshToMesh/calcMethod/meshToMeshMethod/meshToMeshMethod.H +++ b/src/sampling/meshToMesh/calcMethod/meshToMeshMethod/meshToMeshMethod.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -145,8 +145,9 @@ public: // Member Functions - //- Return the corresponding AMI method for patch interpolation - virtual const word& AMImethod() const = 0; + //- Return the corresponding patchToPatch method for patch + // interpolation + virtual const word& patchToPatchMethod() const = 0; // Evaluate diff --git a/src/sampling/meshToMesh/calcMethod/meshToMeshMethod/meshToMeshMethodNew.C b/src/sampling/meshToMesh/calcMethod/meshToMeshMethod/meshToMeshMethodNew.C index 3b5753a56e..67c0ebd2ea 100644 --- a/src/sampling/meshToMesh/calcMethod/meshToMeshMethod/meshToMeshMethodNew.C +++ b/src/sampling/meshToMesh/calcMethod/meshToMeshMethod/meshToMeshMethodNew.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,7 +36,7 @@ Foam::autoPtr Foam::meshToMeshMethod::New { if (debug) { - Info<< "Selecting AMIMethod " << methodName << endl; + Info<< "Selecting meshToMeshMethod " << methodName << endl; } componentsConstructorTable::iterator cstrIter = diff --git a/src/sampling/meshToMesh/meshToMesh.C b/src/sampling/meshToMesh/meshToMesh.C index 8bcaafcc06..4b1886d728 100644 --- a/src/sampling/meshToMesh/meshToMesh.C +++ b/src/sampling/meshToMesh/meshToMesh.C @@ -39,106 +39,6 @@ namespace Foam // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -template<> -void Foam::meshToMesh::mapAndOpSrcToTgt -( - const AMIInterpolation& AMI, - const Field& srcField, - Field& tgtField -) const -{} - - -template<> -void Foam::meshToMesh::mapAndOpSrcToTgt -( - const AMIInterpolation& AMI, - const Field& srcField, - Field& tgtField -) const -{} - - -template<> -void Foam::meshToMesh::mapAndOpSrcToTgt -( - const AMIInterpolation& AMI, - const Field& srcField, - Field& tgtField -) const -{} - - -template<> -void Foam::meshToMesh::mapAndOpSrcToTgt -( - const AMIInterpolation& AMI, - const Field& srcField, - Field& tgtField -) const -{} - - -template<> -void Foam::meshToMesh::mapAndOpSrcToTgt -( - const AMIInterpolation& AMI, - const Field& srcField, - Field& tgtField -) const -{} - - -template<> -void Foam::meshToMesh::mapAndOpTgtToSrc -( - const AMIInterpolation& AMI, - Field& srcField, - const Field& tgtField -) const -{} - - -template<> -void Foam::meshToMesh::mapAndOpTgtToSrc -( - const AMIInterpolation& AMI, - Field& srcField, - const Field& tgtField -) const -{} - - -template<> -void Foam::meshToMesh::mapAndOpTgtToSrc -( - const AMIInterpolation& AMI, - Field& srcField, - const Field& tgtField -) const -{} - - -template<> -void Foam::meshToMesh::mapAndOpTgtToSrc -( - const AMIInterpolation& AMI, - Field& srcField, - const Field& tgtField -) const -{} - - -template<> -void Foam::meshToMesh::mapAndOpTgtToSrc -( - const AMIInterpolation& AMI, - Field& srcField, - const Field& tgtField -) const -{} - - Foam::labelList Foam::meshToMesh::maskCells ( const polyMesh& src, @@ -235,7 +135,7 @@ Foam::word Foam::meshToMesh::calcAddressing methodPtr->writeConnectivity(src, tgt, srcToTgtCellAddr_); } - return methodPtr->AMImethod(); + return methodPtr->patchToPatchMethod(); } @@ -247,7 +147,7 @@ Foam::word Foam::meshToMesh::calculate(const word& methodName) singleMeshProc_ = calcDistribution(srcRegion_, tgtRegion_); - word amiMethod; + word patchToPatchType; if (singleMeshProc_ == -1) { @@ -314,9 +214,6 @@ Foam::word Foam::meshToMesh::calculate(const word& methodName) // force calculation of tet-base points used for point-in-cell (void)newTgt.tetBasePtIs(); - // force construction of cell tree -// (void)newTgt.cellTree(); - if (debug) { Pout<< "Created newTgt mesh:" << nl @@ -332,7 +229,7 @@ Foam::word Foam::meshToMesh::calculate(const word& methodName) } } - amiMethod = calcAddressing(methodName, srcRegion_, newTgt); + patchToPatchType = calcAddressing(methodName, srcRegion_, newTgt); // per source cell the target cell address in newTgt mesh forAll(srcToTgtCellAddr_, i) @@ -417,7 +314,7 @@ Foam::word Foam::meshToMesh::calculate(const word& methodName) } else { - amiMethod = calcAddressing(methodName, srcRegion_, tgtRegion_); + patchToPatchType = calcAddressing(methodName, srcRegion_, tgtRegion_); normaliseWeights ( @@ -436,50 +333,38 @@ Foam::word Foam::meshToMesh::calculate(const word& methodName) Info<< " Overlap volume: " << V_ << endl; - return amiMethod; + return patchToPatchType; } -void Foam::meshToMesh::calculatePatchAMIs(const word& AMIMethodName) +void Foam::meshToMesh::calculatePatchToPatches(const word& patchToPatchType) { - if (!patchAMIs_.empty()) + if (!patchToPatches_.empty()) { FatalErrorInFunction - << "patch AMI already calculated" + << "patchToPatches already calculated" << exit(FatalError); } - patchAMIs_.setSize(srcPatchID_.size()); + patchToPatches_.setSize(srcPatchID_.size()); forAll(srcPatchID_, i) { - label srcPatchi = srcPatchID_[i]; - label tgtPatchi = tgtPatchID_[i]; + const label srcPatchi = srcPatchID_[i]; + const label tgtPatchi = tgtPatchID_[i]; const polyPatch& srcPP = srcRegion_.boundaryMesh()[srcPatchi]; const polyPatch& tgtPP = tgtRegion_.boundaryMesh()[tgtPatchi]; - Info<< "Creating AMI between source patch " << srcPP.name() - << " and target patch " << tgtPP.name() - << " using " << AMIMethodName - << endl; + Info<< "Creating patchToPatch between source patch " + << srcPP.name() << " and target patch " << tgtPP.name() + << " using " << patchToPatchType << endl; Info<< incrIndent; - patchAMIs_.set - ( - i, - new AMIInterpolation - ( - srcPP, - tgtPP, - faceAreaIntersect::tmMesh, - false, - AMIMethodName, - -1, - true // flip target patch since patch normals are aligned - ) - ); + patchToPatches_.set(i, patchToPatch::New(patchToPatchType, true)); + + patchToPatches_[i].update(srcPP, srcPP.pointNormals(), tgtPP); Info<< decrIndent; } @@ -532,10 +417,10 @@ void Foam::meshToMesh::constructNoCuttingPatches } // calculate volume addressing and weights - const word amiMethod = calculate(methodName); + const word patchToPatchType = calculate(methodName); // calculate patch addressing and weights - calculatePatchAMIs(amiMethod); + calculatePatchToPatches(patchToPatchType); } @@ -564,10 +449,10 @@ void Foam::meshToMesh::constructFromCuttingPatches } // calculate volume addressing and weights - const word amiMethod = calculate(methodName); + const word patchToPatchType = calculate(methodName); // calculate patch addressing and weights - calculatePatchAMIs(amiMethod); + calculatePatchToPatches(patchToPatchType); // set IDs of cutting patches on target mesh cuttingPatches_.setSize(cuttingPatches.size()); @@ -593,7 +478,7 @@ Foam::meshToMesh::meshToMesh tgtRegion_(tgt), srcPatchID_(), tgtPatchID_(), - patchAMIs_(), + patchToPatches_(), cuttingPatches_(), srcToTgtCellAddr_(), tgtToSrcCellAddr_(), @@ -621,7 +506,7 @@ Foam::meshToMesh::meshToMesh tgtRegion_(tgt), srcPatchID_(), tgtPatchID_(), - patchAMIs_(), + patchToPatches_(), cuttingPatches_(), srcToTgtCellAddr_(), tgtToSrcCellAddr_(), diff --git a/src/sampling/meshToMesh/meshToMesh.H b/src/sampling/meshToMesh/meshToMesh.H index 0df2d9f10e..b0d12e03f3 100644 --- a/src/sampling/meshToMesh/meshToMesh.H +++ b/src/sampling/meshToMesh/meshToMesh.H @@ -47,7 +47,7 @@ SourceFiles #include "distributionMap.H" #include "volFieldsFwd.H" #include "NamedEnum.H" -#include "AMIInterpolation.H" +#include "patchToPatch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -74,8 +74,9 @@ class meshToMesh //- List of source patch IDs per target patch (local index) List