本文整理汇总了Python中fipy.tools.numerix.MA.getmaskarray方法的典型用法代码示例。如果您正苦于以下问题:Python MA.getmaskarray方法的具体用法?Python MA.getmaskarray怎么用?Python MA.getmaskarray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fipy.tools.numerix.MA
的用法示例。
在下文中一共展示了MA.getmaskarray方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _calcCellDistAndVec
# 需要导入模块: from fipy.tools.numerix import MA [as 别名]
# 或者: from fipy.tools.numerix.MA import getmaskarray [as 别名]
def _calcCellDistAndVec(self):
tmp = numerix.take(self._cellCenters, self.faceCellIDs, axis=1)
tmp = tmp[...,1,:] - tmp[...,0,:]
tmp = MA.filled(MA.where(MA.getmaskarray(tmp), self._cellToFaceDistanceVectors[:,0], tmp))
cellDistanceVectors = tmp
cellDistances = MA.filled(MA.sqrt(MA.sum(tmp * tmp, 0)))
return cellDistances, cellDistanceVectors
示例2: _calcFaceCellToCellNormals
# 需要导入模块: from fipy.tools.numerix import MA [as 别名]
# 或者: from fipy.tools.numerix.MA import getmaskarray [as 别名]
def _calcFaceCellToCellNormals(self):
faceCellCentersUp = numerix.take(self._cellCenters, self.faceCellIDs[1], axis=1)
faceCellCentersDown = numerix.take(self._cellCenters, self.faceCellIDs[0], axis=1)
faceCellCentersUp = numerix.where(MA.getmaskarray(faceCellCentersUp),
self._faceCenters,
faceCellCentersUp)
diff = faceCellCentersDown - faceCellCentersUp
mag = numerix.sqrt(numerix.sum(diff**2))
faceCellToCellNormals = diff / numerix.resize(mag, (self.dim, len(mag)))
orientation = 1 - 2 * (numerix.dot(self.faceNormals, faceCellToCellNormals) < 0)
return faceCellToCellNormals * orientation
示例3: _calcFaceAreas
# 需要导入模块: from fipy.tools.numerix import MA [as 别名]
# 或者: from fipy.tools.numerix.MA import getmaskarray [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.
示例4: _calcFaceCenters
# 需要导入模块: from fipy.tools.numerix import MA [as 别名]
# 或者: from fipy.tools.numerix.MA import getmaskarray [as 别名]
def _calcFaceCenters(self):
maskedFaceVertexIDs = MA.filled(self.faceVertexIDs, 0)
faceVertexCoords = numerix.take(self.vertexCoords, maskedFaceVertexIDs, axis=1)
if MA.getmask(self.faceVertexIDs) is False:
faceVertexCoordsMask = numerix.zeros(numerix.shape(faceVertexCoords), 'l')
else:
faceVertexCoordsMask = \
numerix.repeat(MA.getmaskarray(self.faceVertexIDs)[numerix.newaxis,...],
self.dim, axis=0)
faceVertexCoords = MA.array(data=faceVertexCoords, mask=faceVertexCoordsMask)
return MA.filled(MA.average(faceVertexCoords, axis=1))
示例5: _cellVertexIDs
# 需要导入模块: from fipy.tools.numerix import MA [as 别名]
# 或者: from fipy.tools.numerix.MA import getmaskarray [as 别名]
def _cellVertexIDs(self):
## Get all the vertices from all the faces for each cell
cellFaceVertices = numerix.take(self.faceVertexIDs, self.cellFaceIDs, axis=1)
## get a sorted list of vertices for each cell
cellVertexIDs = numerix.reshape(cellFaceVertices, (-1, self.numberOfCells))
cellVertexIDs = MA.sort(cellVertexIDs, axis=0, fill_value=-1)
cellVertexIDs = MA.sort(MA.concatenate((cellVertexIDs[-1, numerix.newaxis],
MA.masked_where(cellVertexIDs[:-1]
== cellVertexIDs[1:],
cellVertexIDs[:-1]))),
axis=0, fill_value=-1)
## resize the array to remove extra masked values
if cellVertexIDs.shape[-1] == 0:
length = 0
else:
length = min(numerix.sum(MA.getmaskarray(cellVertexIDs), axis=0))
return cellVertexIDs[length:][::-1]
示例6: _cellToCellIDsFilled
# 需要导入模块: from fipy.tools.numerix import MA [as 别名]
# 或者: from fipy.tools.numerix.MA import getmaskarray [as 别名]
def _cellToCellIDsFilled(self):
N = self.numberOfCells
M = self._maxFacesPerCell
cellIDs = numerix.repeat(numerix.arange(N)[numerix.newaxis, ...], M, axis=0)
cellToCellIDs = self._cellToCellIDs
return MA.where(MA.getmaskarray(cellToCellIDs), cellIDs, cellToCellIDs)
示例7: _adjacentCellIDs
# 需要导入模块: from fipy.tools.numerix import MA [as 别名]
# 或者: from fipy.tools.numerix.MA import getmaskarray [as 别名]
def _adjacentCellIDs(self):
faceCellIDs = self.faceCellIDs
return (MA.where(MA.getmaskarray(faceCellIDs[0]), faceCellIDs[1], faceCellIDs[0]).filled(),
MA.where(MA.getmaskarray(faceCellIDs[1]), faceCellIDs[0], faceCellIDs[1]).filled())
示例8: _calcAdjacentCellIDs
# 需要导入模块: from fipy.tools.numerix import MA [as 别名]
# 或者: from fipy.tools.numerix.MA import getmaskarray [as 别名]
def _calcAdjacentCellIDs(self):
return (MA.filled(self.faceCellIDs[0]),
MA.filled(MA.where(MA.getmaskarray(self.faceCellIDs[1]),
self.faceCellIDs[0],
self.faceCellIDs[1])))
示例9: _calcCellToCellIDsFilled
# 需要导入模块: from fipy.tools.numerix import MA [as 别名]
# 或者: from fipy.tools.numerix.MA import getmaskarray [as 别名]
def _calcCellToCellIDsFilled(self):
N = self.getNumberOfCells()
M = self._getMaxFacesPerCell()
cellIDs = numerix.repeat(numerix.arange(N)[numerix.newaxis, ...], M, axis=0)
cellToCellIDs = self._getCellToCellIDs()
self.cellToCellIDsFilled = MA.where(MA.getmaskarray(cellToCellIDs), cellIDs, cellToCellIDs)