本文整理匯總了Python中dolfin.UnitSquareMesh.coordinates()[:]方法的典型用法代碼示例。如果您正苦於以下問題:Python UnitSquareMesh.coordinates()[:]方法的具體用法?Python UnitSquareMesh.coordinates()[:]怎麽用?Python UnitSquareMesh.coordinates()[:]使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類dolfin.UnitSquareMesh
的用法示例。
在下文中一共展示了UnitSquareMesh.coordinates()[:]方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _cooks
# 需要導入模塊: from dolfin import UnitSquareMesh [as 別名]
# 或者: from dolfin.UnitSquareMesh import coordinates()[:] [as 別名]
def _cooks(cls, **kwargs):
mesh = UnitSquareMesh(10, 5)
def cooks_domain(x, y):
return [48 * x, 44 * (x + y) - 18 * x * y]
mesh.coordinates()[:] = np.array(cooks_domain(mesh.coordinates()[:, 0], mesh.coordinates()[:, 1])).transpose()
# plot(mesh, interactive=True, axes=True)
maxx, minx, maxy, miny = 48, 0, 60, 0
# setup boundary parts
llc, lrc, tlc, trc = compile_subdomains(['near(x[0], 0.) && near(x[1], 0.)',
'near(x[0], 48.) && near(x[1], 0.)',
'near(x[0], 0.) && near(x[1], 60.)',
'near(x[0], 48.) && near(x[1], 60.)'])
top, bottom, left, right = compile_subdomains([ 'x[0] >= 0. && x[0] <= 48. && x[1] >= 44. && on_boundary',
'x[0] >= 0. && x[0] <= 48. && x[1] <= 44. && on_boundary',
'near(x[0], 0.) && on_boundary',
'near(x[0], 48.) && on_boundary'])
# the corners
llc.minx = minx
llc.miny = miny
lrc.maxx = maxx
lrc.miny = miny
tlc.minx = minx
tlc.maxy = maxy
trc.maxx = maxx
trc.maxy = maxy
# the edges
top.minx = minx
top.maxx = maxx
bottom.minx = minx
bottom.maxx = maxx
left.minx = minx
right.maxx = maxx
return mesh, {'top':top, 'bottom':bottom, 'left':left, 'right':right, 'llc':llc, 'lrc':lrc, 'tlc':tlc, 'trc':trc, 'all': DomainBoundary()}, 2