Exemplo n.º 1
0
def dotest(S):
    firsthash = S.hash(), hash((tuple(S.nneighbors)))
    #print firsthash[0], firsthash[1]
    s = pickle.dumps(S, -1)
    print "save size:", len(s)
    
    S2 = pickle.loads(s)
    #print S2.hash(), hash((tuple(S2.nneighbors)))
    S2.consistencyCheck()
    S2.eddConsistencyCheck()
    
    assert firsthash == (S2.hash(), hash((tuple(S2.nneighbors))))
    
    if S._eddEnabled: S.eddEnable()  # must reset our move-lists to the same
    saiga12.randomSeed(9999)
    S.cycle(10)
    if S._eddEnabled: S.eddEnable()  # must reset our move-lists to the same
    saiga12.randomSeed(9999)
    S2.cycle(10)
    #printstuff(S, S2)
    
    assert S.hash() == S2.hash()
Exemplo n.º 2
0
S1.makegrid(3, 3)
S1.addParticleRandom(n=1, type_=3)

print S1.lattsite, S1.persist
S1.cycle()
print S1.lattsite, S1.persist

S1._allocPersistArray()

print S1.lattsite, S1.persist
S1.cycle()
print S1.lattsite, S1.persist

print

import saiga12 ; saiga12.randomSeed(174)
S1 = Grid2d()
S1.setCycleMode('kobandersen')
S1.makegrid(3, 3)
S1.addParticleRandom(n=1, type_=3)
S1.eddEnable()

print S1.lattsite, S1.persist
S1.cycle()
print S1.lattsite, S1.persist

S1._allocPersistArray()

print S1.lattsite, S1.persist
S1.cycle()
print S1.lattsite, S1.persist