本文整理汇总了Python中fipy.variables.variable.Variable._getShape方法的典型用法代码示例。如果您正苦于以下问题:Python Variable._getShape方法的具体用法?Python Variable._getShape怎么用?Python Variable._getShape使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fipy.variables.variable.Variable
的用法示例。
在下文中一共展示了Variable._getShape方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: shape
# 需要导入模块: from fipy.variables.variable import Variable [as 别名]
# 或者: from fipy.variables.variable.Variable import _getShape [as 别名]
def shape(self):
"""
>>> from fipy.meshes import Grid2D
>>> from fipy.variables.cellVariable import CellVariable
>>> mesh = Grid2D(nx=2, ny=3)
>>> var = CellVariable(mesh=mesh)
>>> print numerix.allequal(var.shape, (6,)) # doctest: +PROCESSOR_0
True
>>> print numerix.allequal(var.arithmeticFaceValue.shape, (17,)) # doctest: +PROCESSOR_0
True
>>> print numerix.allequal(var.grad.shape, (2, 6)) # doctest: +PROCESSOR_0
True
>>> print numerix.allequal(var.faceGrad.shape, (2, 17)) # doctest: +PROCESSOR_0
True
Have to account for zero length arrays
>>> from fipy import Grid1D
>>> m = Grid1D(nx=0)
>>> v = CellVariable(mesh=m, elementshape=(2,))
>>> (v * 1).shape
(2, 0)
"""
return (Variable._getShape(self)
or (self.elementshape + self._getShapeFromMesh(self.mesh))
or ())