本文整理匯總了Python中region.Region.facets方法的典型用法代碼示例。如果您正苦於以下問題:Python Region.facets方法的具體用法?Python Region.facets怎麽用?Python Region.facets使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類region.Region
的用法示例。
在下文中一共展示了Region.facets方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _region_leaf
# 需要導入模塊: from region import Region [as 別名]
# 或者: from region.Region import facets [as 別名]
def _region_leaf(level, op):
token, details = op['token'], op['orig']
if token != 'KW_Region':
parse_def = token + '<' + ' '.join(details) + '>'
region = Region('leaf', rdef, domain, parse_def=parse_def)
if token == 'KW_Region':
details = details[1][2:]
aux = regions.find(details)
if not aux:
raise ValueError, 'region %s does not exist' % details
else:
if rdef[:4] == 'copy':
region = aux.copy()
else:
region = aux
elif token == 'KW_All':
region.vertices = nm.arange(domain.mesh.n_nod, dtype=nm.uint32)
elif token == 'E_VIR':
where = details[2]
if where[0] == '[':
vertices = nm.array(eval(where), dtype=nm.uint32)
assert_(nm.amin(vertices) >= 0)
assert_(nm.amax(vertices) < domain.mesh.n_nod)
else:
coors = domain.get_mesh_coors()
x = coors[:,0]
y = coors[:,1]
if domain.mesh.dim == 3:
z = coors[:,2]
else:
z = None
coor_dict = {'x' : x, 'y' : y, 'z': z}
vertices = nm.where(eval(where, {}, coor_dict))[0]
region.vertices = vertices
elif token == 'E_VOS':
facets = domain.cmesh.get_surface_facets()
region.set_kind('facet')
region.facets = facets
elif token == 'E_VBF':
where = details[2]
coors = domain.get_mesh_coors()
fun = functions[where]
vertices = fun(coors, domain=domain)
region.vertices = vertices
elif token == 'E_CBF':
where = details[2]
coors = domain.get_centroids(domain.mesh.dim)
fun = functions[where]
cells = fun(coors, domain=domain)
region.cells = cells
elif token == 'E_COG':
group = int(details[3])
ig = domain.mat_ids_to_i_gs[group]
group = domain.groups[ig]
off = domain.mesh.el_offsets[ig]
region.cells = off + nm.arange(group.shape.n_el, dtype=nm.uint32)
elif token == 'E_COSET':
raise NotImplementedError('element sets not implemented!')
elif token == 'E_VOG':
group = int(details[3])
vertices = nm.where(domain.mesh.ngroups == group)[0]
region.vertices = vertices
elif token == 'E_VOSET':
try:
vertices = domain.mesh.nodal_bcs[details[3]]
except KeyError:
msg = 'undefined vertex set! (%s)' % details[3]
raise ValueError(msg)
region.vertices = vertices
elif token == 'E_OVIR':
aux = regions[details[3][2:]]
region.vertices = aux.vertices[0:1]
#.........這裏部分代碼省略.........