Commit f5628d72 authored by Andrew Heather's avatar Andrew Heather
Browse files

BUG: AMI/ACMI - corrected setting of [src|tgt]MagSf for parallel runs. See #856 #906

parent 0b14c637
...@@ -605,9 +605,11 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation ...@@ -605,9 +605,11 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
requireMatch_(requireMatch), requireMatch_(requireMatch),
singlePatchProc_(-999), singlePatchProc_(-999),
lowWeightCorrection_(lowWeightCorrection), lowWeightCorrection_(lowWeightCorrection),
srcMagSf_(),
srcAddress_(), srcAddress_(),
srcWeights_(), srcWeights_(),
srcWeightsSum_(), srcWeightsSum_(),
tgtMagSf_(),
tgtAddress_(), tgtAddress_(),
tgtWeights_(), tgtWeights_(),
tgtWeightsSum_(), tgtWeightsSum_(),
...@@ -636,9 +638,11 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation ...@@ -636,9 +638,11 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
requireMatch_(requireMatch), requireMatch_(requireMatch),
singlePatchProc_(-999), singlePatchProc_(-999),
lowWeightCorrection_(lowWeightCorrection), lowWeightCorrection_(lowWeightCorrection),
srcMagSf_(),
srcAddress_(), srcAddress_(),
srcWeights_(), srcWeights_(),
srcWeightsSum_(), srcWeightsSum_(),
tgtMagSf_(),
tgtAddress_(), tgtAddress_(),
tgtWeights_(), tgtWeights_(),
tgtWeightsSum_(), tgtWeightsSum_(),
...@@ -668,9 +672,11 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation ...@@ -668,9 +672,11 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
requireMatch_(requireMatch), requireMatch_(requireMatch),
singlePatchProc_(-999), singlePatchProc_(-999),
lowWeightCorrection_(lowWeightCorrection), lowWeightCorrection_(lowWeightCorrection),
srcMagSf_(),
srcAddress_(), srcAddress_(),
srcWeights_(), srcWeights_(),
srcWeightsSum_(), srcWeightsSum_(),
tgtMagSf_(),
tgtAddress_(), tgtAddress_(),
tgtWeights_(), tgtWeights_(),
tgtWeightsSum_(), tgtWeightsSum_(),
...@@ -700,9 +706,11 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation ...@@ -700,9 +706,11 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
requireMatch_(requireMatch), requireMatch_(requireMatch),
singlePatchProc_(-999), singlePatchProc_(-999),
lowWeightCorrection_(lowWeightCorrection), lowWeightCorrection_(lowWeightCorrection),
srcMagSf_(),
srcAddress_(), srcAddress_(),
srcWeights_(), srcWeights_(),
srcWeightsSum_(), srcWeightsSum_(),
tgtMagSf_(),
tgtAddress_(), tgtAddress_(),
tgtWeights_(), tgtWeights_(),
tgtWeightsSum_(), tgtWeightsSum_(),
...@@ -727,9 +735,11 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation ...@@ -727,9 +735,11 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
requireMatch_(fineAMI.requireMatch_), requireMatch_(fineAMI.requireMatch_),
singlePatchProc_(fineAMI.singlePatchProc_), singlePatchProc_(fineAMI.singlePatchProc_),
lowWeightCorrection_(-1.0), lowWeightCorrection_(-1.0),
srcMagSf_(),
srcAddress_(), srcAddress_(),
srcWeights_(), srcWeights_(),
srcWeightsSum_(), srcWeightsSum_(),
tgtMagSf_(),
tgtAddress_(), tgtAddress_(),
tgtWeights_(), tgtWeights_(),
tgtWeightsSum_(), tgtWeightsSum_(),
...@@ -884,7 +894,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update ...@@ -884,7 +894,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
tgtFaceIDs tgtFaceIDs
); );
TargetPatch const TargetPatch
newTgtPatch newTgtPatch
( (
SubList<face> SubList<face>
...@@ -917,11 +927,11 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update ...@@ -917,11 +927,11 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
tgtWeights_ tgtWeights_
); );
// Note: using patch face areas calculated by the AMI method // Note: using patch face areas calculated by the AMI method
// - TODO: should move into the calculate method // - TODO: move into the calculate or normalise method?
srcMagSf_.transfer(AMIPtr->srcMagSf()); AMIPtr->setMagSf(tgtPatch, map, srcMagSf_, tgtMagSf_);
tgtMagSf_.transfer(AMIPtr->tgtMagSf());
map.reverseDistribute(tgtPatch.size(), tgtMagSf_);
// Now // Now
// ~~~ // ~~~
......
...@@ -84,11 +84,11 @@ protected: ...@@ -84,11 +84,11 @@ protected:
const TargetPatch& tgtPatch_; const TargetPatch& tgtPatch_;
//- Flag to indicate that the two patches are co-directional and //- 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_; const bool reverseTarget_;
//- Flag to indicate that the two patches must be matched/an overlap //- Flag to indicate that the two patches must be matched/an overlap
// exists between them //- exists between them
const bool requireMatch_; const bool requireMatch_;
//- Source face areas //- Source face areas
...@@ -98,7 +98,7 @@ protected: ...@@ -98,7 +98,7 @@ protected:
List<scalar> tgtMagSf_; List<scalar> tgtMagSf_;
//- Labels of faces that are not overlapped by any target faces //- 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_; labelList srcNonOverlap_;
//- Octree used to find face seeds //- Octree used to find face seeds
...@@ -254,8 +254,17 @@ public: ...@@ -254,8 +254,17 @@ public:
label tgtFacei = -1 label tgtFacei = -1
) = 0; ) = 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 //- Normalise the weight. Can optionally subset addressing
// (e.g. for mapNearest) //- (e.g. for mapNearest)
virtual void normaliseWeights virtual void normaliseWeights
( (
const bool verbose, const bool verbose,
......
...@@ -313,6 +313,20 @@ void Foam::directAMI<SourcePatch, TargetPatch>::calculate ...@@ -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> template<class SourcePatch, class TargetPatch>
void Foam::directAMI<SourcePatch, TargetPatch>::normaliseWeights void Foam::directAMI<SourcePatch, TargetPatch>::normaliseWeights
( (
......
...@@ -134,6 +134,15 @@ public: ...@@ -134,6 +134,15 @@ public:
label tgtFacei = -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;
//- Normalise the weight. Can optionally subset addressing //- Normalise the weight. Can optionally subset addressing
// (e.g. for mapNearest) // (e.g. for mapNearest)
virtual void normaliseWeights virtual void normaliseWeights
......
...@@ -648,6 +648,21 @@ void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::calculate ...@@ -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> template<class SourcePatch, class TargetPatch>
void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::normaliseWeights void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::normaliseWeights
( (
......
...@@ -180,8 +180,17 @@ public: ...@@ -180,8 +180,17 @@ public:
label tgtFacei = -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;
//- Normalise the weight. Can optionally subset addressing //- Normalise the weight. Can optionally subset addressing
// (e.g. for mapNearest) //- (e.g. for mapNearest)
virtual void normaliseWeights virtual void normaliseWeights
( (
const bool verbose, const bool verbose,
......
...@@ -347,6 +347,20 @@ void Foam::mapNearestAMI<SourcePatch, TargetPatch>::calculate ...@@ -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> template<class SourcePatch, class TargetPatch>
void Foam::mapNearestAMI<SourcePatch, TargetPatch>::normaliseWeights void Foam::mapNearestAMI<SourcePatch, TargetPatch>::normaliseWeights
( (
......
...@@ -138,8 +138,17 @@ public: ...@@ -138,8 +138,17 @@ public:
label tgtFacei = -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;
//- Normalise the weight. Can optionally subset addressing //- Normalise the weight. Can optionally subset addressing
// (e.g. for mapNearest) //- (e.g. for mapNearest)
virtual void normaliseWeights virtual void normaliseWeights
( (
const bool verbose, const bool verbose,
......
...@@ -150,4 +150,32 @@ void Foam::partialFaceAreaWeightAMI<SourcePatch, TargetPatch>::calculate ...@@ -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);
}
}
// ************************************************************************* // // ************************************************************************* //
...@@ -120,6 +120,15 @@ public: ...@@ -120,6 +120,15 @@ public:
label srcFacei = -1, label srcFacei = -1,
label tgtFacei = -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;
}; };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment