mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: mapNearest: candidate selection
This commit is contained in:
@ -48,9 +48,7 @@ bool Foam::mapNearestMethod::findInitialSeeds
|
|||||||
label& tgtSeedI
|
label& tgtSeedI
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const cellList& srcCells = src_.cells();
|
const vectorField& srcCcs = src_.cellCentres();
|
||||||
const faceList& srcFaces = src_.faces();
|
|
||||||
const pointField& srcPts = src_.points();
|
|
||||||
|
|
||||||
for (label i = startSeedI; i < srcCellIDs.size(); i++)
|
for (label i = startSeedI; i < srcCellIDs.size(); i++)
|
||||||
{
|
{
|
||||||
@ -58,11 +56,9 @@ bool Foam::mapNearestMethod::findInitialSeeds
|
|||||||
|
|
||||||
if (mapFlag[srcI])
|
if (mapFlag[srcI])
|
||||||
{
|
{
|
||||||
const pointField
|
const point& srcCc = srcCcs[srcI];
|
||||||
pts(srcCells[srcI].points(srcFaces, srcPts).xfer());
|
pointIndexHit hit =
|
||||||
|
tgt_.cellTree().findNearest(srcCc, GREAT);
|
||||||
const point& pt = pts[0];
|
|
||||||
pointIndexHit hit = tgt_.cellTree().findNearest(pt, GREAT);
|
|
||||||
|
|
||||||
if (hit.hit())
|
if (hit.hit())
|
||||||
{
|
{
|
||||||
@ -86,8 +82,7 @@ bool Foam::mapNearestMethod::findInitialSeeds
|
|||||||
)
|
)
|
||||||
<< "Unable to find nearest target cell"
|
<< "Unable to find nearest target cell"
|
||||||
<< " for source cell " << srcI
|
<< " for source cell " << srcI
|
||||||
<< " with centre "
|
<< " with centre " << srcCc
|
||||||
<< srcCells[srcI].centre(srcPts, srcFaces)
|
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,6 +118,7 @@ void Foam::mapNearestMethod::calculateAddressing
|
|||||||
const scalarField& srcVc = src_.cellVolumes();
|
const scalarField& srcVc = src_.cellVolumes();
|
||||||
const scalarField& tgtVc = tgt_.cellVolumes();
|
const scalarField& tgtVc = tgt_.cellVolumes();
|
||||||
|
|
||||||
|
{
|
||||||
label srcCellI = srcSeedI;
|
label srcCellI = srcSeedI;
|
||||||
label tgtCellI = tgtSeedI;
|
label tgtCellI = tgtSeedI;
|
||||||
|
|
||||||
@ -152,7 +148,7 @@ void Foam::mapNearestMethod::calculateAddressing
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
while (srcCellI >= 0);
|
while (srcCellI >= 0);
|
||||||
|
}
|
||||||
|
|
||||||
// for the case of multiple source cells per target cell, select the
|
// for the case of multiple source cells per target cell, select the
|
||||||
// nearest source cell only and discard the others
|
// nearest source cell only and discard the others
|
||||||
@ -163,7 +159,7 @@ void Foam::mapNearestMethod::calculateAddressing
|
|||||||
{
|
{
|
||||||
if (tgtToSrc[targetCellI].size() > 1)
|
if (tgtToSrc[targetCellI].size() > 1)
|
||||||
{
|
{
|
||||||
const vector& tgtC = tgtCc[tgtCellI];
|
const vector& tgtC = tgtCc[targetCellI];
|
||||||
|
|
||||||
DynamicList<label>& srcCells = tgtToSrc[targetCellI];
|
DynamicList<label>& srcCells = tgtToSrc[targetCellI];
|
||||||
|
|
||||||
@ -203,16 +199,14 @@ void Foam::mapNearestMethod::calculateAddressing
|
|||||||
// transfer addressing into persistent storage
|
// transfer addressing into persistent storage
|
||||||
forAll(srcToTgtCellAddr, i)
|
forAll(srcToTgtCellAddr, i)
|
||||||
{
|
{
|
||||||
scalar v = srcVc[i];
|
srcToTgtCellWght[i] = scalarList(srcToTgt[i].size(), srcVc[i]);
|
||||||
srcToTgtCellAddr[i].transfer(srcToTgt[i]);
|
srcToTgtCellAddr[i].transfer(srcToTgt[i]);
|
||||||
srcToTgtCellWght[i] = scalarList(1, v);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(tgtToSrcCellAddr, i)
|
forAll(tgtToSrcCellAddr, i)
|
||||||
{
|
{
|
||||||
scalar v = tgtVc[i];
|
tgtToSrcCellWght[i] = scalarList(tgtToSrc[i].size(), tgtVc[i]);
|
||||||
tgtToSrcCellAddr[i].transfer(tgtToSrc[i]);
|
tgtToSrcCellAddr[i].transfer(tgtToSrc[i]);
|
||||||
tgtToSrcCellWght[i] = scalarList(1, v);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,12 +266,20 @@ void Foam::mapNearestMethod::setNextNearestCells
|
|||||||
if (mapFlag[cellI])
|
if (mapFlag[cellI])
|
||||||
{
|
{
|
||||||
srcCellI = cellI;
|
srcCellI = cellI;
|
||||||
startSeedI = cellI + 1;
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (label i = startSeedI; i < srcCellIDs.size(); i++)
|
||||||
|
{
|
||||||
|
label cellI = srcCellIDs[i];
|
||||||
|
if (mapFlag[cellI])
|
||||||
|
{
|
||||||
|
startSeedI = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
(void)findInitialSeeds
|
(void)findInitialSeeds
|
||||||
(
|
(
|
||||||
srcCellIDs,
|
srcCellIDs,
|
||||||
|
|||||||
@ -28,6 +28,10 @@ Description
|
|||||||
Map nearest mesh-to-mesh interpolation class
|
Map nearest mesh-to-mesh interpolation class
|
||||||
|
|
||||||
Not volume conservative.
|
Not volume conservative.
|
||||||
|
- cells outside other meshes bounding box do not get mapped
|
||||||
|
(initial filtering)
|
||||||
|
- all remaining cells will be mapped (with weight 1!)
|
||||||
|
- so take care when mapping meshes with different bounding boxes!
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
mapNearestMethod.C
|
mapNearestMethod.C
|
||||||
|
|||||||
Reference in New Issue
Block a user