Commit dfb3a7fb authored by berenger-bramas's avatar berenger-bramas

Update octree and Fmm periodic core.

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/scalfmm/scalfmm/trunk@255 2616d619-271b-44dc-8df4-d4a8f33a7222
parent da2adc55
......@@ -560,6 +560,13 @@ public:
}
}
/** Get the part of array that contains all the pointers
*
*/
CellClass** getCurrentBox() const {
return &this->current.tree->cellsAt(this->currentLocalLevel)[this->currentLocalIndex & ~7];
}
/** Get the Morton index of the current cell pointed by the iterator
* @return The global morton index
* <code>iter.getCurrentGlobalIndex();<br>
......@@ -794,17 +801,20 @@ public:
// if we are not on the current cell
if( idxX || idxY || idxZ ){
FTreeCoordinate otherParent(parentCell.getX() + idxX,parentCell.getY() + idxY,parentCell.getZ() + idxZ);
const FTreeCoordinate otherParent(parentCell.getX() + idxX,parentCell.getY() + idxY,parentCell.getZ() + idxZ);
FTreeCoordinate otherParentInBox(otherParent);
// periodic
if( otherParent.getX() < 0 ) otherParent.setX( otherParent.getX() + limite );
else if( limite <= otherParent.getX() ) otherParent.setX( otherParent.getX() - limite );
if( otherParent.getY() < 0 ) otherParent.setY( otherParent.getY() + limite );
else if( limite <= otherParent.getY() ) otherParent.setY( otherParent.getY() - limite );
if( otherParent.getZ() < 0 ) otherParent.setZ( otherParent.getZ() + limite );
else if( limite <= otherParent.getZ() ) otherParent.setZ( otherParent.getZ() - limite );
if( otherParentInBox.getX() < 0 ) otherParentInBox.setX( otherParentInBox.getX() + limite );
else if( limite <= otherParentInBox.getX() ) otherParentInBox.setX( otherParentInBox.getX() - limite );
if( otherParentInBox.getY() < 0 ) otherParentInBox.setY( otherParentInBox.getY() + limite );
else if( limite <= otherParentInBox.getY() ) otherParentInBox.setY( otherParentInBox.getY() - limite );
const MortonIndex mortonOtherParent = otherParent.getMortonIndex(inLevel-1) << 3;
if( otherParentInBox.getZ() < 0 ) otherParentInBox.setZ( otherParentInBox.getZ() + limite );
else if( limite <= otherParentInBox.getZ() ) otherParentInBox.setZ( otherParentInBox.getZ() - limite );
const MortonIndex mortonOtherParent = otherParentInBox.getMortonIndex(inLevel-1) << 3;
// Get child
CellClass** const cells = getCellPt(mortonOtherParent, inLevel);
......@@ -819,9 +829,9 @@ public:
(otherParent.getY()<<1) | (idxCousin>>1 & 1),
(otherParent.getZ()<<1) | (idxCousin&1));
const FTreeCoordinate relativePosition(workingCell.getX() - potentialNeighbor.getX(),
workingCell.getY() - potentialNeighbor.getY(),
workingCell.getZ() - potentialNeighbor.getZ());
const FTreeCoordinate relativePosition(potentialNeighbor.getX() - workingCell.getX(),
potentialNeighbor.getY() - workingCell.getY(),
potentialNeighbor.getZ() - workingCell.getZ());
// Test if it is a direct neighbor
if(FMath::Abs(relativePosition.getX()) > 1 ||
......
......@@ -160,7 +160,6 @@ private:
if(counter) kernels->M2L( octreeIterator.getCurrentCell() , neighbors, relativePosition, counter, idxLevel);
FDEBUG(computationCounter.tac());
} while(octreeIterator.moveRight());
avoidGotoLeftIterator.moveDown();
octreeIterator = avoidGotoLeftIterator;
}
......@@ -250,7 +249,7 @@ private:
{
typename OctreeClass::Iterator octreeIterator(tree);
octreeIterator.gotoLeft();
kernels->M2M( &upperCells[0], octreeIterator.getCurrentCell(), 0);
kernels->M2M( &upperCells[0], octreeIterator.getCurrentBox(), 0);
}
// Then M2M from level 0 to level -LIMITE
{
......@@ -259,7 +258,7 @@ private:
for(int idxChild = 0 ; idxChild < 8 ; ++idxChild){
virtualChild[idxChild] = &upperCells[idxLevel-1];
}
kernels->M2M( upperCells[idxLevel], virtualChild, -idxLevel);
kernels->M2M( &upperCells[idxLevel], virtualChild, -idxLevel);
}
}
// Then M2L at all level
......@@ -282,14 +281,14 @@ private:
const CellClass* neighbors[189];
const int counter = 189;
FDEBUG(computationCounter.tic());
for(int idxLevel = 0 ; idxLevel < PeriodicLimit ; ++idxLevel ){
for(int idxNeigh = 0 ; idxNeigh < 189 ; ++idxNeigh){
neighbors[idxNeigh] = &upperCells[idxLevel];
}
kernels->M2L( upperCells[idxLevel] , neighbors, relativePosition, counter, -idxLevel);
kernels->M2L( &upperCells[idxLevel] , neighbors, relativePosition, counter, -idxLevel);
}
FDEBUG(computationCounter.tac());
}
// Finally L2L until level 0
......@@ -298,7 +297,7 @@ private:
memset(virtualChild, 0, sizeof(CellClass*) * 8);
for(int idxLevel = PeriodicLimit - 1 ; idxLevel > 0 ; --idxLevel){
virtualChild[0] = &upperCells[idxLevel-1];
kernels->L2L( upperCells[idxLevel], virtualChild, -idxLevel);
kernels->L2L( &upperCells[idxLevel], virtualChild, -idxLevel);
}
}
......@@ -306,7 +305,7 @@ private:
{
typename OctreeClass::Iterator octreeIterator(tree);
octreeIterator.gotoLeft();
kernels->L2L( &upperCells[0], octreeIterator.getCurrentCell(), 0);
kernels->L2L( &upperCells[0], octreeIterator.getCurrentBox(), 0);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment