本文整理汇总了Python中fipy.tools.numerix.MA.indices方法的典型用法代码示例。如果您正苦于以下问题:Python MA.indices方法的具体用法?Python MA.indices怎么用?Python MA.indices使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fipy.tools.numerix.MA
的用法示例。
在下文中一共展示了MA.indices方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _calcFaceCellIDs
# 需要导入模块: from fipy.tools.numerix import MA [as 别名]
# 或者: from fipy.tools.numerix.MA import indices [as 别名]
def _calcFaceCellIDs(self):
array = MA.array(MA.indices(self.cellFaceIDs.shape, 'l')[1],
mask=MA.getmask(self.cellFaceIDs))
self.faceCellIDs = MA.zeros((2, self.numberOfFaces), 'l')
## Nasty bug: MA.put(arr, ids, values) fills its ids and
## values arguments when masked! This was not the behavior
## that was assumed when used below. It was only working
## because the old fill value was 0 and the first element of
## the array needed to be 0 since the cell's face was
## 0. numerix.put() has been changed to deal with this
## properly.
## MA.put(firstRow, cellFaceIDsFlat[::-1], array[::-1])
## MA.put(secondRow, cellFaceIDsFlat, array)
firstRow = self.faceCellIDs[0]
secondRow = self.faceCellIDs[1]
numerix.put(firstRow, self.cellFaceIDs[::-1,::-1], array[::-1,::-1])
numerix.put(secondRow, self.cellFaceIDs, array)
mask = ((False,) * self.numberOfFaces, (firstRow == secondRow))
self.faceCellIDs = MA.sort(MA.array(self.faceCellIDs, mask = mask),
axis=0)
示例2: _cellToFaceOrientations
# 需要导入模块: from fipy.tools.numerix import MA [as 别名]
# 或者: from fipy.tools.numerix.MA import indices [as 别名]
def _cellToFaceOrientations(self):
tmp = numerix.take(self.faceCellIDs[0], self.cellFaceIDs)
return (tmp == MA.indices(tmp.shape)[-1]) * 2 - 1