本文整理汇总了Python中fipy.tools.numerix.MA.shape方法的典型用法代码示例。如果您正苦于以下问题:Python MA.shape方法的具体用法?Python MA.shape怎么用?Python MA.shape使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fipy.tools.numerix.MA
的用法示例。
在下文中一共展示了MA.shape方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _calcFaceAreas
# 需要导入模块: from fipy.tools.numerix import MA [as 别名]
# 或者: from fipy.tools.numerix.MA import shape [as 别名]
def _calcFaceAreas(self):
faceVertexIDs = MA.filled(self.faceVertexIDs, -1)
substitute = numerix.repeat(faceVertexIDs[numerix.newaxis, 0],
faceVertexIDs.shape[0], axis=0)
faceVertexIDs = numerix.where(MA.getmaskarray(self.faceVertexIDs), substitute, faceVertexIDs)
faceVertexCoords = numerix.take(self.vertexCoords, faceVertexIDs, axis=1)
faceOrigins = numerix.repeat(faceVertexCoords[:,0], faceVertexIDs.shape[0], axis=0)
faceOrigins = numerix.reshape(faceOrigins, MA.shape(faceVertexCoords))
faceVertexCoords = faceVertexCoords - faceOrigins
left = range(faceVertexIDs.shape[0])
right = left[1:] + [left[0]]
cross = numerix.sum(numerix.cross(faceVertexCoords, numerix.take(faceVertexCoords, right, 1), axis=0), 1)
self.faceAreas = numerix.sqrtDot(cross, cross) / 2.