Checks that the vectors in div conforming spaces on a triangle are correctly oriented.
(space_type, order)
| 21 | @pytest.mark.parametrize("space_type", ["RT"]) |
| 22 | @pytest.mark.parametrize("order", [1, 2, 3, 4, 5]) |
| 23 | def test_div_conforming_triangle(space_type, order): |
| 24 | """Checks that the vectors in div conforming spaces on a triangle are correctly oriented.""" |
| 25 | |
| 26 | # Create simple triangle mesh |
| 27 | def perform_test(points, cells): |
| 28 | domain = ufl.Mesh(element("Lagrange", "triangle", 1, shape=(2,), dtype=default_real_type)) |
| 29 | mesh = create_mesh(MPI.COMM_WORLD, cells, domain, points) |
| 30 | V = functionspace(mesh, (space_type, order)) |
| 31 | f = Function(V) |
| 32 | x = f.x.array |
| 33 | output = [] |
| 34 | for dof in range(len(x)): |
| 35 | x[:] = 0.0 |
| 36 | x[dof] = 1 |
| 37 | points = np.array([[0.5, 0.5, 0], [0.5, 0.5, 0]]) |
| 38 | cells = np.array([0, 1]) |
| 39 | result = f.eval(points, cells) |
| 40 | normal = np.array([-1.0, 1.0]) |
| 41 | output.append(result.dot(normal)) |
| 42 | return output |
| 43 | |
| 44 | points = np.array([[0, 0], [1, 0], [1, 1], [0, 1]], dtype=default_real_type) |
| 45 | cells = np.array([[0, 1, 2], [2, 3, 0]]) |
| 46 | result = perform_test(points, cells) |
| 47 | for i, j in result: |
| 48 | assert i == pytest.approx(j, abs=1.0e-5) |
| 49 | |
| 50 | |
| 51 | @pytest.mark.skip_in_parallel |
nothing calls this directly
no test coverage detected