本文整理匯總了Python中openmdao.lib.casehandlers.api.CaseSet.record_case方法的典型用法代碼示例。如果您正苦於以下問題:Python CaseSet.record_case方法的具體用法?Python CaseSet.record_case怎麽用?Python CaseSet.record_case使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類openmdao.lib.casehandlers.api.CaseSet
的用法示例。
在下文中一共展示了CaseSet.record_case方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_copy
# 需要導入模塊: from openmdao.lib.casehandlers.api import CaseSet [as 別名]
# 或者: from openmdao.lib.casehandlers.api.CaseSet import record_case [as 別名]
def test_copy(self):
cs = CaseSet()
cs.record_case(self.case1)
cs.record_case(self.case2)
cs.record_case(self.case1_dup)
cscopy = cs.copy()
for c1, c2 in zip(cs, cscopy):
self.assertEqual(c1, c2)
示例2: test_from_case
# 需要導入模塊: from openmdao.lib.casehandlers.api import CaseSet [as 別名]
# 或者: from openmdao.lib.casehandlers.api.CaseSet import record_case [as 別名]
def test_from_case(self):
cs = CaseSet(self.case1)
self.assertEqual(1, len(cs))
self.assertEqual(cs[0]._inputs, self.case1_dup._inputs)
self.assertEqual(cs[0]._outputs, self.case1_dup._outputs)
cs.record_case(self.case2)
cs.record_case(self.case1_dup)
self.assertEqual(2, len(cs))
示例3: test_iteration
# 需要導入模塊: from openmdao.lib.casehandlers.api import CaseSet [as 別名]
# 或者: from openmdao.lib.casehandlers.api.CaseSet import record_case [as 別名]
def test_iteration(self):
cs = CaseSet()
cs.record_case(self.case1)
cs.record_case(self.case2)
cs.record_case(self.case1_dup)
expected = [self.case1, self.case2, self.case1_dup]
for i, case in enumerate(cs):
self.assertEqual(case._inputs, expected[i]._inputs)
self.assertEqual(case._outputs, expected[i]._outputs)
示例4: test_start_empty
# 需要導入模塊: from openmdao.lib.casehandlers.api import CaseSet [as 別名]
# 或者: from openmdao.lib.casehandlers.api.CaseSet import record_case [as 別名]
def test_start_empty(self):
cs = CaseSet()
cs.record_case(self.case1)
cs.record_case(self.case2)
cs.record_case(self.case1_dup)
self.assertEqual(2, len(cs))
self.assertEqual(cs[0]._inputs, self.case1_dup._inputs)
self.assertEqual(cs[0]._outputs, self.case1_dup._outputs)
self.assertEqual(cs[1]._inputs, self.case2._inputs)
self.assertEqual(cs[1]._outputs, self.case2._outputs)
示例5: test_update_empty
# 需要導入模塊: from openmdao.lib.casehandlers.api import CaseSet [as 別名]
# 或者: from openmdao.lib.casehandlers.api.CaseSet import record_case [as 別名]
def test_update_empty(self):
c1 = Case(inputs=[('x', 10)], outputs=[('y', 10)])
c2 = Case(inputs=[('x', 1)], outputs=[('y', 1)])
cs1 = CaseSet()
cs1.record_case(c1)
cs1.record_case(c2)
cs2 = CaseSet()
cs2.update(cs1)
for c1, c2 in zip(cs1, cs2):
self.assertEqual(c1, c2)
示例6: test_start_empty_subset
# 需要導入模塊: from openmdao.lib.casehandlers.api import CaseSet [as 別名]
# 或者: from openmdao.lib.casehandlers.api.CaseSet import record_case [as 別名]
def test_start_empty_subset(self):
names = ['comp1.a', 'comp2.c+comp2.d', 'comp1.b']
ins = [names[0], names[2]]
outs = [names[1]]
cs = CaseSet(names=names)
cs.record_case(self.case1)
cs.record_case(self.case2)
cs.record_case(self.case1_dup)
self.assertEqual(2, len(cs))
self.assertEqual(3, len(cs[0].items()))
self.assertEqual(2, len(cs[0].items('in')))
self.assertEqual(1, len(cs[0].items('out')))
self.assertEqual(set(names), set(cs[0].keys()))
self.assertEqual(set(ins), set(cs[0].keys('in')))
self.assertEqual(set(outs), set(cs[0].keys('out')))
示例7: test_set_ops
# 需要導入模塊: from openmdao.lib.casehandlers.api import CaseSet [as 別名]
# 或者: from openmdao.lib.casehandlers.api.CaseSet import record_case [as 別名]
def test_set_ops(self):
cs = CaseSet()
cs2 = CaseSet()
for case in self.caselist:
cs.record_case(case)
cs2.record_case(case)
self.assertEqual(len(cs), len(self.caselist)-2)
self.assertTrue(cs == cs2)
case = cs2.pop(1)
self.assertFalse(cs == cs2)
self.assertTrue(cs2 < cs)
self.assertFalse(cs < cs)
self.assertTrue(cs <= cs)
self.assertTrue(cs >= cs)
self.assertFalse(cs2 > cs)
self.assertFalse(cs2 > cs2)
self.assertTrue(case in cs)
self.assertFalse(case in cs2)
self.assertTrue(case not in cs2)
self.assertFalse(case not in cs)
diffset = cs - cs2
self.assertEqual(len(diffset), 1)
self.assertTrue(case in diffset)
cs3 = CaseSet()
cs4 = CaseSet()
cs3.record_case(self.case1)
cs3.record_case(self.case2)
try:
self.assertTrue(cs3.isdisjoint(cs4))
except ValueError, err:
self.assertEqual(str(err), "case containers have different sets of variables")
示例8: test_close
# 需要導入模塊: from openmdao.lib.casehandlers.api import CaseSet [as 別名]
# 或者: from openmdao.lib.casehandlers.api.CaseSet import record_case [as 別名]
def test_close(self):
c1 = Case(inputs=[('x', 10)], outputs=[('y', 10)])
cs1 = CaseSet()
cs1.record_case(c1)
cs1.close()
示例9: test_contains
# 需要導入模塊: from openmdao.lib.casehandlers.api import CaseSet [as 別名]
# 或者: from openmdao.lib.casehandlers.api.CaseSet import record_case [as 別名]
def test_contains(self):
cs = CaseSet()
cs.record_case(self.case1)
self.assertTrue(self.case1_dup in cs)
self.assertFalse(self.case2 in cs)
self.assertFalse(None in cs)