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.Union(
[
dmsh.Circle([numpy.cos(angles[0]), numpy.sin(angles[0])], 1.0),
dmsh.Circle([numpy.cos(angles[1]), numpy.sin(angles[1])], 1.0),
dmsh.Circle([numpy.cos(angles[2]), numpy.sin(angles[2])], 1.0),
]
)
X, cells = dmsh.generate(geo, 0.2, show=show, tol=1.0e-10)
ref_norms = [4.0372522103229670e02, 2.1155465970807523e01, 1.9999337650692937e00]
assert_norm_equality(X.flatten(), ref_norms, 1.0e-10)
return X, cells
def test_boundary_step():
geo = dmsh.Union([dmsh.Circle([-0.5, 0.0], 1.0), dmsh.Circle([+0.5, 0.0], 1.0)])
geo.show()
a = geo.boundary_step([-0.5, 0.9])
assert numpy.array_equal(a, [-0.5, 1.0])
a = geo.boundary_step([-0.5, 0.6])
assert numpy.array_equal(a, [-0.5, 1.0])
a = geo.boundary_step([0.05, 0.05])
assert_equality(a, [-4.4469961425821203e-01, 9.9846976285554556e-01], 1.0e-10)
def test_union(show=False):
geo = dmsh.Union(
[dmsh.Rectangle(-1.0, +0.5, -1.0, +0.5), dmsh.Rectangle(-0.5, +1.0, -0.5, +1.0)]
)
X, cells = dmsh.generate(geo, 0.15, show=show, tol=1.0e-5)
ref_norms = [1.8432376349018622e02, 1.1278734993846784e01, 1.0000000000000000e00]
assert_norm_equality(X.flatten(), ref_norms, 1.0e-10)
return X, cells
def test_union(show=False):
geo = dmsh.Union([dmsh.Circle([-0.5, 0.0], 1.0), dmsh.Circle([+0.5, 0.0], 1.0)])
X, cells = dmsh.generate(geo, 0.15, show=show, tol=1.0e-10)
geo.plot()
ref_norms = [3.0088043884612756e02, 1.5785099320497183e01, 1.5]
assert_norm_equality(X.flatten(), ref_norms, 1.0e-10)
return X, cells