Go to the documentation of this file.
30 template<
class SourcePatch,
class TargetPatch>
33 const SourcePatch& srcPatch,
34 const TargetPatch& tgtPatch,
35 const label& srcFaceI,
42 const vector srcP = srcCf[srcFaceI];
56 scalar dTest =
magSqr(tgtCf[tgtI] - srcP);
71 }
while (tgtFaces.size() > 0);
75 template<
class SourcePatch,
class TargetPatch>
84 const labelList& srcNbr = this->srcPatch_.faceFaces()[srcFaceI];
90 label faceI = srcNbr[i];
94 startSeedI = faceI + 1;
105 tgtFaceI = this->findTargetFace(faceI);
109 const vectorField& srcCf = this->srcPatch_.faceCentres();
112 <<
"Unable to find target face for source face "
113 << srcFaceI <<
" with face centre " << srcCf[srcFaceI]
123 template<
class SourcePatch,
class TargetPatch>
126 const label tgtFaceI,
133 testFaces.
append(tgtFaceI);
142 visitedFaces.
append(tgtI);
144 if (tgtToSrc[tgtI].size())
146 return tgtToSrc[tgtI][0];
150 const labelList& nbrFaces = this->tgtPatch_.faceFaces()[tgtI];
154 if (
findIndex(visitedFaces, nbrFaces[i]) == -1)
156 testFaces.
append(nbrFaces[i]);
161 }
while (testFaces.size());
170 template<
class SourcePatch,
class TargetPatch>
173 const SourcePatch& srcPatch,
174 const TargetPatch& tgtPatch,
178 const bool reverseTarget,
179 const bool requireMatch
197 template<
class SourcePatch,
class TargetPatch>
204 template<
class SourcePatch,
class TargetPatch>
244 label startSeedI = 0;
249 findNearestFace(this->srcPatch_, this->tgtPatch_, srcFaceI, tgtFaceI);
251 srcAddr[srcFaceI].
append(tgtFaceI);
252 tgtAddr[tgtFaceI].
append(srcFaceI);
254 mapFlag[srcFaceI] =
false;
264 }
while (srcFaceI >= 0);
269 const vectorField& srcCf = this->srcPatch_.faceCentres();
270 const vectorField& tgtCf = this->tgtPatch_.faceCentres();
272 forAll(tgtAddr, targetFaceI)
274 if (tgtAddr[targetFaceI].size() > 1)
276 const vector& tgtC = tgtCf[tgtFaceI];
280 label srcFaceI = srcFaces[0];
281 scalar d =
magSqr(tgtC - srcCf[srcFaceI]);
283 for (
label i = 1; i < srcFaces.size(); i++)
285 label srcI = srcFaces[i];
286 scalar dNew =
magSqr(tgtC - srcCf[srcI]);
295 srcFaces.
append(srcFaceI);
303 if (tgtAddr[tgtFaceI].empty())
305 label srcFaceI = findMappedSrcFace(tgtFaceI, tgtAddr);
318 tgtAddr[tgtFaceI].
append(srcFaceI);
327 scalar magSf = this->srcMagSf_[i];
333 scalar magSf = this->tgtMagSf_[i];
List< scalar > scalarList
A List of scalars.
#define forAll(list, i)
Loop across all elements in list.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
mapNearestAMI(const mapNearestAMI &)
Disallow default bitwise copy construct.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
Base class for Arbitrary Mesh Interface (AMI) methods.
virtual ~mapNearestAMI()
Destructor.
virtual void calculate(labelListList &srcAddress, scalarListList &srcWeights, labelListList &tgtAddress, scalarListList &tgtWeights, label srcFaceI=-1, label tgtFaceI=-1)
Update addressing and weights.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
void findNearestFace(const SourcePatch &srcPatch, const TargetPatch &tgtPatch, const label &srcFaceI, label &tgtFaceI) const
Find nearest target face for source face srcFaceI.
void append(const T &)
Append an element at the end of the list.
void clear()
Clear the addressed list, i.e. set the size to zero.
errorManip< error > abort(error &err)
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
void setNextNearestFaces(boolList &mapFlag, label &startSeedI, label &srcFaceI, label &tgtFaceI) const
Determine next source-target face pair.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
T remove()
Remove and return the top element.
void size(const label)
Override size to be inconsistent with allocated storage.
label findMappedSrcFace(const label tgtFaceI, const List< DynamicList< label > > &tgtToSrc) const
Find mapped source face.
dimensioned< scalar > magSqr(const dimensioned< Type > &)