How to use the dmsh.Polygon function in dmsh

To help you get started, we’ve selected a few dmsh examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nschloe / dmsh / test / test_square_hole.py View on Github external
def test(show=False):
    geo = dmsh.Difference(
        dmsh.Rectangle(0.0, 5.0, 0.0, 5.0),
        dmsh.Polygon([[1, 1], [4, 1], [4, 4], [1, 4]]),
    )
    X, cells = dmsh.generate(geo, 1.0, show=show, tol=1.0e-3)

    ref_norms = [1.4000000000000000e02, 2.3176757306973560e01, 5.0000000000000000e00]
    assert_norm_equality(X.flatten(), ref_norms, 1.0e-10)
github nschloe / dmsh / test / test_polygon.py View on Github external
def test(show=False):
    geo = dmsh.Polygon(
        [
            [0.0, 0.0],
            [1.1, 0.0],
            [1.2, 0.5],
            [0.7, 0.6],
            [2.0, 1.0],
            [1.0, 2.0],
            [0.5, 1.5],
        ]
    )
    X, cells = dmsh.generate(geo, 0.1, show=show)

    ref_norms = [4.1468030858462305e+02, 2.1861920662017866e+01, 2.0]
    assert_norm_equality(X.flatten(), ref_norms, 1.0e-5)
    return X, cells
github nschloe / dmsh / test / test_pacman.py View on Github external
def test_pacman(show=False):
    geo = dmsh.Difference(
        dmsh.Circle([0.0, 0.0], 1.0),
        dmsh.Polygon([[0.0, 0.0], [1.5, 0.4], [1.5, -0.4]]),
    )
    X, cells = dmsh.generate(geo, 0.1, show=show, tol=1.0e-10)

    ref_norms = [3.0385105041432689e02, 1.3644964912810719e01, 1.0]
    assert_norm_equality(X.flatten(), ref_norms, 1.0e-10)
    return X, cells