本文整理汇总了Python中pylith.topology.Jacobian.Jacobian.cleanup方法的典型用法代码示例。如果您正苦于以下问题:Python Jacobian.cleanup方法的具体用法?Python Jacobian.cleanup怎么用?Python Jacobian.cleanup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pylith.topology.Jacobian.Jacobian
的用法示例。
在下文中一共展示了Jacobian.cleanup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestJacobian
# 需要导入模块: from pylith.topology.Jacobian import Jacobian [as 别名]
# 或者: from pylith.topology.Jacobian.Jacobian import cleanup [as 别名]
class TestJacobian(unittest.TestCase):
"""
Unit testing of Jacobian object.
"""
def setUp(self):
"""
Setup mesh and associated field.
"""
from spatialdata.geocoords.CSCart import CSCart
cs = CSCart()
cs.inventory.spaceDim = 2
cs._configure()
from spatialdata.units.Nondimensional import Nondimensional
normalizer = Nondimensional()
normalizer._configure()
from pylith.meshio.MeshIOAscii import MeshIOAscii
importer = MeshIOAscii()
importer.inventory.filename = "data/tri3.mesh"
importer.inventory.coordsys = cs
importer._configure()
self.mesh = importer.read(debug=False, interpolate=False)
from pylith.topology.SolutionFields import SolutionFields
fields = SolutionFields(self.mesh)
fields.add("disp t+dt", "displacement")
fields.solutionName("disp t+dt")
solution = fields.solution()
solution.newSection(solution.VERTICES_FIELD, self.mesh.dimension())
solution.allocate()
solution.zero()
self.fields = fields
self.jacobian = Jacobian(solution)
return
def tearDown(self):
self.jacobian.cleanup()
return
def test_constructor(self):
"""
Test constructor.
"""
# setUp() tests constructor with default type
jacobianA = Jacobian(self.fields.solution(), "aij")
jacobianB = Jacobian(self.fields.solution(), "baij")
return
def test_matrix(self):
"""
Test matrix().
:WARNING: This is not a complete test of matrix(). We do not
verify the results.
"""
matrix = self.jacobian.matrix()
# No testing of result.
return
def test_assemble(self):
"""
Test assemble().
:WARNING: This is not a complete test of assemble(). We do not
verify the results.
"""
self.jacobian.assemble("flush_assembly")
self.jacobian.assemble("final_assembly")
# No testing of result.
return
def test_zero(self):
"""
Test zero().
:WARNING: This is not a complete test of zero(). We do not
verify the results.
"""
self.jacobian.zero()
# No testing of result.
return
def test_view(self):
"""
Test view().
:WARNING: This is not a complete test of view(). We do not
verify the results.
#.........这里部分代码省略.........