(V, W, Q, mesh)
| 61 | |
| 62 | |
| 63 | def test_eval(V, W, Q, mesh): |
| 64 | u1 = Function(V) |
| 65 | u2 = Function(W) |
| 66 | u3 = Function(Q) |
| 67 | |
| 68 | def e2(x): |
| 69 | values = np.empty((3, x.shape[1])) |
| 70 | values[0] = x[0] + x[1] + x[2] |
| 71 | values[1] = x[0] - x[1] - x[2] |
| 72 | values[2] = x[0] + x[1] + x[2] |
| 73 | return values |
| 74 | |
| 75 | def e3(x): |
| 76 | values = np.empty((9, x.shape[1])) |
| 77 | values[0] = x[0] + x[1] + x[2] |
| 78 | values[1] = x[0] - x[1] - x[2] |
| 79 | values[2] = x[0] + x[1] + x[2] |
| 80 | values[3] = x[0] |
| 81 | values[4] = x[1] |
| 82 | values[5] = x[2] |
| 83 | values[6] = -x[0] |
| 84 | values[7] = -x[1] |
| 85 | values[8] = -x[2] |
| 86 | return values |
| 87 | |
| 88 | u1.interpolate(lambda x: x[0] + x[1] + x[2]) |
| 89 | u2.interpolate(e2) |
| 90 | u3.interpolate(e3) |
| 91 | |
| 92 | x0 = (mesh.geometry.x[0] + mesh.geometry.x[1]) / 2.0 |
| 93 | tree = bb_tree(mesh, mesh.topology.dim, padding=0.0) |
| 94 | cell_candidates = compute_collisions_points(tree, x0) |
| 95 | cell = compute_colliding_cells(mesh, cell_candidates, x0).array |
| 96 | assert len(cell) > 0 |
| 97 | first_cell = cell[0] |
| 98 | assert np.allclose(u3.eval(x0, first_cell)[:3], u2.eval(x0, first_cell), rtol=1e-15, atol=1e-15) |
| 99 | |
| 100 | |
| 101 | @pytest.mark.skip_in_parallel |
nothing calls this directly
no test coverage detected