polyMesh: clear cellTree if mesh moves
Patch contributed by Mattijs Janssens Resolves bug-report http://bugs.openfoam.org/view.php?id=2235
This commit is contained in:
parent
3eacfb7621
commit
fec5c063f5
1 changed files with 7 additions and 51 deletions
|
|
@ -1109,6 +1109,9 @@ Foam::tmp<Foam::scalarField> Foam::polyMesh::movePoints
|
||||||
faceZones_.movePoints(points_);
|
faceZones_.movePoints(points_);
|
||||||
cellZones_.movePoints(points_);
|
cellZones_.movePoints(points_);
|
||||||
|
|
||||||
|
// Cell tree might become invalid
|
||||||
|
cellTreePtr_.clear();
|
||||||
|
|
||||||
// Reset valid directions (could change with rotation)
|
// Reset valid directions (could change with rotation)
|
||||||
geometricD_ = Zero;
|
geometricD_ = Zero;
|
||||||
solutionD_ = Zero;
|
solutionD_ = Zero;
|
||||||
|
|
@ -1211,60 +1214,13 @@ void Foam::polyMesh::findCellFacePt
|
||||||
|
|
||||||
const indexedOctree<treeDataCell>& tree = cellTree();
|
const indexedOctree<treeDataCell>& tree = cellTree();
|
||||||
|
|
||||||
// Find nearest cell to the point
|
// Find point inside cell
|
||||||
pointIndexHit info = tree.findNearest(p, sqr(GREAT));
|
celli = tree.findInside(p);
|
||||||
|
|
||||||
if (info.hit())
|
if (celli != -1)
|
||||||
{
|
{
|
||||||
label nearestCelli = tree.shapes().cellLabels()[info.index()];
|
|
||||||
|
|
||||||
// Check the nearest cell to see if the point is inside.
|
// Check the nearest cell to see if the point is inside.
|
||||||
findTetFacePt(nearestCelli, p, tetFacei, tetPti);
|
findTetFacePt(celli, p, tetFacei, tetPti);
|
||||||
|
|
||||||
if (tetFacei != -1)
|
|
||||||
{
|
|
||||||
// Point was in the nearest cell
|
|
||||||
|
|
||||||
celli = nearestCelli;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Check the other possible cells that the point may be in
|
|
||||||
|
|
||||||
labelList testCells = tree.findIndices(p);
|
|
||||||
|
|
||||||
forAll(testCells, pCI)
|
|
||||||
{
|
|
||||||
label testCelli = tree.shapes().cellLabels()[testCells[pCI]];
|
|
||||||
|
|
||||||
if (testCelli == nearestCelli)
|
|
||||||
{
|
|
||||||
// Don't retest the nearest cell
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check the test cell to see if the point is inside.
|
|
||||||
findTetFacePt(testCelli, p, tetFacei, tetPti);
|
|
||||||
|
|
||||||
if (tetFacei != -1)
|
|
||||||
{
|
|
||||||
// Point was in the test cell
|
|
||||||
|
|
||||||
celli = testCelli;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "Did not find nearest cell in search tree."
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue