Commit 132cd57e authored by berenger-bramas's avatar berenger-bramas

Update the test file to enable passing the input file as a parameter.

Now most of the test file use the fallowing arguments (in any order):
./exec -h [tree height] -sh [tree subheigt] -f [filename]

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/scalfmm/scalfmm/trunk@351 2616d619-271b-44dc-8df4-d4a8f33a7222
parent 84e79774
...@@ -45,18 +45,9 @@ int main(int argc, char ** argv){ ...@@ -45,18 +45,9 @@ int main(int argc, char ** argv){
const int NbLevels = FParameters::getValue(argc,argv,"-h", 5); const int NbLevels = FParameters::getValue(argc,argv,"-h", 5);
const int SizeSubLevels = FParameters::getValue(argc,argv,"-sh", 3); const int SizeSubLevels = FParameters::getValue(argc,argv,"-sh", 3);
FTic counter; FTic counter;
const char* const defaultFilename = "../Data/test20k.fma"; const char* const filename = FParameters::getStr(argc,argv,"-f", "../Data/test20k.fma");
const char* filename;
if(argc == 1){ std::cout << "Opening : " << filename << "\n";
std::cout << "You have to give a .fma file in argument.\n";
std::cout << "The program will try a default file : " << defaultFilename << "\n";
filename = defaultFilename;
}
else{
filename = argv[1];
std::cout << "Opening : " << filename << "\n";
}
FFmaLoader<ParticleClass> loader(filename); FFmaLoader<ParticleClass> loader(filename);
if(!loader.isOpen()){ if(!loader.isOpen()){
......
...@@ -181,18 +181,9 @@ int main(int argc, char ** argv){ ...@@ -181,18 +181,9 @@ int main(int argc, char ** argv){
const int NbLevels = FParameters::getValue(argc,argv,"-h", 5); const int NbLevels = FParameters::getValue(argc,argv,"-h", 5);
const int SizeSubLevels = FParameters::getValue(argc,argv,"-sh", 3); const int SizeSubLevels = FParameters::getValue(argc,argv,"-sh", 3);
FTic counter; FTic counter;
const char defaultFilename[] = "../Data/test20k.fma"; const char* const filename = FParameters::getStr(argc,argv,"-f", "../Data/test20k.fma");
const char* filename;
if(argc == 1){ std::cout << "Opening : " << filename << "\n";
std::cout << "You have to give a .fma file in argument.\n";
std::cout << "The program will try a default file : " << defaultFilename << "\n";
filename = defaultFilename;
}
else{
filename = argv[1];
std::cout << "Opening : " << filename << "\n";
}
FMpiFmaLoader<ParticleClass> loader(filename, app.global()); FMpiFmaLoader<ParticleClass> loader(filename, app.global());
if(!loader.isOpen()){ if(!loader.isOpen()){
......
...@@ -49,18 +49,9 @@ int main(int argc, char ** argv){ ...@@ -49,18 +49,9 @@ int main(int argc, char ** argv){
const int NbLevels = FParameters::getValue(argc,argv,"-h", 5); const int NbLevels = FParameters::getValue(argc,argv,"-h", 5);
const int SizeSubLevels = FParameters::getValue(argc,argv,"-sh", 3); const int SizeSubLevels = FParameters::getValue(argc,argv,"-sh", 3);
FTic counter; FTic counter;
const char* const defaultFilename = "../Data/test20k.fma";
const char* filename;
if(argc == 1){ const char* const filename = FParameters::getStr(argc,argv,"-f", "../Data/test20k.fma");
std::cout << "You have to give a .fma file in argument.\n"; std::cout << "Opening : " << filename << "\n";
std::cout << "The program will try a default file : " << defaultFilename << "\n";
filename = defaultFilename;
}
else{
filename = argv[1];
std::cout << "Opening : " << filename << "\n";
}
FFmaScanfLoader<ParticleClass> loader(filename); FFmaScanfLoader<ParticleClass> loader(filename);
if(!loader.isOpen()){ if(!loader.isOpen()){
......
...@@ -76,7 +76,7 @@ int main(int argc, char ** argv){ ...@@ -76,7 +76,7 @@ int main(int argc, char ** argv){
FComputeCell::Init(DevP); FComputeCell::Init(DevP);
GalaxyLoader<ParticleClass> loader("../Data/galaxy.fma.tmp"); GalaxyLoader<ParticleClass> loader(FParameters::getStr(argc,argv,"-f", "../Data/galaxy.fma.tmp"));
// ----------------------------------------------------- // -----------------------------------------------------
......
...@@ -45,18 +45,9 @@ int main(int argc, char ** argv){ ...@@ -45,18 +45,9 @@ int main(int argc, char ** argv){
const int NbLevels = FParameters::getValue(argc,argv,"-h", 5); const int NbLevels = FParameters::getValue(argc,argv,"-h", 5);
const int SizeSubLevels = FParameters::getValue(argc,argv,"-sh", 3); const int SizeSubLevels = FParameters::getValue(argc,argv,"-sh", 3);
FTic counter; FTic counter;
const char* const defaultFilename = "../Data/test20k.tsm.fma";
const char* filename;
if(argc == 1){ const char* const filename = FParameters::getStr(argc,argv,"-f", "../Data/test20k.tsm.fma");
std::cout << "You have to give a .fma file in argument.\n"; std::cout << "Opening : " << filename << "\n";
std::cout << "The program will try a default file : " << defaultFilename << "\n";
filename = defaultFilename;
}
else{
filename = argv[1];
std::cout << "Opening : " << filename << "\n";
}
FFmaTsmLoader<ParticleClass> loader(filename); FFmaTsmLoader<ParticleClass> loader(filename);
if(!loader.isOpen()){ if(!loader.isOpen()){
......
...@@ -324,19 +324,10 @@ int main(int argc, char ** argv){ ...@@ -324,19 +324,10 @@ int main(int argc, char ** argv){
const int NbLevels = FParameters::getValue(argc,argv,"-h", 5); const int NbLevels = FParameters::getValue(argc,argv,"-h", 5);
const int SizeSubLevels = FParameters::getValue(argc,argv,"-sh", 3); const int SizeSubLevels = FParameters::getValue(argc,argv,"-sh", 3);
char defaultFilename[] = "../Data/test20k.bin.fma";
char* filename;
FTic counter; FTic counter;
if(argc == 1){ const char* const filename = FParameters::getStr(argc,argv,"-f", "../Data/test20k.bin.fma");
std::cout << "You have to give a .fma file in argument.\n"; std::cout << "Opening : " << filename << "\n";
std::cout << "The program will try a default file : " << defaultFilename << "\n";
filename = defaultFilename;
}
else{
filename = argv[1];
std::cout << "Opening : " << filename << "\n";
}
FMpiFmaLoader<ParticleClass> loader(filename,app.global()); FMpiFmaLoader<ParticleClass> loader(filename,app.global());
if(!loader.isOpen()){ if(!loader.isOpen()){
......
...@@ -42,18 +42,9 @@ int main(int argc, char ** argv){ ...@@ -42,18 +42,9 @@ int main(int argc, char ** argv){
// Use testLoaderCreate.exe to create this file // Use testLoaderCreate.exe to create this file
FTic counter; FTic counter;
const char* const defaultFilename = "../Data/test20k.basic";
const char* filename;
if(argc == 1){ const char* const filename = FParameters::getStr(argc,argv,"-f", "../Data/test20k.basic");
std::cout << "You have to give a .fma file in argument.\n"; std::cout << "Opening : " << filename << "\n";
std::cout << "The program will try a default file : " << defaultFilename << "\n";
filename = defaultFilename;
}
else{
filename = argv[1];
std::cout << "Opening : " << filename << "\n";
}
// open basic particles loader // open basic particles loader
FBasicLoader<FBasicParticle> loader(filename); FBasicLoader<FBasicParticle> loader(filename);
......
...@@ -34,18 +34,8 @@ int main(int argc, char ** argv){ ...@@ -34,18 +34,8 @@ int main(int argc, char ** argv){
// Box width // Box width
const FReal BoxWidth = 1.0; const FReal BoxWidth = 1.0;
// Output file please let .temp extension // Output file please let .temp extension
const char defaultFilename[] = "../Data/test20k.basic"; const char* const Output = FParameters::getStr(argc,argv,"-f", "../Data/test20k.basic");
const char* Output; std::cout << "Creating : " << Output << "\n";
if(argc == 1){
std::cout << "You have to give a filename in argument.\n";
std::cout << "The program will create one with a default name : " << defaultFilename << "\n";
Output = defaultFilename;
}
else{
Output = argv[1];
std::cout << "Creating : " << Output << "\n";
}
// Create file // Create file
std::ofstream myfile; std::ofstream myfile;
......
...@@ -46,18 +46,8 @@ int main(int argc, char ** argv ){ ...@@ -46,18 +46,8 @@ int main(int argc, char ** argv ){
// Use testLoaderCreate.exe to create this file // Use testLoaderCreate.exe to create this file
FTic counter; FTic counter;
const char* const defaultFilename = "../Data/test20k.fma"; const char* const filename = FParameters::getStr(argc,argv,"-f", "../Data/test20k.fma");
const char* filename; std::cout << "Opening : " << filename << "\n";
if(argc == 1){
std::cout << "You have to give a .fma file in argument.\n";
std::cout << "The program will try a default file : " << defaultFilename << "\n";
filename = defaultFilename;
}
else{
filename = argv[1];
std::cout << "Opening : " << filename << "\n";
}
// open basic particles loader // open basic particles loader
FFmaLoader<FFmaParticle> loader(filename); FFmaLoader<FFmaParticle> loader(filename);
......
...@@ -34,19 +34,8 @@ int main(int argc, char ** argv){ ...@@ -34,19 +34,8 @@ int main(int argc, char ** argv){
// Box width // Box width
const FReal BoxWidth = 1.0/2; const FReal BoxWidth = 1.0/2;
// Output file please let .temp extension // Output file please let .temp extension
const char defaultFilename[] = "../Data/test20k.bin.fma"; const char* const Output = FParameters::getStr(argc,argv,"-f", "../Data/test20k.bin.fma");
std::cout << "Creating : " << Output << "\n";
const char* Output;
if(argc == 1){
std::cout << "You have to give a filename in argument.\n";
std::cout << "The program will create one with a default name : " << defaultFilename << "\n";
Output = defaultFilename;
}
else{
Output = argv[1];
std::cout << "Creating : " << Output << "\n";
}
// Create file // Create file
FILE* const myfile = fopen(Output, "wb"); FILE* const myfile = fopen(Output, "wb");
......
...@@ -38,19 +38,8 @@ int main(int argc, char ** argv){ ...@@ -38,19 +38,8 @@ int main(int argc, char ** argv){
const FReal ZCenter = BoxWidth; const FReal ZCenter = BoxWidth;
// Output file please let .temp extension // Output file please let .temp extension
const char defaultFilename[] = "../Data/test20k.fma"; const char* const Output = FParameters::getStr(argc,argv,"-f", "../Data/test20k.fma");
std::cout << "Creating : " << Output << "\n";
const char* Output;
if(argc == 1){
std::cout << "You have to give a filename in argument.\n";
std::cout << "The program will create one with a default name : " << defaultFilename << "\n";
Output = defaultFilename;
}
else{
Output = argv[1];
std::cout << "Creating : " << Output << "\n";
}
// Create file // Create file
std::ofstream myfile; std::ofstream myfile;
......
...@@ -47,18 +47,8 @@ int main(int argc, char ** argv ){ ...@@ -47,18 +47,8 @@ int main(int argc, char ** argv ){
// Use testLoaderCreate.exe to create this file // Use testLoaderCreate.exe to create this file
FTic counter; FTic counter;
const char* const defaultFilename = "../Data/test20k.tsm.fma"; const char* const filename = FParameters::getStr(argc,argv,"-f", "../Data/test20k.tsm.fma");
const char* filename; std::cout << "Opening : " << filename << "\n";
if(argc == 1){
std::cout << "You have to give a .tos.fma file in argument.\n";
std::cout << "The program will try a default file : " << defaultFilename << "\n";
filename = defaultFilename;
}
else{
filename = argv[1];
std::cout << "Opening : " << filename << "\n";
}
// open basic particles loader // open basic particles loader
FFmaTsmLoader<ParticleTsm> loader(filename); FFmaTsmLoader<ParticleTsm> loader(filename);
......
...@@ -34,19 +34,8 @@ int main(int argc, char ** argv){ ...@@ -34,19 +34,8 @@ int main(int argc, char ** argv){
// Box width // Box width
const FReal BoxWidth = 1.0/2; const FReal BoxWidth = 1.0/2;
// Output file please let .temp extension // Output file please let .temp extension
const char defaultFilename[] = "../Data/test20k.tsm.fma"; const char* const Output = FParameters::getStr(argc,argv,"-f", "../Data/test20k.tsm.fma");
std::cout << "Creating : " << Output << "\n";
const char* Output;
if(argc == 1){
std::cout << "You have to give a filename in argument.\n";
std::cout << "The program will create one with a default name : " << defaultFilename << "\n";
Output = defaultFilename;
}
else{
Output = argv[1];
std::cout << "Creating : " << Output << "\n";
}
// Create file // Create file
std::ofstream myfile; std::ofstream myfile;
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "../Src/Fmb/FFmbKernels.hpp" #include "../Src/Fmb/FFmbKernels.hpp"
#include "../Src/Utils/FGlobal.hpp" #include "../Src/Utils/FGlobal.hpp"
#include "../Src/Utils/FParameters.hpp"
#include "../Src/Files/FHLoader.hpp" #include "../Src/Files/FHLoader.hpp"
...@@ -98,21 +99,11 @@ int main(int argc, char ** argv){ ...@@ -98,21 +99,11 @@ int main(int argc, char ** argv){
std::cout << ">> This executable has to be used to know the box used.\n"; std::cout << ">> This executable has to be used to know the box used.\n";
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
const int NbLevels = 6; const int NbLevels = FParameters::getValue(argc,argv,"-h", 5);
const int SizeSubLevels = 2; const int SizeSubLevels = FParameters::getValue(argc,argv,"-sh", 3);
FTic counter; FTic counter;
const char* const defaultFilename = "../Data/testMortonIndex.txt"; const char* const filename = FParameters::getStr(argc,argv,"-f", "../Data/testMortonIndex.txt");
const char* filename; std::cout << "Opening : " << filename << "\n";
if(argc == 1){
std::cout << "You have to give a .fma file in argument.\n";
std::cout << "The program will try a default file : " << defaultFilename << "\n";
filename = defaultFilename;
}
else{
filename = argv[1];
std::cout << "Opening : " << filename << "\n";
}
FHLoader<Particle> loader(filename); FHLoader<Particle> loader(filename);
if(!loader.isOpen() ){ if(!loader.isOpen() ){
......
...@@ -49,18 +49,9 @@ int main(int argc, char ** argv){ ...@@ -49,18 +49,9 @@ int main(int argc, char ** argv){
const int NbLevels = FParameters::getValue(argc,argv,"-h", 5); const int NbLevels = FParameters::getValue(argc,argv,"-h", 5);
const int SizeSubLevels = FParameters::getValue(argc,argv,"-sh", 3); const int SizeSubLevels = FParameters::getValue(argc,argv,"-sh", 3);
FTic counter; FTic counter;
const char* const defaultFilename = "../Data/test20k.fma";
const char* filename;
if(argc == 1){ const char* const filename = FParameters::getStr(argc,argv,"-f", "../Data/test20k.fma");
std::cout << "You have to give a .fma file in argument.\n"; std::cout << "Opening : " << filename << "\n";
std::cout << "The program will try a default file : " << defaultFilename << "\n";
filename = defaultFilename;
}
else{
filename = argv[1];
std::cout << "Opening : " << filename << "\n";
}
FFmaLoader<FFmaParticle> loader(filename); FFmaLoader<FFmaParticle> loader(filename);
if(!loader.isOpen()){ if(!loader.isOpen()){
......
...@@ -35,18 +35,8 @@ int main(int argc, char ** argv){ ...@@ -35,18 +35,8 @@ int main(int argc, char ** argv){
const int NbLevels = FParameters::getValue(argc,argv,"-h", 5); const int NbLevels = FParameters::getValue(argc,argv,"-h", 5);
const int SizeSubLevels = FParameters::getValue(argc,argv,"-sh", 3); const int SizeSubLevels = FParameters::getValue(argc,argv,"-sh", 3);
FTic counter; FTic counter;
const char* const defaultFilename = "../Data/test20k.fma"; const char* const filename = FParameters::getStr(argc,argv,"-f", "../Data/test20k.fma");
const char* filename; std::cout << "Opening : " << filename << "\n";
if(argc == 1){
std::cout << "You have to give a .fma file in argument.\n";
std::cout << "The program will try a default file : " << defaultFilename << "\n";
filename = defaultFilename;
}
else{
filename = argv[1];
std::cout << "Opening : " << filename << "\n";
}
FFmaLoader<ParticleClass> loader(filename); FFmaLoader<ParticleClass> loader(filename);
if(!loader.isOpen()){ if(!loader.isOpen()){
......
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