File: test_refinement_point_line.py

package info (click to toggle)
python-dmsh 0.2.19-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 480 kB
  • sloc: python: 1,893; makefile: 5
file content (29 lines) | stat: -rw-r--r-- 707 bytes parent folder | download
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
from helpers import assert_norm_equality, save

import dmsh


def generate(show=False):
    geo = dmsh.Rectangle(0.0, 1.0, 0.0, 1.0)

    # p0 = dmsh.Path([[0.0, 0.0]])
    p1 = dmsh.Path([[0.4, 0.6], [0.6, 0.4]])

    def edge_size(x):
        return 0.03 + 0.1 * p1.dist(x)

    X, cells = dmsh.generate(geo, edge_size, show=show, tol=1.0e-10, max_steps=100)
    return X, cells


def test(show=False):
    X, cells = generate(show)

    ref_norms = [3.7918105331047593e02, 1.5473837427489348e01, 1.0000000000000000e00]
    assert_norm_equality(X.flatten(), ref_norms, 1.0e-2)


if __name__ == "__main__":
    test(show=False)
    X, cells = generate(show=False)
    save("refinement_line.png", X, cells)