mesh2tikz
is a library to convert meshes of the t8code library into tikz
format. It takes a mesh, a camera-position and a view-volume as an input and transfers the elements of the mesh that lay in the view-volume into a .tikz
file.
t8code is known for its parallel capabilities and its support for extremely large meshes. At first, it seems to be unpractical to transfrom a mesh into a tikz
-file.
This library is meant to support you to visualize concepts used in t8code for any of your publications. As t8code keeps on evolving and new features are published this library can visualize these additions on smaller meshes. Even though it is possible to write meshes that were constructed in parallel it is not recommended to use this feature for many processes.
Before starting, you should ensure that t8code, p4est and sc are installed. p4est and sc should come with an installation of t8code. The installation of mesh2tikz
is very similar to png2mesh and if you have already installed it, you can probably skip the setup of the environment variables. If not, the following environment variables must be set:
T8_INCLUDE
, the include directory of t8code, p4est and scT8_LIB
, the directory containing the libraries of t8code, p4est and sc.
The following steps will build 'mesh2tikz' on a linux environment:
mkdir build
cd build
cmake ..
make
You can setup your AMR-pipeline and use mesh2tikz
to transform your mesh into a tikz file. An example can be found in mesh2tikz_demo
.
To write a tikz
file mesh2tikz
gets a commited forest and a fileprefix to define where the output should be written.
The size of the output-graphic is defined via screen_width
and screen_height
. The position and the direction of the camera are defined using
cam
and focus
. up
defines which direction referes to the y-direction of the camera coordinates. The view-volume is defined by view_width
and view_height
, defining a plane at the focus-point orthogonal to the view-direction. The depth of the frustom is defined by far
.
Parameter | Explanation |
---|---|
forest | A commited forest. |
fileprefix | A filename, where the tikz-file should be created |
screen_width | The width of the output-screen. |
screen_height | The height of the output-screen. |
cam | The position of the camera. |
focus | The point the camera is facing. |
up | The up-direction of the camera. |
view_width | The width of the frontal view-plane orthogonal to the view-direction, defining the view-volume. |
view_height | The height of the frontal view-plane orthogonal to the view-direction, defining the view-volume. |
far | The distance between the camera and the back of the view-volume. |
write_sfc | If set to 1, a line jumping from center to center of each element along the space-filling curve is drawn |
color_mpi | If set to 1 colorize the different processes. |
mpi_colors | The colors to use for the mpi_processes |
After calling the elements in the view-volume are transformed using a perspective-projection onto the screen defined by screen_width
and screen_height
. Eventually, the tikz
-file can be included in your latex-document.
If you use a file that was generated by mesh2tikz
or mesh2tikz
itself, please cite this github page with David Knapp as the author. A citation of t8code would be appreciated, as well.