A JIT input file is a C++ input file that can be used along side a python input file, or even replace the python input file. The JIT input file includes "S_source.hh" that gives it access to the entire simulation. The code in a JIT input file is compiled into a shared library during simulation initialization. The simulation dynamically opens the shared library and runs a specific function called "run_me" that must be defined in the JIT input file. There are a couple of advantages to this type of input file.
1. Once compiled, a JIT input file is orders of magnitude faster to execute than a python equivalent. That is because there is no python is involved, everything is C++.
2. Full C++ functionality. Our SWIG/python code cannot access everything in the sim, C++ can.
3. Events and malfunctions written in C++ and inputted through a JIT input file will not impact real-time operations as much as python events.
4. A JIT input file can be loaded and executed from a python input file. you don’t have to choose one type or the other.
An example JIT input file from SIM_Ball++_L1/RUN_cpp_input/input.cpp
```c++
/*
To use this as an input file include this file on the command line.
S_main_${TRICK_HOST_CPU}.exe RUN_<dir>/input.cpp
Trick will compile and link this file at simulation runtime. The
run_me function will automatically be executed during the
input_processor phase of initialization.
*/
// need access to private/protected things? uncomment these.
// add a read event that removes all other events.
jit_add_read( 150.0 , "remove_events" ) ;
// tries to add event that does not exist. (currently silents fails)
jit_add_read( 190.0 , "dne_event" ) ;
exec_set_terminate_time(200.0) ;
/*
real_time_enable() ;
trick_real_time.itimer.enable() ;
sim_control_panel_set_enabled(true) ;
*/
return 0 ;
}
```
A JIT input file may be used with a python input file or in place of a python input file. To use a JIT input file from within a python script use the following calls
```python
# jit_compile_and_run specifies the c++ input file, and an optional function name to run. The function
# must fit the c++ prototype 'extern "C" int function()'. If no function name is given, the function