diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C index 9aad24979826649c97c04aa82dc91fefdb43e5f1..910efba4e83da97820c28c6340e274081cb2699e 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C @@ -605,9 +605,11 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation requireMatch_(requireMatch), singlePatchProc_(-999), lowWeightCorrection_(lowWeightCorrection), + srcMagSf_(), srcAddress_(), srcWeights_(), srcWeightsSum_(), + tgtMagSf_(), tgtAddress_(), tgtWeights_(), tgtWeightsSum_(), @@ -636,9 +638,11 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation requireMatch_(requireMatch), singlePatchProc_(-999), lowWeightCorrection_(lowWeightCorrection), + srcMagSf_(), srcAddress_(), srcWeights_(), srcWeightsSum_(), + tgtMagSf_(), tgtAddress_(), tgtWeights_(), tgtWeightsSum_(), @@ -668,9 +672,11 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation requireMatch_(requireMatch), singlePatchProc_(-999), lowWeightCorrection_(lowWeightCorrection), + srcMagSf_(), srcAddress_(), srcWeights_(), srcWeightsSum_(), + tgtMagSf_(), tgtAddress_(), tgtWeights_(), tgtWeightsSum_(), @@ -700,9 +706,11 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation requireMatch_(requireMatch), singlePatchProc_(-999), lowWeightCorrection_(lowWeightCorrection), + srcMagSf_(), srcAddress_(), srcWeights_(), srcWeightsSum_(), + tgtMagSf_(), tgtAddress_(), tgtWeights_(), tgtWeightsSum_(), @@ -727,9 +735,11 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation requireMatch_(fineAMI.requireMatch_), singlePatchProc_(fineAMI.singlePatchProc_), lowWeightCorrection_(-1.0), + srcMagSf_(), srcAddress_(), srcWeights_(), srcWeightsSum_(), + tgtMagSf_(), tgtAddress_(), tgtWeights_(), tgtWeightsSum_(), @@ -884,7 +894,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update tgtFaceIDs ); - TargetPatch + const TargetPatch newTgtPatch ( SubList<face> @@ -917,11 +927,11 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update tgtWeights_ ); + // Note: using patch face areas calculated by the AMI method - // - TODO: should move into the calculate method - srcMagSf_.transfer(AMIPtr->srcMagSf()); - tgtMagSf_.transfer(AMIPtr->tgtMagSf()); - map.reverseDistribute(tgtPatch.size(), tgtMagSf_); + // - TODO: move into the calculate or normalise method? + AMIPtr->setMagSf(tgtPatch, map, srcMagSf_, tgtMagSf_); + // Now // ~~~ diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.H b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.H index cf3c8289d45cf5e5256712da9b4d40adb987060a..8410c7c68c61647b558bdf8c17a69ef754a899c7 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.H +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/AMIMethod/AMIMethod.H @@ -84,11 +84,11 @@ protected: const TargetPatch& tgtPatch_; //- Flag to indicate that the two patches are co-directional and - // that the orientation of the target patch should be reversed + //- that the orientation of the target patch should be reversed const bool reverseTarget_; //- Flag to indicate that the two patches must be matched/an overlap - // exists between them + //- exists between them const bool requireMatch_; //- Source face areas @@ -98,7 +98,7 @@ protected: List<scalar> tgtMagSf_; //- Labels of faces that are not overlapped by any target faces - // (should be empty for correct functioning) + //- (should be empty for correct functioning) labelList srcNonOverlap_; //- Octree used to find face seeds @@ -254,8 +254,17 @@ public: label tgtFacei = -1 ) = 0; + //- Set the face areas for parallel runs + virtual void setMagSf + ( + const TargetPatch& tgtPatch, + const mapDistribute& map, + scalarList& srcMagSf, + scalarList& tgtMagSf + ) const = 0; + //- Normalise the weight. Can optionally subset addressing - // (e.g. for mapNearest) + //- (e.g. for mapNearest) virtual void normaliseWeights ( const bool verbose, diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/directAMI/directAMI.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/directAMI/directAMI.C index 25bf21baaa12108d835ca3fc0fabe8076d44fbd9..0e503da082850722d4316e8e2b876c11a2f8d0e7 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/directAMI/directAMI.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/directAMI/directAMI.C @@ -313,6 +313,20 @@ void Foam::directAMI<SourcePatch, TargetPatch>::calculate } +template<class SourcePatch, class TargetPatch> +void Foam::directAMI<SourcePatch, TargetPatch>::setMagSf +( + const TargetPatch& tgtPatch, + const mapDistribute& map, + scalarList& srcMagSf, + scalarList& tgtMagSf +) const +{ + srcMagSf = std::move(this->srcMagSf_); + tgtMagSf = scalarList(tgtPatch.size(), 1.0); +} + + template<class SourcePatch, class TargetPatch> void Foam::directAMI<SourcePatch, TargetPatch>::normaliseWeights ( diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/directAMI/directAMI.H b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/directAMI/directAMI.H index 19544a8fbfdcbd877f63dcd173e5313de2e0d1dd..dfdc8edff75d6b2751befa807ac784d6b72f6ee9 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/directAMI/directAMI.H +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/directAMI/directAMI.H @@ -134,6 +134,15 @@ public: label tgtFacei = -1 ); + //- Set the face areas for parallel runs + virtual void setMagSf + ( + const TargetPatch& tgtPatch, + const mapDistribute& map, + scalarList& srcMagSf, + scalarList& tgtMagSf + ) const; + //- Normalise the weight. Can optionally subset addressing // (e.g. for mapNearest) virtual void normaliseWeights diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.C index 1cf13f44be1ea451ad0537edb25d0e4ab1b7d354..b382379b5a0d680b98d852365483a14bbc976fdc 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.C @@ -648,6 +648,21 @@ void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::calculate } +template<class SourcePatch, class TargetPatch> +void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::setMagSf +( + const TargetPatch& tgtPatch, + const mapDistribute& map, + scalarList& srcMagSf, + scalarList& tgtMagSf +) const +{ + srcMagSf = std::move(this->srcMagSf_); + tgtMagSf = std::move(this->tgtMagSf_); + map.reverseDistribute(tgtPatch.size(), tgtMagSf); +} + + template<class SourcePatch, class TargetPatch> void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::normaliseWeights ( diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.H b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.H index d27f518e9d1f7d76acb9ab3398c3142c0f22814b..423b6ec807f120ff01a788a77e70fe6255dba957 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.H +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/faceAreaWeightAMI/faceAreaWeightAMI.H @@ -180,8 +180,17 @@ public: label tgtFacei = -1 ); + //- Set the face areas for parallel runs + virtual void setMagSf + ( + const TargetPatch& tgtPatch, + const mapDistribute& map, + scalarList& srcMagSf, + scalarList& tgtMagSf + ) const; + //- Normalise the weight. Can optionally subset addressing - // (e.g. for mapNearest) + //- (e.g. for mapNearest) virtual void normaliseWeights ( const bool verbose, diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/mapNearestAMI/mapNearestAMI.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/mapNearestAMI/mapNearestAMI.C index b2f16391b29066db63235031b1f81fd7d5fe0572..27e455bc5624dbdc7f6269352b840a03493e38b8 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/mapNearestAMI/mapNearestAMI.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/mapNearestAMI/mapNearestAMI.C @@ -347,6 +347,20 @@ void Foam::mapNearestAMI<SourcePatch, TargetPatch>::calculate } +template<class SourcePatch, class TargetPatch> +void Foam::mapNearestAMI<SourcePatch, TargetPatch>::setMagSf +( + const TargetPatch& tgtPatch, + const mapDistribute& map, + scalarList& srcMagSf, + scalarList& tgtMagSf +) const +{ + srcMagSf = std::move(this->srcMagSf_); + tgtMagSf = scalarList(tgtPatch.size(), 1.0); +} + + template<class SourcePatch, class TargetPatch> void Foam::mapNearestAMI<SourcePatch, TargetPatch>::normaliseWeights ( diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/mapNearestAMI/mapNearestAMI.H b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/mapNearestAMI/mapNearestAMI.H index 897ed9ae0ce40216d8b89f4f4fae201819a36984..e8e94ee559f428e086df9fbcf40fa04a50bc5bef 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/mapNearestAMI/mapNearestAMI.H +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/mapNearestAMI/mapNearestAMI.H @@ -138,8 +138,17 @@ public: label tgtFacei = -1 ); + //- Set the face areas for parallel runs + virtual void setMagSf + ( + const TargetPatch& tgtPatch, + const mapDistribute& map, + scalarList& srcMagSf, + scalarList& tgtMagSf + ) const; + //- Normalise the weight. Can optionally subset addressing - // (e.g. for mapNearest) + //- (e.g. for mapNearest) virtual void normaliseWeights ( const bool verbose, diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/partialFaceAreaWeightAMI/partialFaceAreaWeightAMI.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/partialFaceAreaWeightAMI/partialFaceAreaWeightAMI.C index f25f7cb3c5dc2942d6f63769c18ce96a4fb7d6ac..f16aa2a8a46da48efd44d2d021cf47844654d82e 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/partialFaceAreaWeightAMI/partialFaceAreaWeightAMI.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/partialFaceAreaWeightAMI/partialFaceAreaWeightAMI.C @@ -150,4 +150,32 @@ void Foam::partialFaceAreaWeightAMI<SourcePatch, TargetPatch>::calculate } +template<class SourcePatch, class TargetPatch> +void Foam::partialFaceAreaWeightAMI<SourcePatch, TargetPatch>::setMagSf +( + const TargetPatch& tgtPatch, + const mapDistribute& map, + scalarList& srcMagSf, + scalarList& tgtMagSf +) const +{ + srcMagSf = std::move(this->srcMagSf_); + + scalarList newTgtMagSf(std::move(this->tgtMagSf_)); + map.reverseDistribute(tgtPatch.size(), newTgtMagSf); + + // Assign default sizes. Override selected values with + // calculated values. This is to support ACMI + // where some of the target faces are never used (so never get sent + // over and hence never assigned to) + tgtMagSf = tgtPatch.magFaceAreas(); + + for (const labelList& smap : map.subMap()) + { + UIndirectList<scalar>(tgtMagSf, smap) = + UIndirectList<scalar>(newTgtMagSf, smap); + } +} + + // ************************************************************************* // diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/partialFaceAreaWeightAMI/partialFaceAreaWeightAMI.H b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/partialFaceAreaWeightAMI/partialFaceAreaWeightAMI.H index a79f0b6572445e6565a3b820025989c0b878d605..67aec398a009741513a5de6a7f591a49fc4e694c 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/partialFaceAreaWeightAMI/partialFaceAreaWeightAMI.H +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIMethod/partialFaceAreaWeightAMI/partialFaceAreaWeightAMI.H @@ -120,6 +120,15 @@ public: label srcFacei = -1, label tgtFacei = -1 ); + + //- Set the face areas for parallel runs + virtual void setMagSf + ( + const TargetPatch& tgtPatch, + const mapDistribute& map, + scalarList& srcMagSf, + scalarList& tgtMagSf + ) const; };