ENH: Updated templating in AMI code

This commit is contained in:
andy
2012-05-24 13:03:16 +01:00
parent 2f89754b61
commit bfbb22d6d9
2 changed files with 57 additions and 60 deletions

View File

@ -142,8 +142,8 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::writeIntersectionOBJ
template<class SourcePatch, class TargetPatch> template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::checkPatches void Foam::AMIInterpolation<SourcePatch, TargetPatch>::checkPatches
( (
const primitivePatch& srcPatch, const SourcePatch& srcPatch,
const primitivePatch& tgtPatch const TargetPatch& tgtPatch
) const ) const
{ {
const scalar maxBoundsError = 0.05; const scalar maxBoundsError = 0.05;
@ -166,8 +166,8 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::checkPatches
( (
"AMIInterpolation<SourcePatch, TargetPatch>::checkPatches" "AMIInterpolation<SourcePatch, TargetPatch>::checkPatches"
"(" "("
"const primitivePatch&, " "const SourcePatch&, "
"const primitivePatch&" "const TargetPatch&"
")" ")"
) << "Source and target patch bounding boxes are not similar" << nl ) << "Source and target patch bounding boxes are not similar" << nl
<< " source box span : " << bbSrc.span() << nl << " source box span : " << bbSrc.span() << nl
@ -182,7 +182,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::checkPatches
template<class SourcePatch, class TargetPatch> template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::resetTree void Foam::AMIInterpolation<SourcePatch, TargetPatch>::resetTree
( (
const primitivePatch& tgtPatch const TargetPatch& tgtPatch
) )
{ {
// Clear the old octree // Clear the old octree
@ -212,8 +212,8 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::resetTree
template<class SourcePatch, class TargetPatch> template<class SourcePatch, class TargetPatch>
Foam::label Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcDistribution Foam::label Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcDistribution
( (
const primitivePatch& srcPatch, const SourcePatch& srcPatch,
const primitivePatch& tgtPatch const TargetPatch& tgtPatch
) const ) const
{ {
label procI = 0; label procI = 0;
@ -297,7 +297,7 @@ template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::distributePatches void Foam::AMIInterpolation<SourcePatch, TargetPatch>::distributePatches
( (
const mapDistribute& map, const mapDistribute& map,
const primitivePatch& pp, const TargetPatch& pp,
const globalIndex& gi, const globalIndex& gi,
List<faceList>& faces, List<faceList>& faces,
List<pointField>& points, List<pointField>& points,
@ -394,7 +394,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::
distributeAndMergePatches distributeAndMergePatches
( (
const mapDistribute& map, const mapDistribute& map,
const primitivePatch& tgtPatch, const TargetPatch& tgtPatch,
const globalIndex& gi, const globalIndex& gi,
faceList& tgtFaces, faceList& tgtFaces,
pointField& tgtPoints, pointField& tgtPoints,
@ -509,8 +509,8 @@ template<class SourcePatch, class TargetPatch>
Foam::autoPtr<Foam::mapDistribute> Foam::autoPtr<Foam::mapDistribute>
Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcProcMap Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcProcMap
( (
const primitivePatch& srcPatch, const SourcePatch& srcPatch,
const primitivePatch& tgtPatch const TargetPatch& tgtPatch
) const ) const
{ {
// Get decomposition of patch // Get decomposition of patch
@ -711,7 +711,7 @@ template<class SourcePatch, class TargetPatch>
Foam::label Foam::AMIInterpolation<SourcePatch, TargetPatch>::findTargetFace Foam::label Foam::AMIInterpolation<SourcePatch, TargetPatch>::findTargetFace
( (
const label srcFaceI, const label srcFaceI,
const primitivePatch& srcPatch const SourcePatch& srcPatch
) const ) const
{ {
label targetFaceI = -1; label targetFaceI = -1;
@ -745,7 +745,7 @@ template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::appendNbrFaces void Foam::AMIInterpolation<SourcePatch, TargetPatch>::appendNbrFaces
( (
const label faceI, const label faceI,
const primitivePatch& patch, const TargetPatch& patch,
const DynamicList<label>& visitedFaces, const DynamicList<label>& visitedFaces,
DynamicList<label>& faceIDs DynamicList<label>& faceIDs
) const ) const
@ -793,8 +793,8 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::setNextFaces
label& startSeedI, label& startSeedI,
label& srcFaceI, label& srcFaceI,
label& tgtFaceI, label& tgtFaceI,
const primitivePatch& srcPatch0, const SourcePatch& srcPatch0,
const primitivePatch& tgtPatch0, const TargetPatch& tgtPatch0,
const boolList& mapFlag, const boolList& mapFlag,
labelList& seedFaces, labelList& seedFaces,
const DynamicList<label>& visitedFaces const DynamicList<label>& visitedFaces
@ -897,8 +897,8 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::setNextFaces
"label&, " "label&, "
"label&, " "label&, "
"label&, " "label&, "
"const primitivePatch&, " "const SourcePatch&, "
"const primitivePatch&, " "const TargetPatch&, "
"const boolList&, " "const boolList&, "
"labelList&, " "labelList&, "
"const DynamicList<label>&" "const DynamicList<label>&"
@ -913,8 +913,8 @@ Foam::scalar Foam::AMIInterpolation<SourcePatch, TargetPatch>::interArea
( (
const label srcFaceI, const label srcFaceI,
const label tgtFaceI, const label tgtFaceI,
const primitivePatch& srcPatch, const SourcePatch& srcPatch,
const primitivePatch& tgtPatch const TargetPatch& tgtPatch
) const ) const
{ {
const pointField& srcPoints = srcPatch.points(); const pointField& srcPoints = srcPatch.points();
@ -964,21 +964,18 @@ Foam::scalar Foam::AMIInterpolation<SourcePatch, TargetPatch>::interArea
template<class SourcePatch, class TargetPatch> template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcAddressing void Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcAddressing
( (
const primitivePatch& srcPatch, const SourcePatch& srcPatch,
const primitivePatch& tgtPatch, const TargetPatch& tgtPatch,
label srcFaceI, label srcFaceI,
label tgtFaceI label tgtFaceI
) )
{ {
if (!srcPatch.size() || !tgtPatch.size()) if (debug && (!srcPatch.size() || !tgtPatch.size()))
{
if (debug)
{ {
Pout<< "AMI: Patches not on processor: Source faces = " Pout<< "AMI: Patches not on processor: Source faces = "
<< srcPatch.size() << ", target faces = " << tgtPatch.size() << srcPatch.size() << ", target faces = " << tgtPatch.size()
<< endl; << endl;
} }
}
if (!srcPatch.size()) if (!srcPatch.size())
{ {
@ -991,8 +988,8 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcAddressing
"void Foam::AMIInterpolation<SourcePatch, TargetPatch>::" "void Foam::AMIInterpolation<SourcePatch, TargetPatch>::"
"calcAddressing" "calcAddressing"
"(" "("
"const primitivePatch&, " "const SourcePatch&, "
"const primitivePatch&, " "const TargetPatch&, "
"label, " "label, "
"label" "label"
")" ")"
@ -1036,8 +1033,8 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcAddressing
"void Foam::AMIInterpolation<SourcePatch, TargetPatch>::" "void Foam::AMIInterpolation<SourcePatch, TargetPatch>::"
"calcAddressing" "calcAddressing"
"(" "("
"const primitivePatch&, " "const SourcePatch&, "
"const primitivePatch&, " "const TargetPatch&, "
"label, " "label, "
"label" "label"
")" ")"
@ -1543,7 +1540,7 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
{ {
// create new patches for source and target // create new patches for source and target
pointField srcPoints = srcPatch.points(); pointField srcPoints = srcPatch.points();
primitivePatch srcPatch0 SourcePatch srcPatch0
( (
SubList<face> SubList<face>
( (
@ -1564,7 +1561,7 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
} }
pointField tgtPoints = tgtPatch.points(); pointField tgtPoints = tgtPatch.points();
primitivePatch tgtPatch0 TargetPatch tgtPatch0
( (
SubList<face> SubList<face>
( (
@ -1735,8 +1732,8 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::~AMIInterpolation()
template<class SourcePatch, class TargetPatch> template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
( (
const primitivePatch& srcPatch, const SourcePatch& srcPatch,
const primitivePatch& tgtPatch const TargetPatch& tgtPatch
) )
{ {
// Calculate face areas // Calculate face areas
@ -1785,7 +1782,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
tgtFaceIDs tgtFaceIDs
); );
primitivePatch TargetPatch
newTgtPatch newTgtPatch
( (
SubList<face> SubList<face>
@ -2145,8 +2142,8 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget
template<class SourcePatch, class TargetPatch> template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::writeFaceConnectivity void Foam::AMIInterpolation<SourcePatch, TargetPatch>::writeFaceConnectivity
( (
const primitivePatch& srcPatch, const SourcePatch& srcPatch,
const primitivePatch& tgtPatch, const TargetPatch& tgtPatch,
const labelListList& srcAddress const labelListList& srcAddress
) )
const const

View File

@ -160,12 +160,12 @@ class AMIInterpolation
//- Check that patches are valid //- Check that patches are valid
void checkPatches void checkPatches
( (
const primitivePatch& srcPatch, const SourcePatch& srcPatch,
const primitivePatch& tgtPatch const TargetPatch& tgtPatch
) const; ) const;
//- Reset the octree for the traget patch face search //- Reset the octree for the traget patch face search
void resetTree(const primitivePatch& tgtPatch); void resetTree(const TargetPatch& tgtPatch);
@ -174,8 +174,8 @@ class AMIInterpolation
//- Calculate if patches are on multiple processors //- Calculate if patches are on multiple processors
label calcDistribution label calcDistribution
( (
const primitivePatch& srcPatch, const SourcePatch& srcPatch,
const primitivePatch& tgtPatch const TargetPatch& tgtPatch
) const; ) const;
label calcOverlappingProcs label calcOverlappingProcs
@ -188,7 +188,7 @@ class AMIInterpolation
void distributePatches void distributePatches
( (
const mapDistribute& map, const mapDistribute& map,
const primitivePatch& pp, const TargetPatch& pp,
const globalIndex& gi, const globalIndex& gi,
List<faceList>& faces, List<faceList>& faces,
List<pointField>& points, List<pointField>& points,
@ -198,7 +198,7 @@ class AMIInterpolation
void distributeAndMergePatches void distributeAndMergePatches
( (
const mapDistribute& map, const mapDistribute& map,
const primitivePatch& tgtPatch, const TargetPatch& tgtPatch,
const globalIndex& gi, const globalIndex& gi,
faceList& tgtFaces, faceList& tgtFaces,
pointField& tgtPoints, pointField& tgtPoints,
@ -207,8 +207,8 @@ class AMIInterpolation
autoPtr<mapDistribute> calcProcMap autoPtr<mapDistribute> calcProcMap
( (
const primitivePatch& srcPatch, const SourcePatch& srcPatch,
const primitivePatch& tgtPatch const TargetPatch& tgtPatch
) const; ) const;
@ -228,14 +228,14 @@ class AMIInterpolation
label findTargetFace label findTargetFace
( (
const label srcFaceI, const label srcFaceI,
const primitivePatch& srcPatch const SourcePatch& srcPatch
) const; ) const;
//- Add faces neighbouring faceI to the ID list //- Add faces neighbouring faceI to the ID list
void appendNbrFaces void appendNbrFaces
( (
const label faceI, const label faceI,
const primitivePatch& patch, const TargetPatch& patch,
const DynamicList<label>& visitedFaces, const DynamicList<label>& visitedFaces,
DynamicList<label>& faceIDs DynamicList<label>& faceIDs
) const; ) const;
@ -246,8 +246,8 @@ class AMIInterpolation
label& startSeedI, label& startSeedI,
label& srcFaceI, label& srcFaceI,
label& tgtFaceI, label& tgtFaceI,
const primitivePatch& srcPatch0, const SourcePatch& srcPatch0,
const primitivePatch& tgtPatch0, const TargetPatch& tgtPatch0,
const boolList& mapFlag, const boolList& mapFlag,
labelList& seedFaces, labelList& seedFaces,
const DynamicList<label>& visitedFaces const DynamicList<label>& visitedFaces
@ -261,15 +261,15 @@ class AMIInterpolation
( (
const label srcFaceI, const label srcFaceI,
const label tgtFaceI, const label tgtFaceI,
const primitivePatch& srcPatch, const SourcePatch& srcPatch,
const primitivePatch& tgtPatch const TargetPatch& tgtPatch
) const; ) const;
//- Calculate addressing //- Calculate addressing
void calcAddressing void calcAddressing
( (
const primitivePatch& srcPatch, const SourcePatch& srcPatch,
const primitivePatch& tgtPatch, const TargetPatch& tgtPatch,
label srcFaceI = -1, label srcFaceI = -1,
label tgtFaceI = -1 label tgtFaceI = -1
); );
@ -398,8 +398,8 @@ public:
//- Update addressing and weights //- Update addressing and weights
void update void update
( (
const primitivePatch& srcPatch, const SourcePatch& srcPatch,
const primitivePatch& tgtPatch const TargetPatch& tgtPatch
); );
@ -495,8 +495,8 @@ public:
//- Write face connectivity as OBJ file //- Write face connectivity as OBJ file
void writeFaceConnectivity void writeFaceConnectivity
( (
const primitivePatch& srcPatch, const SourcePatch& srcPatch,
const primitivePatch& tgtPatch, const TargetPatch& tgtPatch,
const labelListList& srcAddress const labelListList& srcAddress
) const; ) const;
}; };