/[ascend]/trunk/pygtk/test.py
ViewVC logotype

Diff of /trunk/pygtk/test.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 943 by johnpye, Sat Nov 25 06:32:51 2006 UTC revision 944 by johnpye, Sat Nov 25 10:46:13 2006 UTC
# Line 51  class AscendTest(unittest.TestCase): Line 51  class AscendTest(unittest.TestCase):
51          I.setMaxSubStep(0.02);          I.setMaxSubStep(0.02);
52          I.setInitialSubStep(0.001);          I.setInitialSubStep(0.001);
53          I.setMaxSubSteps(200);          I.setMaxSubSteps(200);
54            if(integratorname=='IDA'):
55                I.setParameter('autodiff',False)
56          I.analyse();          I.analyse();
57          I.solve();          I.solve();
58          print "At end of simulation,"          print "At end of simulation,"
# Line 82  class AscendTest(unittest.TestCase): Line 84  class AscendTest(unittest.TestCase):
84          I = ascpy.Integrator(M)          I = ascpy.Integrator(M)
85          I.setEngine('IDA')          I.setEngine('IDA')
86          P = I.getParameters()          P = I.getParameters()
87          assert len(P)==1          assert len(P)==2
88          assert P[0].isBool()          assert P[0].isBool()
89          assert P[0].getName()=="autodiff"          assert P[0].getName()=="autodiff"
90          assert P[0].getBoolValue() == True          assert P[0].getBoolValue() == True
91            assert P[1].getName()=="useatol"
92            assert P[1].getBoolValue() == True
93          P[0].setBoolValue(False)          P[0].setBoolValue(False)
94          assert P[0].getBoolValue()==False          assert P[0].getBoolValue()==False
95          I.setParameters(P)          I.setParameters(P)
96          assert len(I.getParameters())==1          assert len(I.getParameters())==2
97          for p in I.getParameters():          for p in I.getParameters():
98              print p.getName(),"=",p.getValue()              print p.getName(),"=",p.getValue()
99          assert I.getParameterValue('autodiff')==False          assert I.getParameterValue('autodiff')==False
# Line 106  class AscendTest(unittest.TestCase): Line 110  class AscendTest(unittest.TestCase):
110          M = self.L.findType('idadenx').getSimulation('sim')          M = self.L.findType('idadenx').getSimulation('sim')
111          I = ascpy.Integrator(M)          I = ascpy.Integrator(M)
112          I.setEngine('IDA')          I.setEngine('IDA')
113          I.setReporter(ascpy.IntegratorReporterNull(I))          I.setReporter(ascpy.IntegratorReporterConsole(I))
114          I.setLogTimesteps(ascpy.Units("s"), 0.4, 4e10, 11);          I.setLogTimesteps(ascpy.Units("s"), 0.2, 4e10, 21);
115          I.setMinSubStep(0.0005); # these limits are required by IDA at present (numeric diff)          I.setMinSubStep(0.0005); # these limits are required by IDA at present (numeric diff)
116          I.setMaxSubStep(0.02);          I.setMaxSubStep(0.02);
117          I.setInitialSubStep(0.001);          I.setInitialSubStep(0.001);
118          I.setMaxSubSteps(500);          I.setMaxSubSteps(500);
119          I.setParameter('autodiff',False)          I.setParameter('autodiff',True)
120          I.analyse();          I.analyse()
121          I.solve();            I.solve()
122    
123  # move code above down here if you want to temporarily avoid testing it  # move code above down here if you want to temporarily avoid testing it
124  class NotToBeTested:  class NotToBeTested:

Legend:
Removed from v.943  
changed lines
  Added in v.944

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22