Beispiel #1
0
def test0():
    outedges,walldomains,varsaffectedatwall=tc.test0()
    wallinfo = wl.makeWallInfo(outedges,walldomains,varsaffectedatwall)
    print wallinfo[(3,4)]==[(6,('um',))]
    print wallinfo[(1,4)]==[(6,('um',))]
    print wallinfo[(2,0)]==[(1,('md',))]
    print set(wallinfo[(6,5)])==set([(2,('dM',)),(3,('dM',))])
Beispiel #2
0
def test0():
    outedges, walldomains, varsaffectedatwall = tc.test0()
    wallinfo = wl.makeWallInfo(outedges, walldomains, varsaffectedatwall)
    print wallinfo[(3, 4)] == [(6, ('um', ))]
    print wallinfo[(1, 4)] == [(6, ('um', ))]
    print wallinfo[(2, 0)] == [(1, ('md', ))]
    print set(wallinfo[(6, 5)]) == set([(2, ('dM', )), (3, ('dM', ))])
Beispiel #3
0
def test0(showme=1, findallmatches=1):
    wallinfo = makeWallInfo(*tc.test0())

    pattern = ['md', 'um', 'Mu', 'dM', 'md']
    match = matchPattern(pattern,
                         wallinfo,
                         cyclic=1,
                         findallmatches=findallmatches)
    if showme and findallmatches:
        print set(match) == set([(0, 1, 4, 6, 5, 2, 0), (3, 4, 6, 5, 3)])
    if showme and not findallmatches:
        print match[0] in [(0, 1, 4, 6, 5, 2, 0), (3, 4, 6, 5, 3)]

    pattern = ['md', 'um', 'Mu', 'dM', 'md', 'um', 'Mu', 'dM',
               'md']  #check double loop
    match = matchPattern(pattern,
                         wallinfo,
                         cyclic=1,
                         findallmatches=findallmatches)
    if showme and findallmatches:
        print set(match) == set([(0, 1, 4, 6, 5, 2, 0, 1, 4, 6, 5, 2, 0),
                                 (3, 4, 6, 5, 3, 4, 6, 5, 3),
                                 (0, 1, 4, 6, 5, 3, 4, 6, 5, 2, 0),
                                 (3, 4, 6, 5, 2, 0, 1, 4, 6, 5, 3)])
    if showme and not findallmatches:
        print match[0] in [(0, 1, 4, 6, 5, 2, 0, 1, 4, 6, 5, 2, 0),
                           (3, 4, 6, 5, 3, 4, 6, 5, 3),
                           (0, 1, 4, 6, 5, 3, 4, 6, 5, 2, 0),
                           (3, 4, 6, 5, 2, 0, 1, 4, 6, 5, 3)]

    pattern = ['um', 'md']  #intermediate extrema
    match = matchPattern(pattern,
                         wallinfo,
                         cyclic=0,
                         findallmatches=findallmatches)
    if showme: print 'None' in match

    pattern = ['ud', 'um', 'Mu']  # acyclic
    match = matchPattern(pattern,
                         wallinfo,
                         cyclic=0,
                         findallmatches=findallmatches)
    if showme: print match == [(1, 4, 6)]
Beispiel #4
0
def test0(showme=1, findallmatches=1):
    wallinfo = makeWallInfo(*tc.test0())

    pattern = ["md", "um", "Mu", "dM", "md"]
    match = matchPattern(pattern, wallinfo, cyclic=1, findallmatches=findallmatches)
    if showme and findallmatches:
        print set(match) == set([(0, 1, 4, 6, 5, 2, 0), (3, 4, 6, 5, 3)])
    if showme and not findallmatches:
        print match[0] in [(0, 1, 4, 6, 5, 2, 0), (3, 4, 6, 5, 3)]

    pattern = ["md", "um", "Mu", "dM", "md", "um", "Mu", "dM", "md"]  # check double loop
    match = matchPattern(pattern, wallinfo, cyclic=1, findallmatches=findallmatches)
    if showme and findallmatches:
        print set(match) == set(
            [
                (0, 1, 4, 6, 5, 2, 0, 1, 4, 6, 5, 2, 0),
                (3, 4, 6, 5, 3, 4, 6, 5, 3),
                (0, 1, 4, 6, 5, 3, 4, 6, 5, 2, 0),
                (3, 4, 6, 5, 2, 0, 1, 4, 6, 5, 3),
            ]
        )
    if showme and not findallmatches:
        print match[0] in [
            (0, 1, 4, 6, 5, 2, 0, 1, 4, 6, 5, 2, 0),
            (3, 4, 6, 5, 3, 4, 6, 5, 3),
            (0, 1, 4, 6, 5, 3, 4, 6, 5, 2, 0),
            (3, 4, 6, 5, 2, 0, 1, 4, 6, 5, 3),
        ]

    pattern = ["um", "md"]  # intermediate extrema
    match = matchPattern(pattern, wallinfo, cyclic=0, findallmatches=findallmatches)
    if showme:
        print "None" in match

    pattern = ["ud", "um", "Mu"]  # acyclic
    match = matchPattern(pattern, wallinfo, cyclic=0, findallmatches=findallmatches)
    if showme:
        print match == [(1, 4, 6)]