| 1 |
# Fractal sample |
| 2 |
The example calculates two classical Mandelbrot fractals with different concurrency levels. |
| 3 |
|
| 4 |
The application window is divided into two areas where fractals are rendered. The example also has the console mode. |
| 5 |
|
| 6 |
## Building the example |
| 7 |
``` |
| 8 |
cmake <path_to_example> [EXAMPLES_UI_MODE=value] |
| 9 |
cmake --build . |
| 10 |
|
| 11 |
``` |
| 12 |
### Predefined CMake variables |
| 13 |
* `EXAMPLES_UI_MODE` - defines the GUI mode, supported values are `gdi`, `d2d`, `con` on Windows, `x`,`con` on Linux and `mac`,`con` on macOS. The default mode is `con`. See the [common page](../../README.md) to get more information. |
| 14 |
|
| 15 |
## Running the sample |
| 16 |
### Predefined make targets |
| 17 |
* `make run_fractal` - executes the example with predefined parameters. |
| 18 |
* `make perf_run_fractal` - executes the example with suggested parameters to measure the oneTBB performance. |
| 19 |
* `make light_test_fractal` - executes the example with suggested parameters to reduce execution time. |
| 20 |
|
| 21 |
### Application parameters |
| 22 |
Usage: |
| 23 |
``` |
| 24 |
fractal [n-of-threads=value] [n-of-frames=value] [max-of-iterations=value] [grain-size=value] [use-auto-partitioner] [silent] [single] [-h] [n-of-threads [n-of-frames [max-of-iterations [grain-size]]]] |
| 25 |
``` |
| 26 |
* `-h` - prints the help for command line options. |
| 27 |
* `n-of-threads` - the number of threads to use; a range of the form low\[:high\], where low and optional high are non-negative integers or `auto` for a platform-specific default number. |
| 28 |
* `n-of-frames` - the number of frames the example processes internally. |
| 29 |
* `max-of-iterations` - the maximum number of the fractal iterations. |
| 30 |
* `grain-size` - the optional grain size, must be a positive integer. |
| 31 |
* `use-auto-partitioner` - use oneapi::tbb::auto_partitioner. |
| 32 |
* `silent` - no output except elapsed time. |
| 33 |
* `single` - process only one fractal. |
| 34 |
|
| 35 |
### Interactive graphical user interface |
| 36 |
The following hot keys can be used in interactive execution mode when the example is compiled with the graphical user interface: |
| 37 |
|
| 38 |
* `left mouse button` - make the fractal active. |
| 39 |
* `w` - move the active fractal up. |
| 40 |
* `a` - move the active fractal to the left. |
| 41 |
* `s` - move the active fractal down. |
| 42 |
* `d` - move the active fractal to the right. |
| 43 |
* `q` - zoom in the active fractal. |
| 44 |
* `e` - zoom out the active fractal. |
| 45 |
* `r` - increase quality (count of iterations for each pixel) the active fractal. |
| 46 |
* `f` - decrease quality (count of iterations for each pixel) the active fractal. |
| 47 |
* `esc` - stop execution. |