Skip to content

Commit

Permalink
Add doc and C++ style cast
Browse files Browse the repository at this point in the history
  • Loading branch information
HomesGH authored May 31, 2024
1 parent 8d7da1d commit 05ccdeb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Simulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,10 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) {
xmlconfig.changecurrentnode(oldpath);

// _simulationTime might be updated by readers -> also update _initSimulation
_simstep = _initSimulation = (unsigned long) round(_simulationTime / _integrator->getTimestepLength() );
// In theory, the division of the physical time (_simulationTime) and the time step width,
// should give a whole number. However, due to numerical errors, the result of the
// division must be rounded
_simstep = _initSimulation = static_cast<unsigned long>(std::round(_simulationTime / _integrator->getTimestepLength()));
Log::global_log->info() << "Set initial time step to " << _initSimulation << std::endl;
}

Expand Down

0 comments on commit 05ccdeb

Please sign in to comment.