File: test_remove_points.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 (28 lines) | stat: -rw-r--r-- 659 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
import numpy as np

import meshplex

from .helpers import assert_mesh_consistency, compute_all_entities


def test():
    points = [
        [-2.1, -3.1],
        [0.0, 0.0],
        [1.0, 0.0],
        [-2.1, -3.1],
        [1.0, 1.0],
        [0.0, 1.0],
    ]
    cells = [[1, 2, 4], [1, 4, 5]]
    mesh = meshplex.MeshTri(points, cells)
    compute_all_entities(mesh)

    mesh.remove_dangling_points()

    assert len(mesh.points) == 4
    assert np.all(mesh.cells("points") == np.array([[0, 1, 2], [0, 2, 3]]))
    assert np.all(
        mesh.edges["points"] == np.array([[0, 1], [0, 2], [0, 3], [1, 2], [2, 3]])
    )
    assert_mesh_consistency(mesh)