40 void Foam::mapNearestAMI::findNearestFace
44 const label& srcFacei,
51 const vector srcP = srcCf[srcFacei];
53 DynamicList<label> tgtFaces(10);
54 tgtFaces.append(tgtFacei);
56 DynamicList<label> visitedFaces(10);
62 label tgtI = tgtFaces.remove();
63 visitedFaces.append(tgtI);
65 scalar dTest =
magSqr(tgtCf[tgtI] - srcP);
80 }
while (tgtFaces.size() > 0);
84 void Foam::mapNearestAMI::setNextNearestFaces
92 const labelList& srcNbr = this->srcPatch_.faceFaces()[srcFacei];
98 label facei = srcNbr[i];
102 startSeedI = facei + 1;
113 tgtFacei = this->findTargetFace(facei);
117 const vectorField& srcCf = this->srcPatch_.faceCentres();
120 <<
"Unable to find target face for source face " 121 << srcFacei <<
" with face centre " << srcCf[srcFacei]
133 const label tgtFacei,
134 const List<DynamicList<label>>& tgtToSrc
137 DynamicList<label> testFaces(10);
138 DynamicList<label> visitedFaces(10);
140 testFaces.append(tgtFacei);
145 label tgtI = testFaces.remove();
149 visitedFaces.append(tgtI);
151 if (tgtToSrc[tgtI].size())
153 return tgtToSrc[tgtI][0];
157 const labelList& nbrFaces = this->tgtPatch_.faceFaces()[tgtI];
161 if (
findIndex(visitedFaces, nbrFaces[i]) == -1)
163 testFaces.append(nbrFaces[i]);
168 }
while (testFaces.size());
184 const bool reverseTarget,
185 const bool requireMatch
245 boolList mapFlag(srcAddr.size(),
true);
248 label startSeedI = 0;
253 findNearestFace(this->srcPatch_, this->tgtPatch_, srcFacei, tgtFacei);
255 srcAddr[srcFacei].append(tgtFacei);
256 tgtAddr[tgtFacei].append(srcFacei);
258 mapFlag[srcFacei] =
false;
268 }
while (srcFacei >= 0);
273 const vectorField& srcCf = this->srcPatch_.faceCentres();
274 const vectorField& tgtCf = this->tgtPatch_.faceCentres();
276 forAll(tgtAddr, targetFacei)
278 if (tgtAddr[targetFacei].size() > 1)
280 const vector& tgtC = tgtCf[tgtFacei];
284 label srcFacei = srcFaces[0];
285 scalar d =
magSqr(tgtC - srcCf[srcFacei]);
287 for (
label i = 1; i < srcFaces.
size(); i++)
289 label srcI = srcFaces[i];
290 scalar dNew =
magSqr(tgtC - srcCf[srcI]);
299 srcFaces.
append(srcFacei);
307 if (tgtAddr[tgtFacei].empty())
309 label srcFacei = findMappedSrcFace(tgtFacei, tgtAddr);
322 tgtAddr[tgtFacei].append(srcFacei);
#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.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void size(const label)
Override size to be inconsistent with allocated storage.
Vector< scalar > vector
A scalar version of the templated Vector.
virtual ~mapNearestAMI()
Destructor.
virtual void calculate(labelListList &srcAddress, scalarListList &srcWeights, labelListList &tgtAddress, scalarListList &tgtWeights, label srcFacei=-1, label tgtFacei=-1)
Update addressing and weights.
Macros for easy insertion into run-time selection tables.
List< bool > boolList
Bool container classes.
A list of faces which address into the list of points.
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.
errorManip< error > abort(error &err)
Base class for Arbitrary Mesh Interface (AMI) methods.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
PrimitivePatch< SubList< face >, const pointField & > primitivePatch
Addressing for a faceList slice.
Field< vector > vectorField
Specialisation of Field<T> for vector.
mapNearestAMI(const primitivePatch &srcPatch, const primitivePatch &tgtPatch, const scalarField &srcMagSf, const scalarField &tgtMagSf, const faceAreaIntersect::triangulationMode &triMode, const bool reverseTarget=false, const bool requireMatch=true)
Construct from components.
void clear()
Clear the addressed list, i.e. set the size to zero.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.