feat(python): Repaired python bindings

Python bindings have now been brought back up to feature pairity with
C++. Further, stubs have been added for all python features so that code
completion will work
This commit is contained in:
2025-11-25 14:08:58 -05:00
parent 22b52abc30
commit bb1d6bbb24
51 changed files with 3798 additions and 460 deletions

View File

@@ -0,0 +1,92 @@
"""
GridFire numerical solver bindings
"""
from __future__ import annotations
import collections.abc
import fourdst._phys.atomic
import gridfire._gridfire.engine
import gridfire._gridfire.type
import typing
__all__: list[str] = ['CVODESolverStrategy', 'CVODETimestepContext', 'DynamicNetworkSolverStrategy', 'SolverContextBase']
class CVODESolverStrategy(DynamicNetworkSolverStrategy):
def __init__(self, engine: gridfire._gridfire.engine.DynamicEngine) -> None:
"""
Initialize the CVODESolverStrategy object.
"""
def evaluate(self, netIn: gridfire._gridfire.type.NetIn, display_trigger: bool = False) -> gridfire._gridfire.type.NetOut:
"""
evaluate the dynamic engine using the dynamic engine class
"""
def get_absTol(self) -> float:
"""
Get the absolute tolerance for the CVODE solver.
"""
def get_relTol(self) -> float:
"""
Get the relative tolerance for the CVODE solver.
"""
def get_stdout_logging_enabled(self) -> bool:
"""
Check if solver logging to standard output is enabled.
"""
def set_absTol(self, absTol: typing.SupportsFloat) -> None:
"""
Set the absolute tolerance for the CVODE solver.
"""
def set_callback(self, cb: collections.abc.Callable[[CVODETimestepContext], None]) -> None:
"""
Set a callback function which will run at the end of every successful timestep
"""
def set_relTol(self, relTol: typing.SupportsFloat) -> None:
"""
Set the relative tolerance for the CVODE solver.
"""
def set_stdout_logging_enabled(self, logging_enabled: bool) -> None:
"""
Enable logging to standard output.
"""
class CVODETimestepContext(SolverContextBase):
@property
def T9(self) -> float:
...
@property
def currentConvergenceFailures(self) -> int:
...
@property
def currentNonlinearIterations(self) -> int:
...
@property
def dt(self) -> float:
...
@property
def engine(self) -> gridfire._gridfire.engine.DynamicEngine:
...
@property
def last_step_time(self) -> float:
...
@property
def networkSpecies(self) -> list[fourdst._phys.atomic.Species]:
...
@property
def num_steps(self) -> int:
...
@property
def rho(self) -> float:
...
@property
def state(self) -> list[float]:
...
@property
def t(self) -> float:
...
class DynamicNetworkSolverStrategy:
def describe_callback_context(self) -> list[tuple[str, str]]:
"""
Get a structure representing what data is in the callback context in a human readable format
"""
def evaluate(self, netIn: gridfire._gridfire.type.NetIn) -> gridfire._gridfire.type.NetOut:
"""
evaluate the dynamic engine using the dynamic engine class
"""
class SolverContextBase:
pass