Subsections


13.2 Python

Figure 13.2: The Python unit directory tree, along with the implemented APIs.
Image Python_pic

FLASH allows for binding certain unit API functionality to python through the compilation of a pyFlash module that is linked against the FLASH source and which the FLASH executable is in turn linked against using the pybind11 library to generate the bindings. This enables the code to embed a python interpreter in the application allowing for python scripts to interact with a FLASH simulation at runtime. Currently the python bindings are only supported through the cmake build system.

Like the Cpp unit, the Python unit collects various other units' implementations of their own Python subunit. Each Python subunit contains a source file Unit_py11.cxx that is responsible for generating a python module for that unit. The full API as well as additional usage documentation can be found in the pyFlash documentation.

13.2.1 Setup Generated Files

FlashH.py Maps the simulation specific preprocessor macros from Flash.h to python variables. Array indices are decremented to be 0-indexed.
constantsH.py Maps the preprocessor macros from constants.h to python variables.
parm.py Creates rp_[Int|Real|Log|Str] python variables that wrap around all the runtime parameters encountered in the simulation's Config files.