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:
file >> fx >> fy >> fz;
inParticle.setPosition(x,y,z);
inParticle.setForces(fx,fy,fz);
inParticle.setIndex(index);
//inParticle.setForces(fx,fy,fz);
inParticle.setForces(vx,vy,vz);
inParticle.setIndex(index-1);
if( strncmp(type, "OW", 2) == 0){
inParticle.setPhysicalValue(FReal(-0.82));
......
......@@ -13,8 +13,8 @@
#include "../Src/Core/FFmmAlgorithmPeriodic.hpp"
#include "../Src/Components/FBasicKernels.hpp"
#include "../Src/Fmb/FFmbKernels.hpp"
#include "../Src/Kernels/FComputeCell.hpp"
#include "../Src/Kernels/FElecForcesKernels.hpp"
#include "../Src/Fmb/FFmbComponents.hpp"
#include "../Src/Files/FEwalLoader.hpp"
......@@ -61,12 +61,12 @@ public:
// Simply create particles and try the kernels
int main(int argc, char ** argv){
typedef EwalParticle ParticleClass;
typedef FmbCell CellClass;
typedef FComputeCell CellClass;
typedef FVector<ParticleClass> ContainerClass;
typedef FSimpleLeaf<ParticleClass, ContainerClass > LeafClass;
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;
......@@ -74,22 +74,16 @@ int main(int argc, char ** argv){
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 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;
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);
if(!loader.isOpen()){
std::cout << "Loader Error, " << filename << " is missing\n";
......@@ -98,14 +92,14 @@ int main(int argc, char ** argv){
// -----------------------------------------------------
CellClass::Init(DevP);
OctreeClass tree(NbLevels, SizeSubLevels, loader.getBoxWidth(), loader.getCenterOfBox());
// -----------------------------------------------------
std::cout << "Creating & Inserting " << loader.getNumberOfParticles() << " particles ..." << std::endl;
std::cout << "\tWidth : " << loader.getBoxWidth() << " \t center x : " << loader.getCenterOfBox().getX()
<< " y : " << loader.getCenterOfBox().getY() << " z : " << loader.getCenterOfBox().getZ()
<< std::endl;
<< " y : " << loader.getCenterOfBox().getY() << " z : " << loader.getCenterOfBox().getZ() << std::endl;
std::cout << "\tHeight : " << NbLevels << " \t sub-height : " << SizeSubLevels << std::endl;
counter.tic();
......@@ -114,7 +108,11 @@ int main(int argc, char ** argv){
for(int idxPart = 0 ; idxPart < loader.getNumberOfParticles() ; ++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();
......@@ -125,9 +123,8 @@ int main(int argc, char ** argv){
std::cout << "Working on particles ..." << std::endl;
counter.tic();
//KernelClass kernels(NbLevels,loader.getBoxWidth());
KernelClass kernels;
FmmClass algo(&tree,&kernels);
KernelClass kernels(DevP, NbLevels,loader.getBoxWidth(),BoundaryDeep);
FmmClass algo(&tree,&kernels,BoundaryDeep);
algo.execute();
counter.tac();
......@@ -140,13 +137,15 @@ int main(int argc, char ** argv){
do{
typename ContainerClass::ConstBasicIterator iter(*octreeIterator.getCurrentListTargets());
while( iter.hasNotFinished() ){
///potential += iter.data().getPotential() * iter.data().getPhysicalValue();
///forces += iter.data().getForces();
std::cout << "index " << iter.data().getIndex() << " type " << iter.data().getType() << std::endl;
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 << "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();
}
......
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