/[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 941 by johnpye, Fri Nov 24 10:46:32 2006 UTC revision 942 by johnpye, Sat Nov 25 05:26:47 2006 UTC
# Line 25  class AscendTest(unittest.TestCase): Line 25  class AscendTest(unittest.TestCase):
25          self.L.load('johnpye/testlog10.a4c')          self.L.load('johnpye/testlog10.a4c')
26          T = self.L.findType('testlog10')          T = self.L.findType('testlog10')
27          M = T.getSimulation('sim')          M = T.getSimulation('sim')
28          M.solve(ascpy.Solver("QRSlv"),ascpy.SolverReporter())                M.solve(ascpy.Solver("QRSlv"),ascpy.SolverReporter())  
29          M.run(T.getMethod('self_test'))              M.run(T.getMethod('self_test'))    
30    
31      def testListIntegrators(self):      def testListIntegrators(self):
# Line 34  class AscendTest(unittest.TestCase): Line 34  class AscendTest(unittest.TestCase):
34          s2 = sorted(['IDA','LSODE'])          s2 = sorted(['IDA','LSODE'])
35          assert s1==s2          assert s1==s2
36    
37        # this routine is reused by both testIDA and testLSODE
38      def _testIntegrator(self,integratorname):      def _testIntegrator(self,integratorname):
39          self.L.load('johnpye/shm.a4c')          self.L.load('johnpye/shm.a4c')
40          M = self.L.findType('shm').getSimulation('sim')          M = self.L.findType('shm').getSimulation('sim')
# Line 75  class AscendTest(unittest.TestCase): Line 76  class AscendTest(unittest.TestCase):
76      def testIDA(self):      def testIDA(self):
77          self._testIntegrator('IDA')          self._testIntegrator('IDA')
78    
79        def testIDAwithDAE(self):
80            self.L.load('johnpye/idadenx.a4c')
81            M = self.L.findType('idadenx').getSimulation('sim')
82            I = ascpy.Integrator(M)
83            I.setEngine('IDA')
84            I.setReporter(ascpy.IntegratorReporterNull(I))
85            I.setLogTimesteps(ascpy.Units("s"), 0.4, 4e10, 11);
86            I.setMinSubStep(0.0005); # these limits are required by IDA at present (numeric diff)
87            I.setMaxSubStep(0.02);
88            I.setInitialSubStep(0.001);
89            I.setMaxSubSteps(500);
90            I.analyse();
91            I.solve();
92    
93        def testIDAparameters(self):
94            self.L.load('johnpye/shm.a4c')
95            M = self.L.findType('shm').getSimulation('sim')
96            I = ascpy.Integrator(M)
97            I.setEngine('IDA')
98            P = I.getParameters()
99            print "THERE ARE %d PARAMETERS" % len(P)
100            print P[0]
101            assert P[0].getBoolValue() == True
102            P[0].setBoolValue(False)
103            I.setParameters(P)
104            P = I.getParameters()
105            assert P[0].getBoolValue() == False    
106            print P[0]
107    
108    
109  class NotToBeTested:  class NotToBeTested:
110      def nothing(self):      def nothing(self):
111          pass          pass

Legend:
Removed from v.941  
changed lines
  Added in v.942

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