本文整理匯總了Python中sfepy.fem.Domain.create_surface_group方法的典型用法代碼示例。如果您正苦於以下問題:Python Domain.create_surface_group方法的具體用法?Python Domain.create_surface_group怎麽用?Python Domain.create_surface_group使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sfepy.fem.Domain
的用法示例。
在下文中一共展示了Domain.create_surface_group方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_normals
# 需要導入模塊: from sfepy.fem import Domain [as 別名]
# 或者: from sfepy.fem.Domain import create_surface_group [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