本文整理汇总了Python中axialdisp_soln.AnalyticalSoln.strain方法的典型用法代码示例。如果您正苦于以下问题:Python AnalyticalSoln.strain方法的具体用法?Python AnalyticalSoln.strain怎么用?Python AnalyticalSoln.strain使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类axialdisp_soln.AnalyticalSoln
的用法示例。
在下文中一共展示了AnalyticalSoln.strain方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestAxialDisp
# 需要导入模块: from axialdisp_soln import AnalyticalSoln [as 别名]
# 或者: from axialdisp_soln.AnalyticalSoln import strain [as 别名]
class TestAxialDisp(TestQuad4):
"""
Test suite for testing pylith with 2-D axial extension.
"""
def setUp(self):
"""
Setup for test.
"""
TestQuad4.setUp(self)
run_pylith()
self.outputRoot = "axialdisp"
if has_vtk():
self.reader = VTKDataReader()
self.soln = AnalyticalSoln()
else:
self.reader = None
return
def calcDisplacements(self, vertices):
"""
Calculate displacement field given coordinates of vertices.
"""
return self.soln.displacement(vertices)
def calcStateVar(self, name, vertices, cells):
"""
Calculate state variable.
"""
ncells = self.mesh['ncells']
pts = numpy.zeros( (ncells, 3), dtype=numpy.float64)
if name == "total_strain":
stateVar = self.soln.strain(pts)
elif name == "stress":
stateVar = self.soln.stress(pts)
else:
raise ValueError("Unknown state variable '%s'." % name)
return stateVar