A self-hosted, browser-based GUI for t8code. You can:
- load meshes
- inspect cmeshes and forests in a ParaView-like pipeline
- create, adapt, partition and balance forests, and repartition cmeshes
- color and select elements in a 3D view
t8gui is an application you run yourself, not a website. A small C++ server serves the interface on localhost. It starts t8code with the number of MPI processes you choose in the browser.
DISLAIMER: This repo is 100% vibe coded and therefore does not comply with our usual strive for human based quality assurance and human understanding of code. Nobody in our team has the capabilities and time to maintain a GUI for t8code. This codebase is also not critical in anyway and just for demonstration purposes.
- Sources:
- Gmsh files, read by t8code's own reader, which takes ASCII MSH 4.x with first-order elements and reports everything else. t8gui does not convert files.
- Curved geometry from CAD, if t8code was built with OpenCASCADE (
T8GUI_T8CODE_ENABLE_OCC, see INSTALL.md): refined elements then follow the CAD surfaces.- Open a
.mshfile with the.brepof the same name next to it, or drop both files. The mesh needs parametric node coordinates (gmsh:Mesh.SaveParametric = 1); without them t8code silently uses straight elements. - Elements are drawn with straight edges between their corners.
- Open a
- All 33 t8code example cmeshes, with parameter forms.
- The p4est/p8est built-in connectivities.
- VTK files, if t8code was built with VTK.
- OpenFOAM cases, opened through the
.foamfile in the case directory and read fromconstant/polyMeshby t8code's OpenFOAM reader. - Cmesh options for examples, Gmsh files and p4est connectivities, such as turning off the negative volume check of a debug build of t8code. t8code's OpenFOAM and VTK readers set up the cmesh themselves and take none.
- Repartition of a cmesh: evenly by t8code, or with the first tree of each process chosen by hand. Ranges chosen by hand fit only the number of processes they were made for, so a replay on another number stops there.
- Forests:
- Uniform refinement with the default, standalone or subelement scheme.
- Adaptation by sphere, plane, level, random or the selected elements (refine or coarsen).
- Partition and 2:1 balance.
- Hanging-node removal with subelements.
- Element data:
- Values on the elements of a forest, with any number of components (a scalar or a vector): a constant, a linear function, a Gaussian or a sine wave of the element center; a constant vector, a vortex, a radial source or the gradient of a Gaussian, with one component per dimension of the forest; or Python functions you write, for example from the example that reads values from a CSV file.
- Python:
setup()runs once on every process (import modules, read files) and its result goes toelement_callback(data, coords, level, element_id, eclass), which returns the value of each element. Every process runs its own Python, the one given with--python, so it can be one with numpy or pandas. - The data follows the forest as t8code's mesh handle carries it: adapting interpolates it (refined elements keep the value of their parent, coarsened families get their mean), partitioning moves it to the new processes. t8code relates only elements one level apart, so a forest with data can not be adapted recursively, balanced unless it is balanced already, or get subelements.
- Shown as a coloring field (a vector by its magnitude or by one component), in the hover readout and the selection, and written to VTK files.
- Pipeline browser:
- Every object is shown in a tree with eye toggles, renaming, deletion and VTK export.
- Creating an object hides its input, as in ParaView.
- View:
- Representations: surface with edges, surface, wireframe, points, and vectors: an arrow in each element for element data with one component per dimension of the mesh, as long as its magnitude times a factor.
- Rendering options: opacity, shrink, curved elements (for geometries that are not linear: quadratic, through the middles of the edges mapped by the geometry, as t8code writes curved VTK files), clipping of whole elements, and thresholds on any field.
- Camera and export: ±X/±Y/±Z/isometric views, perspective or orthographic projection, PNG screenshots.
- Coloring:
- Fields: refinement level, tree, MPI rank, element shape, element id (the space-filling-curve order), volume or element data.
- Legend: shown in the viewport for the active object.
- Palettes: categorical colors come from a palette checked for color-vision deficiencies, and the sequential maps are perceptually uniform.
- Legend: shown in the viewport for the active object; drag it to move it, drag its top-left corner to resize it, double-click to put it back. Marks on a range bar show where its labeled values lie.
- Mouse:
- A rotate / pan / zoom / select toggle (keys R/P/Z/S) changes what the left button does. The middle button always pans, and the right button and wheel always zoom.
- Double-click rotates about an element.
- Selection:
- Click, add or toggle single elements, or drag a box.
- Per-element details: corners, volume, linear id and face neighbors (including ghosts).
- Actions on the selection: refine, coarsen, hide and isolate.
- MPI:
- Pick the number of processes at start; you can restart with a different number at any time.
- The view of one process (Display panel): only its elements and, see-through, its ghost elements, with the element data t8code exchanged to the ghosts.
- The pipeline is replayed exactly, because element ids follow the space-filling curve and don't depend on the partition. Only a cmesh partition with hand-chosen ranges needs the same number of processes.
- A crashed worker (a t8code abort, a segmentation fault or an uncaught exception) does not take the GUI down. A popup shows what t8code printed before the crash and the path of the crash report, and restarts the worker.
- Every crash leaves a crash report: the log of all ranks with a backtrace, the pipeline, the command that crashed and a script that reproduces it (see Crash reports). For a problem that did not crash, such as a mesh that looks wrong, the bug button in the toolbar writes such a report on request.
- Interface:
- Light and dark themes, following the system or set explicitly.
- A console with the t8code output of all ranks.
You need Linux, CMake ≥ 3.19, a C++20 compiler, MPI (preferably MPICH), Git and Node.js ≥ 18. The first configure downloads t8code (the release or commit named in cmake/t8code-version.txt), which is then built along with t8gui.
cmake -S . -B build -G Ninja
cmake --build build
cmake --install build --prefix ~/.local # optionalINSTALL.md is a step-by-step guide for Ubuntu 24.04 and 22.04, with the packages to install, the optional OpenCASCADE and VTK support, and troubleshooting.
./build/t8guiWhat happens on start:
- The server prints a link like
http://127.0.0.1:8080/?token=…. Open it. - The browser asks how many MPI processes t8code should use.
- The Open dialog starts in the directory t8gui was started in. It can open every file that the user running t8gui can read.
On a remote machine: run t8gui on the cluster or workstation, then forward the port, for example ssh -L 8080:localhost:8080 host, and open the printed link locally.
Useful options (all in t8gui --help):
--np Nstarts t8code right away.--mpi-launcher "srun -n {np}"uses another launcher.--max-elements Ncaps uniform refinements.--host 0.0.0.0listens on all interfaces. The token is always required.--report-dir DIRchanges where crash reports are written.--python PATHpicks the Python for element data from Python functions (defaultpython3), for example thepythonof a conda environment with pandas.--no-pythonswitches Python off.
Security:
- Every API request needs the token. It is stored in a cookie when you open the link.
- Whoever has the token can open every file that the user running t8gui can read and run Python code as that user (unless
--no-python), so share the link only with people you would give your login to. - Requests with foreign
HostorOriginheaders are rejected.
When the t8code worker crashes, or you kill it while a command runs, the server writes a directory t8gui-crash-<date>-<time> into ~/.local/state/t8gui/crash-reports (or $XDG_STATE_HOME/t8gui/crash-reports, or --report-dir). It also packs the directory into t8gui-crash-<date>-<time>.tar.gz next to it. The crash popup and the session dialog show the path of that file and offer it for download; the server also prints the path in its terminal.
report.md:- what happened
- the t8gui commit, t8code, MPI and the machine
- the command that was running
- the pipeline
- the backtrace with function names
- the complete console log of the server and all ranks
replay.json: the pipeline steps and the command that crashed.t8gui-worker --script replay.jsonruns them without the GUI;report.mdhas the exact command.files/: copies of uploaded input files, which are deleted when the server stops.
Reports are meant to be shared, so they name neither you nor your machine: the home directory appears as ~ and the machine name as <host>. Input files that you opened from disk are named without their directory and are not included; attach them to the issue if they are needed to reproduce it.
For a problem that did not crash t8code, such as a mesh that looks wrong, the bug button in the toolbar writes a report on request. It goes into a directory t8gui-report-<date>-<time> and its .tar.gz next to the crash reports and has what a crash report has except the command, plus what you describe and a screenshot of the window with the view, the legend and the panels (screenshot.png).
To report a bug, open an issue and attach the report's .tar.gz file. The crash popup and the report dialog link there.
./build/t8gui --token dev --port 8080 # terminal 1
cd frontend && T8GUI_TOKEN=dev npm run dev # terminal 2, then open http://localhost:5173
npm run check && npm test # type check and unit tests
npx playwright install chromium && npm run e2e # browser test against the real server (also run by ctest)C++ code follows t8code's style; format it with t8code's .clang-format (clang-format 17).
GPL-2.0-or-later, like t8code. See LICENSE. The licenses of the libraries t8gui is built with are collected in THIRD_PARTY_LICENSES.txt (also in share/t8gui/ of an install); the About dialog links to them.