No, the code is correct as-is. This is needed to handle the case where one is restarting a simulation. Here, the elapsed progress is the difference between where we currently are (self.stcurr) and where we are restarting from (st.rtrt). This enables the progress bar to differentiate between progress which was made before the current restart action and that which has been made since we restarted; the former is signified by a + whilst the latter is signified by a =.
Regards, Freddie. >> On 26 Jun 2020, at 22:11, Kiny Wan <[email protected]> wrote: > > Dear all, I find that the variable 'self.stelap' in progress_bar.py means the > elapsed simulation times, however, 'self.stelap = self.stcurr - self.strtrt' > is confused. Is ''self.strtrt' should be replaced with 'self.ststrt'? > >> class ProgressBar(object): >> def __init__(self, start, curr, end, dps=2): >> self.ststrt = start >> self.strtrt = curr >> self.stend = end >> self.dps = dps >> self._wstart = time.time() >> self._last_wallt = 0.0 >> self._ncol = shutil.get_terminal_size()[0] or 80 >> self._nbarcol = self._ncol - 24 - 2*len('{:.{}f}'.format(end, dps)) >> self.advance_to(curr) >> def advance_to(self, t): >> self.stcurr = min(t, self.stend) >> self.stelap = self.stcurr - self.strtrt > > -- > You received this message because you are subscribed to the Google Groups > "PyFR Mailing List" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web, visit > https://groups.google.com/d/msgid/pyfrmailinglist/724f722b-da6c-4852-b5eb-098577160594o%40googlegroups.com. -- You received this message because you are subscribed to the Google Groups "PyFR Mailing List" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web, visit https://groups.google.com/d/msgid/pyfrmailinglist/2D65BC49-EE70-42E9-AB95-BA0D492C44A0%40witherden.org.
