Skip to content

Commit

Permalink
Fix in init of simulation steps
Browse files Browse the repository at this point in the history
  • Loading branch information
HomesGH authored Oct 24, 2023
1 parent f81d919 commit 5d4f89d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/Simulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) {
/* run section */
if(xmlconfig.changecurrentnode("run")) {
xmlconfig.getNodeValueReduced("currenttime", _simulationTime);
setSimulationTime(_simulationTime);
Log::global_log->info() << "Simulation start time: " << getSimulationTime() << std::endl;
/* steps */
xmlconfig.getNodeValue("equilibration/steps", _initStatistics);
Expand Down Expand Up @@ -676,6 +675,9 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) {
}

xmlconfig.changecurrentnode(oldpath);

// _simulationTime might be updated by readers -> also update _initSimulation
_initSimulation = (unsigned long) round(_simulationTime / _integrator->getTimestepLength() );
}


Expand Down
6 changes: 1 addition & 5 deletions src/Simulation.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,7 @@ class Simulation {
void initStatistics(unsigned long t) { this->_initStatistics = t; }
unsigned long getInitStatistics() const { return this->_initStatistics; }

void setSimulationTime(double curtime) {
_simulationTime = curtime;
// Also change corresponding initial timestep
_initSimulation = (unsigned long) round(_simulationTime / _integrator->getTimestepLength() );
}
void setSimulationTime(double curtime) { _simulationTime = curtime; }
void advanceSimulationTime(double timestep) { _simulationTime += timestep; }
double getSimulationTime() { return _simulationTime; }

Expand Down

0 comments on commit 5d4f89d

Please sign in to comment.