Пример #1
0
    def generaClose(self):
        out = ""
        if self.isGood:
            staticOffset = []
            for i in range(self.father.dim):
                staticOffset.append(1)


            id = self.generaId()
            start = util.addList(staticOffset, self.realCoordinates)
            end = util.addList(start, self.realDim)
            #print start,end
            out += ("b(")
            count = 0
            merged = zip(start,end)
            for i in merged:
                #print i
                count +=1
                out += (str(i[0])+":"+str(i[1]-1))
                if count < len(merged):
                    out += (",")

            out += (") = s" +str(id)+"_1 ;\n")
            
        return out
Пример #2
0
    def recursiveInit(self,element,level,coordinate):
        #print "ELEMENT:\n"+ str(element) + "\nLEVEL:\n" +str(level) + "\nCOORDINATE\n" +str(coordinate)
        if element is not None:
            for index, item in enumerate(element):
                #print "sono nella recursiveInit" ,index,item,element
                coordinate.append(index)
                isLast = self.recursiveInit(item,level+1,coordinate)
                if isLast:
                    # coordinates of this point in the partition
                    globalCoordinates = util.addList(coordinate , self.sendCoordinates)

                    #initialize and assign the point
                    p = SectionPoint(copy.deepcopy(coordinate),globalCoordinates,self,False)
#                    if self.minPoint is None or p < self.minPoint:
#                        self.minPoint = p
#                    if self.maxPoint is None or p > self.maxPoint:
#                        self.MaxPoint = p
                    element[index] = p

                    #CHECK if it is a shift point
                    lowerBound = self.computationCoordinates
                    print lowerBound
                    upperBound = util.addList(self.computationCoordinates,self.computationDim)
                    print upperBound
                    isLower = reduce(lambda x,y:x or y,map(lambda x,y: x<y,globalCoordinates,lowerBound))
                    isUpper = reduce(lambda x,y:x or y,map(lambda x,y: x>=y,globalCoordinates,upperBound))
                    if isLower or isUpper :
                        print str(p)+"is a shift point"
                        self.shiftPoints.append(p)
                    else:
                        print str(p)+"is not a shift point"
                        
                coordinate.pop()
            return False
        else:
            return True
Пример #3
0
    def orecursiveInit(self,element,level,coordinate):
        #print "ELEMENT:\n"+ str(element) + "\nLEVEL:\n" +str(level) + "\nCOORDINATE\n" +str(coordinate)
        if element is not None:
            for index, item in enumerate(element):
                #print "sono nella recursiveInit" ,index,item,element
                coordinate.append(index)
                isLast = self.orecursiveInit(item,level+1,coordinate)
                if isLast:
                    #print "sto per modificare", str(element[index])
                    p = SectionPoint(copy.deepcopy(coordinate), util.addList(coordinate , self.outsideCoordinates),self,True)
#                    if self.minPoint is None or p < self.minPoint:
#                        self.minPoint = p
#                    if self.maxPoint is None or p > self.maxPoint:
#                        self.MaxPoint = p
                    element[index] = p
                    #print "stampo cosa ho fatto: " + str(element[index])
                    #print self
                coordinate.pop()
            return False
        else:
            return True
Пример #4
0
 def isNotShiftPoint(self,point):
     
     for item0,item1 in zip(point.gcoordinates,self.computationCoordinates):
         
         if item0 < item1 :
             if point in self.shiftPoints:
                 return False
             else:
                 print "point is",point
                 print "section is",self
                 raise ValueError('Problema: punti di shift non sono corretti'+str(point))
             
     for item0,item1 in zip(point.gcoordinates,util.addList(self.computationCoordinates,self.computationDim)):
         
         if item0 >= item1 :
             if point in self.shiftPoints:
                 return False
             else:
                 print "point is",point
                 print "section is",self
                 raise ValueError('Problema: punti di shift non sono corretti')
     return True