本文整理汇总了Python中mesh.Mesh.convert方法的典型用法代码示例。如果您正苦于以下问题:Python Mesh.convert方法的具体用法?Python Mesh.convert怎么用?Python Mesh.convert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mesh.Mesh
的用法示例。
在下文中一共展示了Mesh.convert方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: areas
# 需要导入模块: from mesh import Mesh [as 别名]
# 或者: from mesh.Mesh import convert [as 别名]
def areas(self):
"""area of elements
For surface element the faces' area is returned.
For volume elements the sum of the faces'areas is returned.
"""
#In case of quadratic faces, the face's area should be
#the area inside the polygon of face vertices or
#the area of the equivalent linear face?
##this function would require some changes (here proposed inside the function as starting):
##create a _default_surfacetype to create quad8 instead of hex8 ?maybe also a _default_volumetype to create tet4 instead of quad4 ?
def defaultSurfacetype(nplex):
"""Default face type for a surface mesh with given plexitude.
For the most common cases of plexitudes, we define a default face
type. The full list of default types can be found in
mesh._default_facetype.
"""
return _default_surfacetype.get(nplex,None)
import geomtools
nfacperel= len(self.eltype.faces[1])#nfaces per elem
mf=Mesh(self.coords, self.getFaces())#mesh of all faces
mf.eltype = elementType(defaultSurfacetype(mf.nplex()))
ntriperfac= mf.select([0]).convert('tri3').nelems()#how many tri per face
elfacarea = geomtools.areaNormals( mf.convert('tri3').toFormex()[:])[0].reshape(self.nelems(), nfacperel*ntriperfac)#elems'faces'areas
return elfacarea.sum(axis=1)#elems'areas