Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F63506134
main.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, May 20, 14:53
Size
1 KB
Mime Type
text/x-c
Expires
Wed, May 22, 14:53 (2 d)
Engine
blob
Format
Raw Data
Handle
17781302
Attached To
rPHPCSHALLOWWATER PHPC project - Shallow water simulation 2019
main.cpp
View Options
#include <omp.h>
#include <iostream>
#include "Simulation.h"
#include <algorithm>
int main(int argc, char *argv[]) {
if (argc < 9) {
std::cerr << "Usage: " << argv[0] << "-i <data folder> -nx <size of problem> -t <end time of simulation> \n"
"-o <output folder> [-r : init. with random values] \n\n";
return 1;
}
std::string input_folder;
std::string output_folder;
bool random_values = false;
int nx;
double tend;
std::string flag;
//Assigning all the correct arguments
for(int i = 1;i < argc;++i) {
if(std::string(argv[i]) == "-o") {
flag = "o";
continue;
}
else if(std::string(argv[i]) == "-i") {
flag = "i";
continue;
}
else if(std::string(argv[i]) == "-nx") {
flag = "nx";
continue;
}
else if(std::string(argv[i]) == "-t") {
flag = "t";
continue;
}
else if(std::string(argv[i]) == "-r") {
random_values = true;
continue;
}
if(flag == "o")
output_folder = std::string(argv[i]);
else if(flag == "i")
input_folder = std::string(argv[i]);
else if(flag == "nx")
nx = std::stoi(argv[i]);
else if(flag == "t")
tend = std::stod(argv[i]);
}
Simulation sim(input_folder, nx, 500, tend, true, random_values);
sim.compute();
std::cout << "Perf. = " << sim.get_flops_performance()/1e9 << "Gflops / TTS : " << sim.get_TTS()/1e3 << "s" << std::endl;
std::string file_name = output_folder + "Data_nx" + std::to_string(nx) + "_500km_T0.2_h_Sol.bin";
sim.save(file_name);
return 0;
}
Event Timeline
Log In to Comment