mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: AMIInterpolation: have access to non-overlapping faces
This commit is contained in:
@ -32,6 +32,32 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
//- Helper class for list
|
||||
template<class T>
|
||||
class ListPlusEqOp
|
||||
{
|
||||
public:
|
||||
void operator()(List<T>& x, const List<T> y) const
|
||||
{
|
||||
if (y.size())
|
||||
{
|
||||
if (x.size())
|
||||
{
|
||||
label sz = x.size();
|
||||
x.setSize(sz + y.size());
|
||||
forAll(y, i)
|
||||
{
|
||||
x[sz++] = y[i];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
x = y;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//- Combine operator for interpolateToSource/Target
|
||||
template<class Type, class BinaryOp>
|
||||
class combineBinaryOp
|
||||
@ -1044,7 +1070,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcAddressing
|
||||
// reset starting seed
|
||||
label startSeedI = 0;
|
||||
|
||||
label nNonOverlap = 0;
|
||||
DynamicList<label> nonOverlapFaces;
|
||||
do
|
||||
{
|
||||
nbrFaces.clear();
|
||||
@ -1085,7 +1111,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcAddressing
|
||||
|
||||
if (!faceProcessed)
|
||||
{
|
||||
nNonOverlap++;
|
||||
nonOverlapFaces.append(srcFaceI);
|
||||
}
|
||||
|
||||
// choose new src face from current src face neighbour
|
||||
@ -1105,10 +1131,13 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcAddressing
|
||||
}
|
||||
} while (nFacesRemaining > 0);
|
||||
|
||||
if (nNonOverlap != 0)
|
||||
if (nonOverlapFaces.size() != 0)
|
||||
{
|
||||
Pout<< "AMI: " << nNonOverlap << " non-overlap faces identified"
|
||||
Pout<< "AMI: " << nonOverlapFaces.size()
|
||||
<< " non-overlap faces identified"
|
||||
<< endl;
|
||||
|
||||
srcNonOverlap_.transfer(nonOverlapFaces);
|
||||
}
|
||||
|
||||
// transfer data to persistent storage
|
||||
@ -1461,6 +1490,7 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
|
||||
singlePatchProc_(-999),
|
||||
srcAddress_(),
|
||||
srcWeights_(),
|
||||
srcNonOverlap_(),
|
||||
tgtAddress_(),
|
||||
tgtWeights_(),
|
||||
treePtr_(NULL),
|
||||
@ -1493,6 +1523,7 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
|
||||
singlePatchProc_(-999),
|
||||
srcAddress_(),
|
||||
srcWeights_(),
|
||||
srcNonOverlap_(),
|
||||
tgtAddress_(),
|
||||
tgtWeights_(),
|
||||
treePtr_(NULL),
|
||||
@ -1580,6 +1611,7 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
|
||||
singlePatchProc_(fineAMI.singlePatchProc_),
|
||||
srcAddress_(),
|
||||
srcWeights_(),
|
||||
srcNonOverlap_(),
|
||||
tgtAddress_(),
|
||||
tgtWeights_(),
|
||||
treePtr_(NULL),
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -84,32 +84,6 @@ class AMIInterpolation
|
||||
//- local typedef to octree tree-type
|
||||
typedef treeDataPrimitivePatch<face, SubList, const pointField&> treeType;
|
||||
|
||||
//- Helper class for list
|
||||
template<class T>
|
||||
class ListPlusEqOp
|
||||
{
|
||||
public:
|
||||
void operator()(List<T>& x, const List<T> y) const
|
||||
{
|
||||
if (y.size())
|
||||
{
|
||||
if (x.size())
|
||||
{
|
||||
label sz = x.size();
|
||||
x.setSize(sz + y.size());
|
||||
forAll(y, i)
|
||||
{
|
||||
x[sz++] = y[i];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
x = y;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Private data
|
||||
|
||||
@ -132,6 +106,10 @@ class AMIInterpolation
|
||||
//- Weights of target faces per source face
|
||||
scalarListList srcWeights_;
|
||||
|
||||
//- Labels of faces that are not overlapped by any target faces
|
||||
// (should be empty for correct functioning)
|
||||
labelList srcNonOverlap_;
|
||||
|
||||
|
||||
// Target patch
|
||||
|
||||
@ -141,7 +119,7 @@ class AMIInterpolation
|
||||
//- Addresses of source faces per target face
|
||||
labelListList tgtAddress_;
|
||||
|
||||
//- Weights of wource faces per target face
|
||||
//- Weights of source faces per target face
|
||||
scalarListList tgtWeights_;
|
||||
|
||||
|
||||
@ -387,6 +365,11 @@ public:
|
||||
//- Return const access to source patch weights
|
||||
inline const scalarListList& srcWeights() const;
|
||||
|
||||
//- Labels of faces that are not overlapped by any target faces
|
||||
// (should be empty for correct functioning)
|
||||
inline const labelList& srcNonOverlap() const;
|
||||
|
||||
|
||||
//- Source map pointer - valid only if singlePatchProc = -1
|
||||
// This gets source data into a form to be consumed by
|
||||
// tgtAddress, tgtWeights
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -55,6 +55,14 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::srcWeights() const
|
||||
}
|
||||
|
||||
|
||||
template<class SourcePatch, class TargetPatch>
|
||||
inline const Foam::labelList&
|
||||
Foam::AMIInterpolation<SourcePatch, TargetPatch>::srcNonOverlap() const
|
||||
{
|
||||
return srcNonOverlap_;
|
||||
}
|
||||
|
||||
|
||||
template<class SourcePatch, class TargetPatch>
|
||||
inline const Foam::mapDistribute&
|
||||
Foam::AMIInterpolation<SourcePatch, TargetPatch>::srcMap() const
|
||||
|
||||
Reference in New Issue
Block a user