33 template<
class SourcePatch,
class TargetPatch>
36 const SourcePatch& srcPatch,
37 const TargetPatch& tgtPatch,
38 const label& srcFacei,
45 const vector srcP = srcCf[srcFacei];
47 DynamicList<label> tgtFaces(10);
48 tgtFaces.append(tgtFacei);
50 DynamicList<label> visitedFaces(10);
56 label tgtI = tgtFaces.remove();
57 visitedFaces.append(tgtI);
59 scalar dTest =
magSqr(tgtCf[tgtI] - srcP);
74 }
while (tgtFaces.size() > 0);
78 template<
class SourcePatch,
class TargetPatch>
87 const labelList& srcNbr = this->srcPatch_.faceFaces()[srcFacei];
91 for (
const label facei : srcNbr)
96 startSeedI = facei + 1;
107 tgtFacei = this->findTargetFace(facei);
111 const vectorField& srcCf = this->srcPatch_.faceCentres();
114 <<
"Unable to find target face for source face "
115 << srcFacei <<
" with face centre " << srcCf[srcFacei]
125 template<
class SourcePatch,
class TargetPatch>
128 const label tgtFacei,
129 const List<DynamicList<label>>& tgtToSrc
132 DynamicList<label> testFaces(10);
133 DynamicList<label> visitedFaces(10);
135 testFaces.append(tgtFacei);
140 label tgtI = testFaces.remove();
142 if (!visitedFaces.found(tgtI))
144 visitedFaces.append(tgtI);
146 if (tgtToSrc[tgtI].size())
148 return tgtToSrc[tgtI][0];
152 const labelList& nbrFaces = this->tgtPatch_.faceFaces()[tgtI];
154 for (
const label nbrFacei : nbrFaces)
156 if (!visitedFaces.found(nbrFacei))
158 testFaces.
append(nbrFacei);
163 }
while (testFaces.size());
172 template<
class SourcePatch,
class TargetPatch>
175 const SourcePatch& srcPatch,
176 const TargetPatch& tgtPatch,
178 const bool reverseTarget,
179 const bool requireMatch
195 template<
class SourcePatch,
class TargetPatch>
202 template<
class SourcePatch,
class TargetPatch>
239 boolList mapFlag(srcAddr.size(),
true);
242 label startSeedI = 0;
247 findNearestFace(this->srcPatch_, this->tgtPatch_, srcFacei, tgtFacei);
249 srcAddr[srcFacei].append(tgtFacei);
250 tgtAddr[tgtFacei].append(srcFacei);
252 mapFlag[srcFacei] =
false;
262 }
while (srcFacei >= 0);
267 const vectorField& srcCf = this->srcPatch_.faceCentres();
268 const vectorField& tgtCf = this->tgtPatch_.faceCentres();
270 forAll(tgtAddr, targetFacei)
272 if (tgtAddr[targetFacei].size() > 1)
274 const vector& tgtC = tgtCf[tgtFacei];
278 label srcFacei = srcFaces[0];
279 scalar d =
magSqr(tgtC - srcCf[srcFacei]);
281 for (
label i = 1; i < srcFaces.size(); ++i)
283 label srcI = srcFaces[i];
284 scalar dNew =
magSqr(tgtC - srcCf[srcI]);
293 srcFaces.
append(srcFacei);
301 if (tgtAddr[tgtFacei].empty())
303 label srcFacei = findMappedSrcFace(tgtFacei, tgtAddr);
316 tgtAddr[tgtFacei].append(srcFacei);
323 const pointField& srcFc = this->srcPatch_.faceCentres();
324 const pointField& tgtFc = this->tgtPatch_.faceCentres();
328 srcAddress[srcI].
transfer(srcAddr[srcI]);
330 const labelList& addr = srcAddress[srcI];
331 srcWeights[srcI].
setSize(addr.size());
332 const point& srcPt = srcFc[srcI];
335 srcWeights[srcI][i] =
magSqr(srcPt-tgtFc[addr[i]]);
340 tgtAddress[tgtI].
transfer(tgtAddr[tgtI]);
342 const labelList& addr = tgtAddress[tgtI];
343 tgtWeights[tgtI].
setSize(addr.size());
344 const point& tgtPt = tgtFc[tgtI];
347 tgtWeights[tgtI][i] =
magSqr(tgtPt-srcFc[addr[i]]);
353 template<
class SourcePatch,
class TargetPatch>
356 const TargetPatch& tgtPatch,
362 srcMagSf = std::move(this->srcMagSf_);
367 template<
class SourcePatch,
class TargetPatch>
387 label minFaceI = addr[0];
388 scalar minWeight = wghts[0];
390 for (
label i = 0; i < addr.size(); ++i)
392 if (wghts[i] < minWeight)
394 minWeight = wghts[i];
400 wghts[0] = this->srcMagSf_[srcI];
420 label minFaceI = addr[0];
421 scalar minWeight = wghts[0];
425 if (wghts[i] < minWeight)
427 minWeight = wghts[i];
440 inter.normaliseWeights(this->conformal(), verbose);