wolfgpu.SimulationRunner

Module Contents

class wolfgpu.SimulationRunner.GlWindowManagerInterface[source]

Bases: enum.Enum

Inheritance diagram of wolfgpu.SimulationRunner.GlWindowManagerInterface

Generic enumeration.

Derive from this class to define new enumerations.

PYGAME = 'pygame'[source]
GLFW = 'glfw'[source]
classmethod for_glfw(glfw_window)[source]

If one wants to call the swap buffer function in glfw, one needs to have a reference to the window.

wolfgpu.SimulationRunner.MEM_TRACKING = False[source]
wolfgpu.SimulationRunner.MOSTLY_DRY_MESHES_THRESHOLD = 1e-05[source]
class wolfgpu.SimulationRunner.SimulationRunner(glsim, record_path: pathlib.Path | str = Path('.'), early_out_delta_max=1e-06, record=True, page_flip_func=pygame.display.flip, enable_alpha_recording=False)[source]
property early_out_threshold: float[source]
property step_num[source]

The step that is going to be computed. Starts at zero.

record: bool[source]
_glsim: wolfgpu.glsimulation.GLSimulation[source]
classmethod quick_run(sim: wolfgpu.simple_simulation.SimpleSimulation, record_path: pathlib.Path | str, refresh_view: float = 0.1, early_out_threshold=None, gl_wmi: GlWindowManagerInterface = GlWindowManagerInterface.PYGAME) wolfgpu.results_store.ResultsStore[source]

Run a full simulation quickly. By quickly we mean a lot of the setup of the simulator (such as OpenGL context) is done automatically. In particular a progress window is displayed.

  • sim: the simulation you want to run

  • record_patha directory where to record the results of the simulation. We

    accept str as well as Path.

  • refresh_view : how often the progress window is displyaed (every N seconds)

scanned_file()[source]
restart_from_record(start_rec=None)[source]

Restart a simulation from a previous record. This is useful when you want to continue a simulation that has been interrupted.

When restarting from a record, it means that the record in question will be deleted and simulation will go on from there.

Parameters:

start_rec – the index of the record you want to start from. If None, the simulation will restart from the last record.

results_path() pathlib.Path[source]
results_store() wolfgpu.results_store.ResultsStore[source]

Gives a result store back. The result store will be opened in read mode.

record_file()[source]
do_record(texture_ndx, force=False)[source]
texture_written_by_last_step() int[source]

After running run_one_step this gives the number of the texture that was written to (zero or one; rememeber the GPU code often uses flip-flop textures, that’s what you query here).

texture_read_by_last_step() int[source]
run_extra_step()[source]

When a simulation run is complete, this allows to run an additional step. This is useful in debugging.

FIXME The way the reporting is updated is not clear right now.

run_one_step(dont_close_results=False)[source]
plot_progress2()[source]
file_in_use(f)[source]
_try_reload_bathymetry()[source]
init_result_store()[source]
full_run(pace=None, refresh_view=1, label='sim.pdf', dont_close_results=False)[source]