本文整理汇总了Python中openalea.core.node.Node.add_input方法的典型用法代码示例。如果您正苦于以下问题:Python Node.add_input方法的具体用法?Python Node.add_input怎么用?Python Node.add_input使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openalea.core.node.Node
的用法示例。
在下文中一共展示了Node.add_input方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_fake_node
# 需要导入模块: from openalea.core.node import Node [as 别名]
# 或者: from openalea.core.node.Node import add_input [as 别名]
def create_fake_node(self, vid):
""" Return an empty node with the correct number of inputs
and output """
# Count in and out needed
ins = 0
outs = 0
for eid, link in self.connections.iteritems():
(source_vid, source_port, target_vid, target_port) = link
if(source_vid == vid):
outs = max(outs, source_port)
elif(target_vid == vid):
ins = max(ins, target_port)
node = Node()
attributes = copy.deepcopy(self.elt_data[vid])
ad_hoc = copy.deepcopy(self.elt_ad_hoc.get(vid, None))
self.load_ad_hoc_data(node, attributes, ad_hoc)
# copy node input data if any
values = copy.deepcopy(self.elt_value.get(vid, ()))
for p in range(ins+1):
port = node.add_input(name="In"+str(p))
for p in range(outs+1):
port = node.add_output(name="Out"+str(p))
for vs in values:
try:
#the two first elements are the historical
#values : port Id and port value
#beyond that are extensions added by gengraph:
#the ad_hoc_dict representation is third.
port, v = vs[:2]
node.set_input(port, eval(v))
if(len(vs)>2):
d = MetaDataDict(vs[2])
node.input_desc[port].get_ad_hoc_dict().update(d)
except:
continue
return node