Commit 7e5da75a authored by berenger-bramas's avatar berenger-bramas

Clean the code and add comments.

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/scalfmm/scalfmm/trunk@324 2616d619-271b-44dc-8df4-d4a8f33a7222
parent 802050d0
......@@ -26,10 +26,12 @@ public:
virtual ~FTestParticle(){
}
/** Get the down data */
long long int getDataDown() const {
return this->dataDown;
}
/** Set down data */
void setDataDown(const long long int inData){
this->dataDown = inData;
}
......
......@@ -9,6 +9,8 @@
* @author Berenger Bramas (berenger.bramas@inria.fr)
* @class FBoolArray
* Please read the license
*
* A bool array is a dynamique allocated array that used 1 bit per value.
*/
class FBoolArray{
/** Size of a unsigned long */
......
......@@ -105,6 +105,18 @@ public:
}
}
/** Use a loader to be filled
* @param the loader to fill the current tree
*/
template <class LoaderClass>
void fillWithLoader(LoaderClass& loader){
ParticleClass particleToFill;
for(int idxPart = 0 ; idxPart < loader.getNumberOfParticles() ; ++idxPart){
loader.fillParticle(particleToFill);
insert(particleToFill);
}
}
/** Desctructor */
virtual ~FOctree() {
delete [] boxWidthAtLevel;
......
......@@ -2,7 +2,7 @@
#define FASSERTABLE_HPP
// [--License--]
#include <stdlib.h>
#include <cstdlib>
#include <sstream>
#include <iostream>
......
#ifndef FBLAS_HPP
#define FBLAS_HPP
// This file interfaces the blas function
// This file interfaces the blas functions
// to enable a generic use.
//
// If no blas has been enabled in the cmake,
// the function will be empty
///////////////////////////////////////////////////////
// Manage Blas Version
......
......@@ -13,7 +13,7 @@
// Stdlib
///////////////////////////////////////////////////////
#include <stdlib.h>
#include <cstdlib>
///////////////////////////////////////////////////////
// Operating System
......
#include "FMath.hpp"
// Constant values
const FReal FMath::FPi = FReal(M_PI);
const FReal FMath::FPiDiv2 = FReal(M_PI_2);
const FReal FMath::Epsilon = FReal(0.00000000000000000001);
......
......@@ -3,9 +3,15 @@
#include "FGlobal.hpp"
#include <stdlib.h>
#include <cstdlib>
#include <cstring>
/** Memstat has to be enabled in the cmake,
* then it will use the know each allocate and deallocate
* and give simple stats like max, total used, current used
*/
#ifdef SCALFMM_USE_MEM_STATS
#include <new>
#include <stdexcept>
......@@ -55,32 +61,40 @@ private:
#endif
public:
/** Singleton */
static FMemStats controler;
/** return the max that has been allocated */
unsigned long long getMaxAllocated() const{
return maxAllocated;
}
/** return the total memory allocated during the running */
unsigned long long getTotalAllocated() const{
return totalAllocated;
}
/** return the current size allcoated */
std::size_t getCurrentAllocated() const{
return currentAllocated;
}
/** get the max in MB */
float getMaxAllocatedMB() const{
return float(getMaxAllocated()) / 1024 / 1024;
}
/** get the total in MB */
float getTotalAllocatedMB() const{
return float(getTotalAllocated()) / 1024 / 1024;
}
/** get the current in MB */
float getCurrentAllocatedMB() const{
return float(getCurrentAllocated()) / 1024 / 1024;
}
/** To know if mem stat has been enabled */
bool isUsed() const {
#ifdef SCALFMM_USE_MEM_STATS
return true;
......
......@@ -7,9 +7,14 @@
#include <cstring>
#include <climits>
/** The memory utils class proposes some methods
* to copy/set memory with an size bigger than size_t
*/
namespace FMemUtils {
static const FSize MaxSize_t = UINT_MAX; //std::numeric_limits<std::size_t>::max();
/** memcpy */
static void* memcpy(void* const dest, const void* const source, const FSize nbBytes){
if( nbBytes < MaxSize_t){
return ::memcpy(dest, source, size_t(nbBytes));
......@@ -29,6 +34,7 @@ namespace FMemUtils {
}
}
/** memset */
static void* memset(void* const dest, const int val, const FSize nbBytes){
if( nbBytes < MaxSize_t){
return ::memset(dest, val, size_t(nbBytes));
......@@ -46,6 +52,7 @@ namespace FMemUtils {
}
}
/** copy all value from one vector to the other */
template <class TypeClass>
void copyall(TypeClass*const dest, const TypeClass*const source, const int nbElements){
for(int idx = 0 ; idx < nbElements ; ++idx){
......
......@@ -8,9 +8,14 @@
* This class is currently in its minimum version
*/
class FSpherical {
FReal r, cosTheta, sinTheta, phi;
// The attributes of a sphere
FReal r;
FReal cosTheta;
FReal sinTheta;
FReal phi;
public:
/** From now, we just need a constructor based on a 3D position */
explicit FSpherical(const F3DPosition& inVector){
const FReal x2y2 = (inVector.getX() * inVector.getX()) + (inVector.getY() * inVector.getY());
this->r = FMath::Sqrt( x2y2 + (inVector.getZ() * inVector.getZ()));
......@@ -19,18 +24,22 @@ public:
this->sinTheta = FMath::Sqrt(x2y2) / r;
}
/** Get the rayon */
FReal getR() const{
return r;
}
/** Get the cos theta = z / r */
FReal getCosTheta() const{
return cosTheta;
}
/** Get the sin theta = sqrt(x2y2) / r */
FReal getSinTheta() const{
return sinTheta;
}
/** Get the phi = atan2(y,x) */
FReal getPhi() const{
return phi;
}
......
......@@ -2,8 +2,6 @@
#include "../Src/Utils/FDebug.hpp"
// Compile by : g++ testDebug.cpp ../Src/Utils/FDebug.cpp -o testDebug.exe
/**
* In this file we show how to use the debug module.
* Warning, in FGlobal.hpp (included in FDebug.hpp) SCALFMM_USE_DEBUG might be undefined.
......
......@@ -2,8 +2,8 @@
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#include <cstdlib>
#include "../Src/Utils/FTic.hpp"
#include "../Src/Utils/FParameters.hpp"
......@@ -20,12 +20,9 @@
#include "../Src/Files/FFmaLoader.hpp"
// With openmp : g++ testFmbAlgorithm.cpp ../Src/Utils/FDebug.cpp ../Src/Utils/FTrace.cpp -lgomp -fopenmp -O2 -o testFmbAlgorithm.exe
// icpc -openmp -openmp-lib=compat testFmbAlgorithm.cpp ../Src/Utils/FAssertable.cpp ../Src/Utils/FDebug.cpp -O2 -o testFmbAlgorithm.exe
/** This program show an example of use of
* the fmm basic algo
* it also check that eachh particles is little or longer
* it also check that each particles is little or longer
* related that each other
*/
......
......@@ -24,31 +24,18 @@
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#include <cstdlib>
// Uncoment to validate the FMM
//#define VALIDATE_FMM
// With openmp : mpicxx -g testFmbAlgorithmProc.cpp ../Src/Utils/FDebug.cpp ../Src/Utils/FTrace.cpp ../Src/Utils/FMath.cpp ../Src/Utils/F3DPosition.cpp -lgomp -fopenmp -O2 -o testFmbAlgorithmProc.exe
// mpicxx -openmp testFmbAlgorithmProc.cpp ../Src/Utils/FDebug.cpp ../Src/Utils/FTrace.cpp ../Src/Utils/FMath.cpp ../Src/Utils/F3DPosition.cpp -O2 -o testFmbAlgorithmProc.exe
// mpirun -perhost 1 -trace -l -np 8 ../testFmbAlgorithmProc.exe /lustre/bramas/200kk.fma.bin -h 9
// mpirun -np 3 `eztrace -e ./Tests/Debug/testFmbAlgorithmProc ../Data/testFMAlgorithm.fma.tmp `
// eztrace_convert -o my_paje /tmp/berenger_eztrace_log_rank_0 /tmp/berenger_eztrace_log_rank_1 /tmp/berenger_eztrace_log_rank_2
//mpicxx -I$VT_ROOT/include -trace -openmp testFmbAlgorithmProc.cpp ../Src/Utils/FDebug.cpp ../Src/Utils/FTrace.cpp ../Src/Utils/FMath.cpp ../Src/Utils/F3DPosition.cpp -O2 -o testFmbAlgorithmProc.exe
// mpirun -np 8 -npernode 1 -output-filename tempmpi/out.mpi.temp `eztrace -e ./testFmbAlgorithmProc.exe /lustre/bramas/200kk.fma.bin -h 9`
// eztrace_convert -o my_paje /tmp/berenger_eztrace_log_rank_0 /tmp/berenger_eztrace_log_rank_1 /tmp/berenger_eztrace_log_rank_2 /tmp/berenger_eztrace_log_rank_3 /tmp/berenger_eztrace_log_rank_4 /tmp/berenger_eztrace_log_rank_5 /tmp/berenger_eztrace_log_rank_6 /tmp/berenger_eztrace_log_rank_7
/** This program show an example of use of
* the fmm basic algo
* it also check that eachh particles is little or longer
* the fmm basic algo it also check that eachh particles is little or longer
* related that each other
*/
///////////////////////////////////////////////////////
// to test equality between good and potentialy bad solution
///////////////////////////////////////////////////////
......
......@@ -2,8 +2,8 @@
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#include <cstdlib>
#include "../Src/Utils/FTic.hpp"
#include "../Src/Utils/FParameters.hpp"
......@@ -24,12 +24,6 @@
#include "../Src/Files/FFmaScanfLoader.hpp"
// With openmp : g++ testFmbBlasAlgorithm.cpp ../Src/Utils/FDebug.cpp ../Src/Utils/FTrace.cpp -lgomp -fopenmp -lcblas -O2 -o testFmbBlasAlgorithm.exe
// icpc -openmp -openmp-lib=compat testFmbAlgorithm.cpp ../Src/Utils/FAssertable.cpp ../Src/Utils/FDebug.cpp -O2 -o testFmbAlgorithm.exe
// icpc -openmp -openmp-lib=compat -lmkl_intel_lp64 -lmkl_sequential -lmkl_core testFmbBlasAlgorithm.cpp ../Src/Utils/FAssertable.cpp ../Src/Utils/FDebug.cpp -O2 -o testFmbBlasAlgorithm.exe
// g++ testFmbBlasAlgorithm.cpp ../Src/Utils/FAssertable.cpp ../Src/Utils/FDebug.cpp ../Src/Utils/FTrace.cpp -lgomp -fopenmp -lmkl_ia32 -O2 -o testFmbBlasAlgorithm.exe
/** This program show an example of use of
* the fmm basic algo
* it also check that eachh particles is little or longer
......
......@@ -2,8 +2,8 @@
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#include <cstdlib>
#include "../Src/Utils/FTic.hpp"
#include "../Src/Utils/FParameters.hpp"
......@@ -19,8 +19,12 @@
#include "../Src/Files/FEwalLoader.hpp"
/** Ewal particle is used in the gadget program
* here we try to make the same simulation
*/
class EwalParticle : public FmbParticle {
public:
// Type of particle
enum Type{
OW,
HW,
......@@ -28,10 +32,11 @@ public:
};
private:
Type type;
int index;
Type type; //< current type
int index; //< current index in array
public:
// Basic constructor
EwalParticle() : type(Undefined), index(-1) {
}
......@@ -128,6 +133,7 @@ int main(int argc, char ** argv){
counter.tac();
std::cout << "Done " << "(@Algorithm = " << counter.elapsed() << "s)." << std::endl;
// -----------------------------------------------------
{
typename OctreeClass::Iterator octreeIterator(&tree);
octreeIterator.gotoBottomLeft();
......
......@@ -2,8 +2,8 @@
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#include <cstdlib>
#include "../Src/Utils/FTic.hpp"
#include "../Src/Utils/FParameters.hpp"
......@@ -20,9 +20,6 @@
#include "../Src/Files/FFmaTsmLoader.hpp"
// With openmp : g++ testFmbTsmAlgorithm.cpp ../Src/Utils/FDebug.cpp ../Src/Utils/FTrace.cpp -lgomp -fopenmp -O2 -o testFmbTsmAlgorithm.exe
// icpc -openmp -openmp-lib=compat testFmbTsmAlgorithm.cpp ../Src/Utils/FAssertable.cpp ../Src/Utils/FDebug.cpp -O2 -o testFmbTsmAlgorithm.exe
/** This program show an example of use of
* the fmm basic algo
* it also check that eachh particles is little or longer
......
......@@ -2,8 +2,8 @@
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#include <cstdlib>
#include "../Src/Utils/FTic.hpp"
#include "../Src/Utils/FParameters.hpp"
......@@ -24,10 +24,6 @@
#include "../Src/Components/FTypedLeaf.hpp"
// With openmp : g++ testFmbTsmNoTsm.cpp ../Src/Utils/FDebug.cpp ../Src/Utils/FTrace.cpp -lgomp -fopenmp -O2 -o testFmbTsmNoTsm.exe
// icpc -openmp -openmp-lib=compat testFmbTsmAlgorithm.cpp ../Src/Utils/FAssertable.cpp ../Src/Utils/FDebug.cpp -O2 -o testFmbTsmAlgorithm.exe
/** This program show an example of use of
* the fmm basic algo
* it also check that eachh particles is little or longer
......
// [--License--]
#include <iostream>
#include <cstdio>
#include <stdio.h>
#include <stdlib.h>
#include "../Src/Utils/FParameters.hpp"
#include "../Src/Utils/FTic.hpp"
......@@ -23,17 +22,15 @@
#include "../Src/Core/FFmmAlgorithmThread.hpp"
#include "../Src/Core/FFmmAlgorithmTask.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
#include "../Src/Files/FRandomLoader.hpp"
/** This program show an example of use of
* the fmm basic algo
/** This program show an example of use of the fmm basic algo
* it also check that each particles is impacted each other particles
*/
// Simply create particles and try the kernels
int main(int argc, char ** argv){
typedef FTestParticle ParticleClass;
......@@ -46,6 +43,7 @@ int main(int argc, char ** argv){
// FFmmAlgorithmTask FFmmAlgorithmThread
typedef FFmmAlgorithmTask<OctreeClass, ParticleClass, CellClass, ContainerClass, KernelClass, LeafClass > FmmClass;
///////////////////////What we do/////////////////////////////
std::cout << ">> This executable has to be used to test the FMM algorithm.\n";
//////////////////////////////////////////////////////////////
......@@ -53,16 +51,13 @@ int main(int argc, char ** argv){
const int NbLevels = FParameters::getValue(argc,argv,"-h", 7);
const int SizeSubLevels = FParameters::getValue(argc,argv,"-sh", 3);
const long NbPart = FParameters::getValue(argc,argv,"-nb", 2000000);
const FReal FRandMax = FReal(RAND_MAX);
FTic counter;
srand ( 1 ); // volontary set seed to constant
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
OctreeClass tree(NbLevels, SizeSubLevels, 1.0, F3DPosition(0.5,0.5,0.5));
FRandomLoader<ParticleClass> loader(NbPart, 1, F3DPosition(0.5,0.5,0.5), 1);
OctreeClass tree(NbLevels, SizeSubLevels, loader.getBoxWidth(), loader.getCenterOfBox());
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
......@@ -71,13 +66,7 @@ int main(int argc, char ** argv){
std::cout << "\tHeight : " << NbLevels << " \t sub-height : " << SizeSubLevels << std::endl;
counter.tic();
{
FTestParticle particleToFill;
for(int idxPart = 0 ; idxPart < NbPart ; ++idxPart){
particleToFill.setPosition(FReal(rand())/FRandMax,FReal(rand())/FRandMax,FReal(rand())/FRandMax);
tree.insert(particleToFill);
}
}
tree.fillWithLoader(loader);
counter.tac();
std::cout << "Done " << "(@Creating and Inserting Particles = " << counter.elapsed() << "s)." << std::endl;
......@@ -88,10 +77,8 @@ int main(int argc, char ** argv){
std::cout << "Working on particles ..." << std::endl;
counter.tic();
// FTestKernels FBasicKernels
KernelClass kernels;
//FFmmAlgorithm FFmmAlgorithmThread
FmmClass algo(&tree,&kernels);
KernelClass kernels; // FTestKernels FBasicKernels
FmmClass algo(&tree,&kernels); //FFmmAlgorithm FFmmAlgorithmThread
algo.execute();
counter.tac();
......
......@@ -3,8 +3,8 @@
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#include <cstdlib>
#include "../Src/Utils/FParameters.hpp"
#include "../Src/Utils/FTic.hpp"
......@@ -22,9 +22,6 @@
#include "../Src/Core/FFmmAlgorithmPeriodic.hpp"
// Compile by : g++ testFmmAlgorithm.cpp ../Src/Utils/FDebug.cpp ../Src/Utils/FTrace.cpp -lgomp -fopenmp -O2 -o testFmmAlgorithm.exe
/** This program show an example of use of
* the fmm basic algo
* it also check that each particles is impacted each other particles
......
......@@ -29,15 +29,11 @@
#include "../Src/Components/FBasicKernels.hpp"
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <stdio.h>
#include <stdlib.h>
// Compile by : g++ testFmmAlgorithmProc.cpp ../Src/Utils/FDebug.cpp ../Src/Utils/FTrace.cpp -lgomp -fopenmp -O2 -o testFmmAlgorithmProc.exe
/** This program show an example of use of
* the fmm threaded + mpi algo
/** This program show an example of use of the fmm threaded + mpi algo
* it also check that each particles is impacted each other particles
*/
......@@ -366,11 +362,7 @@ int main(int argc, char ** argv){
//////////////////////////////////////////////////////////////////////////////////
}
else{
ParticleClass partToInsert;
for(FSize idxPart = 0 ; idxPart < loader.getNumberOfParticles() ; ++idxPart){
loader.fillParticle(partToInsert);
realTree.insert(partToInsert);
}
realTree.fillWithLoader(loader);
}
//////////////////////////////////////////////////////////////////////////////////
......@@ -380,11 +372,7 @@ int main(int argc, char ** argv){
OctreeClass treeValide(NbLevels, SizeSubLevels,loader.getBoxWidth(),loader.getCenterOfBox());
{
FFmaBinLoader<ParticleClass> loaderSeq(filename);
ParticleClass partToInsert;
for(FSize idxPart = 0 ; idxPart < loaderSeq.getNumberOfParticles() ; ++idxPart){
loaderSeq.fillParticle(partToInsert);
treeValide.insert(partToInsert);
}
treeValide.fillWithLoader(loaderSeq);
}
//////////////////////////////////////////////////////////////////////////////////
......
......@@ -3,8 +3,8 @@
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#include <cstdlib>
#include "../Src/Utils/FParameters.hpp"
#include "../Src/Utils/FTic.hpp"
......@@ -26,7 +26,6 @@
#include "../Src/Utils/FAbstractSendable.hpp"
// Compile by : g++ testFmmAlgorithm.cpp ../Src/Utils/FDebug.cpp ../Src/Utils/FTrace.cpp -lgomp -fopenmp -O2 -o testFmmAlgorithm.exe
/** This program show an example of use of
* the fmm basic algo
......
......@@ -2,8 +2,8 @@
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#include <cstdlib>
#include "../Src/Utils/FTic.hpp"
......@@ -27,7 +27,7 @@
#include "../Src/Components/FBasicKernels.hpp"
// Compile by : g++ testFmmAlgorithmTsm.cpp ../Src/Utils/FDebug.cpp ../Src/Utils/FTrace.cpp -lgomp -fopenmp -O2 -o testFmmAlgorithmTsm.exe
#include "../Src/Files/FRandomLoader.hpp"
/** This program show an example of use of
* the fmm basic algo
......@@ -58,32 +58,22 @@ int main(int argc, char ** argv){
const int NbLevels = FParameters::getValue(argc,argv,"-h", 5);
const int SizeSubLevels = FParameters::getValue(argc,argv,"-sh", 3);
const long NbPart = 2000000;//2000000
const FReal FRandMax = FReal(RAND_MAX);
const long NbPart = FParameters::getValue(argc,argv,"-nb", 2000000);
FTic counter;
srand ( 1 ); // volontary set seed to constant
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
OctreeClassTyped tree(NbLevels, SizeSubLevels,1.0,F3DPosition(0.5,0.5,0.5));
FRandomLoaderTsm<ParticleClassTyped> loader(NbPart, 1, F3DPosition(0.5,0.5,0.5), 1);
OctreeClassTyped tree(NbLevels, SizeSubLevels,loader.getBoxWidth(),loader.getCenterOfBox());
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
std::cout << "Creating " << NbPart << " particles ..." << std::endl;
counter.tic();
{
ParticleClassTyped particle;
for(long idxPart = 0 ; idxPart < NbPart ; ++idxPart){
particle.setPosition(FReal(rand())/FRandMax,FReal(rand())/FRandMax,FReal(rand())/FRandMax);
if(rand() > RAND_MAX/2) particle.setAsTarget();
else particle.setAsSource();
tree.insert(particle);
}
}
tree.fillWithLoader(loader);
counter.tac();
std::cout << "Done " << "(@Creating and Inserting Particles = " << counter.elapsed() << "s)." << std::endl;
......
......@@ -2,8 +2,8 @@
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#include <cstdlib>
#include "../Src/Utils/FParameters.hpp"
#include "../Src/Utils/FTic.hpp"
......@@ -26,7 +26,7 @@
#include "../Src/Components/FBasicKernels.hpp"
// Compile by : g++ testFmmDemonstration.cpp ../Src/Utils/FDebug.cpp ../Src/Utils/FTrace.cpp -lgomp -fopenmp -O2 -o testFmmDemonstration.exe
#include "../Src/Files/FRandomLoader.hpp"
// My cell is actually a basic cell => minimum of data
class MyCell : public FBasicCell {
......@@ -124,16 +124,13 @@ int main(int argc, char ** argv){
const int NbLevels = FParameters::getValue(argc,argv,"-h", 5);
const int SizeSubLevels = FParameters::getValue(argc,argv,"-sh", 3);
const long NbPart = FParameters::getValue(argc,argv,"-pn", 20L);
const FReal FRandMax = FReal(RAND_MAX);
FTic counter;
srand ( 1 );
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
OctreeClass tree(NbLevels, SizeSubLevels,1.0,F3DPosition(0.5,0.5,0.5));
FRandomLoader<ParticleClass> loader(NbPart, 1, F3DPosition(0.5,0.5,0.5), 1);
OctreeClass tree(NbLevels, SizeSubLevels,loader.getBoxWidth(),loader.getCenterOfBox());
FBasicParticle*const realsParticles = new FBasicParticle[NbPart];
//////////////////////////////////////////////////////////////////////////////////
......@@ -145,12 +142,14 @@ int main(int argc, char ** argv){
{
ParticleClass particleToFill;
for(int idxPart = 0 ; idxPart < NbPart ; ++idxPart){
particleToFill.setPosition(FReal(rand())/FRandMax,FReal(rand())/FRandMax,FReal(rand())/FRandMax);
for(int idxPart = 0 ; idxPart < loader.getNumberOfParticles() ; ++idxPart){
// get a random position
loader.fillParticle(particleToFill);
// put the index inside
particleToFill.setIndex(idxPart);
// insert in the tree
tree.insert(particleToFill);
// copy in the array
realsParticles[idxPart].setPosition(particleToFill.getPosition());
}
}
......
......@@ -2,8 +2,8 @@
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#include <cstdlib>
#include <time.h>
#include "../Src/Utils/FTic.hpp"
......@@ -22,12 +22,8 @@
#include "../Src/Files/FBasicLoader.hpp"
// Compile by : g++ testLoader.cpp ../Src/Utils/FDebug.cpp ../Src/Utils/FTrace.cpp -O2 -o testLoader.exe
/**
* In this file we show an example of FBasicLoader use
* Démarrage de /home/berenger/Dropbox/Personnel/FMB++/FMB++-build-desktop/FMB++...
* Inserting 2000000 particles ...
* Done (5.77996).
* Deleting particles ...
......
......@@ -3,8 +3,8 @@
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#include <cstdlib>
#include <time.h>
#include "../Src/Utils/FGlobal.hpp"
......
......@@ -2,8 +2,8 @@
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#include <cstdlib>
#include <time.h>
#include "../Src/Utils/FParameters.hpp"
......
......@@ -4,14 +4,13 @@
#include <fstream>
#include <cstdio>
#include <stdlib.h>
#include <cstdlib>
#include <time.h>
#include "../Src/Utils/FGlobal.hpp"
#include "../Src/Utils/FParameters.hpp"
// This file can generate basic particles files in the FMA format
// g++ testLoaderFMACreate.cpp -o testLoaderFMACreate.exe
int main(int argc, char ** argv){
///////////////////////What we do/////////////////////////////
......@@ -79,10 +78,6 @@ int main(int argc, char ** argv){
data[1] = ((FReal(rand())/FRandMax) * BoxWidth * 2) + YCenter - BoxWidth;
data[2] = ((FReal(rand())/FRandMax) * BoxWidth * 2) + ZCenter - BoxWidth;
/*data[0] = ((FReal(idx)/NbParticles) * BoxWidth * 2) + XCenter - BoxWidth;
data[1] = ((FReal(idx)/NbParticles) * BoxWidth * 2) + YCenter - BoxWidth;