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_union(show=False):
angles = numpy.pi * numpy.array([3.0 / 6.0, 7.0 / 6.0, 11.0 / 6.0])
geo = dmsh.Intersection(
[
dmsh.Circle([numpy.cos(angles[0]), numpy.sin(angles[0])], 1.5),
dmsh.Circle([numpy.cos(angles[1]), numpy.sin(angles[1])], 1.5),
dmsh.Circle([numpy.cos(angles[2]), numpy.sin(angles[2])], 1.5),
]
)
X, cells = dmsh.generate(geo, 0.1, show=show, tol=1.0e-10)
ref_norms = [6.9463737382956737e01, 5.1279489107568983e00, 7.2474487138537913e-01]
assert_norm_equality(X.flatten(), ref_norms, 1.0e-10)
return X, cells
def test_halfspace(show=False):
geo = dmsh.Intersection(
[
dmsh.HalfSpace(numpy.sqrt(0.5) * numpy.array([1.0, 1.0]), 0.0),
dmsh.Circle([0.0, 0.0], 1.0),
]
)
X, cells = dmsh.generate(geo, 0.1, show=show)
ref_norms = [1.6445971629723411e02, 1.0032823867864321e01, 9.9962000746451751e-01]
assert_norm_equality(X.flatten(), ref_norms, 1.0e-10)
return X, cells
def test_intersection(show=False):
geo = dmsh.Intersection(
[dmsh.Circle([0.0, -0.5], 1.0), dmsh.Circle([0.0, +0.5], 1.0)]
)
X, cells = dmsh.generate(geo, 0.1, show=show, tol=1.0e-10)
geo.plot()
ref_norms = [8.6619344595913475e01, 6.1599895121114274e00, 8.6602540378466342e-01]
assert_norm_equality(X.flatten(), ref_norms, 1.0e-10)
return X, cells