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

Update the program that creates spherical data files.

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/scalfmm/scalfmm/trunk@338 2616d619-271b-44dc-8df4-d4a8f33a7222
parent 441cc200
......@@ -18,7 +18,7 @@
int main(int argc, char ** argv){
///////////////////////What we do/////////////////////////////
std::cout << ">> This executable can create a FMA particles files in a spherical scattering";
std::cout << ">> This executable can create a FMA particles files in a spherical scattering\n";
std::cout << ">> You can pass a filename in parameter else the program will use\n";
std::cout << ">> a default filename.\n";
std::cout << ">> The format of the file is : \n";
......@@ -29,12 +29,11 @@ int main(int argc, char ** argv){
// Nb of particles
const long NbParticles = FParameters::getValue(argc,argv,"-nb", long(20000));
const FReal FRandMax = FReal(RAND_MAX);
// Center of the box
const FReal XCenter = 0.5;
const FReal YCenter = 0.5;
const FReal ZCenter = 0.5;
const FReal XCenter = 0.;
const FReal YCenter = 0.;
const FReal ZCenter = 0.;
// Box width
const FReal BoxWidth = 1.0;
// Output file please let .temp extension
......@@ -68,18 +67,19 @@ int main(int argc, char ** argv){
myfile << NbParticles << " " << BoxWidth << " " << XCenter << " " << YCenter << " " << ZCenter;
const FReal FRandMax = FReal(RAND_MAX);
const FReal rayon = FReal(0.4);
const FReal thresh = FReal(0.2);
const FReal thresh = FReal(0.15);
const FReal threshDiv2 = thresh/2;
// Generate particles
for( long idx = 0 ; idx < NbParticles ; ++idx ){
const FReal phi = ((FReal(rand())/FRandMax) * thresh - (thresh/FReal(2))) + rayon;
const FReal theta = FMath::FPi * (FReal(rand())/FRandMax);
const FReal omega = FReal(2) * FMath::FPi * (FReal(rand())/FRandMax);
const FReal theta = (FReal(rand())/FRandMax) * FMath::FPi;
const FReal omega = (FReal(rand())/FRandMax) * FMath::FPi * FReal(2);
const FReal px = phi*FMath::Cos(omega)*FMath::Sin(theta) + XCenter;
const FReal py = phi*FMath::Sin(omega)*FMath::Cos(theta) + YCenter;
const FReal pz = phi*FMath::Cos(theta) + ZCenter;
const FReal px = rayon * FMath::Cos(omega) * FMath::Sin(theta) + XCenter + thresh * (FReal(rand())/FRandMax) - threshDiv2;
const FReal py = rayon * FMath::Sin(omega) * FMath::Sin(theta) + YCenter + thresh * (FReal(rand())/FRandMax) - threshDiv2;
const FReal pz = rayon * FMath::Cos(theta) + ZCenter + thresh * (FReal(rand())/FRandMax) - threshDiv2;
myfile << " \n" << px << " " << py << " " << pz << " 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