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

Update the Ewal sum, it runs but the result are not equals!

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/scalfmm/scalfmm/trunk@328 2616d619-271b-44dc-8df4-d4a8f33a7222
parent 877d06e5
...@@ -122,8 +122,9 @@ public: ...@@ -122,8 +122,9 @@ public:
file >> fx >> fy >> fz; file >> fx >> fy >> fz;
inParticle.setPosition(x,y,z); inParticle.setPosition(x,y,z);
inParticle.setForces(fx,fy,fz); //inParticle.setForces(fx,fy,fz);
inParticle.setIndex(index); inParticle.setForces(vx,vy,vz);
inParticle.setIndex(index-1);
if( strncmp(type, "OW", 2) == 0){ if( strncmp(type, "OW", 2) == 0){
inParticle.setPhysicalValue(FReal(-0.82)); inParticle.setPhysicalValue(FReal(-0.82));
......
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
#include "../Src/Core/FFmmAlgorithmPeriodic.hpp" #include "../Src/Core/FFmmAlgorithmPeriodic.hpp"
#include "../Src/Components/FBasicKernels.hpp" #include "../Src/Kernels/FComputeCell.hpp"
#include "../Src/Fmb/FFmbKernels.hpp" #include "../Src/Kernels/FElecForcesKernels.hpp"
#include "../Src/Fmb/FFmbComponents.hpp" #include "../Src/Fmb/FFmbComponents.hpp"
#include "../Src/Files/FEwalLoader.hpp" #include "../Src/Files/FEwalLoader.hpp"
...@@ -61,12 +61,12 @@ public: ...@@ -61,12 +61,12 @@ public:
// Simply create particles and try the kernels // Simply create particles and try the kernels
int main(int argc, char ** argv){ int main(int argc, char ** argv){
typedef EwalParticle ParticleClass; typedef EwalParticle ParticleClass;
typedef FmbCell CellClass; typedef FComputeCell CellClass;
typedef FVector<ParticleClass> ContainerClass; typedef FVector<ParticleClass> ContainerClass;
typedef FSimpleLeaf<ParticleClass, ContainerClass > LeafClass; typedef FSimpleLeaf<ParticleClass, ContainerClass > LeafClass;
typedef FOctree<ParticleClass, CellClass, ContainerClass , LeafClass > OctreeClass; typedef FOctree<ParticleClass, CellClass, ContainerClass , LeafClass > OctreeClass;
typedef FBasicKernels<ParticleClass, CellClass, ContainerClass > KernelClass; typedef FElecForcesKernels<ParticleClass, CellClass, ContainerClass > KernelClass;
typedef FFmmAlgorithmPeriodic<OctreeClass, ParticleClass, CellClass, ContainerClass, KernelClass, LeafClass > FmmClass; typedef FFmmAlgorithmPeriodic<OctreeClass, ParticleClass, CellClass, ContainerClass, KernelClass, LeafClass > FmmClass;
...@@ -74,22 +74,16 @@ int main(int argc, char ** argv){ ...@@ -74,22 +74,16 @@ int main(int argc, char ** argv){
std::cout << ">> This executable has to be used to test fmb algorithm.\n"; std::cout << ">> This executable has to be used to test fmb algorithm.\n";
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
const int NbLevels = FParameters::getValue(argc,argv,"-h", 3); const int NbLevels = FParameters::getValue(argc,argv,"-h", 4);
const int SizeSubLevels = FParameters::getValue(argc,argv,"-sh", 2); const int SizeSubLevels = FParameters::getValue(argc,argv,"-sh", 2);
const int DevP = FParameters::getValue(argc,argv,"-P", 5);
const int BoundaryDeep = FParameters::getValue(argc,argv,"-bd", 5);
const char* const filename = FParameters::getStr(argc,argv,"-f", "../Data/testEwal417.dt");
FTic counter; FTic counter;
const char* const defaultFilename = "../Data/testEwal417.dt";
const char* filename;
if(argc == 1){ // -----------------------------------------------------
std::cout << "You have to give a .fma file in argument.\n";
std::cout << "The program will try a default file : " << defaultFilename << "\n";
filename = defaultFilename;
}
else{
filename = argv[1];
std::cout << "Opening : " << filename << "\n";
}
std::cout << "Opening : " << filename << "\n";
FEwalLoader<ParticleClass> loader(filename); FEwalLoader<ParticleClass> loader(filename);
if(!loader.isOpen()){ if(!loader.isOpen()){
std::cout << "Loader Error, " << filename << " is missing\n"; std::cout << "Loader Error, " << filename << " is missing\n";
...@@ -98,14 +92,14 @@ int main(int argc, char ** argv){ ...@@ -98,14 +92,14 @@ int main(int argc, char ** argv){
// ----------------------------------------------------- // -----------------------------------------------------
CellClass::Init(DevP);
OctreeClass tree(NbLevels, SizeSubLevels, loader.getBoxWidth(), loader.getCenterOfBox()); OctreeClass tree(NbLevels, SizeSubLevels, loader.getBoxWidth(), loader.getCenterOfBox());
// ----------------------------------------------------- // -----------------------------------------------------
std::cout << "Creating & Inserting " << loader.getNumberOfParticles() << " particles ..." << std::endl; std::cout << "Creating & Inserting " << loader.getNumberOfParticles() << " particles ..." << std::endl;
std::cout << "\tWidth : " << loader.getBoxWidth() << " \t center x : " << loader.getCenterOfBox().getX() std::cout << "\tWidth : " << loader.getBoxWidth() << " \t center x : " << loader.getCenterOfBox().getX()
<< " y : " << loader.getCenterOfBox().getY() << " z : " << loader.getCenterOfBox().getZ() << " y : " << loader.getCenterOfBox().getY() << " z : " << loader.getCenterOfBox().getZ() << std::endl;
<< std::endl;
std::cout << "\tHeight : " << NbLevels << " \t sub-height : " << SizeSubLevels << std::endl; std::cout << "\tHeight : " << NbLevels << " \t sub-height : " << SizeSubLevels << std::endl;
counter.tic(); counter.tic();
...@@ -114,7 +108,11 @@ int main(int argc, char ** argv){ ...@@ -114,7 +108,11 @@ int main(int argc, char ** argv){
for(int idxPart = 0 ; idxPart < loader.getNumberOfParticles() ; ++idxPart){ for(int idxPart = 0 ; idxPart < loader.getNumberOfParticles() ; ++idxPart){
loader.fillParticle(particles[idxPart]); loader.fillParticle(particles[idxPart]);
tree.insert(particles[idxPart]); // reset forces and insert in the tree
ParticleClass part = particles[idxPart];
part.setForces(0,0,0);
part.setPotential(0);
tree.insert(part);
} }
counter.tac(); counter.tac();
...@@ -125,9 +123,8 @@ int main(int argc, char ** argv){ ...@@ -125,9 +123,8 @@ int main(int argc, char ** argv){
std::cout << "Working on particles ..." << std::endl; std::cout << "Working on particles ..." << std::endl;
counter.tic(); counter.tic();
//KernelClass kernels(NbLevels,loader.getBoxWidth()); KernelClass kernels(DevP, NbLevels,loader.getBoxWidth(),BoundaryDeep);
KernelClass kernels; FmmClass algo(&tree,&kernels,BoundaryDeep);
FmmClass algo(&tree,&kernels);
algo.execute(); algo.execute();
counter.tac(); counter.tac();
...@@ -140,13 +137,15 @@ int main(int argc, char ** argv){ ...@@ -140,13 +137,15 @@ int main(int argc, char ** argv){
do{ do{
typename ContainerClass::ConstBasicIterator iter(*octreeIterator.getCurrentListTargets()); typename ContainerClass::ConstBasicIterator iter(*octreeIterator.getCurrentListTargets());
while( iter.hasNotFinished() ){ while( iter.hasNotFinished() ){
///potential += iter.data().getPotential() * iter.data().getPhysicalValue(); std::cout << ">> index " << iter.data().getIndex() << " type " << iter.data().getType() << std::endl;
///forces += iter.data().getForces();
std::cout << "index " << iter.data().getIndex() << " type " << iter.data().getType() << std::endl;
std::cout << "x " << iter.data().getPosition().getX() << " y " << iter.data().getPosition().getY() << " z " << iter.data().getPosition().getZ() << std::endl; std::cout << "x " << iter.data().getPosition().getX() << " y " << iter.data().getPosition().getY() << " z " << iter.data().getPosition().getZ() << std::endl;
std::cout << "fx " << iter.data().getForces().getX() << " fy " << iter.data().getForces().getY() << " fz " << iter.data().getForces().getZ() << std::endl; std::cout << "fx " << iter.data().getForces().getX() << " fy " << iter.data().getForces().getY() << " fz " << iter.data().getForces().getZ() << std::endl;
std::cout << "potential " << iter.data().getPhysicalValue() << std::endl; std::cout << "physical value " << iter.data().getPhysicalValue() << " potential " << iter.data().getPotential() << std::endl;
const ParticleClass& part = particles[iter.data().getIndex()];
std::cout << "x " << part.getPosition().getX() << " y " << part.getPosition().getY() << " z " << part.getPosition().getZ() << std::endl;
std::cout << "fx " <<part.getForces().getX() << " fy " << part.getForces().getY() << " fz " << part.getForces().getZ() << std::endl;
std::cout << "physical value " << part.getPhysicalValue() << " potential " << part.getPotential() << std::endl;
iter.gotoNext(); iter.gotoNext();
} }
......
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