本文整理汇总了Python中dolfin.UnitSquareMesh.radius_ratio_min方法的典型用法代码示例。如果您正苦于以下问题:Python UnitSquareMesh.radius_ratio_min方法的具体用法?Python UnitSquareMesh.radius_ratio_min怎么用?Python UnitSquareMesh.radius_ratio_min使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dolfin.UnitSquareMesh
的用法示例。
在下文中一共展示了UnitSquareMesh.radius_ratio_min方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_HarmonicSmoothing
# 需要导入模块: from dolfin import UnitSquareMesh [as 别名]
# 或者: from dolfin.UnitSquareMesh import radius_ratio_min [as 别名]
def test_HarmonicSmoothing(self):
print ""
print "Testing HarmonicSmoothing::move(Mesh& mesh, " \
"const BoundaryMesh& new_boundary)"
# Create some mesh and its boundary
mesh = UnitSquareMesh(10, 10)
boundary = BoundaryMesh(mesh, 'exterior')
# Move boundary
disp = Expression(("0.3*x[0]*x[1]", "0.5*(1.0-x[1])"))
boundary.move(disp)
# Move mesh according to given boundary
mesh.move(boundary)
# Check that new boundary topology corresponds to given one
boundary_new = BoundaryMesh(mesh, 'exterior')
self.assertEqual(boundary.topology().hash(),
boundary_new.topology().hash())
# Check that coordinates are almost equal
err = sum(sum(abs(boundary.coordinates() \
- boundary_new.coordinates()))) / mesh.num_vertices()
print "Current CG solver produced error in boundary coordinates", err
self.assertAlmostEqual(err, 0.0, places=5)
# Check mesh quality
magic_number = 0.35
self.assertTrue(mesh.radius_ratio_min()>magic_number)
示例2: test_ale
# 需要导入模块: from dolfin import UnitSquareMesh [as 别名]
# 或者: from dolfin.UnitSquareMesh import radius_ratio_min [as 别名]
def test_ale(self):
print ""
print "Testing ALE::move(Mesh& mesh0, const Mesh& mesh1)"
# Create some mesh
mesh = UnitSquareMesh(4, 5)
# Make some cell function
# FIXME: Initialization by array indexing is probably
# not a good way for parallel test
cellfunc = CellFunction('size_t', mesh)
cellfunc.array()[0:4] = 0
cellfunc.array()[4:] = 1
# Create submeshes - this does not work in parallel
submesh0 = SubMesh(mesh, cellfunc, 0)
submesh1 = SubMesh(mesh, cellfunc, 1)
# Move submesh0
disp = Constant(("0.1", "-0.1"))
submesh0.move(disp)
# Move and smooth submesh1 accordignly
submesh1.move(submesh0)
# Move mesh accordingly
parent_vertex_indices_0 = \
submesh0.data().array('parent_vertex_indices', 0)
parent_vertex_indices_1 = \
submesh1.data().array('parent_vertex_indices', 0)
mesh.coordinates()[parent_vertex_indices_0[:]] = \
submesh0.coordinates()[:]
mesh.coordinates()[parent_vertex_indices_1[:]] = \
submesh1.coordinates()[:]
# If test passes here then it is probably working
# Check for cell quality for sure
magic_number = 0.28
self.assertTrue(mesh.radius_ratio_min() > magic_number)