Commit bc907910 authored by BRAMAS Berenger's avatar BRAMAS Berenger

Add -pv parameter to files generator to pass the physical value when generate files

parent 61aeed7a
......@@ -34,7 +34,7 @@ int main(int argc, char ** argv){
// Nb of particles
const FSize NbParticles = FParameters::getValue(argc,argv,"-nb", FSize(20000));
const FReal physicalValue = FParameters::getValue(argc,argv,"-pv", FReal(0.1));
// Center of the box
const FReal XCenter = 0.5;
const FReal YCenter = 0.5;
......@@ -75,7 +75,7 @@ int main(int argc, char ** argv){
const FReal LimitedBoxWidth = BoxWidth - Limite * 2;
FReal data[4];
data[3] = FReal(0.1);
data[3] = physicalValue;
// Generate particles
for( FSize idx = 0 ; idx < NbParticles ; ++idx ){
data[0] = ((FReal(rand())/FRandMax) * LimitedBoxWidth * 2) + XCenter - BoxWidth + Limite;
......
......@@ -36,6 +36,7 @@ int main(int argc, char ** argv){
// Nb of particles
const FSize NbParticles = FParameters::getValue(argc,argv,"-nb", FSize(20000));
const FReal physicalValue = FParameters::getValue(argc,argv,"-pv", FReal(0.1));
// Center of the box
const FReal XCenter = 0.5;
......@@ -72,7 +73,7 @@ int main(int argc, char ** argv){
FReal data[4];
data[3] = FReal(0.1);
data[3] = physicalValue;
if( FParameters::findParameter(argc,argv,"-double") == FParameters::NotFound ){
const FReal rayon = FReal(0.4);
......
......@@ -34,6 +34,7 @@ int main(int argc, char ** argv){
// Nb of particles
const long NbParticles = FParameters::getValue(argc,argv,"-nb", long(20000));
const FReal physicalValue = FParameters::getValue(argc,argv,"-pv", FReal(0.1));
const FReal FRandMax = FReal(RAND_MAX);
......@@ -74,7 +75,7 @@ int main(int argc, char ** argv){
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);
myfile << "\n" << px << "\t" << py << "\t" << pz << "\t" << physicalValue;
}
myfile.close();
......
......@@ -38,6 +38,8 @@ int main(int argc, char ** argv){
// Nb of particles
const long NbParticles = FParameters::getValue(argc,argv,"-nb", long(20000));
const FReal physicalValue = FParameters::getValue(argc,argv,"-pv", FReal(0.1));
const char* const Output = FParameters::getStr(argc,argv,"-f", "../Data/testSphere20k.fma");
std::cout << "Creating : " << Output << "\n";
......@@ -78,7 +80,7 @@ int main(int argc, char ** argv){
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";
myfile << " \n" << px << " " << py << " " << pz << " " << physicalValue;
}
}
else{
......@@ -97,7 +99,7 @@ int main(int argc, char ** argv){
const FReal py = rayon * FMath::Sin(omega) * FMath::Sin(theta) + YCenter - offset + thresh * (FReal(rand())/FRandMax) - threshDiv2;
const FReal pz = rayon * FMath::Cos(theta) + ZCenter - offset + thresh * (FReal(rand())/FRandMax) - threshDiv2;
myfile << " \n" << px << " " << py << " " << pz << " 0.01";
myfile << " \n" << px << " " << py << " " << pz << " " << physicalValue;
}
for( long idx = 0 ; idx < NbParticles/2 ; ++idx ){
......@@ -108,7 +110,7 @@ int main(int argc, char ** argv){
const FReal py = rayon * FMath::Sin(omega) * FMath::Sin(theta) + YCenter + offset + thresh * (FReal(rand())/FRandMax) - threshDiv2;
const FReal pz = rayon * FMath::Cos(theta) + ZCenter + offset + thresh * (FReal(rand())/FRandMax) - threshDiv2;
myfile << " \n" << px << " " << py << " " << pz << " 0.01";
myfile << " \n" << px << " " << py << " " << pz << " " << physicalValue;
}
}
......
......@@ -33,6 +33,8 @@ int main(int argc, char ** argv){
//////////////////////////////////////////////////////////////
// Nb of particles
const long NbParticles = FParameters::getValue(argc,argv,"-nb", long(20000));
const FReal physicalValue = FParameters::getValue(argc,argv,"-pv", FReal(0.1));
const FReal FRandMax = FReal(RAND_MAX);
// Center of the box
......@@ -70,7 +72,7 @@ int main(int argc, char ** argv){
const int isTarget = rand() > RAND_MAX/2 ? 1 : 0;
myfile << "\n" << px << "\t" << py << "\t" << pz << "\t" << (0.01) << "\t" << isTarget;
myfile << "\n" << px << "\t" << py << "\t" << pz << "\t" << physicalValue << "\t" << isTarget;
}
myfile.close();
......
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