AMI: Un-templated the interpolation and method classes

AMI interpolation is only ever constructed between sets of primitive
patches, so templating on the patch type is unnecessary. Templating in
this instance is undesirable; it makes type type/debug/selection system
more complex and increases the number and compilation times of files
which need recompiling when code is modified.
This commit is contained in:
Will Bainbridge
2018-07-18 14:49:11 +01:00
parent 5e8593c171
commit aea61ccdbf
50 changed files with 772 additions and 1048 deletions

View File

@ -87,9 +87,9 @@ public:
// Access
//- Return a reference to the AMI interpolators
virtual const PtrList<AMIPatchToPatchInterpolation>& AMIs() const
virtual const PtrList<AMIInterpolation>& AMIs() const
{
const PtrList<AMIPatchToPatchInterpolation>& AMIs =
const PtrList<AMIInterpolation>& AMIs =
cyclicAMIFvPatch::AMIs();
updateAreas();

View File

@ -122,7 +122,7 @@ public:
}
//- Return a reference to the AMI interpolators
virtual const PtrList<AMIPatchToPatchInterpolation>& AMIs() const
virtual const PtrList<AMIInterpolation>& AMIs() const
{
return cyclicAMIPolyPatch_.AMIs();
}

View File

@ -139,7 +139,7 @@ public:
}
//- Return a reference to the AMI interpolator
virtual const AMIPatchToPatchInterpolation& AMI() const
virtual const AMIInterpolation& AMI() const
{
return regionCoupledBase_.AMI();
}

View File

@ -31,9 +31,15 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<class SourcePatch, class TargetPatch>
Foam::word
Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolationMethodToWord
namespace Foam
{
defineTypeNameAndDebug(AMIInterpolation, 0);
}
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
Foam::word Foam::AMIInterpolation::interpolationMethodToWord
(
const interpolationMethod& im
)
@ -79,12 +85,8 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolationMethodToWord
}
template<class SourcePatch, class TargetPatch>
typename Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolationMethod
Foam::AMIInterpolation<SourcePatch, TargetPatch>::wordTointerpolationMethod
(
const word& im
)
typename Foam::AMIInterpolation::interpolationMethod
Foam::AMIInterpolation::wordTointerpolationMethod(const word& im)
{
interpolationMethod method = imDirect;
@ -134,12 +136,9 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::wordTointerpolationMethod
}
template<class SourcePatch, class TargetPatch>
template<class Patch>
Foam::tmp<Foam::scalarField>
Foam::AMIInterpolation<SourcePatch, TargetPatch>::patchMagSf
Foam::tmp<Foam::scalarField> Foam::AMIInterpolation::patchMagSf
(
const Patch& patch,
const primitivePatch& patch,
const faceAreaIntersect::triangulationMode triMode
)
{
@ -178,8 +177,7 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::patchMagSf
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::projectPointsToSurface
void Foam::AMIInterpolation::projectPointsToSurface
(
const searchableSurface& surf,
pointField& pts
@ -220,8 +218,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::projectPointsToSurface
}
template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::sumWeights
void Foam::AMIInterpolation::sumWeights
(
const scalarListList& wght,
scalarField& wghtSum
@ -237,8 +234,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::sumWeights
}
template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::sumWeights
void Foam::AMIInterpolation::sumWeights
(
const UPtrList<scalarListList>& wghts,
scalarField& wghtSum
@ -260,8 +256,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::sumWeights
}
template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::reportSumWeights
void Foam::AMIInterpolation::reportSumWeights
(
const scalarField& patchAreas,
const word& patchName,
@ -298,8 +293,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::reportSumWeights
}
template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::normaliseWeights
void Foam::AMIInterpolation::normaliseWeights
(
scalarListList& wght,
const scalarField& wghtSum
@ -317,8 +311,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::normaliseWeights
}
template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::normaliseWeights
void Foam::AMIInterpolation::normaliseWeights
(
UPtrList<scalarListList>& wghts,
const scalarField& wghtSum
@ -339,8 +332,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::normaliseWeights
}
template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::agglomerate
void Foam::AMIInterpolation::agglomerate
(
const autoPtr<mapDistribute>& targetMapPtr,
const scalarField& fineSrcMagSf,
@ -594,11 +586,10 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::agglomerate
}
template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::constructFromSurface
void Foam::AMIInterpolation::constructFromSurface
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch,
const autoPtr<searchableSurface>& surfPtr,
const bool report
)
@ -607,7 +598,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::constructFromSurface
{
// Create new patches for source and target
pointField srcPoints = srcPatch.points();
SourcePatch srcPatch0
primitivePatch srcPatch0
(
SubList<face>
(
@ -628,7 +619,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::constructFromSurface
}
pointField tgtPoints = tgtPatch.points();
TargetPatch tgtPatch0
primitivePatch tgtPatch0
(
SubList<face>
(
@ -666,11 +657,10 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::constructFromSurface
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class SourcePatch, class TargetPatch>
Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
Foam::AMIInterpolation::AMIInterpolation
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch,
const faceAreaIntersect::triangulationMode& triMode,
const bool requireMatch,
const interpolationMethod& method,
@ -698,11 +688,10 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
}
template<class SourcePatch, class TargetPatch>
Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
Foam::AMIInterpolation::AMIInterpolation
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch,
const faceAreaIntersect::triangulationMode& triMode,
const bool requireMatch,
const word& methodName,
@ -730,11 +719,10 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
}
template<class SourcePatch, class TargetPatch>
Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
Foam::AMIInterpolation::AMIInterpolation
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch,
const autoPtr<searchableSurface>& surfPtr,
const faceAreaIntersect::triangulationMode& triMode,
const bool requireMatch,
@ -763,11 +751,10 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
}
template<class SourcePatch, class TargetPatch>
Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
Foam::AMIInterpolation::AMIInterpolation
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch,
const autoPtr<searchableSurface>& surfPtr,
const faceAreaIntersect::triangulationMode& triMode,
const bool requireMatch,
@ -796,10 +783,9 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
}
template<class SourcePatch, class TargetPatch>
Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
Foam::AMIInterpolation::AMIInterpolation
(
const AMIInterpolation<SourcePatch, TargetPatch>& fineAMI,
const AMIInterpolation& fineAMI,
const labelList& sourceRestrictAddressing,
const labelList& targetRestrictAddressing,
const bool report
@ -911,18 +897,16 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class SourcePatch, class TargetPatch>
Foam::AMIInterpolation<SourcePatch, TargetPatch>::~AMIInterpolation()
Foam::AMIInterpolation::~AMIInterpolation()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
void Foam::AMIInterpolation::update
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch,
const bool report
)
{
@ -987,7 +971,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
tgtFaceIDs
);
TargetPatch
primitivePatch
newTgtPatch
(
SubList<face>
@ -1000,9 +984,9 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
scalarField newTgtMagSf(patchMagSf(newTgtPatch, triMode_));
// Calculate AMI interpolation
autoPtr<AMIMethod<SourcePatch, TargetPatch>> AMIPtr
autoPtr<AMIMethod> AMIPtr
(
AMIMethod<SourcePatch, TargetPatch>::New
AMIMethod::New
(
methodName_,
srcPatch,
@ -1099,9 +1083,9 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
else
{
// Calculate AMI interpolation
autoPtr<AMIMethod<SourcePatch, TargetPatch>> AMIPtr
autoPtr<AMIMethod> AMIPtr
(
AMIMethod<SourcePatch, TargetPatch>::New
AMIMethod::New
(
methodName_,
srcPatch,
@ -1136,7 +1120,8 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
if (debug)
{
Info<< "AMIInterpolation : Constructed addressing and weights" << nl
Info<< "AMIIPatchToPatchnterpolation :"
<< "Constructed addressing and weights" << nl
<< " triMode :"
<< faceAreaIntersect::triangulationModeNames_[triMode_] << nl
<< " singlePatchProc:" << singlePatchProc_ << nl
@ -1147,22 +1132,14 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
}
template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::sumWeights
(
AMIInterpolation<SourcePatch, TargetPatch>& AMI
)
void Foam::AMIInterpolation::sumWeights(AMIInterpolation& AMI)
{
sumWeights(AMI.srcWeights_, AMI.srcWeightsSum_);
sumWeights(AMI.tgtWeights_, AMI.tgtWeightsSum_);
}
template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::sumWeights
(
PtrList<AMIInterpolation<SourcePatch, TargetPatch>>& AMIs
)
void Foam::AMIInterpolation::sumWeights(PtrList<AMIInterpolation>& AMIs)
{
UPtrList<scalarListList> srcWeights(AMIs.size());
forAll(AMIs, i)
@ -1192,11 +1169,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::sumWeights
}
template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::reportSumWeights
(
AMIInterpolation<SourcePatch, TargetPatch>& AMI
)
void Foam::AMIInterpolation::reportSumWeights(AMIInterpolation& AMI)
{
reportSumWeights
(
@ -1216,22 +1189,14 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::reportSumWeights
}
template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::normaliseWeights
(
AMIInterpolation<SourcePatch, TargetPatch>& AMI
)
void Foam::AMIInterpolation::normaliseWeights(AMIInterpolation& AMI)
{
normaliseWeights(AMI.srcWeights_, AMI.srcWeightsSum_);
normaliseWeights(AMI.tgtWeights_, AMI.tgtWeightsSum_);
}
template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::normaliseWeights
(
UPtrList<AMIInterpolation<SourcePatch, TargetPatch>>& AMIs
)
void Foam::AMIInterpolation::normaliseWeights(UPtrList<AMIInterpolation>& AMIs)
{
UPtrList<scalarListList> srcWeights(AMIs.size());
forAll(AMIs, i)
@ -1251,323 +1216,10 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::normaliseWeights
}
template<class SourcePatch, class TargetPatch>
template<class Type, class CombineOp>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget
Foam::label Foam::AMIInterpolation::srcPointFace
(
const UList<Type>& fld,
const CombineOp& cop,
List<Type>& result,
const UList<Type>& defaultValues
) const
{
if (fld.size() != srcAddress_.size())
{
FatalErrorInFunction
<< "Supplied field size is not equal to source patch size" << nl
<< " source patch = " << srcAddress_.size() << nl
<< " target patch = " << tgtAddress_.size() << nl
<< " supplied field = " << fld.size()
<< abort(FatalError);
}
if (lowWeightCorrection_ > 0)
{
if (defaultValues.size() != tgtAddress_.size())
{
FatalErrorInFunction
<< "Employing default values when sum of weights falls below "
<< lowWeightCorrection_
<< " but supplied default field size is not equal to target "
<< "patch size" << nl
<< " default values = " << defaultValues.size() << nl
<< " target patch = " << tgtAddress_.size() << nl
<< abort(FatalError);
}
}
result.setSize(tgtAddress_.size());
if (singlePatchProc_ == -1)
{
const mapDistribute& map = srcMapPtr_();
List<Type> work(fld);
map.distribute(work);
forAll(result, facei)
{
if (tgtWeightsSum_[facei] < lowWeightCorrection_)
{
result[facei] = defaultValues[facei];
}
else
{
const labelList& faces = tgtAddress_[facei];
const scalarList& weights = tgtWeights_[facei];
forAll(faces, i)
{
cop(result[facei], facei, work[faces[i]], weights[i]);
}
}
}
}
else
{
forAll(result, facei)
{
if (tgtWeightsSum_[facei] < lowWeightCorrection_)
{
result[facei] = defaultValues[facei];
}
else
{
const labelList& faces = tgtAddress_[facei];
const scalarList& weights = tgtWeights_[facei];
forAll(faces, i)
{
cop(result[facei], facei, fld[faces[i]], weights[i]);
}
}
}
}
}
template<class SourcePatch, class TargetPatch>
template<class Type, class CombineOp>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource
(
const UList<Type>& fld,
const CombineOp& cop,
List<Type>& result,
const UList<Type>& defaultValues
) const
{
if (fld.size() != tgtAddress_.size())
{
FatalErrorInFunction
<< "Supplied field size is not equal to target patch size" << nl
<< " source patch = " << srcAddress_.size() << nl
<< " target patch = " << tgtAddress_.size() << nl
<< " supplied field = " << fld.size()
<< abort(FatalError);
}
if (lowWeightCorrection_ > 0)
{
if (defaultValues.size() != srcAddress_.size())
{
FatalErrorInFunction
<< "Employing default values when sum of weights falls below "
<< lowWeightCorrection_
<< " but supplied default field size is not equal to target "
<< "patch size" << nl
<< " default values = " << defaultValues.size() << nl
<< " source patch = " << srcAddress_.size() << nl
<< abort(FatalError);
}
}
result.setSize(srcAddress_.size());
if (singlePatchProc_ == -1)
{
const mapDistribute& map = tgtMapPtr_();
List<Type> work(fld);
map.distribute(work);
forAll(result, facei)
{
if (srcWeightsSum_[facei] < lowWeightCorrection_)
{
result[facei] = defaultValues[facei];
}
else
{
const labelList& faces = srcAddress_[facei];
const scalarList& weights = srcWeights_[facei];
forAll(faces, i)
{
cop(result[facei], facei, work[faces[i]], weights[i]);
}
}
}
}
else
{
forAll(result, facei)
{
if (srcWeightsSum_[facei] < lowWeightCorrection_)
{
result[facei] = defaultValues[facei];
}
else
{
const labelList& faces = srcAddress_[facei];
const scalarList& weights = srcWeights_[facei];
forAll(faces, i)
{
cop(result[facei], facei, fld[faces[i]], weights[i]);
}
}
}
}
}
template<class SourcePatch, class TargetPatch>
template<class Type, class CombineOp>
Foam::tmp<Foam::Field<Type>>
Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource
(
const Field<Type>& fld,
const CombineOp& cop,
const UList<Type>& defaultValues
) const
{
tmp<Field<Type>> tresult
(
new Field<Type>
(
srcAddress_.size(),
Zero
)
);
interpolateToSource
(
fld,
multiplyWeightedOp<Type, CombineOp>(cop),
tresult.ref(),
defaultValues
);
return tresult;
}
template<class SourcePatch, class TargetPatch>
template<class Type, class CombineOp>
Foam::tmp<Foam::Field<Type>>
Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource
(
const tmp<Field<Type>>& tFld,
const CombineOp& cop,
const UList<Type>& defaultValues
) const
{
return interpolateToSource(tFld(), cop, defaultValues);
}
template<class SourcePatch, class TargetPatch>
template<class Type, class CombineOp>
Foam::tmp<Foam::Field<Type>>
Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget
(
const Field<Type>& fld,
const CombineOp& cop,
const UList<Type>& defaultValues
) const
{
tmp<Field<Type>> tresult
(
new Field<Type>
(
tgtAddress_.size(),
Zero
)
);
interpolateToTarget
(
fld,
multiplyWeightedOp<Type, CombineOp>(cop),
tresult.ref(),
defaultValues
);
return tresult;
}
template<class SourcePatch, class TargetPatch>
template<class Type, class CombineOp>
Foam::tmp<Foam::Field<Type>>
Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget
(
const tmp<Field<Type>>& tFld,
const CombineOp& cop,
const UList<Type>& defaultValues
) const
{
return interpolateToTarget(tFld(), cop, defaultValues);
}
template<class SourcePatch, class TargetPatch>
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource
(
const Field<Type>& fld,
const UList<Type>& defaultValues
) const
{
return interpolateToSource(fld, plusEqOp<Type>(), defaultValues);
}
template<class SourcePatch, class TargetPatch>
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource
(
const tmp<Field<Type>>& tFld,
const UList<Type>& defaultValues
) const
{
return interpolateToSource(tFld(), plusEqOp<Type>(), defaultValues);
}
template<class SourcePatch, class TargetPatch>
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget
(
const Field<Type>& fld,
const UList<Type>& defaultValues
) const
{
return interpolateToTarget(fld, plusEqOp<Type>(), defaultValues);
}
template<class SourcePatch, class TargetPatch>
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget
(
const tmp<Field<Type>>& tFld,
const UList<Type>& defaultValues
) const
{
return interpolateToTarget(tFld(), plusEqOp<Type>(), defaultValues);
}
template<class SourcePatch, class TargetPatch>
Foam::label Foam::AMIInterpolation<SourcePatch, TargetPatch>::srcPointFace
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch,
const vector& n,
const label tgtFacei,
point& tgtPoint
@ -1612,11 +1264,10 @@ const
}
template<class SourcePatch, class TargetPatch>
Foam::label Foam::AMIInterpolation<SourcePatch, TargetPatch>::tgtPointFace
Foam::label Foam::AMIInterpolation::tgtPointFace
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch,
const vector& n,
const label srcFacei,
point& srcPoint
@ -1661,11 +1312,10 @@ const
}
template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::writeFaceConnectivity
void Foam::AMIInterpolation::writeFaceConnectivity
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch,
const labelListList& srcAddress
)
const

View File

@ -41,8 +41,8 @@ Description
SourceFiles
AMIInterpolation.C
AMIInterpolationName.C
AMIInterpolationParallelOps.C
AMIInterpolationTemplates.C
\*---------------------------------------------------------------------------*/
@ -64,32 +64,13 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class AMIInterpolationName Declaration
Class AMIInterpolation Declaration
\*---------------------------------------------------------------------------*/
TemplateName(AMIInterpolation);
/*---------------------------------------------------------------------------*\
Class AMIInterpolation Declaration
\*---------------------------------------------------------------------------*/
template<class SourcePatch, class TargetPatch>
class AMIInterpolation
:
public AMIInterpolationName
{
public:
// Public typedefs
// Typedef to SourcePatch type this AMIInterplation is instantiated on
typedef SourcePatch sourcePatchType;
// Typedef to TargetPatch type this AMIInterplation is instantiated on
typedef TargetPatch targetPatchType;
// Public data types
//- Enumeration specifying interpolation method
@ -115,10 +96,9 @@ public:
);
//- Calculate the patch face magnitudes for the given tri-mode
template<class Patch>
static tmp<scalarField> patchMagSf
(
const Patch& patch,
const primitivePatch& patch,
const faceAreaIntersect::triangulationMode triMode
);
@ -200,8 +180,8 @@ private:
//- Calculate if patches are on multiple processors
label calcDistribution
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch
) const;
label calcOverlappingProcs
@ -214,7 +194,7 @@ private:
void distributePatches
(
const mapDistribute& map,
const TargetPatch& pp,
const primitivePatch& pp,
const globalIndex& gi,
List<faceList>& faces,
List<pointField>& points,
@ -224,7 +204,7 @@ private:
void distributeAndMergePatches
(
const mapDistribute& map,
const TargetPatch& tgtPatch,
const primitivePatch& tgtPatch,
const globalIndex& gi,
faceList& tgtFaces,
pointField& tgtPoints,
@ -233,8 +213,8 @@ private:
autoPtr<mapDistribute> calcProcMap
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch
) const;
@ -312,21 +292,25 @@ private:
void constructFromSurface
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch,
const autoPtr<searchableSurface>& surfPtr,
const bool report
);
public:
//- Runtime type information
TypeName("cyclicAMI");
// Constructors
//- Construct from components
AMIInterpolation
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch,
const faceAreaIntersect::triangulationMode& triMode,
const bool requireMatch = true,
const interpolationMethod& method = imFaceAreaWeight,
@ -338,8 +322,8 @@ public:
//- Construct from components
AMIInterpolation
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch,
const faceAreaIntersect::triangulationMode& triMode,
const bool requireMatch = true,
const word& methodName =
@ -352,8 +336,8 @@ public:
//- Construct from components, with projection surface
AMIInterpolation
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch,
const autoPtr<searchableSurface>& surf,
const faceAreaIntersect::triangulationMode& triMode,
const bool requireMatch = true,
@ -366,8 +350,8 @@ public:
//- Construct from components, with projection surface
AMIInterpolation
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch,
const autoPtr<searchableSurface>& surf,
const faceAreaIntersect::triangulationMode& triMode,
const bool requireMatch = true,
@ -378,11 +362,12 @@ public:
const bool report = true
);
//- Construct from agglomeration of AMIInterpolation. Agglomeration
// passed in as new coarse size and addressing from fine from coarse
//- Construct from agglomeration of AMIInterpolation.
// Agglomeration passed in as new coarse size and addressing from fine
// from coarse
AMIInterpolation
(
const AMIInterpolation<SourcePatch, TargetPatch>& fineAMI,
const AMIInterpolation& fineAMI,
const labelList& sourceRestrictAddressing,
const labelList& neighbourRestrictAddressing,
const bool report = false
@ -390,7 +375,7 @@ public:
//- Destructor
~AMIInterpolation();
virtual ~AMIInterpolation();
// Member Functions
@ -469,42 +454,27 @@ public:
//- Update addressing and weights
void update
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch,
const bool report
);
//- Sum the weights on both sides of an AMI
static void sumWeights
(
AMIInterpolation<SourcePatch, TargetPatch>& AMI
);
static void sumWeights(AMIInterpolation& AMI);
//- As above, but for multiple AMI-s
static void sumWeights
(
PtrList<AMIInterpolation<SourcePatch, TargetPatch>>& AMIs
);
static void sumWeights(PtrList<AMIInterpolation>& AMIs);
//- Print out information relating to the weights sum. Values close
// to one are ideal. This information acts as a measure of the
// quality of the AMI.
static void reportSumWeights
(
AMIInterpolation<SourcePatch, TargetPatch>& AMI
);
static void reportSumWeights(AMIInterpolation& AMI);
//- Normalise the weights on both sides of an AMI
static void normaliseWeights
(
AMIInterpolation<SourcePatch, TargetPatch>& AMI
);
static void normaliseWeights(AMIInterpolation& AMI);
//- As above, but for multiple AMI-s
static void normaliseWeights
(
UPtrList<AMIInterpolation<SourcePatch, TargetPatch>>& AMIs
);
static void normaliseWeights(UPtrList<AMIInterpolation>& AMIs);
// Evaluation
@ -608,8 +578,8 @@ public:
//- Return source patch face index of point on target patch face
label srcPointFace
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch,
const vector& n,
const label tgtFacei,
point& tgtPoint
@ -619,8 +589,8 @@ public:
//- Return target patch face index of point on source patch face
label tgtPointFace
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch,
const vector& n,
const label srcFacei,
point& srcPoint
@ -633,8 +603,8 @@ public:
//- Write face connectivity as OBJ file
void writeFaceConnectivity
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch,
const labelListList& srcAddress
) const;
};
@ -651,8 +621,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "AMIInterpolation.C"
#include "AMIInterpolationParallelOps.C"
#include "AMIInterpolationTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -23,138 +23,103 @@ License
\*---------------------------------------------------------------------------*/
template<class SourcePatch, class TargetPatch>
inline Foam::label
Foam::AMIInterpolation<SourcePatch, TargetPatch>::singlePatchProc() const
inline Foam::label Foam::AMIInterpolation::singlePatchProc() const
{
return singlePatchProc_;
}
template<class SourcePatch, class TargetPatch>
inline Foam::scalar
Foam::AMIInterpolation<SourcePatch, TargetPatch>::lowWeightCorrection() const
inline Foam::scalar Foam::AMIInterpolation::lowWeightCorrection() const
{
return lowWeightCorrection_;
}
template<class SourcePatch, class TargetPatch>
inline bool
Foam::AMIInterpolation<SourcePatch, TargetPatch>::
applyLowWeightCorrection() const
inline bool Foam::AMIInterpolation::applyLowWeightCorrection() const
{
return lowWeightCorrection_ > 0;
}
template<class SourcePatch, class TargetPatch>
inline const Foam::scalarField&
Foam::AMIInterpolation<SourcePatch, TargetPatch>::srcMagSf() const
inline const Foam::scalarField& Foam::AMIInterpolation::srcMagSf() const
{
return srcMagSf_;
}
template<class SourcePatch, class TargetPatch>
inline const Foam::labelListList&
Foam::AMIInterpolation<SourcePatch, TargetPatch>::srcAddress() const
inline const Foam::labelListList& Foam::AMIInterpolation::srcAddress() const
{
return srcAddress_;
}
template<class SourcePatch, class TargetPatch>
inline const Foam::scalarListList&
Foam::AMIInterpolation<SourcePatch, TargetPatch>::srcWeights() const
inline const Foam::scalarListList& Foam::AMIInterpolation::srcWeights() const
{
return srcWeights_;
}
template<class SourcePatch, class TargetPatch>
inline Foam::scalarListList&
Foam::AMIInterpolation<SourcePatch, TargetPatch>::srcWeights()
inline Foam::scalarListList& Foam::AMIInterpolation::srcWeights()
{
return srcWeights_;
}
template<class SourcePatch, class TargetPatch>
inline const Foam::scalarField&
Foam::AMIInterpolation<SourcePatch, TargetPatch>::srcWeightsSum() const
inline const Foam::scalarField& Foam::AMIInterpolation::srcWeightsSum() const
{
return srcWeightsSum_;
}
template<class SourcePatch, class TargetPatch>
inline Foam::scalarField&
Foam::AMIInterpolation<SourcePatch, TargetPatch>::srcWeightsSum()
inline Foam::scalarField& Foam::AMIInterpolation::srcWeightsSum()
{
return srcWeightsSum_;
}
template<class SourcePatch, class TargetPatch>
inline const Foam::mapDistribute&
Foam::AMIInterpolation<SourcePatch, TargetPatch>::srcMap() const
inline const Foam::mapDistribute& Foam::AMIInterpolation::srcMap() const
{
return srcMapPtr_();
}
template<class SourcePatch, class TargetPatch>
inline const Foam::scalarField&
Foam::AMIInterpolation<SourcePatch, TargetPatch>::tgtMagSf() const
inline const Foam::scalarField& Foam::AMIInterpolation::tgtMagSf() const
{
return tgtMagSf_;
}
template<class SourcePatch, class TargetPatch>
inline const Foam::labelListList&
Foam::AMIInterpolation<SourcePatch, TargetPatch>::tgtAddress() const
inline const Foam::labelListList& Foam::AMIInterpolation::tgtAddress() const
{
return tgtAddress_;
}
template<class SourcePatch, class TargetPatch>
inline const Foam::scalarListList&
Foam::AMIInterpolation<SourcePatch, TargetPatch>::tgtWeights() const
inline const Foam::scalarListList& Foam::AMIInterpolation::tgtWeights() const
{
return tgtWeights_;
}
template<class SourcePatch, class TargetPatch>
inline Foam::scalarListList&
Foam::AMIInterpolation<SourcePatch, TargetPatch>::tgtWeights()
inline Foam::scalarListList& Foam::AMIInterpolation::tgtWeights()
{
return tgtWeights_;
}
template<class SourcePatch, class TargetPatch>
inline const Foam::scalarField&
Foam::AMIInterpolation<SourcePatch, TargetPatch>::tgtWeightsSum() const
inline const Foam::scalarField& Foam::AMIInterpolation::tgtWeightsSum() const
{
return tgtWeightsSum_;
}
template<class SourcePatch, class TargetPatch>
inline Foam::scalarField&
Foam::AMIInterpolation<SourcePatch, TargetPatch>::tgtWeightsSum()
inline Foam::scalarField& Foam::AMIInterpolation::tgtWeightsSum()
{
return tgtWeightsSum_;
}
template<class SourcePatch, class TargetPatch>
inline const Foam::mapDistribute&
Foam::AMIInterpolation<SourcePatch, TargetPatch>::tgtMap() const
inline const Foam::mapDistribute& Foam::AMIInterpolation::tgtMap() const
{
return tgtMapPtr_();
}

View File

@ -1,36 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "AMIInterpolation.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(AMIInterpolationName, 0);
}
// ************************************************************************* //

View File

@ -29,11 +29,10 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class SourcePatch, class TargetPatch>
Foam::label Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcDistribution
Foam::label Foam::AMIInterpolation::calcDistribution
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch
) const
{
label proci = 0;
@ -81,9 +80,7 @@ Foam::label Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcDistribution
}
template<class SourcePatch, class TargetPatch>
Foam::label
Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcOverlappingProcs
Foam::label Foam::AMIInterpolation::calcOverlappingProcs
(
const List<treeBoundBoxList>& procBb,
const treeBoundBox& bb,
@ -113,11 +110,10 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcOverlappingProcs
}
template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::distributePatches
void Foam::AMIInterpolation::distributePatches
(
const mapDistribute& map,
const TargetPatch& pp,
const primitivePatch& pp,
const globalIndex& gi,
List<faceList>& faces,
List<pointField>& points,
@ -209,12 +205,10 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::distributePatches
}
template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::
distributeAndMergePatches
void Foam::AMIInterpolation::distributeAndMergePatches
(
const mapDistribute& map,
const TargetPatch& tgtPatch,
const primitivePatch& tgtPatch,
const globalIndex& gi,
faceList& tgtFaces,
pointField& tgtPoints,
@ -325,12 +319,11 @@ distributeAndMergePatches
}
template<class SourcePatch, class TargetPatch>
Foam::autoPtr<Foam::mapDistribute>
Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcProcMap
Foam::AMIInterpolation::calcProcMap
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch
) const
{
// Get decomposition of patch

View File

@ -0,0 +1,336 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "AMIInterpolation.H"
#include "AMIMethod.H"
#include "meshTools.H"
#include "mapDistribute.H"
#include "flipOp.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type, class CombineOp>
void Foam::AMIInterpolation::interpolateToTarget
(
const UList<Type>& fld,
const CombineOp& cop,
List<Type>& result,
const UList<Type>& defaultValues
) const
{
if (fld.size() != srcAddress_.size())
{
FatalErrorInFunction
<< "Supplied field size is not equal to source patch size" << nl
<< " source patch = " << srcAddress_.size() << nl
<< " target patch = " << tgtAddress_.size() << nl
<< " supplied field = " << fld.size()
<< abort(FatalError);
}
if (lowWeightCorrection_ > 0)
{
if (defaultValues.size() != tgtAddress_.size())
{
FatalErrorInFunction
<< "Employing default values when sum of weights falls below "
<< lowWeightCorrection_
<< " but supplied default field size is not equal to target "
<< "patch size" << nl
<< " default values = " << defaultValues.size() << nl
<< " target patch = " << tgtAddress_.size() << nl
<< abort(FatalError);
}
}
result.setSize(tgtAddress_.size());
if (singlePatchProc_ == -1)
{
const mapDistribute& map = srcMapPtr_();
List<Type> work(fld);
map.distribute(work);
forAll(result, facei)
{
if (tgtWeightsSum_[facei] < lowWeightCorrection_)
{
result[facei] = defaultValues[facei];
}
else
{
const labelList& faces = tgtAddress_[facei];
const scalarList& weights = tgtWeights_[facei];
forAll(faces, i)
{
cop(result[facei], facei, work[faces[i]], weights[i]);
}
}
}
}
else
{
forAll(result, facei)
{
if (tgtWeightsSum_[facei] < lowWeightCorrection_)
{
result[facei] = defaultValues[facei];
}
else
{
const labelList& faces = tgtAddress_[facei];
const scalarList& weights = tgtWeights_[facei];
forAll(faces, i)
{
cop(result[facei], facei, fld[faces[i]], weights[i]);
}
}
}
}
}
template<class Type, class CombineOp>
void Foam::AMIInterpolation::interpolateToSource
(
const UList<Type>& fld,
const CombineOp& cop,
List<Type>& result,
const UList<Type>& defaultValues
) const
{
if (fld.size() != tgtAddress_.size())
{
FatalErrorInFunction
<< "Supplied field size is not equal to target patch size" << nl
<< " source patch = " << srcAddress_.size() << nl
<< " target patch = " << tgtAddress_.size() << nl
<< " supplied field = " << fld.size()
<< abort(FatalError);
}
if (lowWeightCorrection_ > 0)
{
if (defaultValues.size() != srcAddress_.size())
{
FatalErrorInFunction
<< "Employing default values when sum of weights falls below "
<< lowWeightCorrection_
<< " but supplied default field size is not equal to target "
<< "patch size" << nl
<< " default values = " << defaultValues.size() << nl
<< " source patch = " << srcAddress_.size() << nl
<< abort(FatalError);
}
}
result.setSize(srcAddress_.size());
if (singlePatchProc_ == -1)
{
const mapDistribute& map = tgtMapPtr_();
List<Type> work(fld);
map.distribute(work);
forAll(result, facei)
{
if (srcWeightsSum_[facei] < lowWeightCorrection_)
{
result[facei] = defaultValues[facei];
}
else
{
const labelList& faces = srcAddress_[facei];
const scalarList& weights = srcWeights_[facei];
forAll(faces, i)
{
cop(result[facei], facei, work[faces[i]], weights[i]);
}
}
}
}
else
{
forAll(result, facei)
{
if (srcWeightsSum_[facei] < lowWeightCorrection_)
{
result[facei] = defaultValues[facei];
}
else
{
const labelList& faces = srcAddress_[facei];
const scalarList& weights = srcWeights_[facei];
forAll(faces, i)
{
cop(result[facei], facei, fld[faces[i]], weights[i]);
}
}
}
}
}
template<class Type, class CombineOp>
Foam::tmp<Foam::Field<Type>>
Foam::AMIInterpolation::interpolateToSource
(
const Field<Type>& fld,
const CombineOp& cop,
const UList<Type>& defaultValues
) const
{
tmp<Field<Type>> tresult
(
new Field<Type>
(
srcAddress_.size(),
Zero
)
);
interpolateToSource
(
fld,
multiplyWeightedOp<Type, CombineOp>(cop),
tresult.ref(),
defaultValues
);
return tresult;
}
template<class Type, class CombineOp>
Foam::tmp<Foam::Field<Type>>
Foam::AMIInterpolation::interpolateToSource
(
const tmp<Field<Type>>& tFld,
const CombineOp& cop,
const UList<Type>& defaultValues
) const
{
return interpolateToSource(tFld(), cop, defaultValues);
}
template<class Type, class CombineOp>
Foam::tmp<Foam::Field<Type>>
Foam::AMIInterpolation::interpolateToTarget
(
const Field<Type>& fld,
const CombineOp& cop,
const UList<Type>& defaultValues
) const
{
tmp<Field<Type>> tresult
(
new Field<Type>
(
tgtAddress_.size(),
Zero
)
);
interpolateToTarget
(
fld,
multiplyWeightedOp<Type, CombineOp>(cop),
tresult.ref(),
defaultValues
);
return tresult;
}
template<class Type, class CombineOp>
Foam::tmp<Foam::Field<Type>>
Foam::AMIInterpolation::interpolateToTarget
(
const tmp<Field<Type>>& tFld,
const CombineOp& cop,
const UList<Type>& defaultValues
) const
{
return interpolateToTarget(tFld(), cop, defaultValues);
}
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::AMIInterpolation::interpolateToSource
(
const Field<Type>& fld,
const UList<Type>& defaultValues
) const
{
return interpolateToSource(fld, plusEqOp<Type>(), defaultValues);
}
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::AMIInterpolation::interpolateToSource
(
const tmp<Field<Type>>& tFld,
const UList<Type>& defaultValues
) const
{
return interpolateToSource(tFld(), plusEqOp<Type>(), defaultValues);
}
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::AMIInterpolation::interpolateToTarget
(
const Field<Type>& fld,
const UList<Type>& defaultValues
) const
{
return interpolateToTarget(fld, plusEqOp<Type>(), defaultValues);
}
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::AMIInterpolation::interpolateToTarget
(
const tmp<Field<Type>>& tFld,
const UList<Type>& defaultValues
) const
{
return interpolateToTarget(tFld(), plusEqOp<Type>(), defaultValues);
}
// ************************************************************************* //

View File

@ -28,10 +28,18 @@ License
#include "mapDistribute.H"
#include "unitConversion.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(AMIMethod, 0);
defineRunTimeSelectionTable(AMIMethod, components);
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class SourcePatch, class TargetPatch>
void Foam::AMIMethod<SourcePatch, TargetPatch>::checkPatches() const
void Foam::AMIMethod::checkPatches() const
{
if (debug && (!srcPatch_.size() || !tgtPatch_.size()))
{
@ -67,8 +75,7 @@ void Foam::AMIMethod<SourcePatch, TargetPatch>::checkPatches() const
}
template<class SourcePatch, class TargetPatch>
bool Foam::AMIMethod<SourcePatch, TargetPatch>::initialise
bool Foam::AMIMethod::initialise
(
labelListList& srcAddress,
scalarListList& srcWeights,
@ -142,8 +149,7 @@ bool Foam::AMIMethod<SourcePatch, TargetPatch>::initialise
}
template<class SourcePatch, class TargetPatch>
void Foam::AMIMethod<SourcePatch, TargetPatch>::writeIntersectionOBJ
void Foam::AMIMethod::writeIntersectionOBJ
(
const scalar area,
const face& f1,
@ -194,8 +200,7 @@ void Foam::AMIMethod<SourcePatch, TargetPatch>::writeIntersectionOBJ
}
template<class SourcePatch, class TargetPatch>
void Foam::AMIMethod<SourcePatch, TargetPatch>::resetTree()
void Foam::AMIMethod::resetTree()
{
// Clear the old octree
treePtr_.clear();
@ -225,8 +230,7 @@ void Foam::AMIMethod<SourcePatch, TargetPatch>::resetTree()
}
template<class SourcePatch, class TargetPatch>
Foam::label Foam::AMIMethod<SourcePatch, TargetPatch>::findTargetFace
Foam::label Foam::AMIMethod::findTargetFace
(
const label srcFacei
) const
@ -256,11 +260,10 @@ Foam::label Foam::AMIMethod<SourcePatch, TargetPatch>::findTargetFace
}
template<class SourcePatch, class TargetPatch>
void Foam::AMIMethod<SourcePatch, TargetPatch>::appendNbrFaces
void Foam::AMIMethod::appendNbrFaces
(
const label facei,
const TargetPatch& patch,
const primitivePatch& patch,
const DynamicList<label>& visitedFaces,
DynamicList<label>& faceIDs
) const
@ -310,8 +313,7 @@ void Foam::AMIMethod<SourcePatch, TargetPatch>::appendNbrFaces
}
template<class SourcePatch, class TargetPatch>
Foam::scalar Foam::AMIMethod<SourcePatch, TargetPatch>::maxWalkAngle() const
Foam::scalar Foam::AMIMethod::maxWalkAngle() const
{
return degToRad(89);
}
@ -319,11 +321,10 @@ Foam::scalar Foam::AMIMethod<SourcePatch, TargetPatch>::maxWalkAngle() const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class SourcePatch, class TargetPatch>
Foam::AMIMethod<SourcePatch, TargetPatch>::AMIMethod
Foam::AMIMethod::AMIMethod
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch,
const scalarField& srcMagSf,
const scalarField& tgtMagSf,
const faceAreaIntersect::triangulationMode& triMode,
@ -344,15 +345,13 @@ Foam::AMIMethod<SourcePatch, TargetPatch>::AMIMethod
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class SourcePatch, class TargetPatch>
Foam::AMIMethod<SourcePatch, TargetPatch>::~AMIMethod()
Foam::AMIMethod::~AMIMethod()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class SourcePatch, class TargetPatch>
bool Foam::AMIMethod<SourcePatch, TargetPatch>::conformal() const
bool Foam::AMIMethod::conformal() const
{
return true;
}

View File

@ -41,6 +41,7 @@ SourceFiles
#include "indexedOctree.H"
#include "treeDataPrimitivePatch.H"
#include "treeBoundBoxList.H"
#include "primitivePatch.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -52,10 +53,8 @@ namespace Foam
Class AMIMethod Declaration
\*---------------------------------------------------------------------------*/
template<class SourcePatch, class TargetPatch>
class AMIMethod
{
private:
// Private Member Functions
@ -70,16 +69,16 @@ private:
protected:
//- Local typedef to octree tree-type
typedef treeDataPrimitivePatch<TargetPatch> treeType;
typedef treeDataPrimitivePatch<primitivePatch> treeType;
// Protected data
//- Reference to source patch
const SourcePatch& srcPatch_;
const primitivePatch& srcPatch_;
//- Reference to target patch
const TargetPatch& tgtPatch_;
const primitivePatch& tgtPatch_;
//- Flag to indicate that the two patches are co-directional and
// that the orientation of the target patch should be reversed
@ -147,7 +146,7 @@ protected:
void appendNbrFaces
(
const label facei,
const TargetPatch& patch,
const primitivePatch& patch,
const DynamicList<label>& visitedFaces,
DynamicList<label>& faceIDs
) const;
@ -161,6 +160,7 @@ public:
//- Runtime type information
TypeName("AMIMethod");
//- Declare runtime constructor selection table
declareRunTimeSelectionTable
(
@ -168,8 +168,8 @@ public:
AMIMethod,
components,
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch,
const scalarField& srcMagSf,
const scalarField& tgtMagSf,
const faceAreaIntersect::triangulationMode& triMode,
@ -187,24 +187,28 @@ public:
)
);
//- Construct from components
AMIMethod
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const scalarField& srcMagSf,
const scalarField& tgtMagSf,
const faceAreaIntersect::triangulationMode& triMode,
const bool reverseTarget,
const bool requireMatch
);
// Constructors
//- Construct from components
AMIMethod
(
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch,
const scalarField& srcMagSf,
const scalarField& tgtMagSf,
const faceAreaIntersect::triangulationMode& triMode,
const bool reverseTarget,
const bool requireMatch
);
//- Selector
static autoPtr<AMIMethod> New
(
const word& methodName,
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch,
const scalarField& srcMagSf,
const scalarField& tgtMagSf,
const faceAreaIntersect::triangulationMode& triMode,
@ -248,42 +252,12 @@ public:
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makeAMIMethod(AMIType) \
\
typedef AMIMethod<AMIType::sourcePatchType,AMIType::targetPatchType> \
AMIMethod##AMIType; \
\
defineNamedTemplateTypeNameAndDebug(AMIMethod##AMIType, 0); \
defineTemplateRunTimeSelectionTable(AMIMethod##AMIType, components);
#define makeAMIMethodType(AMIType, Method) \
\
typedef Method<AMIType::sourcePatchType,AMIType::targetPatchType> \
Method##AMIType; \
\
defineNamedTemplateTypeNameAndDebug(Method##AMIType, 0); \
\
AMIMethod<AMIType::sourcePatchType,AMIType::targetPatchType>:: \
addcomponentsConstructorToTable<Method##AMIType> \
add##Method##AMIType##ConstructorToTable_;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "AMIMethodI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "AMIMethod.C"
#include "AMIMethodNew.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -23,9 +23,7 @@ License
\*---------------------------------------------------------------------------*/
template<class SourcePatch, class TargetPatch>
inline const Foam::labelList&
Foam::AMIMethod<SourcePatch, TargetPatch>::srcNonOverlap() const
inline const Foam::labelList& Foam::AMIMethod::srcNonOverlap() const
{
return srcNonOverlap_;
}

View File

@ -23,15 +23,15 @@ License
\*---------------------------------------------------------------------------*/
#include "AMIMethod.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class SourcePatch, class TargetPatch>
Foam::autoPtr<Foam::AMIMethod<SourcePatch, TargetPatch>>
Foam::AMIMethod<SourcePatch, TargetPatch>::New
Foam::autoPtr<Foam::AMIMethod> Foam::AMIMethod::New
(
const word& methodName,
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch,
const scalarField& srcMagSf,
const scalarField& tgtMagSf,
const faceAreaIntersect::triangulationMode& triMode,
@ -56,7 +56,7 @@ Foam::AMIMethod<SourcePatch, TargetPatch>::New
<< componentsConstructorTablePtr_->sortedToc() << exit(FatalError);
}
return autoPtr<AMIMethod<SourcePatch, TargetPatch>>
return autoPtr<AMIMethod>
(
cstrIter()
(

View File

@ -24,11 +24,20 @@ License
\*---------------------------------------------------------------------------*/
#include "directAMI.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(directAMI, 0);
addToRunTimeSelectionTable(AMIMethod, directAMI, components);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class SourcePatch, class TargetPatch>
void Foam::directAMI<SourcePatch, TargetPatch>::appendToDirectSeeds
void Foam::directAMI::appendToDirectSeeds
(
labelList& mapFlag,
labelList& srcTgtSeed,
@ -155,8 +164,7 @@ void Foam::directAMI<SourcePatch, TargetPatch>::appendToDirectSeeds
}
template<class SourcePatch, class TargetPatch>
void Foam::directAMI<SourcePatch, TargetPatch>::restartAdvancingFront
void Foam::directAMI::restartAdvancingFront
(
labelList& mapFlag,
DynamicList<label>& nonOverlapFaces,
@ -187,11 +195,10 @@ void Foam::directAMI<SourcePatch, TargetPatch>::restartAdvancingFront
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class SourcePatch, class TargetPatch>
Foam::directAMI<SourcePatch, TargetPatch>::directAMI
Foam::directAMI::directAMI
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch,
const scalarField& srcMagSf,
const scalarField& tgtMagSf,
const faceAreaIntersect::triangulationMode& triMode,
@ -199,7 +206,7 @@ Foam::directAMI<SourcePatch, TargetPatch>::directAMI
const bool requireMatch
)
:
AMIMethod<SourcePatch, TargetPatch>
AMIMethod
(
srcPatch,
tgtPatch,
@ -214,15 +221,13 @@ Foam::directAMI<SourcePatch, TargetPatch>::directAMI
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class SourcePatch, class TargetPatch>
Foam::directAMI<SourcePatch, TargetPatch>::~directAMI()
Foam::directAMI::~directAMI()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class SourcePatch, class TargetPatch>
void Foam::directAMI<SourcePatch, TargetPatch>::calculate
void Foam::directAMI::calculate
(
labelListList& srcAddress,
scalarListList& srcWeights,

View File

@ -46,10 +46,9 @@ namespace Foam
Class directAMI Declaration
\*---------------------------------------------------------------------------*/
template<class SourcePatch, class TargetPatch>
class directAMI
:
public AMIMethod<SourcePatch, TargetPatch>
public AMIMethod
{
private:
@ -107,8 +106,8 @@ public:
//- Construct from components
directAMI
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch,
const scalarField& srcMagSf,
const scalarField& tgtMagSf,
const faceAreaIntersect::triangulationMode& triMode,
@ -144,12 +143,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "directAMI.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -24,11 +24,20 @@ License
\*---------------------------------------------------------------------------*/
#include "faceAreaWeightAMI.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(faceAreaWeightAMI, 0);
addToRunTimeSelectionTable(AMIMethod, faceAreaWeightAMI, components);
}
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
template<class SourcePatch, class TargetPatch>
void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::calcAddressing
void Foam::faceAreaWeightAMI::calcAddressing
(
List<DynamicList<label>>& srcAddr,
List<DynamicList<scalar>>& srcWght,
@ -105,8 +114,7 @@ void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::calcAddressing
}
template<class SourcePatch, class TargetPatch>
bool Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::processSourceFace
bool Foam::faceAreaWeightAMI::processSourceFace
(
const label srcFacei,
const label tgtStartFacei,
@ -181,8 +189,7 @@ bool Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::processSourceFace
}
template<class SourcePatch, class TargetPatch>
void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::setNextFaces
void Foam::faceAreaWeightAMI::setNextFaces
(
label& startSeedI,
label& srcFacei,
@ -296,8 +303,7 @@ void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::setNextFaces
}
template<class SourcePatch, class TargetPatch>
Foam::scalar Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::interArea
Foam::scalar Foam::faceAreaWeightAMI::interArea
(
const label srcFacei,
const label tgtFacei
@ -359,9 +365,7 @@ Foam::scalar Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::interArea
}
template<class SourcePatch, class TargetPatch>
void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::
restartUncoveredSourceFace
void Foam::faceAreaWeightAMI::restartUncoveredSourceFace
(
List<DynamicList<label>>& srcAddr,
List<DynamicList<scalar>>& srcWght,
@ -456,9 +460,8 @@ restartUncoveredSourceFace
}
template<class SourcePatch, class TargetPatch>
Foam::scalar
Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::minWeight() const
Foam::faceAreaWeightAMI::minWeight() const
{
return faceAreaIntersect::tolerance();
}
@ -466,11 +469,10 @@ Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::minWeight() const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class SourcePatch, class TargetPatch>
Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::faceAreaWeightAMI
Foam::faceAreaWeightAMI::faceAreaWeightAMI
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch,
const scalarField& srcMagSf,
const scalarField& tgtMagSf,
const faceAreaIntersect::triangulationMode& triMode,
@ -479,7 +481,7 @@ Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::faceAreaWeightAMI
const bool restartUncoveredSourceFace
)
:
AMIMethod<SourcePatch, TargetPatch>
AMIMethod
(
srcPatch,
tgtPatch,
@ -495,15 +497,13 @@ Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::faceAreaWeightAMI
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class SourcePatch, class TargetPatch>
Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::~faceAreaWeightAMI()
Foam::faceAreaWeightAMI::~faceAreaWeightAMI()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class SourcePatch, class TargetPatch>
void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::calculate
void Foam::faceAreaWeightAMI::calculate
(
labelListList& srcAddress,
scalarListList& srcWeights,

View File

@ -46,10 +46,9 @@ namespace Foam
Class faceAreaWeightAMI Declaration
\*---------------------------------------------------------------------------*/
template<class SourcePatch, class TargetPatch>
class faceAreaWeightAMI
:
public AMIMethod<SourcePatch, TargetPatch>
public AMIMethod
{
private:
@ -141,8 +140,8 @@ public:
//- Construct from components
faceAreaWeightAMI
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch,
const scalarField& srcMagSf,
const scalarField& tgtMagSf,
const faceAreaIntersect::triangulationMode& triMode,
@ -179,12 +178,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "faceAreaWeightAMI.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -24,14 +24,23 @@ License
\*---------------------------------------------------------------------------*/
#include "mapNearestAMI.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(mapNearestAMI, 0);
addToRunTimeSelectionTable(AMIMethod, mapNearestAMI, components);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class SourcePatch, class TargetPatch>
void Foam::mapNearestAMI<SourcePatch, TargetPatch>::findNearestFace
void Foam::mapNearestAMI::findNearestFace
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch,
const label& srcFacei,
label& tgtFacei
) const
@ -72,8 +81,7 @@ void Foam::mapNearestAMI<SourcePatch, TargetPatch>::findNearestFace
}
template<class SourcePatch, class TargetPatch>
void Foam::mapNearestAMI<SourcePatch, TargetPatch>::setNextNearestFaces
void Foam::mapNearestAMI::setNextNearestFaces
(
boolList& mapFlag,
label& startSeedI,
@ -120,8 +128,7 @@ void Foam::mapNearestAMI<SourcePatch, TargetPatch>::setNextNearestFaces
}
template<class SourcePatch, class TargetPatch>
Foam::label Foam::mapNearestAMI<SourcePatch, TargetPatch>::findMappedSrcFace
Foam::label Foam::mapNearestAMI::findMappedSrcFace
(
const label tgtFacei,
const List<DynamicList<label>>& tgtToSrc
@ -167,11 +174,10 @@ Foam::label Foam::mapNearestAMI<SourcePatch, TargetPatch>::findMappedSrcFace
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class SourcePatch, class TargetPatch>
Foam::mapNearestAMI<SourcePatch, TargetPatch>::mapNearestAMI
Foam::mapNearestAMI::mapNearestAMI
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch,
const scalarField& srcMagSf,
const scalarField& tgtMagSf,
const faceAreaIntersect::triangulationMode& triMode,
@ -179,7 +185,7 @@ Foam::mapNearestAMI<SourcePatch, TargetPatch>::mapNearestAMI
const bool requireMatch
)
:
AMIMethod<SourcePatch, TargetPatch>
AMIMethod
(
srcPatch,
tgtPatch,
@ -194,15 +200,13 @@ Foam::mapNearestAMI<SourcePatch, TargetPatch>::mapNearestAMI
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class SourcePatch, class TargetPatch>
Foam::mapNearestAMI<SourcePatch, TargetPatch>::~mapNearestAMI()
Foam::mapNearestAMI::~mapNearestAMI()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class SourcePatch, class TargetPatch>
void Foam::mapNearestAMI<SourcePatch, TargetPatch>::calculate
void Foam::mapNearestAMI::calculate
(
labelListList& srcAddress,
scalarListList& srcWeights,

View File

@ -46,10 +46,9 @@ namespace Foam
Class mapNearestAMI Declaration
\*---------------------------------------------------------------------------*/
template<class SourcePatch, class TargetPatch>
class mapNearestAMI
:
public AMIMethod<SourcePatch, TargetPatch>
public AMIMethod
{
private:
@ -67,8 +66,8 @@ private:
//- Find nearest target face for source face srcFacei
void findNearestFace
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch,
const label& srcFacei,
label& tgtFacei
) const;
@ -111,8 +110,8 @@ public:
//- Construct from components
mapNearestAMI
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch,
const scalarField& srcMagSf,
const scalarField& tgtMagSf,
const faceAreaIntersect::triangulationMode& triMode,
@ -148,12 +147,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "mapNearestAMI.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -24,11 +24,20 @@ License
\*---------------------------------------------------------------------------*/
#include "partialFaceAreaWeightAMI.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(partialFaceAreaWeightAMI, 0);
addToRunTimeSelectionTable(AMIMethod, partialFaceAreaWeightAMI, components);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class SourcePatch, class TargetPatch>
void Foam::partialFaceAreaWeightAMI<SourcePatch, TargetPatch>::setNextFaces
void Foam::partialFaceAreaWeightAMI::setNextFaces
(
label& startSeedI,
label& srcFacei,
@ -39,7 +48,7 @@ void Foam::partialFaceAreaWeightAMI<SourcePatch, TargetPatch>::setNextFaces
const bool errorOnNotFound
) const
{
faceAreaWeightAMI<SourcePatch, TargetPatch>::setNextFaces
faceAreaWeightAMI::setNextFaces
(
startSeedI,
srcFacei,
@ -54,12 +63,10 @@ void Foam::partialFaceAreaWeightAMI<SourcePatch, TargetPatch>::setNextFaces
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class SourcePatch, class TargetPatch>
Foam::partialFaceAreaWeightAMI<SourcePatch, TargetPatch>::
partialFaceAreaWeightAMI
Foam::partialFaceAreaWeightAMI::partialFaceAreaWeightAMI
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch,
const scalarField& srcMagSf,
const scalarField& tgtMagSf,
const faceAreaIntersect::triangulationMode& triMode,
@ -67,7 +74,7 @@ partialFaceAreaWeightAMI
const bool requireMatch
)
:
faceAreaWeightAMI<SourcePatch, TargetPatch>
faceAreaWeightAMI
(
srcPatch,
tgtPatch,
@ -82,23 +89,19 @@ partialFaceAreaWeightAMI
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class SourcePatch, class TargetPatch>
Foam::partialFaceAreaWeightAMI<SourcePatch, TargetPatch>::
~partialFaceAreaWeightAMI()
Foam::partialFaceAreaWeightAMI::~partialFaceAreaWeightAMI()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class SourcePatch, class TargetPatch>
bool Foam::partialFaceAreaWeightAMI<SourcePatch, TargetPatch>::conformal() const
bool Foam::partialFaceAreaWeightAMI::conformal() const
{
return false;
}
template<class SourcePatch, class TargetPatch>
void Foam::partialFaceAreaWeightAMI<SourcePatch, TargetPatch>::calculate
void Foam::partialFaceAreaWeightAMI::calculate
(
labelListList& srcAddress,
scalarListList& srcWeights,
@ -130,7 +133,7 @@ void Foam::partialFaceAreaWeightAMI<SourcePatch, TargetPatch>::calculate
List<DynamicList<label>> tgtAddr(this->tgtPatch_.size());
List<DynamicList<scalar>> tgtWght(tgtAddr.size());
faceAreaWeightAMI<SourcePatch, TargetPatch>::calcAddressing
faceAreaWeightAMI::calcAddressing
(
srcAddr,
srcWght,

View File

@ -46,10 +46,9 @@ namespace Foam
Class partialFaceAreaWeightAMI Declaration
\*---------------------------------------------------------------------------*/
template<class SourcePatch, class TargetPatch>
class partialFaceAreaWeightAMI
:
public faceAreaWeightAMI<SourcePatch, TargetPatch>
public faceAreaWeightAMI
{
private:
@ -88,8 +87,8 @@ public:
//- Construct from components
partialFaceAreaWeightAMI
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch,
const scalarField& srcMagSf,
const scalarField& tgtMagSf,
const faceAreaIntersect::triangulationMode& triMode,
@ -131,12 +130,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "partialFaceAreaWeightAMI.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -27,23 +27,27 @@ License
#include "cut.H"
#include "linearEqn.H"
#include "quadraticEqn.H"
#include "unitConversion.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<class SourcePatch, class TargetPatch>
const Foam::scalar Foam::sweptFaceAreaWeightAMI<SourcePatch, TargetPatch>::
minCutRatio_ = 10*small;
namespace Foam
{
defineTypeNameAndDebug(sweptFaceAreaWeightAMI, 0);
addToRunTimeSelectionTable(AMIMethod, sweptFaceAreaWeightAMI, components);
}
template<class SourcePatch, class TargetPatch>
const Foam::scalar Foam::sweptFaceAreaWeightAMI<SourcePatch, TargetPatch>::
maxDot_ = - cos(degToRad(89.9));
const Foam::scalar Foam::sweptFaceAreaWeightAMI::minCutRatio_ = 10*small;
const Foam::scalar Foam::sweptFaceAreaWeightAMI::maxDot_ =
- cos(degToRad(89.9));
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class SourcePatch, class TargetPatch>
template<unsigned Size>
void Foam::sweptFaceAreaWeightAMI<SourcePatch, TargetPatch>::writeCutTrisVTK
void Foam::sweptFaceAreaWeightAMI::writeCutTrisVTK
(
const cutTriList<Size>& tris,
const word& name
@ -75,8 +79,7 @@ void Foam::sweptFaceAreaWeightAMI<SourcePatch, TargetPatch>::writeCutTrisVTK
}
template<class SourcePatch, class TargetPatch>
void Foam::sweptFaceAreaWeightAMI<SourcePatch, TargetPatch>::writeFaceOBJ
void Foam::sweptFaceAreaWeightAMI::writeFaceOBJ
(
const face& f,
const pointField& ps,
@ -100,8 +103,7 @@ void Foam::sweptFaceAreaWeightAMI<SourcePatch, TargetPatch>::writeFaceOBJ
}
template<class SourcePatch, class TargetPatch>
void Foam::sweptFaceAreaWeightAMI<SourcePatch, TargetPatch>::writeProjectionOBJ
void Foam::sweptFaceAreaWeightAMI::writeProjectionOBJ
(
const label srcN,
const FixedList<point, 4>& srcTri,
@ -153,9 +155,7 @@ void Foam::sweptFaceAreaWeightAMI<SourcePatch, TargetPatch>::writeProjectionOBJ
}
template<class SourcePatch, class TargetPatch>
Foam::label
Foam::sweptFaceAreaWeightAMI<SourcePatch, TargetPatch>::getSourceProjection
Foam::label Foam::sweptFaceAreaWeightAMI::getSourceProjection
(
FixedList<point, 4>& srcTri,
FixedList<point, 4>& srcNrm,
@ -271,8 +271,7 @@ Foam::sweptFaceAreaWeightAMI<SourcePatch, TargetPatch>::getSourceProjection
}
template<class SourcePatch, class TargetPatch>
Foam::plane Foam::sweptFaceAreaWeightAMI<SourcePatch, TargetPatch>::getCutPlane
Foam::plane Foam::sweptFaceAreaWeightAMI::getCutPlane
(
const point& p0,
const point& p1,
@ -355,8 +354,7 @@ Foam::plane Foam::sweptFaceAreaWeightAMI<SourcePatch, TargetPatch>::getCutPlane
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
template<class SourcePatch, class TargetPatch>
Foam::scalar Foam::sweptFaceAreaWeightAMI<SourcePatch, TargetPatch>::interArea
Foam::scalar Foam::sweptFaceAreaWeightAMI::interArea
(
const label srcFacei,
const label tgtFacei
@ -562,7 +560,7 @@ Foam::scalar Foam::sweptFaceAreaWeightAMI<SourcePatch, TargetPatch>::interArea
if (debugPrint)
{
const scalar standardAreaMag =
faceAreaWeightAMI<SourcePatch, TargetPatch>::interArea
faceAreaWeightAMI::interArea
(
srcFacei,
tgtFacei
@ -576,17 +574,13 @@ Foam::scalar Foam::sweptFaceAreaWeightAMI<SourcePatch, TargetPatch>::interArea
}
template<class SourcePatch, class TargetPatch>
Foam::scalar
Foam::sweptFaceAreaWeightAMI<SourcePatch, TargetPatch>::minWeight() const
Foam::scalar Foam::sweptFaceAreaWeightAMI::minWeight() const
{
return small;
}
template<class SourcePatch, class TargetPatch>
Foam::scalar
Foam::sweptFaceAreaWeightAMI<SourcePatch, TargetPatch>::maxWalkAngle() const
Foam::scalar Foam::sweptFaceAreaWeightAMI::maxWalkAngle() const
{
return degToRad(180);
}
@ -594,10 +588,7 @@ Foam::sweptFaceAreaWeightAMI<SourcePatch, TargetPatch>::maxWalkAngle() const
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class SourcePatch, class TargetPatch>
Foam::sweptFaceAreaWeightAMI<SourcePatch, TargetPatch>::~sweptFaceAreaWeightAMI
(
)
Foam::sweptFaceAreaWeightAMI::~sweptFaceAreaWeightAMI()
{}

View File

@ -103,10 +103,9 @@ namespace Foam
Class sweptFaceAreaWeightAMI Declaration
\*---------------------------------------------------------------------------*/
template<class SourcePatch, class TargetPatch>
class sweptFaceAreaWeightAMI
:
public faceAreaWeightAMI<SourcePatch, TargetPatch>
public faceAreaWeightAMI
{
private:
@ -248,7 +247,7 @@ public:
// Constructors
//- Use parent constructors
using faceAreaWeightAMI<SourcePatch, TargetPatch>::faceAreaWeightAMI;
using faceAreaWeightAMI::faceAreaWeightAMI;
//- Destructor
@ -262,12 +261,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "sweptFaceAreaWeightAMI.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,49 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "AMIPatchToPatchInterpolation.H"
#include "AMIMethod.H"
#include "directAMI.H"
#include "mapNearestAMI.H"
#include "faceAreaWeightAMI.H"
#include "partialFaceAreaWeightAMI.H"
#include "sweptFaceAreaWeightAMI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makeAMIMethod(AMIPatchToPatchInterpolation);
makeAMIMethodType(AMIPatchToPatchInterpolation, directAMI);
makeAMIMethodType(AMIPatchToPatchInterpolation, mapNearestAMI);
makeAMIMethodType(AMIPatchToPatchInterpolation, faceAreaWeightAMI);
makeAMIMethodType(AMIPatchToPatchInterpolation, partialFaceAreaWeightAMI);
makeAMIMethodType(AMIPatchToPatchInterpolation, sweptFaceAreaWeightAMI);
}
// ************************************************************************* //

View File

@ -1,50 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef AMIPatchToPatchInterpolation_H
#define AMIPatchToPatchInterpolation_H
#include "AMIInterpolation.H"
#include "PrimitivePatch.H"
#include "face.H"
#include "SubList.H"
#include "pointField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef AMIInterpolation
<
PrimitivePatch<face, SubList, const pointField&>,
PrimitivePatch<face, SubList, const pointField&>
> AMIPatchToPatchInterpolation;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -161,7 +161,7 @@ Foam::cyclicAMIGAMGInterface::cyclicAMIGAMGInterface
AMIs_.set
(
i,
new AMIPatchToPatchInterpolation
new AMIInterpolation
(
fineCyclicAMIInterface_.AMIs()[i],
faceRestrictAddressing_,

View File

@ -59,7 +59,7 @@ class cyclicAMIGAMGInterface
const cyclicAMILduInterface& fineCyclicAMIInterface_;
//- AMI interfaces
PtrList<AMIPatchToPatchInterpolation> AMIs_;
PtrList<AMIInterpolation> AMIs_;
//- AMI transformations
List<vectorTensorTransform> AMITransforms_;
@ -136,7 +136,7 @@ public:
}
//- Return a reference to the AMI interpolators
virtual const PtrList<AMIPatchToPatchInterpolation>& AMIs() const
virtual const PtrList<AMIInterpolation>& AMIs() const
{
return AMIs_;
}

View File

@ -78,7 +78,7 @@ void Foam::cyclicACMIPolyPatch::resetAMI() const
// face is fully covered)
cyclicAMIPolyPatch::resetAMI();
AMIPatchToPatchInterpolation& AMI = this->AMIs_[0];
AMIInterpolation& AMI = this->AMIs_[0];
srcMask_ =
min(scalar(1) - tolerance_, max(tolerance_, AMI.srcWeightsSum()));
@ -218,7 +218,7 @@ Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch
patchType,
transform,
false,
AMIPatchToPatchInterpolation::imPartialFaceAreaWeight
AMIInterpolation::imPartialFaceAreaWeight
),
nonOverlapPatchName_(word::null),
nonOverlapPatchID_(-1),
@ -248,7 +248,7 @@ Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch
bm,
patchType,
false,
AMIPatchToPatchInterpolation::imPartialFaceAreaWeight
AMIInterpolation::imPartialFaceAreaWeight
),
nonOverlapPatchName_(dict.lookup("nonOverlapPatch")),
nonOverlapPatchID_(-1),

View File

@ -36,7 +36,7 @@ SourceFiles
#define cyclicACMIPolyPatch_H
#include "cyclicAMIPolyPatch.H"
#include "AMIPatchToPatchInterpolation.H"
#include "AMIInterpolation.H"
#include "polyBoundaryMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -36,7 +36,7 @@ SourceFiles
#define cyclicAMILduInterface_H
#include "primitiveFieldsFwd.H"
#include "AMIPatchToPatchInterpolation.H"
#include "AMIInterpolation.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -81,8 +81,7 @@ public:
virtual const cyclicAMILduInterface& neighbPatch() const = 0;
//- Return a reference to the AMI interpolators
virtual const PtrList<AMIPatchToPatchInterpolation>&
AMIs() const = 0;
virtual const PtrList<AMIInterpolation>& AMIs() const = 0;
// Return a reference to the AMI transformations
virtual const List<vectorTensorTransform>&

View File

@ -26,6 +26,7 @@ License
#include "cyclicAMIPolyPatch.H"
#include "SubField.H"
#include "Time.H"
#include "unitConversion.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -328,7 +329,7 @@ void Foam::cyclicAMIPolyPatch::resetAMI() const
AMIs_.set
(
0,
new AMIPatchToPatchInterpolation
new AMIInterpolation
(
*this,
nbrPatch0,
@ -484,7 +485,7 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
const word& patchType,
const transformType transform,
const bool AMIRequireMatch,
const AMIPatchToPatchInterpolation::interpolationMethod AMIMethod
const AMIInterpolation::interpolationMethod AMIMethod
)
:
coupledPolyPatch(name, size, start, index, bm, patchType, transform),
@ -517,7 +518,7 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
const polyBoundaryMesh& bm,
const word& patchType,
const bool AMIRequireMatch,
const AMIPatchToPatchInterpolation::interpolationMethod AMIMethod
const AMIInterpolation::interpolationMethod AMIMethod
)
:
coupledPolyPatch(name, dict, index, bm, patchType),
@ -537,7 +538,7 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
AMIMethod_
(
dict.found("method")
? AMIPatchToPatchInterpolation::wordTointerpolationMethod
? AMIInterpolation::wordTointerpolationMethod
(
dict.lookup("method")
)
@ -801,7 +802,7 @@ Foam::cyclicAMIPolyPatch::surfPtr() const
}
const Foam::PtrList<Foam::AMIPatchToPatchInterpolation>&
const Foam::PtrList<Foam::AMIInterpolation>&
Foam::cyclicAMIPolyPatch::AMIs() const
{
if (!owner())
@ -1231,7 +1232,7 @@ void Foam::cyclicAMIPolyPatch::write(Ostream& os) const
}
os.writeKeyword("method")
<< AMIPatchToPatchInterpolation::interpolationMethodToWord(AMIMethod_)
<< AMIInterpolation::interpolationMethodToWord(AMIMethod_)
<< token::END_STATEMENT << nl;
if (!surfDict_.empty())

View File

@ -36,7 +36,7 @@ SourceFiles
#define cyclicAMIPolyPatch_H
#include "coupledPolyPatch.H"
#include "AMIPatchToPatchInterpolation.H"
#include "AMIInterpolation.H"
#include "polyBoundaryMesh.H"
#include "coupleGroupIdentifier.H"
@ -106,7 +106,7 @@ protected:
//- AMI interpolation classes
mutable PtrList<AMIPatchToPatchInterpolation> AMIs_;
mutable PtrList<AMIInterpolation> AMIs_;
//- AMI transforms (from source to target)
mutable List<vectorTensorTransform> AMITransforms_;
@ -121,7 +121,7 @@ protected:
const scalar AMILowWeightCorrection_;
//- AMI Method
const AMIPatchToPatchInterpolation::interpolationMethod AMIMethod_;
const AMIInterpolation::interpolationMethod AMIMethod_;
//- Projection surface
mutable autoPtr<searchableSurface> surfPtr_;
@ -179,8 +179,8 @@ public:
const word& patchType,
const transformType transform = UNKNOWN,
const bool AMIRequireMatch = true,
const AMIPatchToPatchInterpolation::interpolationMethod AMIMethod =
AMIPatchToPatchInterpolation::imFaceAreaWeight
const AMIInterpolation::interpolationMethod AMIMethod =
AMIInterpolation::imFaceAreaWeight
);
//- Construct from dictionary
@ -192,8 +192,8 @@ public:
const polyBoundaryMesh& bm,
const word& patchType,
const bool AMIRequireMatch = true,
const AMIPatchToPatchInterpolation::interpolationMethod AMIMethod =
AMIPatchToPatchInterpolation::imFaceAreaWeight
const AMIInterpolation::interpolationMethod AMIMethod =
AMIInterpolation::imFaceAreaWeight
);
//- Construct as copy, resetting the boundary mesh
@ -307,7 +307,7 @@ public:
const autoPtr<searchableSurface>& surfPtr() const;
//- Return a reference to the AMI interpolators
const PtrList<AMIPatchToPatchInterpolation>& AMIs() const;
const PtrList<AMIInterpolation>& AMIs() const;
//- Return a reference to the AMI transforms
const List<vectorTensorTransform>& AMITransforms() const;

View File

@ -228,15 +228,15 @@ void Foam::cyclicRepeatAMIPolyPatch::resetAMI() const
// Do the three bounding AMI interpolations
thisPoints = TLeft.transformPosition(localPoints());
thisPatch.movePoints(thisPoints);
autoPtr<AMIPatchToPatchInterpolation> AMILeftPtr
autoPtr<AMIInterpolation> AMILeftPtr
(
new AMIPatchToPatchInterpolation
new AMIInterpolation
(
thisPatch,
nbrPatch,
faceAreaIntersect::tmMesh,
false,
AMIPatchToPatchInterpolation::imPartialFaceAreaWeight,
AMIInterpolation::imPartialFaceAreaWeight,
AMILowWeightCorrection_,
AMIReverse_,
false
@ -248,15 +248,15 @@ void Foam::cyclicRepeatAMIPolyPatch::resetAMI() const
thisPoints = T.transformPosition(localPoints());
thisPatch.movePoints(thisPoints);
autoPtr<AMIPatchToPatchInterpolation> AMIPtr
autoPtr<AMIInterpolation> AMIPtr
(
new AMIPatchToPatchInterpolation
new AMIInterpolation
(
thisPatch,
nbrPatch,
faceAreaIntersect::tmMesh,
false,
AMIPatchToPatchInterpolation::imPartialFaceAreaWeight,
AMIInterpolation::imPartialFaceAreaWeight,
AMILowWeightCorrection_,
AMIReverse_,
false
@ -268,15 +268,15 @@ void Foam::cyclicRepeatAMIPolyPatch::resetAMI() const
thisPoints = TRight.transformPosition(localPoints());
thisPatch.movePoints(thisPoints);
autoPtr<AMIPatchToPatchInterpolation> AMIRightPtr
autoPtr<AMIInterpolation> AMIRightPtr
(
new AMIPatchToPatchInterpolation
new AMIInterpolation
(
thisPatch,
nbrPatch,
faceAreaIntersect::tmMesh,
false,
AMIPatchToPatchInterpolation::imPartialFaceAreaWeight,
AMIInterpolation::imPartialFaceAreaWeight,
AMILowWeightCorrection_,
AMIReverse_,
false
@ -301,9 +301,9 @@ void Foam::cyclicRepeatAMIPolyPatch::resetAMI() const
AMITransforms_[1] = sLeft > sRight ? T : TRight;
// Sum and normalise the two AMI interpolators
AMIPatchToPatchInterpolation::sumWeights(AMIs_);
AMIPatchToPatchInterpolation::reportSumWeights(AMIs_[0]);
AMIPatchToPatchInterpolation::normaliseWeights(AMIs_);
AMIInterpolation::sumWeights(AMIs_);
AMIInterpolation::reportSumWeights(AMIs_[0]);
AMIInterpolation::normaliseWeights(AMIs_);
}
@ -330,7 +330,7 @@ Foam::cyclicRepeatAMIPolyPatch::cyclicRepeatAMIPolyPatch
patchType,
transform,
false,
AMIPatchToPatchInterpolation::imFaceAreaWeight
AMIInterpolation::imFaceAreaWeight
),
transformPatchName_(word::null),
transformPatchID_(-1)
@ -357,7 +357,7 @@ Foam::cyclicRepeatAMIPolyPatch::cyclicRepeatAMIPolyPatch
bm,
patchType,
false,
AMIPatchToPatchInterpolation::imFaceAreaWeight
AMIInterpolation::imFaceAreaWeight
),
transformPatchName_(dict.lookup("transformPatch")),
transformPatchID_(-1)

View File

@ -36,7 +36,7 @@ SourceFiles
#define cyclicRepeatAMIPolyPatch_H
#include "cyclicAMIPolyPatch.H"
#include "AMIPatchToPatchInterpolation.H"
#include "AMIInterpolation.H"
#include "polyBoundaryMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -218,15 +218,26 @@ triSurface/triSurfaceTools/pointToPointPlanarInterpolation.C
twoDPointCorrector/twoDPointCorrector.C
AMI=AMIInterpolation
$(AMI)/AMIInterpolation/AMIInterpolationName.C
$(AMI)/AMIInterpolation/AMIPatchToPatchInterpolation.C
$(AMI)/AMIInterpolation/AMIInterpolation.C
$(AMI)/AMIInterpolation/AMIInterpolationParallelOps.C
$(AMI)/faceAreaIntersect/faceAreaIntersect.C
$(AMI)/GAMG/interfaces/cyclicAMIGAMGInterface/cyclicAMIGAMGInterface.C
$(AMI)/GAMG/interfaceFields/cyclicAMIGAMGInterfaceField/cyclicAMIGAMGInterfaceField.C
$(AMI)/GAMG/interfaces/cyclicACMIGAMGInterface/cyclicACMIGAMGInterface.C
$(AMI)/GAMG/interfaceFields/cyclicACMIGAMGInterfaceField/cyclicACMIGAMGInterfaceField.C
$(AMI)/GAMG/interfaces/cyclicRepeatAMIGAMGInterface/cyclicRepeatAMIGAMGInterface.C
$(AMI)/GAMG/interfaceFields/cyclicRepeatAMIGAMGInterfaceField/cyclicRepeatAMIGAMGInterfaceField.C
AMIGAMG=$(AMI)/GAMG
$(AMIGAMG)/interfaces/cyclicAMIGAMGInterface/cyclicAMIGAMGInterface.C
$(AMIGAMG)/interfaceFields/cyclicAMIGAMGInterfaceField/cyclicAMIGAMGInterfaceField.C
$(AMIGAMG)/interfaces/cyclicACMIGAMGInterface/cyclicACMIGAMGInterface.C
$(AMIGAMG)/interfaceFields/cyclicACMIGAMGInterfaceField/cyclicACMIGAMGInterfaceField.C
$(AMIGAMG)/interfaces/cyclicRepeatAMIGAMGInterface/cyclicRepeatAMIGAMGInterface.C
$(AMIGAMG)/interfaceFields/cyclicRepeatAMIGAMGInterfaceField/cyclicRepeatAMIGAMGInterfaceField.C
AMIMethod=$(AMI)/AMIInterpolation/AMIMethod
$(AMIMethod)/AMIMethod/AMIMethod.C
$(AMIMethod)/AMIMethod/AMIMethodNew.C
$(AMIMethod)/directAMI/directAMI.C
$(AMIMethod)/faceAreaWeightAMI/faceAreaWeightAMI.C
$(AMIMethod)/mapNearestAMI/mapNearestAMI.C
$(AMIMethod)/partialFaceAreaWeightAMI/partialFaceAreaWeightAMI.C
$(AMIMethod)/sweptFaceAreaWeightAMI/sweptFaceAreaWeightAMI.C
AMICycPatches=$(AMI)/patches/cyclicAMI
$(AMICycPatches)/cyclicAMILduInterfaceField/cyclicAMILduInterface.C

View File

@ -846,14 +846,14 @@ void Foam::mappedPatchBase::calcAMI() const
// Construct/apply AMI interpolation to determine addressing and weights
AMIPtr_.reset
(
new AMIPatchToPatchInterpolation
new AMIInterpolation
(
patch_,
samplePolyPatch(), // nbrPatch0,
surfPtr(),
faceAreaIntersect::tmMesh,
true,
AMIPatchToPatchInterpolation::imFaceAreaWeight,
AMIInterpolation::imFaceAreaWeight,
-1,
AMIReverse_
)

View File

@ -85,7 +85,7 @@ SourceFiles
#include "pointField.H"
#include "Tuple2.H"
#include "pointIndexHit.H"
#include "AMIPatchToPatchInterpolation.H"
#include "AMIInterpolation.H"
#include "coupleGroupIdentifier.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -230,7 +230,7 @@ protected:
// AMI interpolator (only for NEARESTPATCHFACEAMI)
//- Pointer to AMI interpolator
mutable autoPtr<AMIPatchToPatchInterpolation> AMIPtr_;
mutable autoPtr<AMIInterpolation> AMIPtr_;
//- Flag to indicate that slave patch should be reversed for AMI
const bool AMIReverse_;
@ -385,7 +385,7 @@ public:
inline const mapDistribute& map() const;
//- Return reference to the AMI interpolator
inline const AMIPatchToPatchInterpolation& AMI
inline const AMIInterpolation& AMI
(
const bool forceUpdate = false
) const;

View File

@ -152,7 +152,7 @@ inline const Foam::mapDistribute& Foam::mappedPatchBase::map() const
}
inline const Foam::AMIPatchToPatchInterpolation& Foam::mappedPatchBase::AMI
inline const Foam::AMIInterpolation& Foam::mappedPatchBase::AMI
(
bool forceUpdate
) const

View File

@ -181,7 +181,7 @@ Foam::regionCoupledBaseGAMGInterface::regionCoupledBaseGAMGInterface
amiPtr_.reset
(
new AMIPatchToPatchInterpolation
new AMIInterpolation
(
fineRegionCoupledLduInterface_.AMI(),
faceRestrictAddressing_,

View File

@ -60,7 +60,7 @@ class regionCoupledBaseGAMGInterface
const regionCoupledLduInterface& fineRegionCoupledLduInterface_;
//- AMI interface
// autoPtr<AMIPatchToPatchInterpolation> amiPtr_;
// autoPtr<AMIInterpolation> amiPtr_;
// Private Member Functions
@ -128,7 +128,7 @@ public:
);
}
// virtual const AMIPatchToPatchInterpolation& AMI() const
// virtual const AMIInterpolation& AMI() const
//{
// return amiPtr_();
//}

View File

@ -36,7 +36,7 @@ SourceFiles
#define regionCoupledLduInterface_H
#include "primitiveFieldsFwd.H"
#include "AMIPatchToPatchInterpolation.H"
#include "AMIInterpolation.H"
#include "polyMesh.H"
@ -83,7 +83,7 @@ public:
virtual const regionCoupledLduInterface& neighbPatch() const = 0;
//- Return AMI
// virtual const AMIPatchToPatchInterpolation& AMI() const = 0;
// virtual const AMIInterpolation& AMI() const = 0;
//- Return nbrMesh
virtual const polyMesh& nbrMesh() const = 0;

View File

@ -85,14 +85,14 @@ void Foam::regionCoupledBase::resetAMI() const
// Construct/apply AMI interpolation to determine addressing and weights
AMIPtr_.reset
(
new AMIPatchToPatchInterpolation
new AMIInterpolation
(
patch_,
nbrPatch0,
surfPtr(),
faceAreaIntersect::tmMesh,
true,
AMIPatchToPatchInterpolation::imFaceAreaWeight,
AMIInterpolation::imFaceAreaWeight,
-1,
AMIReverse_
)
@ -279,7 +279,7 @@ surfPtr() const
}
const Foam::AMIPatchToPatchInterpolation& Foam::regionCoupledBase::AMI() const
const Foam::AMIInterpolation& Foam::regionCoupledBase::AMI() const
{
if (!owner())
{

View File

@ -37,7 +37,7 @@ SourceFiles
#ifndef regionCoupledBase_H
#define regionCoupledBase_H
#include "AMIPatchToPatchInterpolation.H"
#include "AMIInterpolation.H"
#include "polyBoundaryMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -71,7 +71,7 @@ private:
const bool sameRegion_;
//- AMI interpolation class
mutable autoPtr<AMIPatchToPatchInterpolation> AMIPtr_;
mutable autoPtr<AMIInterpolation> AMIPtr_;
//- Flag to indicate that slave patch should be reversed for AMI
const bool AMIReverse_;
@ -154,7 +154,7 @@ public:
const autoPtr<searchableSurface>& surfPtr() const;
//- Return a reference to the AMI interpolator
const AMIPatchToPatchInterpolation& AMI() const;
const AMIInterpolation& AMI() const;
// Interpolations

View File

@ -186,7 +186,7 @@ bool Foam::regionModels::regionModel::read(const dictionary& dict)
}
const Foam::AMIPatchToPatchInterpolation&
const Foam::AMIInterpolation&
Foam::regionModels::regionModel::interRegionAMI
(
const regionModel& nbrRegion,
@ -212,13 +212,13 @@ Foam::regionModels::regionModel::interRegionAMI
interRegionAMI_[nbrRegionID].set
(
regionPatchi,
new AMIPatchToPatchInterpolation
new AMIInterpolation
(
p,
nbrP,
faceAreaIntersect::tmMesh,
true,
AMIPatchToPatchInterpolation::imFaceAreaWeight,
AMIInterpolation::imFaceAreaWeight,
-1,
flip
)
@ -246,7 +246,7 @@ Foam::regionModels::regionModel::interRegionAMI
interRegionAMI_.set
(
nbrRegionID,
new PtrList<AMIPatchToPatchInterpolation>(nPatch)
new PtrList<AMIInterpolation>(nPatch)
);
int oldTag = UPstream::msgType();
@ -255,13 +255,13 @@ Foam::regionModels::regionModel::interRegionAMI
interRegionAMI_[nbrRegionID].set
(
regionPatchi,
new AMIPatchToPatchInterpolation
new AMIInterpolation
(
p,
nbrP,
faceAreaIntersect::tmMesh,
true,
AMIPatchToPatchInterpolation::imFaceAreaWeight,
AMIInterpolation::imFaceAreaWeight,
-1,
flip
)

View File

@ -128,8 +128,7 @@ protected:
mutable wordList interRegionAMINames_;
//- List of AMI objects per coupled region
mutable PtrList<PtrList<AMIPatchToPatchInterpolation>>
interRegionAMI_;
mutable PtrList<PtrList<AMIInterpolation>> interRegionAMI_;
// Protected member functions
@ -141,7 +140,7 @@ protected:
virtual bool read(const dictionary& dict);
//- Create or return a new inter-region AMI object
virtual const AMIPatchToPatchInterpolation& interRegionAMI
virtual const AMIInterpolation& interRegionAMI
(
const regionModel& nbrRegion,
const label regionPatchi,

View File

@ -37,7 +37,7 @@ Foam::regionModels::regionModel::mapRegionPatchField
int oldTag = UPstream::msgType();
UPstream::msgType() = oldTag + 1;
const AMIPatchToPatchInterpolation& ami =
const AMIInterpolation& ami =
interRegionAMI(nbrRegion, regionPatchi, nbrPatchi, flip);
tmp<Field<Type>> tresult(ami.interpolateToSource(nbrField));
@ -69,7 +69,7 @@ Foam::regionModels::regionModel::mapRegionPatchField
int oldTag = UPstream::msgType();
UPstream::msgType() = oldTag + 1;
const AMIPatchToPatchInterpolation& ami =
const AMIInterpolation& ami =
interRegionAMI(nbrRegion, regionPatchi, nbrPatchi, flip);
const fieldType& nbrField =
@ -121,7 +121,7 @@ Foam::regionModels::regionModel::mapRegionPatchInternalField
int oldTag = UPstream::msgType();
UPstream::msgType() = oldTag + 1;
const AMIPatchToPatchInterpolation& ami =
const AMIInterpolation& ami =
interRegionAMI(nbrRegion, regionPatchi, nbrPatchi, flip);
const fieldType& nbrField =

View File

@ -56,7 +56,7 @@ namespace Foam
template<>
void Foam::meshToMesh::mapAndOpSrcToTgt
(
const AMIPatchToPatchInterpolation& AMI,
const AMIInterpolation& AMI,
const Field<scalar>& srcField,
Field<scalar>& tgtField,
const plusEqOp<scalar>& cop
@ -67,7 +67,7 @@ void Foam::meshToMesh::mapAndOpSrcToTgt
template<>
void Foam::meshToMesh::mapAndOpSrcToTgt
(
const AMIPatchToPatchInterpolation& AMI,
const AMIInterpolation& AMI,
const Field<vector>& srcField,
Field<vector>& tgtField,
const plusEqOp<vector>& cop
@ -78,7 +78,7 @@ void Foam::meshToMesh::mapAndOpSrcToTgt
template<>
void Foam::meshToMesh::mapAndOpSrcToTgt
(
const AMIPatchToPatchInterpolation& AMI,
const AMIInterpolation& AMI,
const Field<sphericalTensor>& srcField,
Field<sphericalTensor>& tgtField,
const plusEqOp<sphericalTensor>& cop
@ -89,7 +89,7 @@ void Foam::meshToMesh::mapAndOpSrcToTgt
template<>
void Foam::meshToMesh::mapAndOpSrcToTgt
(
const AMIPatchToPatchInterpolation& AMI,
const AMIInterpolation& AMI,
const Field<symmTensor>& srcField,
Field<symmTensor>& tgtField,
const plusEqOp<symmTensor>& cop
@ -100,7 +100,7 @@ void Foam::meshToMesh::mapAndOpSrcToTgt
template<>
void Foam::meshToMesh::mapAndOpSrcToTgt
(
const AMIPatchToPatchInterpolation& AMI,
const AMIInterpolation& AMI,
const Field<tensor>& srcField,
Field<tensor>& tgtField,
const plusEqOp<tensor>& cop
@ -111,7 +111,7 @@ void Foam::meshToMesh::mapAndOpSrcToTgt
template<>
void Foam::meshToMesh::mapAndOpTgtToSrc
(
const AMIPatchToPatchInterpolation& AMI,
const AMIInterpolation& AMI,
Field<scalar>& srcField,
const Field<scalar>& tgtField,
const plusEqOp<scalar>& cop
@ -122,7 +122,7 @@ void Foam::meshToMesh::mapAndOpTgtToSrc
template<>
void Foam::meshToMesh::mapAndOpTgtToSrc
(
const AMIPatchToPatchInterpolation& AMI,
const AMIInterpolation& AMI,
Field<vector>& srcField,
const Field<vector>& tgtField,
const plusEqOp<vector>& cop
@ -133,7 +133,7 @@ void Foam::meshToMesh::mapAndOpTgtToSrc
template<>
void Foam::meshToMesh::mapAndOpTgtToSrc
(
const AMIPatchToPatchInterpolation& AMI,
const AMIInterpolation& AMI,
Field<sphericalTensor>& srcField,
const Field<sphericalTensor>& tgtField,
const plusEqOp<sphericalTensor>& cop
@ -144,7 +144,7 @@ void Foam::meshToMesh::mapAndOpTgtToSrc
template<>
void Foam::meshToMesh::mapAndOpTgtToSrc
(
const AMIPatchToPatchInterpolation& AMI,
const AMIInterpolation& AMI,
Field<symmTensor>& srcField,
const Field<symmTensor>& tgtField,
const plusEqOp<symmTensor>& cop
@ -155,7 +155,7 @@ void Foam::meshToMesh::mapAndOpTgtToSrc
template<>
void Foam::meshToMesh::mapAndOpTgtToSrc
(
const AMIPatchToPatchInterpolation& AMI,
const AMIInterpolation& AMI,
Field<tensor>& srcField,
const Field<tensor>& tgtField,
const plusEqOp<tensor>& cop
@ -458,24 +458,24 @@ void Foam::meshToMesh::calculate(const word& methodName)
}
Foam::AMIPatchToPatchInterpolation::interpolationMethod
Foam::AMIInterpolation::interpolationMethod
Foam::meshToMesh::interpolationMethodAMI(const interpolationMethod method)
{
switch (method)
{
case imDirect:
{
return AMIPatchToPatchInterpolation::imDirect;
return AMIInterpolation::imDirect;
break;
}
case imMapNearest:
{
return AMIPatchToPatchInterpolation::imMapNearest;
return AMIInterpolation::imMapNearest;
break;
}
case imCellVolumeWeight:
{
return AMIPatchToPatchInterpolation::imFaceAreaWeight;
return AMIInterpolation::imFaceAreaWeight;
break;
}
default:
@ -486,7 +486,7 @@ Foam::meshToMesh::interpolationMethodAMI(const interpolationMethod method)
}
}
return AMIPatchToPatchInterpolation::imDirect;
return AMIInterpolation::imDirect;
}
@ -519,7 +519,7 @@ void Foam::meshToMesh::calculatePatchAMIs(const word& AMIMethodName)
patchAMIs_.set
(
i,
new AMIPatchToPatchInterpolation
new AMIInterpolation
(
srcPP,
tgtPP,
@ -659,7 +659,7 @@ Foam::meshToMesh::meshToMesh
constructNoCuttingPatches
(
interpolationMethodNames_[method],
AMIPatchToPatchInterpolation::interpolationMethodToWord
AMIInterpolation::interpolationMethodToWord
(
interpolationMethodAMI(method)
),
@ -723,7 +723,7 @@ Foam::meshToMesh::meshToMesh
constructFromCuttingPatches
(
interpolationMethodNames_[method],
AMIPatchToPatchInterpolation::interpolationMethodToWord
AMIInterpolation::interpolationMethodToWord
(
interpolationMethodAMI(method)
),

View File

@ -47,7 +47,7 @@ SourceFiles
#include "mapDistribute.H"
#include "volFieldsFwd.H"
#include "NamedEnum.H"
#include "AMIPatchToPatchInterpolation.H"
#include "AMIInterpolation.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -92,7 +92,7 @@ private:
List<label> tgtPatchID_;
//- List of AMIs between source and target patches
PtrList<AMIPatchToPatchInterpolation> patchAMIs_;
PtrList<AMIInterpolation> patchAMIs_;
//- Cutting patches whose values are set using a zero-gradient condition
List<label> cuttingPatches_;
@ -134,7 +134,7 @@ private:
template<class Type, class CombineOp>
void mapAndOpSrcToTgt
(
const AMIPatchToPatchInterpolation& AMI,
const AMIInterpolation& AMI,
const Field<Type>& srcField,
Field<Type>& tgtField,
const CombineOp& cop
@ -145,7 +145,7 @@ private:
template<class Type, class CombineOp>
void mapAndOpTgtToSrc
(
const AMIPatchToPatchInterpolation& AMI,
const AMIInterpolation& AMI,
Field<Type>& srcField,
const Field<Type>& tgtField,
const CombineOp& cop
@ -195,7 +195,7 @@ private:
);
//- Return the list of AMIs between source and target patches
inline const PtrList<AMIPatchToPatchInterpolation>&
inline const PtrList<AMIInterpolation>&
patchAMIs() const;
@ -338,11 +338,8 @@ public:
inline scalar V() const;
//- Conversion between mesh and patch interpolation methods
static AMIPatchToPatchInterpolation::interpolationMethod
interpolationMethodAMI
(
const interpolationMethod method
);
static AMIInterpolation::interpolationMethod
interpolationMethodAMI(const interpolationMethod method);
// Evaluation
@ -551,7 +548,7 @@ public:
template<>
void meshToMesh::mapAndOpSrcToTgt
(
const AMIPatchToPatchInterpolation& AMI,
const AMIInterpolation& AMI,
const Field<scalar>& srcField,
Field<scalar>& tgtField,
const plusEqOp<scalar>& cop
@ -559,7 +556,7 @@ void meshToMesh::mapAndOpSrcToTgt
template<>
void meshToMesh::mapAndOpSrcToTgt
(
const AMIPatchToPatchInterpolation& AMI,
const AMIInterpolation& AMI,
const Field<vector>& srcField,
Field<vector>& tgtField,
const plusEqOp<vector>& cop
@ -567,7 +564,7 @@ void meshToMesh::mapAndOpSrcToTgt
template<>
void meshToMesh::mapAndOpSrcToTgt
(
const AMIPatchToPatchInterpolation& AMI,
const AMIInterpolation& AMI,
const Field<sphericalTensor>& srcField,
Field<sphericalTensor>& tgtField,
const plusEqOp<sphericalTensor>& cop
@ -575,7 +572,7 @@ void meshToMesh::mapAndOpSrcToTgt
template<>
void meshToMesh::mapAndOpSrcToTgt
(
const AMIPatchToPatchInterpolation& AMI,
const AMIInterpolation& AMI,
const Field<symmTensor>& srcField,
Field<symmTensor>& tgtField,
const plusEqOp<symmTensor>& cop
@ -583,7 +580,7 @@ void meshToMesh::mapAndOpSrcToTgt
template<>
void meshToMesh::mapAndOpSrcToTgt
(
const AMIPatchToPatchInterpolation& AMI,
const AMIInterpolation& AMI,
const Field<tensor>& srcField,
Field<tensor>& tgtField,
const plusEqOp<tensor>& cop
@ -593,7 +590,7 @@ void meshToMesh::mapAndOpSrcToTgt
template<>
void meshToMesh::mapAndOpTgtToSrc
(
const AMIPatchToPatchInterpolation& AMI,
const AMIInterpolation& AMI,
Field<scalar>& srcField,
const Field<scalar>& tgtField,
const plusEqOp<scalar>& cop
@ -601,7 +598,7 @@ void meshToMesh::mapAndOpTgtToSrc
template<>
void meshToMesh::mapAndOpTgtToSrc
(
const AMIPatchToPatchInterpolation& AMI,
const AMIInterpolation& AMI,
Field<vector>& srcField,
const Field<vector>& tgtField,
const plusEqOp<vector>& cop
@ -609,7 +606,7 @@ void meshToMesh::mapAndOpTgtToSrc
template<>
void meshToMesh::mapAndOpTgtToSrc
(
const AMIPatchToPatchInterpolation& AMI,
const AMIInterpolation& AMI,
Field<sphericalTensor>& srcField,
const Field<sphericalTensor>& tgtField,
const plusEqOp<sphericalTensor>& cop
@ -617,7 +614,7 @@ void meshToMesh::mapAndOpTgtToSrc
template<>
void meshToMesh::mapAndOpTgtToSrc
(
const AMIPatchToPatchInterpolation& AMI,
const AMIInterpolation& AMI,
Field<symmTensor>& srcField,
const Field<symmTensor>& tgtField,
const plusEqOp<symmTensor>& cop
@ -625,7 +622,7 @@ void meshToMesh::mapAndOpTgtToSrc
template<>
void meshToMesh::mapAndOpTgtToSrc
(
const AMIPatchToPatchInterpolation& AMI,
const AMIInterpolation& AMI,
Field<tensor>& srcField,
const Field<tensor>& tgtField,
const plusEqOp<tensor>& cop

View File

@ -73,7 +73,7 @@ inline Foam::scalar Foam::meshToMesh::V() const
}
inline const Foam::PtrList<Foam::AMIPatchToPatchInterpolation>&
inline const Foam::PtrList<Foam::AMIInterpolation>&
Foam::meshToMesh::patchAMIs() const
{
return patchAMIs_;

View File

@ -320,7 +320,7 @@ Foam::tmp<Foam::Field<Type>> Foam::meshToMesh::mapTgtToSrc
template<class Type, class CombineOp>
void Foam::meshToMesh::mapAndOpSrcToTgt
(
const AMIPatchToPatchInterpolation& AMI,
const AMIInterpolation& AMI,
const Field<Type>& srcField,
Field<Type>& tgtField,
const CombineOp& cop
@ -348,7 +348,7 @@ void Foam::meshToMesh::mapSrcToTgt
{
mapSrcToTgt(field, cop, result.primitiveFieldRef());
const PtrList<AMIPatchToPatchInterpolation>& AMIList = patchAMIs();
const PtrList<AMIInterpolation>& AMIList = patchAMIs();
typename GeometricField<Type, fvPatchField, volMesh>::
Boundary& resultBf = result.boundaryFieldRef();
@ -528,7 +528,7 @@ Foam::meshToMesh::mapSrcToTgt
template<class Type, class CombineOp>
void Foam::meshToMesh::mapAndOpTgtToSrc
(
const AMIPatchToPatchInterpolation& AMI,
const AMIInterpolation& AMI,
Field<Type>& srcField,
const Field<Type>& tgtField,
const CombineOp& cop
@ -556,7 +556,7 @@ void Foam::meshToMesh::mapTgtToSrc
{
mapTgtToSrc(field, cop, result.primitiveFieldRef());
const PtrList<AMIPatchToPatchInterpolation>& AMIList = patchAMIs();
const PtrList<AMIInterpolation>& AMIList = patchAMIs();
forAll(AMIList, i)
{