本文整理匯總了Python中pylith.topology.SolutionFields.SolutionFields.solution方法的典型用法代碼示例。如果您正苦於以下問題:Python SolutionFields.solution方法的具體用法?Python SolutionFields.solution怎麽用?Python SolutionFields.solution使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pylith.topology.SolutionFields.SolutionFields
的用法示例。
在下文中一共展示了SolutionFields.solution方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: setUp
# 需要導入模塊: from pylith.topology.SolutionFields import SolutionFields [as 別名]
# 或者: from pylith.topology.SolutionFields.SolutionFields import solution [as 別名]
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
示例2: TestSolutionFields
# 需要導入模塊: from pylith.topology.SolutionFields import SolutionFields [as 別名]
# 或者: from pylith.topology.SolutionFields.SolutionFields import solution [as 別名]
class TestSolutionFields(unittest.TestCase):
"""
Unit testing of SolutionFields 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)
self.fields = SolutionFields(self.mesh)
return
def test_constructor(self):
"""
Test constructor.
"""
return
def test_solutionName(self):
"""
Test mesh().
"""
fields = self.fields
fields.add("field A", "A");
fields.add("field B", "B");
fields.add("field C", "C");
fields.solutionName("field B")
return
def test_solution(self):
"""
Test solution().
"""
fields = self.fields
fields.add("field A", "A");
fields.add("field B", "B");
fields.add("field C", "C");
fields.solutionName("field B")
solution = self.fields.solution()
return
def test_fieldAdd(self):
"""
Test fieldAdd().
"""
fields = self.fields
fields.add("field A", "A");
fields.add("field B", "B");
helper_fieldAdd(fields)
fieldA = fields.get("field A")
fieldB = fields.get("field B")
fieldA.allocate()
fieldB.allocate()
fieldA.copy(fieldB)
return