示例#1
0
def test8():
    tc.test8()
    varnames,threshnames,morsedomgraph,morsecells,vertexmap=fp.parseMorseSet()
    domaingraph=fp.parseDomainGraph()
    domaincells=fp.parseDomainCells()
    extendedmorsegraph,extendedmorsecells=pp.makeExtendedMorseSetDomainGraph(vertexmap,morsecells,domaingraph,domaincells)
    outedges,wallthresh,walldomains,booleanoutedges=pp.makeWallGraphFromDomainGraph(len(vertexmap),extendedmorsegraph, extendedmorsecells)
    varsaffectedatwall=pp.varsAtWalls(threshnames,walldomains,wallthresh,varnames)
    print outedges == [(1,),(2,3),(6,),(4,),(5,),(6,),(0,)]
    print wallthresh == [2,3,2,3,2,3,3]
    print walldomains == [(0.5,1.5,3,0.5,1.5),(0.5,1.5,3.5,1,1.5),(0.5,1.5,3,1.5,1.5),(0.5,1.5,3.5,2,1.5),(0.5,1.5,3,2.5,1.5),(0.5,1.5,2.5,2,1.5),(0.5,1.5,2.5,1,1.5)]
    print varsaffectedatwall==[3,2,3,4,3,4,2]
示例#2
0
def test8(showme=1, findallmatches=1):
    tc.test8()
    patterns, originalpatterns, wallinfo = pp.preprocess(cyclic=1)
    solutions = [[(1, 2, 6, 0, 1), (1, 3, 4, 5, 6, 0, 1)]] * 4 + [None] * 4
    patterns = [p for pat in patterns for p in pat]
    for p, s in zip(patterns, solutions):
        match = matchPattern(p, wallinfo, cyclic=1, findallmatches=findallmatches)
        if s:
            if showme and findallmatches:
                print set(match) == set(s)
            if showme and not findallmatches:
                print match[0] in s
        else:
            if showme:
                print "None" in match and "Pattern" in match
示例#3
0
def test8(showme=1, findallmatches=1):
    tc.test8()
    patterns, originalpatterns, wallinfo = pp.preprocess(cyclic=1)
    solutions = [[(1, 2, 6, 0, 1), (1, 3, 4, 5, 6, 0, 1)]] * 4 + [None] * 4
    patterns = [p for pat in patterns for p in pat]
    for p, s in zip(patterns, solutions):
        match = matchPattern(p,
                             wallinfo,
                             cyclic=1,
                             findallmatches=findallmatches)
        if s:
            if showme and findallmatches: print set(match) == set(s)
            if showme and not findallmatches: print match[0] in s
        else:
            if showme: print 'None' in match and 'Pattern' in match
示例#4
0
def test8():
    tc.test8()
    varnames, threshnames, morsedomgraph, morsecells, vertexmap = fp.parseMorseSet(
    )
    domaingraph = fp.parseDomainGraph()
    domaincells = fp.parseDomainCells()
    extendedmorsegraph, extendedmorsecells = pp.makeExtendedMorseSetDomainGraph(
        vertexmap, morsecells, domaingraph, domaincells)
    outedges, wallthresh, walldomains, booleanoutedges = pp.makeWallGraphFromDomainGraph(
        len(vertexmap), extendedmorsegraph, extendedmorsecells)
    varsaffectedatwall = pp.varsAtWalls(threshnames, walldomains, wallthresh,
                                        varnames)
    print outedges == [(1, ), (2, 3), (6, ), (4, ), (5, ), (6, ), (0, )]
    print wallthresh == [2, 3, 2, 3, 2, 3, 3]
    print walldomains == [(0.5, 1.5, 3, 0.5, 1.5), (0.5, 1.5, 3.5, 1, 1.5),
                          (0.5, 1.5, 3, 1.5, 1.5), (0.5, 1.5, 3.5, 2, 1.5),
                          (0.5, 1.5, 3, 2.5, 1.5), (0.5, 1.5, 2.5, 2, 1.5),
                          (0.5, 1.5, 2.5, 1, 1.5)]
    print varsaffectedatwall == [3, 2, 3, 4, 3, 4, 2]