Commit 85084f17 authored by berenger-bramas's avatar berenger-bramas

Change the utest to use the new kernel.

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/scalfmm/scalfmm/trunk@301 2616d619-271b-44dc-8df4-d4a8f33a7222
parent e8fffbd9
...@@ -28,6 +28,14 @@ public: ...@@ -28,6 +28,14 @@ public:
ExpP = int((DevP+1) * (DevP+2) * 0.5); ExpP = int((DevP+1) * (DevP+2) * 0.5);
} }
static int GetP(){
return DevP;
}
static int GetExp(){
return ExpP;
}
/** Default constructor */ /** Default constructor */
FComputeCell() FComputeCell()
......
...@@ -81,7 +81,7 @@ public: ...@@ -81,7 +81,7 @@ public:
#else #else
timeval t; timeval t;
gettimeofday(&t, NULL); gettimeofday(&t, NULL);
return (t.tv_sec) + (t.tv_usec/1000000.0); return double(t.tv_sec) + (double(t.tv_usec)/1000000.0);
#endif #endif
} }
}; };
......
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
#include "../Src/Containers/FOctree.hpp" #include "../Src/Containers/FOctree.hpp"
#include "../Src/Containers/FVector.hpp" #include "../Src/Containers/FVector.hpp"
#include "../Src/Kernels/FComputeCell.hpp"
#include "../Src/Kernels/FElecForcesKernels.hpp"
#include "../Src/Fmb/FFmbKernels.hpp" #include "../Src/Fmb/FFmbKernels.hpp"
#include "../Src/Fmb/FFmbComponents.hpp" #include "../Src/Fmb/FFmbComponents.hpp"
...@@ -16,10 +19,12 @@ ...@@ -16,10 +19,12 @@
typedef FmbParticle ParticleClass; typedef FmbParticle ParticleClass;
typedef FmbCell CellClass; typedef FComputeCell CellClass;
typedef FVector<ParticleClass> ContainerClass; typedef FVector<ParticleClass> ContainerClass;
typedef FFmbKernels<ParticleClass, CellClass, ContainerClass > KernelClass; //typedef FFmbKernels<ParticleClass, CellClass, ContainerClass > KernelClass;
typedef FElecForcesKernels<ParticleClass, CellClass, ContainerClass > KernelClass;
typedef FSimpleLeaf<ParticleClass, ContainerClass > LeafClass; typedef FSimpleLeaf<ParticleClass, ContainerClass > LeafClass;
typedef FOctree<ParticleClass, CellClass, ContainerClass , LeafClass > OctreeClass; typedef FOctree<ParticleClass, CellClass, ContainerClass , LeafClass > OctreeClass;
...@@ -30,6 +35,8 @@ class TestFmb : public FUTester<TestFmb> { ...@@ -30,6 +35,8 @@ class TestFmb : public FUTester<TestFmb> {
void TestTree(){ void TestTree(){
const int NbLevels = 5; const int NbLevels = 5;
const int SizeSubLevels = 3; const int SizeSubLevels = 3;
const int DevP = 12;
FComputeCell::Init(DevP);
FFmaBinLoader<ParticleClass> loader("../Data/utestFmb.bin.fma"); FFmaBinLoader<ParticleClass> loader("../Data/utestFmb.bin.fma");
if(!loader.isOpen()){ if(!loader.isOpen()){
...@@ -47,11 +54,11 @@ class TestFmb : public FUTester<TestFmb> { ...@@ -47,11 +54,11 @@ class TestFmb : public FUTester<TestFmb> {
} }
KernelClass kernels(NbLevels,loader.getBoxWidth()); KernelClass kernels(DevP,NbLevels,loader.getBoxWidth());
FmmClass algo(&testTree,&kernels); FmmClass algo(&testTree,&kernels);
algo.execute(); algo.execute();
//FTreeIO::Save<OctreeClass, CellClass, ParticleClass, FTreeIO::Copier<CellClass, ParticleClass> >("../UTests/data/fmb.data", testTree); FTreeIO::Save<OctreeClass, CellClass, ParticleClass, FTreeIO::Copier<CellClass, ParticleClass> >("../UTests/data/fmb.data", testTree);
OctreeClass goodTree(NbLevels, SizeSubLevels, loader.getBoxWidth(), loader.getCenterOfBox()); OctreeClass goodTree(NbLevels, SizeSubLevels, loader.getBoxWidth(), loader.getCenterOfBox());
FTreeIO::Load<OctreeClass, CellClass, ParticleClass, FTreeIO::Copier<CellClass, ParticleClass> >("../Data/utestFmb.data", goodTree); FTreeIO::Load<OctreeClass, CellClass, ParticleClass, FTreeIO::Copier<CellClass, ParticleClass> >("../Data/utestFmb.data", goodTree);
...@@ -116,10 +123,10 @@ class TestFmb : public FUTester<TestFmb> { ...@@ -116,10 +123,10 @@ class TestFmb : public FUTester<TestFmb> {
} }
assert( memcmp(testOctreeIterator.getCurrentCell()->getLocal(), assert( memcmp(testOctreeIterator.getCurrentCell()->getLocal(),
goodOctreeIterator.getCurrentCell()->getLocal(),CellClass::MultipoleSize * sizeof(FComplexe)) == 0); goodOctreeIterator.getCurrentCell()->getLocal(), CellClass::GetExp() * sizeof(FComplexe)) == 0);
assert( memcmp(testOctreeIterator.getCurrentCell()->getMultipole(), assert( memcmp(testOctreeIterator.getCurrentCell()->getMultipole(),
goodOctreeIterator.getCurrentCell()->getMultipole(),CellClass::MultipoleSize * sizeof(FComplexe)) == 0); goodOctreeIterator.getCurrentCell()->getMultipole(),CellClass::GetExp() * sizeof(FComplexe)) == 0);
if(!testOctreeIterator.moveRight()){ if(!testOctreeIterator.moveRight()){
if(goodOctreeIterator.moveRight()){ if(goodOctreeIterator.moveRight()){
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
*/ */
class IndexedParticle : public FmbParticle{ class IndexedParticle : public FmbParticle {
int index; int index;
public: public:
IndexedParticle(): index(-1){} IndexedParticle(): index(-1){}
......
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