Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F77493059
simulation.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
Wed, Aug 14, 19:36
Size
2 KB
Mime Type
text/x-c
Expires
Fri, Aug 16, 19:36 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
19878729
Attached To
rDLMA Diffusion limited mixed aggregation
simulation.cpp
View Options
#include <dlma_iterator.hh>
#include <split_string.hh>
//#include <chrono>
using namespace simulation;
int main(int argc, char *argv[])
{
if (argc < 2){
std::cout<<"please provide params file"<<std::endl;
exit(EXIT_FAILURE);
}
std::ifstream parser(argv[1], std::ifstream::in);
if (parser.fail()){
std::cout<<"either file does not exist or does not have permissions"<<std::endl;
exit(EXIT_FAILURE);
}
std::string str;
std::vector<std::string> results;
std::string sys_name;
int lattice_val;
while (getline(parser, str)){
results = split_string_by_delimiter(str, '=');
if (results[0] == "system"){
sys_name = results[1];
}
if (results[0] == "lattice"){
lattice_val = stoi(results[1]);
}
}
//std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now();
if ((sys_name == "dlma") && (lattice_val == 1)){
system_iterator<int> *test = new dlma_iterator<int>(argv[1]);;
test->run_system();
if (argc < 3)
test->save_config_file();
else
test->save_config_file(argv[2]);
delete test;
}
else if((sys_name == "dlma") && (lattice_val == 0)){
system_iterator<double> *test = new dlma_iterator<double>(argv[1]);;
test->run_system();
//test->create_movie_files(argv[2]);
if (argc < 3)
test->save_config_file();
else
test->save_config_file(argv[2]);
delete test;
}
else if((sys_name == "random_site_percolation") && (lattice_val == 1)){
system_iterator<int> *test = new dlma_iterator<int>(argv[1]);
test->run_system_for_percolation();
if (argc < 3)
test->save_config_file();
else
test->save_config_file(argv[2]);
delete test;
}
else if(sys_name == "erdos_renyi"){
system_iterator<double> *test = new dlma_iterator<double>(argv[1]);
test->run_system_for_erdos_renyi();
if (argc < 3)
test->save_config_file();
else
test->save_config_file(argv[2]);
delete test;
}
else{
std::cout<<"please check system and lattice values"<<std::endl;
exit(EXIT_FAILURE);
}
//std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now();
//std::cout << "Time difference = " << std::chrono::duration_cast<std::chrono::seconds>(end - begin).count() << "[s]" << std::endl;
return 0;
}
Event Timeline
Log In to Comment