File: test_plot.py

package info (click to toggle)
python-meshplex 0.17.1-5
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 668 kB
  • sloc: python: 3,626; makefile: 13
file content (36 lines) | stat: -rw-r--r-- 950 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import pathlib

import meshplex

this_dir = pathlib.Path(__file__).resolve().parent


def test_show_mesh():
    mesh = meshplex.read(this_dir / ".." / "meshes" / "pacman.vtu")
    mesh = meshplex.MeshTri(mesh.points[:, :2], mesh.cells("points"))
    print(mesh)  # test __repr__
    # mesh.plot(show_axes=False)
    mesh.show(
        show_axes=False,
        cell_quality_coloring=("viridis", 0.0, 1.0, True),
        show_point_numbers=True,
        show_edge_numbers=True,
        show_cell_numbers=True,
        mark_points=[1],
        mark_edges=[0],
        mark_cells=[0, 3, 7],
        nondelaunay_edge_color="r",
        boundary_edge_color="b",
        control_volume_centroid_color="g",
    )
    # mesh.save("pacman.png", show_axes=False)


def test_show_vertex():
    mesh = meshplex.read(this_dir / ".." / "meshes" / "pacman.vtu")
    # mesh.plot_vertex(125)
    mesh.show_vertex(125)


if __name__ == "__main__":
    test_show_mesh()