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_ball_with_sizing_field():
class Field(pygalmesh.SizingFieldBase):
def eval(self, x):
return abs(numpy.sqrt(numpy.dot(x, x)) - 0.5) / 5 + 0.025
mesh = pygalmesh.generate_with_sizing_field(
pygalmesh.Ball([0.0, 0.0, 0.0], 1.0),
facet_angle=30,
facet_size=0.1,
facet_distance=0.025,
cell_radius_edge_ratio=2,
cell_size=Field(),
verbose=False,
)
assert abs(max(mesh.points[:, 0]) - 1.0) < 0.02
assert abs(min(mesh.points[:, 0]) + 1.0) < 0.02
assert abs(max(mesh.points[:, 1]) - 1.0) < 0.02
assert abs(min(mesh.points[:, 1]) + 1.0) < 0.02
assert abs(max(mesh.points[:, 2]) - 1.0) < 0.02
assert abs(min(mesh.points[:, 2]) + 1.0) < 0.02