當前位置: 首頁>>代碼示例>>Python>>正文


Python SolutionFields.solution方法代碼示例

本文整理匯總了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
開發者ID:panzhengyang,項目名稱:pylith,代碼行數:34,代碼來源:TestJacobian.py

示例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
開發者ID:panzhengyang,項目名稱:pylith,代碼行數:80,代碼來源:TestSolutionFields.py


注:本文中的pylith.topology.SolutionFields.SolutionFields.solution方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。