meshpro / dmsh

:spider_web: Simple mesh generator inspired by distmesh.
GNU General Public License v3.0
210 stars 25 forks source link

update expected test results for meshplex 0.15.4 #57

Closed drew-parsons closed 3 years ago

drew-parsons commented 3 years ago

After meshplex 0.15.4, several dmsh tests are now failing: test_halfspace, test_large, test_pacman, test_rectangle, test_rectangle_hole, etc. e.g.

________________________________ test_halfspace ________________________________

show = False

    def test_halfspace(show=False):
        geo = dmsh.Intersection(
            [
                dmsh.HalfSpace(numpy.sqrt(0.5) * numpy.array([1.0, 1.0]), 0.0),
                dmsh.Circle([0.0, 0.0], 1.0),
            ]
        )
        X, cells = dmsh.generate(geo, 0.1, show=show)

        ref_norms = [1.6445956676826719e02, 1.0032819728269299e01, 9.9962353342404042e-01]
>       assert_norm_equality(X.flatten(), ref_norms, 1.0e-6)

test/test_halfspace.py:17: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

X = array([-0.70710678,  0.70710678,  0.70710678, -0.70710678,  0.6450446 ,
       -0.6450446 ,  0.58124506, -0.58124506, ... -0.07271509,
        0.99735275,  0.03101633,  0.99951888,  0.13299572,  0.99111661,
        0.23490238,  0.97201897])
ref_norm = array([164.45956677,  10.03281973,   0.99962353]), tol = 1e-06

    def assert_norm_equality(X, ref_norm, tol):
        ref_norm = numpy.asarray(ref_norm)
        vals = numpy.array(
            [
                numpy.linalg.norm(X, ord=1),
                numpy.linalg.norm(X, ord=2),
                numpy.linalg.norm(X, ord=numpy.inf),
            ]
        )
>       assert numpy.all(
            numpy.abs(vals - ref_norm) < tol * ref_norm
        ), "Expected: [{:.16e}, {:.16e}, {:.16e}]\nComputed: [{:.16e}, {:.16e}, {:.16e}]".format(
            *ref_norm, *vals
        )
E       AssertionError: Expected: [1.6445956676826719e+02, 1.0032819728269299e+01, 9.9962353342404042e-01]
E       Computed: [1.6391103448060974e+02, 1.0020943433490697e+01, 9.9999732753403403e-01]

test/helpers.py:21: AssertionError

Looks like the dmsh expected values need to be updated in the wake of meshplex 0.15.4.

nschloe commented 3 years ago

I'm on it, but it may take a little.

nschloe commented 3 years ago

Should be fixed now.