本文整理汇总了Python中peacock.Input.ExecutableInfo.ExecutableInfo.path_map方法的典型用法代码示例。如果您正苦于以下问题:Python ExecutableInfo.path_map方法的具体用法?Python ExecutableInfo.path_map怎么用?Python ExecutableInfo.path_map使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类peacock.Input.ExecutableInfo.ExecutableInfo
的用法示例。
在下文中一共展示了ExecutableInfo.path_map方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testIncompatible
# 需要导入模块: from peacock.Input.ExecutableInfo import ExecutableInfo [as 别名]
# 或者: from peacock.Input.ExecutableInfo.ExecutableInfo import path_map [as 别名]
def testIncompatible(self):
t = InputTree(ExecutableInfo())
app_info = ExecutableInfo()
# The original tree wasn't set, any new changes
# are not incompatible
self.assertFalse(t.incompatibleChanges(app_info))
app_info.json_data = {"bad_block": None}
self.assertFalse(t.incompatibleChanges(app_info))
# Current tree is good, new one is not
app_info.json_data = None
t = self.createTree(input_file=self.simple_diffusion)
self.assertTrue(t.incompatibleChanges(app_info))
app_info.json_data = {"bad_block": None}
self.assertFalse(app_info.valid())
self.assertTrue(t.incompatibleChanges(app_info))
app_info.path ="foo"
self.assertTrue(app_info.valid())
self.assertTrue(t.incompatibleChanges(app_info)) # No / which causes an exception
app_info.path_map = t.app_info.path_map.copy()
self.assertFalse(t.incompatibleChanges(app_info)) # Should be the same, no problems
# Simulate removing /BCs/*/<types>/DirichletBC/boundary
# This should be fine since users can have extra parameters
# in their input file
root = app_info.path_map["/"]
bcs = root.children["BCs"]
pname = "boundary"
tmp = bcs.star_node.types["DirichletBC"]
p = tmp.parameters[pname]
p.user_added = True
tmp.removeUserParam(pname)
p = bcs.star_node.parameters[pname]
p.user_added = True
bcs.star_node.removeUserParam(pname)
tmp_tree = InputTree(app_info)
tmp_tree.setInputFileData(t.getInputFileString())
left = tmp_tree.getBlockInfo("/BCs/left")
self.assertTrue(left.user_added)
boundary = left.parameters["boundary"]
self.assertTrue(boundary.user_added)
self.assertTrue(boundary.set_in_input_file)
self.assertFalse(t.incompatibleChanges(app_info))
# Simulate removing /BCs syntax
# This should cause a problem
del app_info.path_map["/BCs"]
root.children_list.remove("BCs")
del root.children["BCs"]
self.assertTrue(t.incompatibleChanges(app_info)) # Errors when reading the input file