Skip to content

Commit 7f71c39

Browse files
fsimonisMakisH
andauthored
Rewrite the config visualization page (#375)
Co-authored-by: Gerasimos Chourdakis <chourdak@in.tum.de>
1 parent cc40d23 commit 7f71c39

1 file changed

Lines changed: 44 additions & 27 deletions

File tree

pages/docs/tooling/tooling-config-visualization.md

Lines changed: 44 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,36 +22,37 @@ This has a few important benefits:
2222

2323
## Installation
2424

25+
We provide two python packages ways of visualizing preCICE configurations.
26+
27+
1. `precice-config-visualizer` which translates preCICE configuration files to a graph and optionally renders them as an image.
28+
2. `precice-config-visualizer-gui` which offers an interactive GUI for the above.
29+
2530
Please first install the dependencies:
2631

2732
* `python3` and `pipx` (or `pip`)
2833
* [`graphviz`](https://graphviz.org/download/) for rendering the result.
29-
* dependencies of [`pygobject`](https://gnome.pages.gitlab.gnome.org/pygobject/getting_started.html)
30-
31-
In particular, in Ubuntu, you might need to install the following packages:
34+
* **GUI only:** dependencies of [`pygobject`](https://gnome.pages.gitlab.gnome.org/pygobject/getting_started.html)
35+
36+
In particular, in Ubuntu, you might need to install the following packages:
3237

33-
```bash
34-
sudo apt install libcairo2-dev libgirepository1.0-dev gcc libcairo2-dev pkg-config python3-dev gir1.2-gtk-4.0
35-
```
38+
```bash
39+
sudo apt install libcairo2-dev libgirepository1.0-dev gcc libcairo2-dev pkg-config python3-dev gir1.2-gtk-4.0
40+
```
3641

3742
Then install the latest version straight from PyPi:
3843

3944
```bash
4045
pipx install precice-config-visualizer
41-
```
42-
43-
Alternatively, you can install the latest develop version from the repository
44-
45-
```bash
46-
pipx install https://github.com/precice/config-visualizer/archive/master.zip
46+
# To also install the GUI
47+
pipx install precice-config-visualizer-gui
4748
```
4849

4950
## General usage
5051

5152
The configuration visualizer comes with a CLI and a GUI, which serve different purposes:
5253

5354
* Use the GUI to quickly explore a configuration and change the visualization parameters.
54-
* Use the CLI to automatriclaly generate graphs from preCICE configuration files or to heavily customize them to suite your own needs.
55+
* Use the CLI to automatically generate graphs from preCICE configuration files or to heavily customize them to suite your own needs.
5556

5657
## Using the GUI
5758

@@ -65,27 +66,43 @@ precice-config-visualizer-gui precice-config.xml
6566

6667
The application automatically reloads configuration files on change and shows parsing errors at the bottom. This is especially useful for rapid prototyping.
6768

68-
Desktop integration is still lacking with commonly used tools for installin python packages.
69-
If you want your launcher to pick up the tool, you can save [its desktop file](https://raw.githubusercontent.com/precice/config-visualizer/master/data/org.precice.config_visualizer.desktop) manually to the directory `~/.local/share/applications/`. The directory may need to be created first.
69+
Desktop integration is still lacking with commonly used tools for installing python packages.
70+
If you want your launcher to pick up the tool, you can save [this desktop file](https://gist.githubusercontent.com/fsimonis/a08c3771abf808b0534d658bcb563f90/raw/e091d78c24b04d0fc903b8de4909528628d22b7b/org.precice.configvisualizer.desktop) (right-click > "Save Link As") manually to the directory `~/.local/share/applications/`. The directory may need to be created first.
71+
After logging out and back in, you can start the program using your launcher and even directly open XML files with it.
7072

7173
## Using the CLI
7274

73-
Alternatively, you can generate [a DOT graph](https://graphviz.org/doc/info/lang.html) and transform it to a presentable format, e.g., PDF or PNG.
75+
There two use-cases for the CLI:
7476

75-
1. Use `precice-config-visualizer -o config.dot precice-config.xml` to generate the grpah `config.dot` from the `precice-config.xml` file.
77+
1. To directly render the configuration as an image
78+
2. To output [a DOT graph](https://graphviz.org/doc/info/lang.html) which can be freely changed and finally rendered as an image
7679

77-
2. Use `dot -Tpdf -O config.dot` to layout the graph in `config.dot`, generating a `config.pdf`.
78-
This program is part of graphviz and there are many more output formats possible.
80+
Some common output formats such as png, pdf, svg, and jpg are automatically detected and rendered using `graphviz`/`dot`.
81+
Unknown formats will be interpreted as an output for the graph description in the dot language.
7982

80-
Combine the two commands with a pipe to generate, for example, a PDF file (PNG/SVG are also possible):
83+
To render a preCICE configuration as a PNG image use:
8184

8285
```bash
83-
precice-config-visualizer precice-config.xml | dot -Tpdf > graph.pdf
86+
precice-config-visualizer -o graph.png precice-config.xml
8487
```
8588

86-
{% tip %}
87-
Set a bash function to your aliases to make your life easier. The [demo virtual machine](installation-vm.html) already [defines such functions](https://github.com/precice/vm/blob/main/provisioning/.alias).
88-
{% endtip %}
89+
To customize the graph further first generate the dot graph:
90+
91+
```bash
92+
precice-config-visualizer precice-config.xml > graph.dot
93+
```
94+
95+
Then you can freely change the graph to your liking.
96+
Useful resources are:
97+
98+
* The documentation of [the DOT language](https://graphviz.org/doc/info/lang.html)
99+
* A visualizer such as [xdot](https://pypi.org/project/xdot/)
100+
101+
Finally, directly use `dot` to render your final image:
102+
103+
```bash
104+
dot -Tpng -O graph.png graph.dot
105+
```
89106

90107
## Controlling the output
91108

@@ -120,23 +137,23 @@ These examples are based on the elastictube1d example.
120137
### The full picture
121138

122139
```bash
123-
precice-config-visualizer precice-config.xml | dot -Tpdf > graph.pdf
140+
precice-config-visualizer -o graph.svg precice-config.xml
124141
```
125142

126143
![Config visualization](images/docs/tooling/elastictube1d-full.svg)
127144

128145
### Reduced information of coupling schemes and communicators
129146

130147
```bash
131-
precice-config-visualizer --communicators=merged --cplschemes=merged precice-config.xml | dot -Tpdf > graph.pdf
148+
precice-config-visualizer --communicators=merged --cplschemes=merged -o graph.svg precice-config.xml
132149
```
133150

134151
![Config visualization](images/docs/tooling/elastictube1d-cpl-com-merged.svg)
135152

136153
### Data flow visualization
137154

138155
```bash
139-
precice-config-visualizer --communicators=hide --cplschemes=hide precice-config.xml | dot -Tpdf > graph.pdf
156+
precice-config-visualizer --communicators=hide --cplschemes=hide -o graph.svg precice-config.xml
140157
```
141158

142159
![Config visualization](images/docs/tooling/elastictube1d-data-flow.svg)

0 commit comments

Comments
 (0)