MCPcopy Create free account
hub / github.com/FEniCS/dolfinx / perform_test

Function perform_test

python/test/unit/fem/test_vector_function.py:27–42  ·  view source on GitHub ↗
(points, cells)

Source from the content-addressed store, hash-verified

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]])

Callers 2

Calls 6

evalMethod · 0.95
create_meshFunction · 0.90
functionspaceFunction · 0.90
FunctionClass · 0.90
MeshMethod · 0.80
arrayMethod · 0.45

Tested by

no test coverage detected