本文整理汇总了Python中field.Field.addTubes方法的典型用法代码示例。如果您正苦于以下问题:Python Field.addTubes方法的具体用法?Python Field.addTubes怎么用?Python Field.addTubes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类field.Field
的用法示例。
在下文中一共展示了Field.addTubes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Run
# 需要导入模块: from field import Field [as 别名]
# 或者: from field.Field import addTubes [as 别名]
def Run(self):
try:
field = Field(self._length, self._springconst, self._deltaslope)
field.addTubes(self._count)
plot = Plot(self._length)
tubes = field.getTubes()
# Debugging code
start = []
stop =[]
for key in field.getTubes().keys():
if field.getTubes()[key].getParams()['P'][0] <= 0:
start.append(key),","
if field.getTubes()[key].getParams()['Q'][0] >= self._length:
stop.append(key)
print "Starting Tubes:",start
print "Stopping Tubes:",stop
print "------------------------------------------"
#time.sleep(10)
plot.plotField(tubes)
end = 0
while end < 1:
field.calculateIntercepts()
point_forces = field.getPointForces()
for key in field.getTubes().keys():
print key,":",field.getTubes()[key].getParams()['neighbors'].keys()
print "=================================="
traverses = 0
neighbor_dict = {}
roots = []
leaves = []
for index in tubes.keys():
neighbor_dict[index] = list()
neighbor_dict[index] = tubes[index].getParams()['neighbors'].keys()
if tubes[index].getParams()['P'][0] <= 0:
roots.append(index)
if tubes[index].getParams()['Q'][0] >= self._length:
leaves.append(index)
#print index
for index in roots:
traverses += field.traverseNeighbors(index,neighbor_dict,leaves,())
print traverses
#if end % 1 == 0:
#plot.plotField(tubes)
#field.rotateTubes(point_forces)
end += 1
except EquitubeException, e:
raise EquitubeException(e.get_message())