You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pycode/memilio-generation/memilio/tools/README.md
+14-4Lines changed: 14 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,17 @@ This descibes the filepath to your model.cpp outgoing from the tools folder.
24
24
25
25
To use a different model, replace ode_secirvvs with the desired model's name in the file path.
26
26
27
-
To set up a target folder, specify the desired output directory for the generated bindings.
27
+
Adding Additional Source Files:
28
+
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
+
´´´
33
+
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
37
+
the tools directory by default, as this is the working directory of the skript.
28
38
29
39
After setting up the source fileand target folder, set the path to the example script in the terminal:
30
40
If the terminal shows the memilio package, just give the path with:
@@ -53,10 +63,10 @@ You can print the AST in the example script with the aviz instance of the Visual
53
63
54
64
55
65
Example:
56
-
`aviz.output_ast_formatted(ast, ast.get_node_by_index(1))` displays the second node of the AST and its children in a file called ast_formatted.txt.
57
-
The root node (`.get_node_by_index(0)`) displays the whole AST.
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.
67
+
The root node `.get_node_by_index(0)` displays the whole AST.
58
68
59
-
`aviz.output_ast_terminal(ast, ast.get_node_by_index(1))` displays the second node of the AST and its children in terminal.
69
+
`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.
60
70
61
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.
0 commit comments