Commit 854ec4ae authored by berenger-bramas's avatar berenger-bramas

Only one P2P methods is used now.

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/scalfmm/scalfmm/trunk@379 2616d619-271b-44dc-8df4-d4a8f33a7222
parent e4aa608a
...@@ -81,22 +81,11 @@ public: ...@@ -81,22 +81,11 @@ public:
/** /**
* P2P * P2P
* Particles to particles * Particles to particles
* @param inLeafPosition tree coordinate of the leaf
* @param targets current boxe targets particles * @param targets current boxe targets particles
* @param sources current boxe sources particles (can be == to targets)
* @param directNeighborsParticles the particles from direct neighbors (this is an array of list) * @param directNeighborsParticles the particles from direct neighbors (this is an array of list)
* @param size the number of direct neighbors (the size of the array directNeighborsParticles) * @param size the number of direct neighbors
*/
virtual void P2P(const FTreeCoordinate& inLeafPosition,
ContainerClass* const FRestrict targets,
ContainerClass* const directNeighborsParticles[27], const int size) = 0;
/**
* P2P
* Particles to particles
* @param inLeafPosition
* @param targets current boxe targets particles
* @param sources current boxe sources particles
* @param directNeighborsParticles the particles from direct neighbors (this is an array of list)
* @param size the number of direct neighbors (the size of the array directNeighborsParticles)
*/ */
virtual void P2P(const FTreeCoordinate& inLeafPosition, virtual void P2P(const FTreeCoordinate& inLeafPosition,
ContainerClass* const FRestrict targets, const ContainerClass* const FRestrict sources, ContainerClass* const FRestrict targets, const ContainerClass* const FRestrict sources,
......
...@@ -58,12 +58,6 @@ public: ...@@ -58,12 +58,6 @@ public:
} }
/** Do nothing */
virtual void P2P(const FTreeCoordinate& ,
ContainerClass* const FRestrict ,
ContainerClass* const [27], const int ) {
}
/** Do nothing */ /** Do nothing */
virtual void P2P(const FTreeCoordinate& , virtual void P2P(const FTreeCoordinate& ,
......
...@@ -89,28 +89,6 @@ public: ...@@ -89,28 +89,6 @@ public:
} }
/** After Downward */
void P2P(const FTreeCoordinate& ,
ContainerClass* const FRestrict targets,
ContainerClass* const directNeighborsParticles[27], const int ){
// Each particles targeted is impacted by the particles sources
long long int inc = targets->getSize() - 1;
for(int idx = 0 ; idx < 27 ; ++idx){
if( directNeighborsParticles[idx] ){
inc += directNeighborsParticles[idx]->getSize();
}
}
typename ContainerClass::BasicIterator iter(*targets);
while( iter.hasNotFinished() ){
iter.data().setDataDown(iter.data().getDataDown() + inc);
iter.gotoNext();
}
}
/** After Downward */ /** After Downward */
void P2P(const FTreeCoordinate& , void P2P(const FTreeCoordinate& ,
......
...@@ -242,7 +242,8 @@ private: ...@@ -242,7 +242,8 @@ private:
// need the current particles and neighbors particles // need the current particles and neighbors particles
const int counter = tree->getLeafsNeighbors(neighbors, octreeIterator.getCurrentGlobalCoordinate(),heightMinusOne); const int counter = tree->getLeafsNeighbors(neighbors, octreeIterator.getCurrentGlobalCoordinate(),heightMinusOne);
FDEBUG(computationCounterP2P.tic()); FDEBUG(computationCounterP2P.tic());
kernels->P2P(octreeIterator.getCurrentGlobalCoordinate(),octreeIterator.getCurrentListTargets(), neighbors, counter); kernels->P2P(octreeIterator.getCurrentGlobalCoordinate(),octreeIterator.getCurrentListTargets(),
octreeIterator.getCurrentListSrc(), neighbors, counter);
FDEBUG(computationCounterP2P.tac()); FDEBUG(computationCounterP2P.tac());
} while(octreeIterator.moveRight()); } while(octreeIterator.moveRight());
......
...@@ -240,7 +240,8 @@ private: ...@@ -240,7 +240,8 @@ private:
// need the current particles and neighbors particles // need the current particles and neighbors particles
const int counter = tree->getPeriodicLeafsNeighbors(neighbors, octreeIterator.getCurrentGlobalCoordinate(),heightMinusOne); const int counter = tree->getPeriodicLeafsNeighbors(neighbors, octreeIterator.getCurrentGlobalCoordinate(),heightMinusOne);
FDEBUG(computationCounterP2P.tic()); FDEBUG(computationCounterP2P.tic());
kernels->P2P(octreeIterator.getCurrentGlobalCoordinate(),octreeIterator.getCurrentListTargets(), neighbors, counter); kernels->P2P(octreeIterator.getCurrentGlobalCoordinate(),octreeIterator.getCurrentListTargets(),
octreeIterator.getCurrentListSrc(), neighbors, counter);
FDEBUG(computationCounterP2P.tac()); FDEBUG(computationCounterP2P.tac());
} while(octreeIterator.moveRight()); } while(octreeIterator.moveRight());
......
...@@ -324,7 +324,8 @@ private: ...@@ -324,7 +324,8 @@ private:
#pragma omp task #pragma omp task
{ {
const int counter = tree->getLeafsNeighbors(neighbors, toWork.getCurrentGlobalCoordinate(),heightMinusOne); const int counter = tree->getLeafsNeighbors(neighbors, toWork.getCurrentGlobalCoordinate(),heightMinusOne);
myThreadkernels->P2P(toWork.getCurrentGlobalCoordinate(), toWork.getCurrentListTargets(), neighbors, counter); myThreadkernels->P2P(toWork.getCurrentGlobalCoordinate(), toWork.getCurrentListTargets(),
toWork.getCurrentListSrc(), neighbors, counter);
} }
} }
......
...@@ -384,7 +384,8 @@ private: ...@@ -384,7 +384,8 @@ private:
// need the current particles and neighbors particles // need the current particles and neighbors particles
FDEBUG(if(!omp_get_thread_num()) computationCounterP2P.tic()); FDEBUG(if(!omp_get_thread_num()) computationCounterP2P.tic());
const int counter = tree->getLeafsNeighbors(neighbors, currentIter.cell->getCoordinate(), LeafIndex); const int counter = tree->getLeafsNeighbors(neighbors, currentIter.cell->getCoordinate(), LeafIndex);
myThreadkernels.P2P(currentIter.cell->getCoordinate(), currentIter.targets, neighbors, counter); myThreadkernels.P2P(currentIter.cell->getCoordinate(), currentIter.targets,
currentIter.sources, neighbors, counter);
FDEBUG(if(!omp_get_thread_num()) computationCounterP2P.tac()); FDEBUG(if(!omp_get_thread_num()) computationCounterP2P.tac());
} }
......
...@@ -1133,7 +1133,8 @@ private: ...@@ -1133,7 +1133,8 @@ private:
// need the current particles and neighbors particles // need the current particles and neighbors particles
const int counter = tree->getLeafsNeighbors(neighbors, currentIter.cell->getCoordinate(), LeafIndex); const int counter = tree->getLeafsNeighbors(neighbors, currentIter.cell->getCoordinate(), LeafIndex);
myThreadkernels.P2P( currentIter.cell->getCoordinate(),currentIter.targets, neighbors, counter); myThreadkernels.P2P( currentIter.cell->getCoordinate(),currentIter.targets,
currentIter.sources, neighbors, counter);
} }
} }
...@@ -1221,7 +1222,8 @@ private: ...@@ -1221,7 +1222,8 @@ private:
} }
} }
myThreadkernels.P2P( currentIter.cell->getCoordinate(), currentIter.targets, neighbors, counter); myThreadkernels.P2P( currentIter.cell->getCoordinate(), currentIter.targets,
currentIter.sources, neighbors, counter);
} }
} }
......
...@@ -1210,7 +1210,8 @@ private: ...@@ -1210,7 +1210,8 @@ private:
// need the current particles and neighbors particles // need the current particles and neighbors particles
const int counter = tree->getPeriodicLeafsNeighbors(neighbors, currentIter.cell->getCoordinate(), LeafIndex); const int counter = tree->getPeriodicLeafsNeighbors(neighbors, currentIter.cell->getCoordinate(), LeafIndex);
myThreadkernels.P2P( currentIter.cell->getCoordinate(), currentIter.targets, neighbors, counter); myThreadkernels.P2P( currentIter.cell->getCoordinate(), currentIter.targets,
currentIter.sources, neighbors, counter);
} }
} }
...@@ -1305,7 +1306,8 @@ private: ...@@ -1305,7 +1306,8 @@ private:
} }
} }
myThreadkernels.P2P( currentIter.cell->getCoordinate(), currentIter.targets, neighbors, counter); myThreadkernels.P2P( currentIter.cell->getCoordinate(), currentIter.targets,
currentIter.sources, neighbors, counter);
} }
} }
......
...@@ -198,6 +198,32 @@ public: ...@@ -198,6 +198,32 @@ public:
* neighbors. * neighbors.
*/ */
void P2P(const FTreeCoordinate& inLeafPosition, void P2P(const FTreeCoordinate& inLeafPosition,
ContainerClass* const FRestrict targets, const ContainerClass* const FRestrict sources,
ContainerClass* const directNeighborsParticles[27], const int size){
if( targets == sources ){
P2PNoTsm(inLeafPosition, targets, directNeighborsParticles, size);
}
else{
P2PTsm(inLeafPosition, targets, sources, directNeighborsParticles, size);
}
}
private:
///////////////////////////////////////////////////////////////////////////////
// P2P possibilities
///////////////////////////////////////////////////////////////////////////////
/** This P2P has to be used when target != sources
* It will proceed an direct interation no mutual
*
* It takes all the target particles from the current leaf,
* then it computes the sources/targets interaction in this leaf,
* then it computes the sources/targets inteactions between this leaf and the
* neighbors.
*/
void P2PTsm(const FTreeCoordinate& inLeafPosition,
ContainerClass* const FRestrict targets, const ContainerClass* const FRestrict sources, ContainerClass* const FRestrict targets, const ContainerClass* const FRestrict sources,
ContainerClass* const directNeighborsParticles[27], const int ){ ContainerClass* const directNeighborsParticles[27], const int ){
...@@ -249,7 +275,7 @@ public: ...@@ -249,7 +275,7 @@ public:
* then it computes the inteactions between this leaf and the * then it computes the inteactions between this leaf and the
* neighbors. * neighbors.
*/ */
void P2P(const FTreeCoordinate& inLeafPosition, void P2PNoTsm(const FTreeCoordinate& inLeafPosition,
ContainerClass* const FRestrict targets, ContainerClass* const FRestrict targets,
ContainerClass* const directNeighborsParticles[27], const int ){ ContainerClass* const directNeighborsParticles[27], const int ){
{ // Compute interaction in this leaf { // Compute interaction in this leaf
...@@ -297,7 +323,7 @@ public: ...@@ -297,7 +323,7 @@ public:
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Computation // Computation
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
private:
/** P2M computation /** P2M computation
* expansion_P2M_add * expansion_P2M_add
......
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