当前位置: 首页>>代码示例>>Python>>正文


Python MA.getmaskarray方法代码示例

本文整理汇总了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
开发者ID:LWhitson2,项目名称:fipy,代码行数:9,代码来源:mesh.py

示例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
开发者ID:LWhitson2,项目名称:fipy,代码行数:15,代码来源:mesh.py

示例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.
开发者ID:regmi,项目名称:fipy,代码行数:15,代码来源:mesh.py

示例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))
开发者ID:LWhitson2,项目名称:fipy,代码行数:17,代码来源:mesh.py

示例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]
开发者ID:LWhitson2,项目名称:fipy,代码行数:22,代码来源:mesh.py

示例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)
开发者ID:usnistgov,项目名称:fipy,代码行数:8,代码来源:uniformGrid3D.py

示例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())
开发者ID:usnistgov,项目名称:fipy,代码行数:6,代码来源:uniformGrid3D.py

示例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])))
开发者ID:LWhitson2,项目名称:fipy,代码行数:7,代码来源:mesh.py

示例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)
开发者ID:regmi,项目名称:fipy,代码行数:8,代码来源:mesh.py


注:本文中的fipy.tools.numerix.MA.getmaskarray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。