Simulator

mechanica.Simulator

alias of MxSimulatorPy

class mechanica.MxSimulator

The Simulator is the entry point to simulation, this is the very first object that needs to be initialized before any other method can be called. All the methods of the Simulator are static, but the constructor needs to be called first to initialize everything.

The Simulator manages all of the operating system interface, it manages window creation, end user input events, GPU access, threading, inter-process messaging and so forth. All ‘physical’ modeling concepts go in the Universe.

static get() MxSimulator *

gets the global simulator object, returns NULL if fail.

static run(et: double) HRESULT

Runs the event loop until all windows close or simulation time expires. Automatically performs universe time propogation.

Parameters

et (float) – final time; a negative number runs infinitely

Return type

int

Returns

HRESULT

static show() HRESULT

Shows any windows that were specified in the config. Works just like MatPlotLib’s show method. The show method does not start the universe time propagation unlike run and irun.

Return type

int

Returns

HRESULT

static close() HRESULT

Closes the main window, while the application / simulation continues to run.

Return type

int

Returns

HRESULT

static getCUDAConfig()

Gets the Simulator CUDA runtime control interface.

Only available in CUDA-supported installations.

Return type

MxSimulatorCUDAConfig

class mechanica.MxSimulatorPy

Bases: MxSimulator

static irun() HRESULT

Interactive python version of the run loop. This checks the ipython context and lets ipython process keyboard input, while we also running the simulator and processing window messages.

Return type

int

Returns

HRESULT