Starting in version 2.5.1, breve supports an experimental bridge to the Python language. This means that your simulation can execute Python code to preform computation. Communication between the languages is done by creating objects in the other language: Python objects can be created from steve code, and vice versa.
This feature is in-development and is subject to minor changes.
All Python files to be loaded into breve should import the breve module
to gain access to important breve engine functionality. In order for a
Python object to be compatible with the breve engine, it must be a
subclass of the breve Python module class breve.object. If an object is
not a subclass of breve.object, it will not be visible to the breve
engine. The __init__
method of the class must execute the
breve.object.__init__
method before any breve bridge
functionality is used.
The following example illustrates a basic Python file with a simple breve-compatible class defined:
@import breve class PythonBridgeObject( breve.object ): def __init__( self ): breve.object.__init__( self ) print "Inited Python bridge object" def iterate( self ): print "Iterating Python bridge object"
This simple Python object will be visible to the breve engine and will have its iterate method called at each iteration of the breve engine.