def run(self, end_time, cp_interval = 0.0, prefix = ""): """ Run the simulation until end_time, automatically checkpoint at each cp_interval. Prefix can be added using prefix=<prefix_string>. """ if cp_interval > 0: while _steps_swig.API_getTime(self) + cp_interval < end_time: _steps_swig.API_advance(self, cp_interval) filename = "%s%e.wmrk4_cp" % (prefix, _steps_swig.API_getTime(self)) print "Checkpointing -> ", filename _steps_swig.API_checkpoint(self, filename) _steps_swig.API_run(self, end_time) filename = "%s%e.wmrk4_cp" % (prefix, _steps_swig.API_getTime(self)) print "Checkpointing -> ", filename _steps_swig.API_checkpoint(self, filename) else: _steps_swig.API_run(self, end_time)
def advance(self, advance_time, cp_interval = 0.0, prefix = ""): """ Advance the simulation for <advance_time>, automatically checkpoint at each <cp_interval>. Prefix can be added using prefix=<prefix_string>. """ end_time = _steps_swig.API_getTime(self) + advance_time if cp_interval > 0: while _steps_swig.API_getTime(self) + cp_interval < end_time: _steps_swig.API_advance(self, cp_interval) filename = "%s%e.tetexact_cp" % (prefix, _steps_swig.API_getTime(self)) print "Checkpointing -> ", filename _steps_swig.API_checkpoint(self, filename) _steps_swig.API_run(self, end_time) filename = "%s%e.tetexact_cp" % (prefix, _steps_swig.API_getTime(self)) print "Checkpointing -> ", filename _steps_swig.API_checkpoint(self, filename) else: _steps_swig.API_run(self, end_time)