ENH: AMI - refactored normalise->conformal
This commit is contained in:
parent
0158cc6134
commit
16b2973fab
@ -200,7 +200,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::normaliseWeights
|
||||
const labelListList& addr,
|
||||
scalarListList& wght,
|
||||
scalarField& wghtSum,
|
||||
const bool normalise,
|
||||
const bool conformal,
|
||||
const bool output
|
||||
)
|
||||
{
|
||||
@ -214,7 +214,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::normaliseWeights
|
||||
scalar s = sum(w);
|
||||
scalar t = s/denom;
|
||||
|
||||
if (normalise)
|
||||
if (conformal)
|
||||
{
|
||||
denom = s;
|
||||
}
|
||||
@ -907,7 +907,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
|
||||
srcAddress_,
|
||||
srcWeights_,
|
||||
srcWeightsSum_,
|
||||
AMIPtr->normalise(),
|
||||
AMIPtr->conformal(),
|
||||
true
|
||||
);
|
||||
normaliseWeights
|
||||
@ -917,7 +917,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
|
||||
tgtAddress_,
|
||||
tgtWeights_,
|
||||
tgtWeightsSum_,
|
||||
AMIPtr->normalise(),
|
||||
AMIPtr->conformal(),
|
||||
true
|
||||
);
|
||||
|
||||
@ -964,7 +964,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
|
||||
srcAddress_,
|
||||
srcWeights_,
|
||||
srcWeightsSum_,
|
||||
AMIPtr->normalise(),
|
||||
AMIPtr->conformal(),
|
||||
true
|
||||
);
|
||||
normaliseWeights
|
||||
@ -974,7 +974,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
|
||||
tgtAddress_,
|
||||
tgtWeights_,
|
||||
tgtWeightsSum_,
|
||||
AMIPtr->normalise(),
|
||||
AMIPtr->conformal(),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ private:
|
||||
const labelListList& addr,
|
||||
scalarListList& wght,
|
||||
scalarField& wghtSum,
|
||||
const bool normalise,
|
||||
const bool conformal,
|
||||
const bool output
|
||||
);
|
||||
|
||||
|
@ -41,24 +41,28 @@ void Foam::AMIMethod<SourcePatch, TargetPatch>::checkPatches() 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))
|
||||
if (conformal())
|
||||
{
|
||||
WarningIn("AMIMethod<SourcePatch, TargetPatch>::checkPatches()")
|
||||
<< "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;
|
||||
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("AMIMethod<SourcePatch, TargetPatch>::checkPatches()")
|
||||
<< "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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,6 +78,8 @@ bool Foam::AMIMethod<SourcePatch, TargetPatch>::initialise
|
||||
label& tgtFaceI
|
||||
)
|
||||
{
|
||||
checkPatches();
|
||||
|
||||
// set initial sizes for weights and addressing - must be done even if
|
||||
// returns false below
|
||||
srcAddress.setSize(srcPatch_.size());
|
||||
@ -333,8 +339,6 @@ Foam::AMIMethod<SourcePatch, TargetPatch>::AMIMethod
|
||||
srcNonOverlap_(),
|
||||
triMode_(triMode)
|
||||
{
|
||||
checkPatches();
|
||||
|
||||
label srcSize = returnReduce(srcPatch_.size(), sumOp<label>());
|
||||
label tgtSize = returnReduce(tgtPatch_.size(), sumOp<label>());
|
||||
|
||||
@ -354,7 +358,7 @@ Foam::AMIMethod<SourcePatch, TargetPatch>::~AMIMethod()
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class SourcePatch, class TargetPatch>
|
||||
bool Foam::AMIMethod<SourcePatch, TargetPatch>::normalise() const
|
||||
bool Foam::AMIMethod<SourcePatch, TargetPatch>::conformal() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -207,8 +207,8 @@ public:
|
||||
// Note: this should be empty for correct functioning
|
||||
inline const labelList& srcNonOverlap() const;
|
||||
|
||||
//- Flag to indicate that weights should be normalised
|
||||
virtual bool normalise() const;
|
||||
//- Flag to indicate that interpolation patches are conformal
|
||||
virtual bool conformal() const;
|
||||
|
||||
|
||||
// Manipulation
|
||||
|
Loading…
Reference in New Issue
Block a user