当前位置: 首页>>代码示例>>Python>>正文


Python Field.addTubes方法代码示例

本文整理汇总了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())
开发者ID:nirovanton,项目名称:equitube,代码行数:53,代码来源:equitube.py


注:本文中的field.Field.addTubes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。