Commit d7f4fe48 authored by Martin Khannouz's avatar Martin Khannouz Committed by Berenger Bramas

Fix an error generating particles.

parent dec0649c
...@@ -113,12 +113,10 @@ int main(int argc, char* argv[]){ ...@@ -113,12 +113,10 @@ int main(int argc, char* argv[]){
#ifndef LOAD_FILE #ifndef LOAD_FILE
FReal boxWidth = 1.0; FReal boxWidth = 1.0;
{ {
FRandomLoader<FReal> loader(NbParticles, boxWidth, FPoint<FReal>(0,0,0), mpiComm.global().processId());
FAssertLF(loader.isOpen());
FSize idxPart = 0; FSize idxPart = 0;
for(int i = 0; i < mpiComm.global().processCount(); ++i){ for(int i = 0; i < mpiComm.global().processCount(); ++i){
FSize NbParticlesPerNode = getNbParticlesPerNode(nproc, i, NbParticles); FSize NbParticlesPerNode = getNbParticlesPerNode(mpiComm.global().processCount(), i, NbParticles);
setSeed(i); setSeed(i+1);//Add +1 so the seed given is never 0 which correspond to random
FReal * tmpParticles = new FReal[4*NbParticlesPerNode]; FReal * tmpParticles = new FReal[4*NbParticlesPerNode];
if(FParameters::existParameter(argc, argv, "-ellipsoid")) { if(FParameters::existParameter(argc, argv, "-ellipsoid")) {
nonunifRandonPointsOnElipsoid(NbParticlesPerNode, boxWidth/2, boxWidth/4, boxWidth/8, tmpParticles); nonunifRandonPointsOnElipsoid(NbParticlesPerNode, boxWidth/2, boxWidth/4, boxWidth/8, tmpParticles);
...@@ -156,7 +154,15 @@ int main(int argc, char* argv[]){ ...@@ -156,7 +154,15 @@ int main(int argc, char* argv[]){
} }
// Put the data into the tree // Put the data into the tree
//GroupOctreeClass groupedTree(NbLevels, loader.getBoxWidth(), loader.getCenterOfBox(), groupSize, &allParticles, true);
for(int i =0; i<sizeForEachGroup.size(); ++i)
{
for(int j =0; j<sizeForEachGroup[i].size(); ++j)
cout << sizeForEachGroup[i][j] << " ";
cout << endl;
}
GroupOctreeClass groupedTree(NbLevels, loader.getBoxWidth(), loader.getCenterOfBox(), groupSize, &allParticles, sizeForEachGroup, true); GroupOctreeClass groupedTree(NbLevels, loader.getBoxWidth(), loader.getCenterOfBox(), groupSize, &allParticles, sizeForEachGroup, true);
groupedTree.printInfoBlocks();
// Run the algorithm // Run the algorithm
int operationsToProceed = FFmmP2M | FFmmM2M | FFmmM2L | FFmmL2L | FFmmL2P | FFmmP2P; int operationsToProceed = FFmmP2M | FFmmM2M | FFmmM2L | FFmmL2L | FFmmL2P | FFmmP2P;
......
...@@ -116,7 +116,7 @@ int main(int argc, char* argv[]){ ...@@ -116,7 +116,7 @@ int main(int argc, char* argv[]){
FRandomLoader<FReal> loader(NbParticles, boxWidth, FPoint<FReal>(0,0,0), mpiComm.global().processId()); FRandomLoader<FReal> loader(NbParticles, boxWidth, FPoint<FReal>(0,0,0), mpiComm.global().processId());
FAssertLF(loader.isOpen()); FAssertLF(loader.isOpen());
setSeed(mpiComm.global().processId()); setSeed(mpiComm.global().processId()+1);
TestParticle* allParticles = new TestParticle[loader.getNumberOfParticles()]; TestParticle* allParticles = new TestParticle[loader.getNumberOfParticles()];
FReal * tmpParticles = new FReal[4*loader.getNumberOfParticles()]; FReal * tmpParticles = new FReal[4*loader.getNumberOfParticles()];
memset(allParticles,0,(unsigned int) (sizeof(TestParticle)* loader.getNumberOfParticles())); memset(allParticles,0,(unsigned int) (sizeof(TestParticle)* loader.getNumberOfParticles()));
......
...@@ -92,7 +92,7 @@ int main(int argc, char* argv[]){ ...@@ -92,7 +92,7 @@ int main(int argc, char* argv[]){
FRandomLoader<FReal> loader(NbParticles, boxWidth, FPoint<FReal>(0,0,0), mpiComm.global().processId()); FRandomLoader<FReal> loader(NbParticles, boxWidth, FPoint<FReal>(0,0,0), mpiComm.global().processId());
FAssertLF(loader.isOpen()); FAssertLF(loader.isOpen());
setSeed(mpiComm.global().processId()); setSeed(mpiComm.global().processId()+1);
TestParticle* allParticles = new TestParticle[loader.getNumberOfParticles()]; TestParticle* allParticles = new TestParticle[loader.getNumberOfParticles()];
FReal * tmpParticles = new FReal[4*loader.getNumberOfParticles()]; FReal * tmpParticles = new FReal[4*loader.getNumberOfParticles()];
memset(allParticles,0,(unsigned int) (sizeof(TestParticle)* loader.getNumberOfParticles())); memset(allParticles,0,(unsigned int) (sizeof(TestParticle)* loader.getNumberOfParticles()));
......
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