Counter#

class fridom.framework.modules.counter.Counter(clock_trigger: ClockTrigger | None = None)[source]#

Bases: Module

A counting module for debugging purposes.

Description#

Every time the update method is called, the counter is incremented by one. Additionally, a clock trigger can be set to only increment the counter for specific clock events.

Parameters#

clock_triggerfr.ClockTrigger, optional

A clock trigger to only increment the counter for specific clock events. If not set, the counter is incremented every time the update method is called.

__init__(clock_trigger: ClockTrigger | None = None) None[source]#

Methods

__init__([clock_trigger])

disable()

Disable the module.

enable()

Enable the module.

is_enabled()

Whether the module is enabled or not.

reset()

Stop and start the module.

setup(mset[, setup_mode])

Set the module up.

start()

Start the module.

stop()

Stop the module.

update(mz)

Update the model state.

Attributes

diff_module

The differentiation module to be used by this module.

grid

The grid of the model settings.

info

Return a dictionary with information about the time stepper.

interp_module

The interpolation module to be used by this module.

is_setup

Whether the module is set up.

mset

The model settings.

name

required_halo

The required halo points for this module.

name = 'Counter'#
update(mz: ModelState) ModelState[source]#

Update the model state.

Description#

This method is called by the model at each time step. Child classes should overwrite this method to update the module. Make sure to decorate the method with the @module_method decorator.

Parameters#

mzfr.ModelState

The model state at the current time step.

Returns#

fr.ModelState

The updated model state.