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

Change the kernels to inherit or not and to use periodic or not.

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/scalfmm/scalfmm/trunk@305 2616d619-271b-44dc-8df4-d4a8f33a7222
parent 3f0f81a0
......@@ -92,6 +92,39 @@ public:
virtual void P2P(const MortonIndex inCurrentLeafIndex,
ContainerClass* const FRestrict targets, const ContainerClass* const FRestrict sources,
ContainerClass* const directNeighborsParticles[26], const MortonIndex inNeighborsIndex[26], const int size) = 0;
//////////////////////////////////////////////////////////////////////////////
// Periodic methods
//////////////////////////////////////////////////////////////////////////////
/**
* M2L
* Multipole to local
* @param local the element to fill using distant neighbors
* @param distantNeighbors is an array containing fathers's direct neighbors's child - direct neigbors
* @param neighborsRelativePositions the relative position of the neighbors (can be -2,-2,-2)
* @param size the number of neighbors
* @param inLevel the current level of the computation
*/
virtual void M2L(CellClass* const FRestrict local, const CellClass* distantNeighbors[189],
const FTreeCoordinate neighborsRelativePositions[189], const int size, const int level) = 0;
/**
* P2P
* Particles to particles
* @param inCurrentLeafIndex the leaf index
* @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 neighborsRelativePositions the relative position of neighbors
* @param size the number of direct neighbors (the size of the array directNeighborsParticles)
*/
virtual void P2P(const MortonIndex inCurrentLeafIndex,
ContainerClass* const FRestrict targets, const ContainerClass* const FRestrict sources,
ContainerClass* const directNeighborsParticles[26], const FTreeCoordinate neighborsRelativeOffset[26],
const int size) = 0;
};
......
......@@ -65,7 +65,7 @@ public:
/** Before Downward */
void M2L(CellClass* const FRestrict , const CellClass* [189], FTreeCoordinate [189], const int , const int ) {
void M2L(CellClass* const FRestrict , const CellClass* [189], const FTreeCoordinate [189], const int , const int ) {
}
......
......@@ -20,7 +20,7 @@
* It used FTestCell and FTestParticle
*/
template< class ParticleClass, class CellClass, class ContainerClass>
class FTestKernels : public FAbstractKernels<ParticleClass,CellClass,ContainerClass> {
class FTestKernels {
public:
/** Default destructor */
virtual ~FTestKernels(){
......
......@@ -18,11 +18,10 @@
#include "../Src/Components/FTestParticle.hpp"
#include "../Src/Components/FTestCell.hpp"
#include "../Src/Components/FTestKernels.hpp"
#include "../Src/Components/FTestPeriodicKernels.hpp"
#include "../Src/Core/FFmmAlgorithmPeriodic.hpp"
#include "../Src/Components/FBasicKernels.hpp"
// Compile by : g++ testFmmAlgorithm.cpp ../Src/Utils/FDebug.cpp ../Src/Utils/FTrace.cpp -lgomp -fopenmp -O2 -o testFmmAlgorithm.exe
......@@ -32,44 +31,6 @@
*/
template< class ParticleClass, class CellClass, class ContainerClass>
class FTestPeriodicKernels : public FTestKernels<ParticleClass,CellClass,ContainerClass> {
public:
/** Before Downward */
void M2L(CellClass* const FRestrict pole, const CellClass* distantNeighbors[189], FTreeCoordinate [189], const int size, const int ) {
// The pole is impacted by what represent other poles
for(int idx = 0 ; idx < size ; ++idx){
pole->setDataDown(pole->getDataDown() + distantNeighbors[idx]->getDataUp());
}
}
/** After Downward */
void P2P(const MortonIndex ,
ContainerClass* const FRestrict targets, const ContainerClass* const FRestrict sources,
ContainerClass* const directNeighborsParticles[26], const FTreeCoordinate [26], const int size) {
// Each particles targeted is impacted by the particles sources
long long int inc = sources->getSize();
if(targets == sources){
inc -= 1;
}
for(int idx = 0 ; idx < size ; ++idx){
inc += directNeighborsParticles[idx]->getSize();
}
typename ContainerClass::BasicIterator iter(*targets);
while( iter.hasNotFinished() ){
iter.data().setDataDown(iter.data().getDataDown() + inc);
iter.gotoNext();
}
}
};
// Simply create particles and try the kernels
int main(int argc, char ** argv){
typedef FTestParticle ParticleClass;
......
......@@ -18,11 +18,10 @@
#include "../Src/Components/FTestParticle.hpp"
#include "../Src/Components/FTestCell.hpp"
#include "../Src/Components/FTestKernels.hpp"
#include "../Src/Components/FTestPeriodicKernels.hpp"
#include "../Src/Core/FFmmAlgorithmThreadProcPeriodic.hpp"
#include "../Src/Components/FBasicKernels.hpp"
#include "../Src/Files/FMpiTreeBuilder.hpp"
#include "../Src/Utils/FAbstractSendable.hpp"
......@@ -34,44 +33,6 @@
* it also check that each particles is impacted each other particles
*/
template< class ParticleClass, class CellClass, class ContainerClass>
class FTestPeriodicKernels : public FTestKernels<ParticleClass,CellClass,ContainerClass> {
public:
/** Before Downward */
void M2L(CellClass* const FRestrict pole, const CellClass* distantNeighbors[189], FTreeCoordinate [189], const int size, const int ) {
// The pole is impacted by what represent other poles
for(int idx = 0 ; idx < size ; ++idx){
pole->setDataDown(pole->getDataDown() + distantNeighbors[idx]->getDataUp());
}
}
/** After Downward */
void P2P(const MortonIndex ,
ContainerClass* const FRestrict targets, const ContainerClass* const FRestrict sources,
ContainerClass* const directNeighborsParticles[26], const FTreeCoordinate [26], const int size) {
// Each particles targeted is impacted by the particles sources
long long int inc = sources->getSize();
if(targets == sources){
inc -= 1;
}
for(int idx = 0 ; idx < size ; ++idx){
inc += directNeighborsParticles[idx]->getSize();
}
typename ContainerClass::BasicIterator iter(*targets);
while( iter.hasNotFinished() ){
iter.data().setDataDown(iter.data().getDataDown() + inc);
iter.gotoNext();
}
}
};
class TestCell : public FTestCell , public FAbstractSendable {
public:
static const int SerializedSizeUp = sizeof(long long int);
......
......@@ -66,7 +66,7 @@ public:
// My kernel actually does nothing except showing how to retreive data from an
// array from the indexes vector giving by the leaf in the P2M
template< class ParticleClass, class CellClass, class ContainerClass>
class MyKernel : public FAbstractKernels<ParticleClass,CellClass,ContainerClass> {
class MyKernel /*: public FAbstractKernels<ParticleClass,CellClass,ContainerClass> */{
FBasicParticle*const realParticles;
public:
MyKernel(FBasicParticle*const inRealParticles): realParticles(inRealParticles) {
......
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