| 206 | } |
| 207 | |
| 208 | int main(int argc, char** argv) |
| 209 | { |
| 210 | // parse command line arguments |
| 211 | po::options_description options("options"); |
| 212 | options.add_options() |
| 213 | ("help", "show usage") |
| 214 | ("particles", po::value<uint_>()->default_value(1000), "number of particles") |
| 215 | ("dt", po::value<float>()->default_value(0.00001f), "width of each integration step"); |
| 216 | po::variables_map vm; |
| 217 | po::store(po::parse_command_line(argc, argv, options), vm); |
| 218 | po::notify(vm); |
| 219 | |
| 220 | if(vm.count("help") > 0) { |
| 221 | std::cout << options << std::endl; |
| 222 | return 0; |
| 223 | } |
| 224 | |
| 225 | const uint_ particles = vm["particles"].as<uint_>(); |
| 226 | const float dt = vm["dt"].as<float>(); |
| 227 | |
| 228 | QApplication app(argc, argv); |
| 229 | NBodyWidget nbody(particles, dt); |
| 230 | |
| 231 | nbody.show(); |
| 232 | |
| 233 | return app.exec(); |
| 234 | } |
| 235 | |
| 236 | #include "nbody.moc" |