Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_stretch():
alpha = 2.0
s = pygalmesh.Stretch(pygalmesh.Cuboid([0, 0, 0], [1, 2, 3]), [alpha, 0.0, 0.0])
mesh = pygalmesh.generate_mesh(s, cell_size=0.2, edge_size=0.2, verbose=False)
tol = 1.0e-2
assert abs(max(mesh.points[:, 0]) - alpha) < tol
assert abs(min(mesh.points[:, 0]) + 0.0) < tol
assert abs(max(mesh.points[:, 1]) - 2.0) < tol
assert abs(min(mesh.points[:, 1]) + 0.0) < tol
assert abs(max(mesh.points[:, 2]) - 3.0) < tol
assert abs(min(mesh.points[:, 2]) + 0.0) < tol
vol = sum(helpers.compute_volumes(mesh.points, mesh.cells["tetra"]))
assert abs(vol - 12.0) < tol
return