本文整理汇总了Python中sfepy.fem.Domain.get_mesh_coors方法的典型用法代码示例。如果您正苦于以下问题:Python Domain.get_mesh_coors方法的具体用法?Python Domain.get_mesh_coors怎么用?Python Domain.get_mesh_coors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfepy.fem.Domain
的用法示例。
在下文中一共展示了Domain.get_mesh_coors方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_normals
# 需要导入模块: from sfepy.fem import Domain [as 别名]
# 或者: from sfepy.fem.Domain import get_mesh_coors [as 别名]
def test_normals(self):
"""
Check orientations of surface normals on the reference elements.
"""
import sfepy
from sfepy.fem import Mesh, Domain, Integral
from sfepy.fem.poly_spaces import PolySpace
from sfepy.fem.mappings import SurfaceMapping
from sfepy.linalg import normalize_vectors
ok = True
for geom in ['2_3', '2_4', '3_4', '3_8']:
mesh = Mesh.from_file('meshes/elements/%s_1.mesh' % geom,
prefix_dir=sfepy.data_dir)
domain = Domain('domain', mesh)
surface = domain.create_region('Surface', 'nodes of surface')
domain.create_surface_group(surface)
sd = domain.surface_groups[0][surface.name]
coors = domain.get_mesh_coors()
gel = domain.geom_els[geom].surface_facet
ps = PolySpace.any_from_args('aux', gel, 1)
mapping = SurfaceMapping(coors, sd.get_connectivity(), ps)
integral = Integral('i', order=1)
vals, weights = integral.get_qp(gel.name)
# Evaluate just in the first quadrature point...
geo = mapping.get_mapping(vals[:1], weights[:1])
expected = expected_normals[geom].copy()
normalize_vectors(expected)
_ok = nm.allclose(expected, geo.normal[:, 0, :, 0],
rtol=0.0, atol=1e-14)
self.report('%s: %s' % (geom, _ok))
if not _ok:
self.report('expected:')
self.report(expected)
self.report('actual:')
self.report(geo.normal[:, 0, :, 0])
ok = ok and _ok
return ok