BUG: PointEdgeWave: incorrect indexing in handleCollocatedPoints

This commit is contained in:
mattijs
2013-01-17 14:55:13 +00:00
parent 0f05652a98
commit 3b637a0d54

View File

@ -566,7 +566,8 @@ Foam::label Foam::PointEdgeWave<Type, TrackingData>::handleCollocatedPoints()
elems[pointI] = allPointInfo_[meshPoints[pointI]]; elems[pointI] = allPointInfo_[meshPoints[pointI]];
} }
// Pull slave data onto master. No need to update transformed slots. // Pull slave data onto master (which might or might not have any
// initialised points). No need to update transformed slots.
slavesMap.distribute(elems, false); slavesMap.distribute(elems, false);
// Combine master data with slave data // Combine master data with slave data
@ -597,26 +598,34 @@ Foam::label Foam::PointEdgeWave<Type, TrackingData>::handleCollocatedPoints()
// Extract back onto mesh // Extract back onto mesh
forAll(meshPoints, pointI) forAll(meshPoints, pointI)
{ {
Type& elem = allPointInfo_[meshPoints[pointI]]; if (elems[pointI].valid(td_))
{
label meshPointI = meshPoints[pointI];
Type& elem = allPointInfo_[meshPointI];
bool wasValid = elem.valid(td_);
// Like updatePoint but bypass Type::updatePoint with its tolerance // Like updatePoint but bypass Type::updatePoint with its tolerance
// checking // checking
if (!elem.valid(td_) || !elem.equal(elems[pointI], td_)) //if (!elem.valid(td_) || !elem.equal(elems[pointI], td_))
if (!elem.equal(elems[pointI], td_))
{ {
nEvals_++; nEvals_++;
elem = elems[pointI]; elem = elems[pointI];
// See if element now valid // See if element now valid
if (elem.valid(td_)) if (!wasValid && elem.valid(td_))
{ {
--nUnvisitedPoints_; --nUnvisitedPoints_;
} }
// Update database of changed points // Update database of changed points
if (!changedPoint_[pointI]) if (!changedPoint_[meshPointI])
{ {
changedPoint_[pointI] = true; changedPoint_[meshPointI] = true;
changedPoints_[nChangedPoints_++] = pointI; changedPoints_[nChangedPoints_++] = meshPointI;
}
} }
} }
} }