Commit 179277ee authored by berenger-bramas's avatar berenger-bramas

Add a border when created fma files.

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/scalfmm/scalfmm/trunk@437 2616d619-271b-44dc-8df4-d4a8f33a7222
parent 6ec0f500
......@@ -68,13 +68,16 @@ int main(int argc, char ** argv){
fwrite(&YCenter, sizeof(FReal), 1, myfile);
fwrite(&ZCenter, sizeof(FReal), 1, myfile);
const FReal Limite = FReal(0.00001);
const FReal LimitedBoxWidth = BoxWidth - Limite * 2;
FReal data[4];
data[3] = FReal(0.1);
// Generate particles
for( FSize idx = 0 ; idx < NbParticles ; ++idx ){
data[0] = ((FReal(rand())/FRandMax) * BoxWidth * 2) + XCenter - BoxWidth;
data[1] = ((FReal(rand())/FRandMax) * BoxWidth * 2) + YCenter - BoxWidth;
data[2] = ((FReal(rand())/FRandMax) * BoxWidth * 2) + ZCenter - BoxWidth;
data[0] = ((FReal(rand())/FRandMax) * LimitedBoxWidth * 2) + XCenter - BoxWidth + Limite;
data[1] = ((FReal(rand())/FRandMax) * LimitedBoxWidth * 2) + YCenter - BoxWidth + Limite;
data[2] = ((FReal(rand())/FRandMax) * LimitedBoxWidth * 2) + ZCenter - BoxWidth + Limite;
fwrite(&data, sizeof(FReal), 4, myfile);
}
......
......@@ -36,7 +36,6 @@ int main(int argc, char ** argv){
const long NbParticles = FParameters::getValue(argc,argv,"-nb", long(20000));
const FReal FRandMax = FReal(RAND_MAX);
const FReal f2 = 2;
// Box width
const FReal BoxWidth = FParameters::getValue(argc,argv,"-width", FReal(1.0/2.0));
......@@ -66,11 +65,14 @@ int main(int argc, char ** argv){
myfile << NbParticles << "\n";
myfile << BoxWidth << "\t" << XCenter << "\t" << YCenter << "\t" << ZCenter;
const FReal Limite = FReal(0.00001);
const FReal LimitedBoxWidth = BoxWidth - Limite * 2;
// Generate particles
for( long idx = 0 ; idx < NbParticles ; ++idx ){
const FReal px = ((FReal(rand())/FRandMax) * BoxWidth * f2) + XCenter - BoxWidth;
const FReal py = ((FReal(rand())/FRandMax) * BoxWidth * f2) + YCenter - BoxWidth;
const FReal pz = ((FReal(rand())/FRandMax) * BoxWidth * f2) + ZCenter - BoxWidth;
const FReal px = ((FReal(rand())/FRandMax) * LimitedBoxWidth * 2) + XCenter - BoxWidth + Limite;
const FReal py = ((FReal(rand())/FRandMax) * LimitedBoxWidth * 2) + YCenter - BoxWidth + Limite;
const FReal pz = ((FReal(rand())/FRandMax) * LimitedBoxWidth * 2) + ZCenter - BoxWidth + Limite;
myfile << "\n" << px << "\t" << py << "\t" << pz << "\t" << (0.01);
}
......
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