| 577 | } |
| 578 | |
| 579 | void SimulatorBase::runSimulation() |
| 580 | { |
| 581 | deferredInit(); |
| 582 | |
| 583 | if (getStateFile() != "") |
| 584 | { |
| 585 | // avoid that command line parameter is overwritten |
| 586 | const Real temp = m_stopAt; |
| 587 | loadState(getStateFile()); |
| 588 | if (m_cmdLineStopAt) |
| 589 | m_stopAt = temp; |
| 590 | if (m_cmdLineNoInitialPause) |
| 591 | m_doPause = false; |
| 592 | } |
| 593 | setCommandLineParameter(); |
| 594 | |
| 595 | if (!m_useGUI) |
| 596 | { |
| 597 | const Real stopAt = getValue<Real>(SimulatorBase::STOP_AT); |
| 598 | if (stopAt < 0.0) |
| 599 | { |
| 600 | LOG_ERR << "StopAt parameter must be set when starting without GUI."; |
| 601 | exit(1); |
| 602 | } |
| 603 | |
| 604 | while (true) |
| 605 | { |
| 606 | if (!timeStepNoGUI()) |
| 607 | break; |
| 608 | } |
| 609 | } |
| 610 | else |
| 611 | m_gui->run(); |
| 612 | } |
| 613 | |
| 614 | void SimulatorBase::cleanup() |
| 615 | { |