47 const label startSeedI,
54 for (
label i = startSeedI; i < srcCellIDs.
size(); i++)
56 label srcI = srcCellIDs[i];
60 const point& srcCc = srcCcs[srcI];
62 tgt_.cellTree().findNearest(srcCc, great);
67 tgtSeedI = hit.
index();
74 <<
"Unable to find nearest target cell" 75 <<
" for source cell " << srcI
76 <<
" with centre " << srcCc
86 Pout<<
"could not find starting seed" <<
endl;
100 const label tgtSeedI,
113 label srcCelli = srcSeedI;
114 label tgtCelli = tgtSeedI;
119 findNearestCell(src_, tgt_, srcCelli, tgtCelli);
122 srcToTgt[srcCelli].append(tgtCelli);
123 tgtToSrc[tgtCelli].append(srcCelli);
126 mapFlag[srcCelli] =
false;
129 V_ += srcVc[srcCelli];
141 while (srcCelli >= 0);
149 forAll(tgtToSrc, targetCelli)
151 if (tgtToSrc[targetCelli].size() > 1)
153 const vector& tgtC = tgtCc[targetCelli];
157 label srcCelli = srcCells[0];
158 scalar d =
magSqr(tgtC - srcCc[srcCelli]);
160 for (
label i = 1; i < srcCells.
size(); i++)
162 label srcI = srcCells[i];
163 scalar dNew =
magSqr(tgtC - srcCc[srcI]);
172 srcCells.
append(srcCelli);
178 forAll(tgtToSrc, tgtCelli)
180 if (tgtToSrc[tgtCelli].empty())
182 label srcCelli = findMappedSrcCell(tgtCelli, tgtToSrc);
184 findNearestCell(tgt_, src_, tgtCelli, srcCelli);
186 tgtToSrc[tgtCelli].append(srcCelli);
191 forAll(srcToTgtCellAddr, i)
193 srcToTgtCellWght[i] =
scalarList(srcToTgt[i].size(), srcVc[i]);
194 srcToTgtCellAddr[i].
transfer(srcToTgt[i]);
197 forAll(tgtToSrcCellAddr, i)
199 tgtToSrcCellWght[i] =
scalarList(tgtToSrc[i].size(), tgtVc[i]);
200 tgtToSrcCellAddr[i].
transfer(tgtToSrc[i]);
216 const vector& p1 = Cc1[cell1];
230 scalar dTest =
magSqr(Cc2[c2] - p1);
235 appendNbrCells(cell2, mesh2, visitedCells, cells2);
238 }
while (cells2.
size() > 0);
251 const labelList& srcNbr = src_.cellCells()[srcCelli];
256 label celli = srcNbr[i];
264 for (
label i = startSeedI; i < srcCellIDs.
size(); i++)
266 label celli = srcCellIDs[i];
274 (void)findInitialSeeds
287 const label tgtCelli,
294 testCells.
append(tgtCelli);
303 visitedCells.
append(tgtI);
305 if (tgtToSrc[tgtI].size())
307 return tgtToSrc[tgtI][0];
311 const labelList& nbrCells = tgt_.cellCells()[tgtI];
315 if (
findIndex(visitedCells, nbrCells[i]) == -1)
317 testCells.
append(nbrCells[i]);
322 }
while (testCells.
size());
351 return mapNearestAMI::typeName;
380 boolList mapFlag(src_.nCells(),
false);
386 label startSeedI = 0;
virtual const word & AMImethod() const
Return the corresponding AMI method for patch interpolation.
virtual void calculateAddressing(labelListList &srcToTgtCellAddr, scalarListList &srcToTgtCellWght, labelListList &tgtToSrcCellAddr, scalarListList &tgtToSrcCellWght, const label srcSeedI, const label tgtSeedI, const labelList &srcCellIDs, boolList &mapFlag, label &startSeedI)
Calculate the mesh-to-mesh addressing and weights.
#define forAll(list, i)
Loop across all elements in list.
virtual void setNextNearestCells(label &startSeedI, label &srcCelli, label &tgtCelli, boolList &mapFlag, const labelList &srcCellIDs) const
Set the next cells for the marching front algorithm.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual void calculate(labelListList &srcToTgtAddr, scalarListList &srcToTgtWght, labelListList &tgtToTgtAddr, scalarListList &tgtToTgtWght)
Calculate addressing and weights.
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual void findNearestCell(const polyMesh &mesh1, const polyMesh &mesh2, const label cell1, label &cell2) const
Find the nearest cell on mesh2 for cell1 on mesh1.
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
Macros for easy insertion into run-time selection tables.
const dimensionedScalar c2
Second radiation constant: default SI units: [m K].
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
A class for handling words, derived from string.
List< scalar > scalarList
A List of scalars.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
bool hit() const
Is there a hit.
const vectorField & cellCentres() const
errorManip< error > abort(error &err)
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,.
Base class for mesh-to-mesh calculation methods.
T remove()
Remove and return the top element.
virtual ~mapNearestMethod()
Destructor.
prefixOSstream Pout(cout, "Pout")
A List with indirect addressing.
virtual bool findInitialSeeds(const labelList &srcCellIDs, const boolList &mapFlag, const label startSeedI, label &srcSeedI, label &tgtSeedI) const
Find indices of overlapping cells in src and tgt meshes - returns.
Mesh consisting of general polyhedral cells.
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.
label index() const
Return index.
virtual label findMappedSrcCell(const label tgtCelli, const List< DynamicList< label >> &tgtToSrc) const
Find a source cell mapped to target cell tgtCelli.
mapNearestMethod(const polyMesh &src, const polyMesh &tgt)
Construct from source and target meshes.