core.Hooks module¶
- class Entry(process, process_sweeper, time, level, iter, sweep, type, num_restarts)¶
Bases:
tuple
- iter¶
Alias for field number 4
- level¶
Alias for field number 3
- num_restarts¶
Alias for field number 7
- process¶
Alias for field number 0
- process_sweeper¶
Alias for field number 1
- sweep¶
Alias for field number 5
- time¶
Alias for field number 2
- type¶
Alias for field number 6
- class hooks[source]¶
Bases:
object
Hook class to contain the functions called during the controller runs (e.g. for calling user-routines)
When deriving a custom hook from this class make sure to always call the parent method using e.g. super().post_step(step, level_number). Otherwise bugs may arise when using filer_recomputed from the stats helper for post processing.
- logger¶
logger instance for output
- __num_restarts¶
number of restarts of the current step
- Type:
int
- __stats¶
dictionary for gathering the statistics of a run
- Type:
dict
- entry¶
statistics entry containing all information to identify the value
- Type:
namedtuple
- add_to_stats(value, **kwargs)[source]¶
Routine to add data to the statistics dict. Please supply the metadata as keyword arguments in accordance with the entry class.
- Parameters:
value – the actual data
- increment_stats(value, initialize=None, **kwargs)[source]¶
Routine to increment data to the statistics dict. If the data is not yet created, it will be initialized to initialize if applicable and to value otherwise. Please supply metadata as keyword arguments in accordance with the entry class.
- Parameters:
value – the actual data
initialize – if supplied and data does not exist already, this will be used over value
- meta_data = {'iter': None, 'level': None, 'num_restarts': None, 'process': None, 'process_sweeper': None, 'sweep': None, 'time': None, 'type': None}¶
- post_comm(step, level_number, add_to_stats=False)[source]¶
Default routine called after each communication
- Parameters:
step (pySDC.Step.step) – the current step
level_number (int) – the current level number
add_to_stats (bool) – set if result should go to stats object
- post_iteration(step, level_number)[source]¶
Default routine called after each iteration
- Parameters:
step (pySDC.Step.step) – the current step
level_number (int) – the current level number
- post_predict(step, level_number)[source]¶
Default routine called after each predictor
- Parameters:
step (pySDC.Step.step) – the current step
level_number (int) – the current level number
- post_run(step, level_number)[source]¶
Default routine called after each run
- Parameters:
step (pySDC.Step.step) – the current step
level_number (int) – the current level number
- post_setup(step, level_number)[source]¶
Default routine called after setup
- Parameters:
step (pySDC.Step.step) – the current step
level_number (int) – the current level number
- post_step(step, level_number)[source]¶
Default routine called after each step or block
- Parameters:
step (pySDC.Step.step) – the current step
level_number (int) – the current level number
- post_sweep(step, level_number)[source]¶
Default routine called after each sweep
- Parameters:
step (pySDC.Step.step) – the current step
level_number (int) – the current level number
- pre_comm(step, level_number)[source]¶
Default routine called before communication starts
- Parameters:
step (pySDC.Step.step) – the current step
level_number (int) – the current level number
- pre_iteration(step, level_number)[source]¶
Default routine called before iteration starts
- Parameters:
step (pySDC.Step.step) – the current step
level_number (int) – the current level number
- pre_predict(step, level_number)[source]¶
Default routine called before predictor starts
- Parameters:
step (pySDC.Step.step) – the current step
level_number (int) – the current level number
- pre_run(step, level_number)[source]¶
Default routine called before time-loop starts
- Parameters:
step (pySDC.Step.step) – the current step
level_number (int) – the current level number
- pre_setup(step, level_number)[source]¶
Default routine called before setup starts
- Parameters:
step (pySDC.Step.step) – the current step
level_number (int) – the current level number
- pre_step(step, level_number)[source]¶
Hook called before each step
- Parameters:
step (pySDC.Step.step) – the current step
level_number (int) – the current level number