30 template<
class SourcePatch,
class TargetPatch>
35 DynamicList<label>& srcSeeds,
36 DynamicList<label>& nonOverlapFaces,
41 const labelList& srcNbr = this->srcPatch_.faceFaces()[srcFacei];
42 const labelList& tgtNbr = this->tgtPatch_.faceFaces()[tgtFacei];
44 const pointField& srcPoints = this->srcPatch_.points();
45 const pointField& tgtPoints = this->tgtPatch_.points();
47 const vectorField& srcCf = this->srcPatch_.faceCentres();
51 label srcI = srcNbr[i];
53 if ((mapFlag[srcI] == 0) && (srcTgtSeed[srcI] == -1))
56 const face& srcF = this->srcPatch_[srcI];
57 const point& srcC = srcCf[srcI];
62 const point& p = srcPoints[srcF[fpI]];
63 scalar d2 =
magSqr(p - srcC);
69 tol =
max(SMALL, 0.0001*
sqrt(tol));
74 label tgtI = tgtNbr[j];
75 const face& tgtF = this->tgtPatch_[tgtI];
78 if (
mag(srcC - tgtC) < tol)
83 srcTgtSeed[srcI] = tgtI;
84 srcSeeds.append(srcI);
93 const vector srcN = srcF.normal(srcPoints);
97 label tgtI = tgtNbr[j];
98 const face& tgtF = this->tgtPatch_[tgtI];
99 pointHit ray = tgtF.ray(srcCf[srcI], srcN, tgtPoints);
106 srcTgtSeed[srcI] = tgtI;
107 srcSeeds.append(srcI);
118 nonOverlapFaces.append(srcI);
122 Pout<<
"source face not found: id=" << srcI
123 <<
" centre=" << srcCf[srcI]
124 <<
" normal=" << srcF.normal(srcPoints)
125 <<
" points=" << srcF.points(srcPoints)
128 Pout<<
"target neighbours:" <<
nl;
131 label tgtI = tgtNbr[j];
132 const face& tgtF = this->tgtPatch_[tgtI];
134 Pout<<
"face id: " << tgtI
135 <<
" centre=" << tgtF.centre(tgtPoints)
136 <<
" normal=" << tgtF.normal(tgtPoints)
137 <<
" points=" << tgtF.points(tgtPoints)
147 srcFacei = srcSeeds.remove();
148 tgtFacei = srcTgtSeed[srcFacei];
158 template<
class SourcePatch,
class TargetPatch>
162 DynamicList<label>& nonOverlapFaces,
169 if (mapFlag[facei] == 0)
171 tgtFacei = this->findTargetFace(facei);
176 nonOverlapFaces.append(facei);
190 template<
class SourcePatch,
class TargetPatch>
193 const SourcePatch& srcPatch,
194 const TargetPatch& tgtPatch,
198 const bool reverseTarget,
199 const bool requireMatch
217 template<
class SourcePatch,
class TargetPatch>
224 template<
class SourcePatch,
class TargetPatch>
264 labelList srcTgtSeed(srcAddr.size(), -1);
265 srcTgtSeed[srcFacei] = tgtFacei;
275 srcAddr[srcFacei].
append(tgtFacei);
276 tgtAddr[tgtFacei].append(srcFacei);
278 mapFlag[srcFacei] = 1;
293 if (srcFacei < 0 && nTested < this->srcPatch_.size())
295 restartAdvancingFront(mapFlag, nonOverlapFaces, srcFacei, tgtFacei);
298 }
while (srcFacei >= 0);
300 if (nonOverlapFaces.
size() != 0)
302 Pout<<
" AMI: " << nonOverlapFaces.
size()
303 <<
" non-overlap faces identified" 306 this->srcNonOverlap_.transfer(nonOverlapFaces);
312 scalar magSf = this->srcMagSf_[i];
318 scalar magSf = this->tgtMagSf_[i];
Direct mapped Arbitrary Mesh Interface (AMI) method.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
void size(const label)
Override size to be inconsistent with allocated storage.
dimensionedScalar sqrt(const dimensionedScalar &ds)
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Vector< Cmpt > & centre(const Foam::List< Vector< Cmpt >> &) const
Return *this (used for point which is a typedef to Vector<scalar>.
volVectorField vectorField(fieldObject, mesh)
Vector< scalar > vector
A scalar version of the templated Vector.
vectorField pointField
pointField is a vectorField.
List< scalar > scalarList
A List of scalars.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
List< label > labelList
A List of labels.
virtual void calculate(labelListList &srcAddress, scalarListList &srcWeights, labelListList &tgtAddress, scalarListList &tgtWeights, label srcFacei=-1, label tgtFacei=-1)
Update addressing and weights.
Base class for Arbitrary Mesh Interface (AMI) methods.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
virtual ~directAMI()
Destructor.
prefixOSstream Pout(cout,"Pout")
vector point
Point is a vector.
dimensioned< scalar > mag(const dimensioned< Type > &)
PointHit< point > pointHit
void transfer(List< T > &)
Transfer the contents of the argument List into this list.