Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nedelec 2nd kind H(curl) fails on 32-bit systems #111

Open
drew-parsons opened this issue Feb 4, 2021 · 2 comments
Open

Nedelec 2nd kind H(curl) fails on 32-bit systems #111

drew-parsons opened this issue Feb 4, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@drew-parsons
Copy link
Contributor

Judging by the build errors at https://buildd.debian.org/status/package.php?p=basix, looks like Nedelec 2nd kind H(curl) is not compatible with 32 bit systems. e.g.
i386 https://buildd.debian.org/status/fetch.php?pkg=basix&arch=i386&ver=0.0.1%7Egit20210122.4f10ef2-1&stamp=1612391676&raw=0
armel https://buildd.debian.org/status/fetch.php?pkg=basix&arch=armel&ver=0.0.1%7Egit20210122.4f10ef2-1&stamp=1612398463&raw=0
armhf https://buildd.debian.org/status/fetch.php?pkg=basix&arch=armhf&ver=0.0.1%7Egit20210122.4f10ef2-1&stamp=1612392128&raw=0

Is this problem expected? Is it something that can be fixed, or should Nedelec 2nd kind H(curl) just be considered not supported on 32 bit systems?

The error message is

__ test_permutation_of_tabulated_data_tetrahedron[5-Nedelec 2nd kind H(curl)] __

element_name = 'Nedelec 2nd kind H(curl)', order = 5

    @pytest.mark.parametrize("element_name", tetrahedron_elements)
    @pytest.mark.parametrize("order", range(1, 6))
    def test_permutation_of_tabulated_data_tetrahedron(element_name, order):
        if element_name == "Crouzeix-Raviart" and order != 1:
            pytest.xfail()
    
        e = basix.create_element(element_name, "tetrahedron", order)
    
        N = 4
        points = np.array([[i / N, j / N, k / N]
                           for i in range(N + 1) for j in range(N + 1 - i) for k in range(N + 1 - i - j)])
        values = e.tabulate(0, points)[0]
    
        start = sum(e.entity_dofs[0])
        ndofs = e.entity_dofs[1][0]
        if ndofs != 0:
            # Check that the 0th permutation undoes the effect of reflecting edge 0
            reflected_points = np.array([[p[0], p[2], p[1]] for p in points])
            reflected_values = e.tabulate(0, reflected_points)[0]
    
            if e.mapping_name == "affine":
                pass
            elif e.mapping_name == "covariant piola":
                for i, r in enumerate(reflected_values):
                    for j in range(e.dim):
                        reflected_values[i][j + e.dim::e.dim] = r[j + e.dim::e.dim][::-1]
            elif e.mapping_name == "contravariant piola":
                for i, r in enumerate(reflected_values):
                    for j in range(e.dim):
                        reflected_values[i][j] = -r[j]
                        reflected_values[i][j + e.dim::e.dim] = -r[j + e.dim::e.dim][::-1]
            elif e.mapping_name == "double covariant piola":
                pytest.skip()  # TODO: implement double covariant piola
            else:
                raise ValueError(f"Unknown mapping: {e.mapping_name}")
    
            for i, j in zip(values, reflected_values):
                for d in range(e.value_size):
                    i_slice = i[d * e.dim:(d + 1) * e.dim]
                    j_slice = j[d * e.dim:(d + 1) * e.dim]
>                   assert np.allclose((e.base_permutations[0].dot(i_slice))[start: start + ndofs],
                                       j_slice[start: start + ndofs])
E                   assert False
E                    +  where False = <function allclose at 0xf6d2a658>(array([ 0., -0., -0., -0., -0.,  0.]), array([-1.34, -1.12, -0.28,  0.68,  0.8 , -1.5 ]))
E                    +    where <function allclose at 0xf6d2a658> = np.allclose

test/test_permutations.py:227: AssertionError

In the meantime since only this one test fails, I'll just skip this test in the 32-bit Debian builds. So the error won't show in future builds (but will still be there).

@drew-parsons
Copy link
Contributor Author

Might be worth noting, in principle orders 1 to 6 should have been tested, but only order 5 is triggering this error.

@mscroggs mscroggs added the bug Something isn't working label Sep 10, 2021
@mscroggs
Copy link
Member

Is this still an issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants