Coverage for pySDC/implementations/hooks/log_step_size.py: 100%

6 statements  

« prev     ^ index     » next       coverage.py v7.6.7, created at 2024-11-16 14:51 +0000

1from pySDC.core.hooks import Hooks 

2 

3 

4class LogStepSize(Hooks): 

5 """ 

6 Store the step size at the end of each step as "dt". 

7 """ 

8 

9 def post_step(self, step, level_number): 

10 """ 

11 Record step size 

12 

13 Args: 

14 step (pySDC.Step.step): the current step 

15 level_number (int): the current level number 

16 

17 Returns: 

18 None 

19 """ 

20 super().post_step(step, level_number) 

21 

22 L = step.levels[level_number] 

23 

24 self.add_to_stats( 

25 process=step.status.slot, 

26 time=L.time, 

27 level=L.level_index, 

28 iter=step.status.iter, 

29 sweep=L.status.sweep, 

30 type='dt', 

31 value=L.dt, 

32 )