Skip to content

Commit 9a8c4ef

Browse files
committed
Final ReadME.md
1 parent 22b0d4d commit 9a8c4ef

1 file changed

Lines changed: 17 additions & 22 deletions

File tree

  • pycode/memilio-generation/memilio/tools

pycode/memilio-generation/memilio/tools/README.md

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,25 @@ Before running the example script, configure the following settings:
1818
`conf.target_folder`: Defines the folder where the generated Python file will be stored.
1919

2020

21-
Example Configuration:
22-
If you want to use the ode_secirvvs model the config should be like this -> `conf.source_file = os.path.abspath(os.path.join(file_path, "..", "..", "..", "..", "cpp", "models", "ode_secirvvs", "model.cpp"))`
21+
Example Configuration:<br>
22+
If you want to use the ode_secirvvs model the config should be like this:<br> `conf.source_file = os.path.abspath(os.path.join(file_path, "..", "..", "..", "..", "cpp", "models", "ode_secirvvs", "model.cpp"))` <br>
2323
This descibes the filepath to your model.cpp outgoing from the tools folder.
2424

2525
To use a different model, replace ode_secirvvs with the desired model's name in the file path.
2626

27-
Adding Additional Source Files:
27+
Adding Additional Source Files:<br>
2828
In addition to the main source file, it is possible to include further source files in the binding process.
29-
For this purpose, the `asts´ instance of the [ASTHandler class](/pycode/memilio-generation/memilio/generation/ast_handler.py) provides the method `add_source_file´:
30-
```python
31-
asts.add_source_file("name_of_the_file.cpp")
32-
```
29+
For this purpose, the `asts` instance of the [ASTHandler class](/pycode/memilio-generation/memilio/generation/ast_handler.py) provides the method `add_source_file`:<br>
30+
Example:<br>
31+
`asts.add_source_file("name_of_the_file.cpp")`
32+
3333

34-
To set up a target folder, specify the desired output directory for the generated bindings here:
35-
`conf.target_folder = file_path`
36-
If no custom path is specified and `file_path`is used as the target folder, the generated files will be saved in
34+
To set up a target folder, specify the desired output directory for the generated bindings here:<br>
35+
`conf.target_folder = file_path`<br>
36+
If no custom path is specified and `file_path` is used as the target folder, the generated files will be saved in
3737
the tools directory by default, as this is the working directory of the skript.
3838

39-
After setting up the source file and target folder, set the path to the example script in the terminal:
39+
After setting up the source files and target folder, set the path to the example script in the terminal.<br>
4040
If the terminal shows the memilio package, just give the path with:
4141
```bash
4242
cd pycode/memilio-generation/memilio/tools
@@ -50,7 +50,7 @@ python example_oseir.py
5050

5151
## Visualization
5252

53-
The package contains a [Visualization class](/pycode/memilio-generation/memilio/generation/graph_visualization.py) to display the generated AST.
53+
The package contains a [Visualization class](/pycode/memilio-generation/memilio/generation/graph_visualization.py) to display the generated AST.<br>
5454
This allows for:
5555

5656
- Printing the AST in the terminal
@@ -59,29 +59,24 @@ This allows for:
5959

6060
- Formatting it in a text file
6161

62-
You can print the AST in the example script with the aviz instance of the Visualisation() class.
62+
You can print the AST in the example script with the `aviz` instance of the Visualisation() class.
6363

6464

65-
Example:
66-
`aviz.output_ast_formatted(asts.get_ast_by_id(0), ast.get_node_by_index(1))` displays the second node of the first AST and its children in a file called ast_formatted.txt.
65+
Example:<br>
66+
`aviz.output_ast_formatted(asts.get_ast_by_id(0), ast.get_node_by_index(1))` displays the second node of the first AST and its children in a file called ast_formatted.txt.<br>
6767
The root node `.get_node_by_index(0)` displays the whole AST.
6868

6969
`aviz.output_ast_terminal(asts.get_ast_by_id(0), ast.get_node_by_index(1))` displays the second node of the AST and its children in terminal.
7070

71-
The first argument of the statements specify the given AST. The second argument specifies the node and its children that you want to display.
71+
The first argument of the statements specifies the selected AST. The second argument specifies the node and its children that you want to display.
7272

7373
`aviz.output_ast_png(ast.get_node_by_index(2), 2)` displays the third node of the AST and its children with a depth of 2 as a png file. The second argument of the statement specifies the depth up to which the function displays child nodes. This means that any nodes beyond the specified depth (e.g., all nodes at level 3 and beyond if the depth is set to 2) will not be shown.
7474
The output of the AST as a PNG should be restricted, since not many nodes can be displayed at once in a PNG. So only subtrees with a restricted depth should be printed.
7575

76-
The visualization is specified under the `if (print_ast):` statement in the example script.
76+
The visualization is specified under the `if (print_ast):` statement in the example script. There you can choose which of the display methods you want to output.<br>
7777
It is enabled when running the example with the following command:
7878

7979

8080
```bash
8181
python example_oseir.py -p
8282
```
83-
84-
85-
86-
87-

0 commit comments

Comments
 (0)