How to use the dmsh.geometry.pypathlib.ClosedPath 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_speed.py View on Github external
def test_speed(n=3):
    path_pts = [[0, 0], [0, 1], [1, 1], [1, 0]]
    path0 = path.Path(path_pts)
    path1 = pypathlib.ClosedPath(path_pts)

    def _mpl_path(pts):
        return path0.contains_points(pts)

    def _pypathlib_contains_points(pts):
        return path1.contains_points(pts)

    numpy.random.seed(0)

    perfplot.show(
        setup=lambda n: numpy.random.rand(n, 2),
        kernels=[_mpl_path, _pypathlib_contains_points],
        n_range=[2 ** k for k in range(n)],
        labels=["matplotlib.path.contains_points", "pypathlib.contains_points"],
        logx=True,
        logy=True,
github nschloe / dmsh / test / test_speed.py View on Github external
def benchmark():
    path_pts = [[0, 0], [0, 1], [1, 1], [1, 0]]
    path1 = pypathlib.ClosedPath(path_pts)
    pts = numpy.random.rand(5000000, 2)
    path1.contains_points(pts)