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


Python Field.set_formula_parameters方法代碼示例

本文整理匯總了Python中hysop.Field.set_formula_parameters方法的典型用法代碼示例。如果您正苦於以下問題:Python Field.set_formula_parameters方法的具體用法?Python Field.set_formula_parameters怎麽用?Python Field.set_formula_parameters使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在hysop.Field的用法示例。


在下文中一共展示了Field.set_formula_parameters方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_analytical_field_8

# 需要導入模塊: from hysop import Field [as 別名]
# 或者: from hysop.Field import set_formula_parameters [as 別名]
def test_analytical_field_8():
    box = Box(dimension=2, length=[1., 1.], origin=[0., 0.])
    topo = box.create_topology(d2d)
    coords = topo.mesh.coords
    caf = Field(box, name='f1', formula=func_vec_6, nb_components=nbc)
    theta = 0.3
    caf.set_formula_parameters(theta)
    ref = Field(box, name='f2', nb_components=nbc)
    refd = ref.discretize(topo)
    cafd = caf.discretize(topo)
    refd = ref.discretize(topo)
    ids = [0, ] * nbc
    for i in xrange(nbc):
        ids[i] = id(cafd.data[i])
    caf.initialize()
    refd.data = func_vec_6(refd.data, *(coords + (0., theta)))
    for i in xrange(caf.nb_components):
        assert allclose(cafd[i], refd.data[i])
        assert id(cafd.data[i]) == ids[i]
    time = 3.0
    caf.initialize(time=time)
    refd.data = func_vec_6(refd.data, *(coords + (time, theta)))
    for i in xrange(caf.nb_components):
        assert allclose(cafd[i], refd.data[i])
        assert id(cafd.data[i]) == ids[i]
開發者ID:ljktest,項目名稱:tmp-tests,代碼行數:27,代碼來源:test_field.py

示例2: test_analytical_field_6

# 需要導入模塊: from hysop import Field [as 別名]
# 或者: from hysop.Field import set_formula_parameters [as 別名]
def test_analytical_field_6():
    box = Box()
    topo = box.create_topology(d3d)
    coords = topo.mesh.coords
    caf = Field(box, name='f1', formula=func_vec_4, is_vector=True,
                vectorize_formula=True)
    theta = 0.3
    caf.set_formula_parameters(theta)
    ref = Field(box, name='f2', is_vector=True)
    refd = ref.discretize(topo)
    cafd = caf.discretize(topo)
    refd = ref.discretize(topo)
    ids = [0, ] * 3
    for i in xrange(3):
        ids[i] = id(cafd.data[i])
    caf.initialize()
    refd.data = func_vec_3(refd.data, *(coords + (0., theta)))
    for i in xrange(caf.nb_components):
        assert allclose(cafd[i], refd.data[i])
        assert id(cafd.data[i]) == ids[i]
    time = 3.0
    caf.initialize(time=time)
    refd.data = func_vec_3(refd.data, *(coords + (time, theta)))
    for i in xrange(caf.nb_components):
        assert allclose(cafd[i], refd.data[i])
        assert id(cafd.data[i]) == ids[i]
開發者ID:ljktest,項目名稱:tmp-tests,代碼行數:28,代碼來源:test_field.py


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