46 const label startSeedI,
53 for (
label i = startSeedI; i < srcCellIDs.
size(); i++)
55 label srcI = srcCellIDs[i];
59 const point& srcCc = srcCcs[srcI];
61 tgt_.cellTree().findNearest(srcCc, GREAT);
66 tgtSeedI = hit.
index();
73 <<
"Unable to find nearest target cell" 74 <<
" for source cell " << srcI
75 <<
" with centre " << srcCc
85 Pout<<
"could not find starting seed" <<
endl;
112 label srcCelli = srcSeedI;
113 label tgtCelli = tgtSeedI;
118 findNearestCell(src_, tgt_, srcCelli, tgtCelli);
121 srcToTgt[srcCelli].append(tgtCelli);
122 tgtToSrc[tgtCelli].append(srcCelli);
125 mapFlag[srcCelli] =
false;
128 V_ += srcVc[srcCelli];
140 while (srcCelli >= 0);
148 forAll(tgtToSrc, targetCelli)
150 if (tgtToSrc[targetCelli].size() > 1)
152 const vector& tgtC = tgtCc[targetCelli];
156 label srcCelli = srcCells[0];
157 scalar d =
magSqr(tgtC - srcCc[srcCelli]);
159 for (
label i = 1; i < srcCells.
size(); i++)
161 label srcI = srcCells[i];
162 scalar dNew =
magSqr(tgtC - srcCc[srcI]);
171 srcCells.
append(srcCelli);
177 forAll(tgtToSrc, tgtCelli)
179 if (tgtToSrc[tgtCelli].empty())
181 label srcCelli = findMappedSrcCell(tgtCelli, tgtToSrc);
183 findNearestCell(tgt_, src_, tgtCelli, srcCelli);
185 tgtToSrc[tgtCelli].append(srcCelli);
190 forAll(srcToTgtCellAddr, i)
192 srcToTgtCellWght[i] =
scalarList(srcToTgt[i].size(), srcVc[i]);
193 srcToTgtCellAddr[i].
transfer(srcToTgt[i]);
196 forAll(tgtToSrcCellAddr, i)
198 tgtToSrcCellWght[i] =
scalarList(tgtToSrc[i].size(), tgtVc[i]);
199 tgtToSrcCellAddr[i].
transfer(tgtToSrc[i]);
215 const vector& p1 = Cc1[cell1];
229 scalar dTest =
magSqr(Cc2[c2] - p1);
234 appendNbrCells(cell2, mesh2, visitedCells, cells2);
237 }
while (cells2.
size() > 0);
250 const labelList& srcNbr = src_.cellCells()[srcCelli];
255 label celli = srcNbr[i];
263 for (
label i = startSeedI; i < srcCellIDs.
size(); i++)
265 label celli = srcCellIDs[i];
273 (void)findInitialSeeds
286 const label tgtCelli,
293 testCells.
append(tgtCelli);
302 visitedCells.
append(tgtI);
304 if (tgtToSrc[tgtI].size())
306 return tgtToSrc[tgtI][0];
310 const labelList& nbrCells = tgt_.cellCells()[tgtI];
314 if (
findIndex(visitedCells, nbrCells[i]) == -1)
316 testCells.
append(nbrCells[i]);
321 }
while (testCells.
size());
373 boolList mapFlag(src_.nCells(),
false);
379 label startSeedI = 0;
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.
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.
bool hit() const
Is there a hit.
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.
const dimensionedScalar c2
Second radiation constant: default SI units: [m.K].
Ostream & endl(Ostream &os)
Add newline and flush stream.
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
virtual void setNextNearestCells(label &startSeedI, label &srcCelli, label &tgtCelli, boolList &mapFlag, const labelList &srcCellIDs) const
Set the next cells for the marching front algorithm.
Macros for easy insertion into run-time selection tables.
mapNearestMethod(const mapNearestMethod &)
Disallow default bitwise copy construct.
List< scalar > scalarList
A List of scalars.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
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.
const vectorField & cellCentres() const
errorManip< error > abort(error &err)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
prefixOSstream Pout(cout,"Pout")
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
Base class for mesh-to-mesh calculation methods.
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.
T remove()
Remove and return the top element.
virtual ~mapNearestMethod()
Destructor.
label index() const
Return index.
A List with indirect addressing.
virtual label findMappedSrcCell(const label tgtCelli, const List< DynamicList< label >> &tgtToSrc) const
Find a source cell mapped to target cell tgtCelli.
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.