Simulation engines

class strengths.rdengine.RDEngineBase(option='', description='')

base class for a reaction-diffusion system trajectory simulation engine.

Parameters:
  • option (str) – engine option (default = “”).

  • description (str) – description of the engine (ie. its name, and which algorithms it implements) that will be featured in the simulation outputs for context (default = “”).

property description

Description of the engine (str).

finalize()

Finalize the engine use. Should be called last.

get_output()

Returns the system trajectory data array. Should be called after initialize_3D and before finalize.

Return type:

array

get_progress()

Returns the percentage of simulation progress. Should be called after initialize_3D and before finalize.

Return type:

number

is_complete()

Tells if the simulation is complete.

Returns:

True if the simulation is complete, False otherwise.

Return type:

bool

iterate()

Makes the engine iterate once. Should be called after initialize_3D and before get_output and finalize.

Returns:

True if the simulation is incomplete, False otherwise.

Return type:

bool

iterate_n(n_iterations)

Makes the engine iterate n_itrations times or until the simulation is finished. Should be called after initialize_3D and before get_output and finalize.

Parameters:

n_iterations (int) – number of iterations requested.

Returns:

True if the simulation is incomplete, False otherwise.

Return type:

bool

property option

Option currently associated with the engine (str). Should be set before calling initialize_3D.

run(breathe_dt)

Makes the engine keep iterating for a real-time duration of breathe_dt or until the simulation is finished. Should be called after initialize_3D and before get_output and finalize.

Parameters:

breathe_dt (int) – maximal real-time duration for which the engine should keep running in ms.

Returns:

True if the simulation is incomplete, False otherwise.

Return type:

bool

sample()

sample the current system state.

setup(script)

setup the engine/ initialize the simulation.

Parameters:

script (RDScript) – Simulation parameters