tud_lbm.registry

Central operator registry for TUD-LBM.

Every operator (class or pure function) self-registers at import time via the register_operator() decorator. Consumers look up entries via get_operators(), get_operator_names(), or get_operator_category().

The registry stores OperatorEntry objects keyed by "{kind}:{name}".

Usage:

from registry import register_operator, get_operators

@register_operator("collision_models")
def collide_bgk(f, feq, tau, source=None):
    ...
collide_bgk.name = "bgk"

# or, for classes:
@register_operator("collision_models")
class CollisionBGK:
    name = "bgk"
    ...

ops = get_operators("collision_models")
# {"bgk": OperatorEntry(name="bgk", kind="collision_models", target=...)}

Attributes

OperatorTarget

T

OPERATOR_REGISTRY

Classes

OperatorEntry

A single entry in the global operator registry.

Functions

register_operator(→ collections.abc.Callable[[_OT], _OT])

Decorator to register a class or function in the global registry.

get_operators(→ dict[str, OperatorEntry])

Return all registered operators of the given kind.

get_operator_names(→ set[str])

Return the set of registered operator names for kind.

get_operator_category(→ set[str])

Return the set of all registered operator kinds.

unregister_operator(→ None)

Remove an operator from the registry (for testing only).

collision_model(→ collections.abc.Callable[[_OT], _OT])

Register a collision operator (kind "collision_models").

force_model(→ collections.abc.Callable[[_OT], _OT])

Register a force operator (kind "force").

boundary_condition(→ collections.abc.Callable[[_OT], _OT])

Register a boundary-condition operator (kind "boundary_condition").

macroscopic_operator(→ collections.abc.Callable[[_OT], ...)

Register a macroscopic operator (kind "macroscopic").

initialise_operator(→ collections.abc.Callable[[_OT], _OT])

Register an initialisation operator (kind "initialise").

equilibrium_operator(→ collections.abc.Callable[[_OT], ...)

Register an equilibrium operator (kind "equilibrium").

simulation_type_operator(...)

Register a simulation type (kind "simulation_type").

stream_operator(→ collections.abc.Callable[[_OT], _OT])

Register a streaming operator (kind "stream").

update_timestep_operator(...)

Register an update-timestep operator (kind "update_timestep").

wetting_operator(→ collections.abc.Callable[[_OT], _OT])

Register a wetting operator (kind "wetting").

lattice_operator(→ collections.abc.Callable[[_OT], _OT])

Register a lattice model (kind "lattice").

plotting_operator(→ collections.abc.Callable[[_OT], _OT])

Register a plotting operator (kind "plotting").

analysis_operator(→ collections.abc.Callable[[_OT], _OT])

Register an analysis plotting operator (kind "analysis").

extra_state_plugin(→ collections.abc.Callable[[_OT], _OT])

Register an extra-state plugin (kind "extra_state").

Module Contents

tud_lbm.registry.OperatorTarget[source]
tud_lbm.registry.T[source]
class tud_lbm.registry.OperatorEntry[source]

Bases: Generic[T]

A single entry in the global operator registry.

name: str[source]
kind: str[source]
target: T[source]
metadata: dict[str, object] | None = None[source]
tud_lbm.registry.OPERATOR_REGISTRY: dict[str, OperatorEntry[object]][source]
tud_lbm.registry.register_operator(kind: str, *, name: str | None = None, **meta: object) collections.abc.Callable[[_OT], _OT][source]

Decorator to register a class or function in the global registry.

The decorated object must either: * Have a name class/function attribute, or * Receive name explicitly via the keyword argument.

Parameters:
  • kind – Operator category, e.g. "collision_models".

  • name – Optional explicit name. Falls back to obj.name or obj.__name__.

  • **meta – Arbitrary metadata stored in OperatorEntry.metadata.

Returns:

A decorator that registers obj and returns it unchanged.

Raises:

ValueError – If obj has no discoverable name, or if the kind:name key is already registered.

tud_lbm.registry.get_operators(kind: str) dict[str, OperatorEntry][source]

Return all registered operators of the given kind.

Parameters:

kind – Category string, e.g. "collision_models".

Returns:

{name: OperatorEntry, ...}

tud_lbm.registry.get_operator_names(kind: str) set[str][source]

Return the set of registered operator names for kind.

tud_lbm.registry.get_operator_category() set[str][source]

Return the set of all registered operator kinds.

tud_lbm.registry.unregister_operator(kind: str, name: str) None[source]

Remove an operator from the registry (for testing only).

Parameters:
  • kind – Operator category, e.g. "collision_models".

  • name – Operator name within that category.

tud_lbm.registry.collision_model(*, name: str | None = None, **meta: object) collections.abc.Callable[[_OT], _OT][source]

Register a collision operator (kind "collision_models").

tud_lbm.registry.force_model(*, name: str | None = None, **meta: object) collections.abc.Callable[[_OT], _OT][source]

Register a force operator (kind "force").

tud_lbm.registry.boundary_condition(*, name: str | None = None, **meta: object) collections.abc.Callable[[_OT], _OT][source]

Register a boundary-condition operator (kind "boundary_condition").

tud_lbm.registry.macroscopic_operator(*, name: str | None = None, **meta: object) collections.abc.Callable[[_OT], _OT][source]

Register a macroscopic operator (kind "macroscopic").

tud_lbm.registry.initialise_operator(*, name: str | None = None, **meta: object) collections.abc.Callable[[_OT], _OT][source]

Register an initialisation operator (kind "initialise").

tud_lbm.registry.equilibrium_operator(*, name: str | None = None, **meta: object) collections.abc.Callable[[_OT], _OT][source]

Register an equilibrium operator (kind "equilibrium").

tud_lbm.registry.simulation_type_operator(*, name: str | None = None, **meta: object) collections.abc.Callable[[_OT], _OT][source]

Register a simulation type (kind "simulation_type").

tud_lbm.registry.stream_operator(*, name: str | None = None, **meta: object) collections.abc.Callable[[_OT], _OT][source]

Register a streaming operator (kind "stream").

tud_lbm.registry.update_timestep_operator(*, name: str | None = None, **meta: object) collections.abc.Callable[[_OT], _OT][source]

Register an update-timestep operator (kind "update_timestep").

tud_lbm.registry.wetting_operator(*, name: str | None = None, **meta: object) collections.abc.Callable[[_OT], _OT][source]

Register a wetting operator (kind "wetting").

tud_lbm.registry.lattice_operator(*, name: str | None = None, **meta: object) collections.abc.Callable[[_OT], _OT][source]

Register a lattice model (kind "lattice").

tud_lbm.registry.plotting_operator(*, name: str | None = None, **meta: object) collections.abc.Callable[[_OT], _OT][source]

Register a plotting operator (kind "plotting").

tud_lbm.registry.analysis_operator(*, name: str | None = None, **meta: object) collections.abc.Callable[[_OT], _OT][source]

Register an analysis plotting operator (kind "analysis").

tud_lbm.registry.extra_state_plugin(*, name: str | None = None, **meta: object) collections.abc.Callable[[_OT], _OT][source]

Register an extra-state plugin (kind "extra_state").