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
Classes
A single entry in the global operator registry. |
Functions
|
Decorator to register a class or function in the global registry. |
|
Return all registered operators of the given kind. |
|
Return the set of registered operator names for kind. |
|
Return the set of all registered operator kinds. |
|
Remove an operator from the registry (for testing only). |
|
Register a collision operator (kind |
|
Register a force operator (kind |
|
Register a boundary-condition operator (kind |
|
Register a macroscopic operator (kind |
|
Register an initialisation operator (kind |
|
Register an equilibrium operator (kind |
Register a simulation type (kind |
|
|
Register a streaming operator (kind |
Register an update-timestep operator (kind |
|
|
Register a wetting operator (kind |
|
Register a lattice model (kind |
|
Register a plotting operator (kind |
|
Register a comparison plot operator (kind |
|
Register an extra-state plugin (kind |
Module Contents
- class tud_lbm.registry.OperatorEntry[source]
Bases:
Generic[T]A single entry in the global operator registry.
- 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
nameclass/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.nameorobj.__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:namekey 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").