本文整理汇总了Python中pylith.topology.Jacobian.Jacobian.write方法的典型用法代码示例。如果您正苦于以下问题:Python Jacobian.write方法的具体用法?Python Jacobian.write怎么用?Python Jacobian.write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pylith.topology.Jacobian.Jacobian
的用法示例。
在下文中一共展示了Jacobian.write方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestJacobian
# 需要导入模块: from pylith.topology.Jacobian import Jacobian [as 别名]
# 或者: from pylith.topology.Jacobian.Jacobian import write [as 别名]
#.........这里部分代码省略.........
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.
"""
self.jacobian.assemble("final_assembly")
self.jacobian.view()
# No testing of result.
return
def test_write(self):
"""
Test write().
:WARNING: This is not a complete test of write(). We do not
verify the results.
"""
self.jacobian = Jacobian(self.fields.solution(), "aij")
self.jacobian.assemble("final_assembly")
self.jacobian.write("jacobian.mat", self.mesh.comm())
# No testing of result.
return