summarylogtreecommitdiffstats
path: root/r837.patch
blob: e5fdd761d3a320cb7f8bb8e8745dc9502d8f559e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
Index: src/implicit_ode.pyx
===================================================================
--- assimulo/implicit_ode.pyx	(revision 836)
+++ assimulo/implicit_ode.pyx	(revision 837)
@@ -26,7 +26,7 @@
 cimport numpy as N
 
 from exception import *
-from time import clock, time
+from timeit import default_timer as timer
 import warnings
 
 realtype = N.float
@@ -187,7 +187,7 @@
         output_index = 0
         
         self.time_limit_activated = 1 if self.time_limit > 0 else 0
-        self.time_integration_start = time()
+        self.time_integration_start = timer()
 
         while (flag == ID_COMPLETE and tevent == tfinal) is False and (self.t-eps > tfinal) if backward else (self.t+eps < tfinal):
 
@@ -203,7 +203,7 @@
             
             #Initialize the clock, enabling storing elapsed time for each step 
             if REPORT_CONTINUOUSLY and self.options["clock_step"]: 
-                self.clock_start = clock()
+                self.clock_start = timer()
                 
             [flag, tlist, ylist, ydlist] = self.integrate(self.t, self.y, self.yd, tevent, opts)
 
@@ -274,16 +274,16 @@
                 
         #Store the elapsed time for a single step 
         if self.options["clock_step"]:
-            self.elapsed_step_time = clock() - self.clock_start 
-            self.clock_start = clock() 
+            self.elapsed_step_time = timer() - self.clock_start 
+            self.clock_start = timer() 
         
         #Check elapsed timed
         if self.time_limit_activated:
-            if self.time_limit-(time()-self.time_integration_start) < 0.0:
+            if self.time_limit-(timer()-self.time_integration_start) < 0.0:
                 raise TimeLimitExceeded("The time limit was exceeded at integration time %.8E."%self.t)    
         
         if self.display_progress:
-            if (time() - self.time_integration_start) > self.display_counter*10:
+            if (timer() - self.time_integration_start) > self.display_counter*10:
                 self.display_counter += 1
                 
                 sys.stdout.write(" Integrator time: %e" % self.t)
Index: src/ode.pyx
===================================================================
--- assimulo/ode.pyx	(revision 836)
+++ assimulo/ode.pyx	(revision 837)
@@ -17,7 +17,7 @@
 
 import numpy as N
 cimport numpy as N
-import time
+from timeit import default_timer as timer
 import pylab as P
 
 import itertools
@@ -283,13 +283,13 @@
         self.initialize()
         
         #Start of simulation, start the clock
-        time_start = time.clock()
+        time_start = timer()
         
         #Start the simulation
         self._simulate(t0, tfinal, output_list, REPORT_CONTINUOUSLY, INTERPOLATE_OUTPUT, TIME_EVENT)
         
         #End of simulation, stop the clock
-        time_stop = time.clock()
+        time_stop = timer()
         
         #Simulation complete, call finalize
         self.finalize()
Index: src/kinsol.py
===================================================================
--- assimulo/kinsol.py	(revision 836)
+++ assimulo/kinsol.py	(revision 837)
@@ -26,7 +26,7 @@
 import pylab as P
 import operator as O
 import re
-import time
+from timeit import default_timer as timer
 from assimulo.problem_algebraic import *
 
 class KINSOL_Exception(Exception):
@@ -290,9 +290,9 @@
                     self.solver.KINSOL_init(self.func,self.x0,self.dim,jac,self.constraints,self.use_sparse,self.verbosity,self.norm_of_res,self.reg_param,self.fscale)
                 else:
                     self.solver.KINSOL_init(self.func,self.x0,self.dim,jac,self.constraints,self.use_sparse,self.verbosity,self.norm_of_res,self.reg_param,None)
-                start = time.clock()
+                start = timer()
                 res = self.solver.KINSOL_solve(not self._use_ls)
-                stop = time.clock()
+                stop = timer()
                 self.exec_time += (stop - start)
                 solved = True
             except KINError as error:
Index: src/explicit_ode.pyx
===================================================================
--- assimulo/explicit_ode.pyx	(revision 836)
+++ assimulo/explicit_ode.pyx	(revision 837)
@@ -25,7 +25,7 @@
 cimport numpy as N
 
 from exception import *
-from time import clock, time
+from timeit import default_timer as timer
 
 include "constants.pxi" #Includes the constants (textual include)
 
@@ -170,7 +170,7 @@
         output_index = 0
         
         self.time_limit_activated = 1 if self.time_limit > 0 else 0
-        self.time_integration_start = time()
+        self.time_integration_start = timer()
         
         while (flag == ID_COMPLETE and tevent == tfinal) is False and (self.t-eps > tfinal) if backward else (self.t+eps < tfinal):
 
@@ -183,7 +183,7 @@
             
             #Initialize the clock, enabling storing elapsed time for each step
             if REPORT_CONTINUOUSLY and self.options["clock_step"]:
-                self.clock_start = clock()
+                self.clock_start = timer()
             
             flag, tlist, ylist = self.integrate(self.t, self.y, tevent, opts)
             
@@ -248,12 +248,12 @@
         
         #Store the elapsed time for a single step
         if self.options["clock_step"]:
-            self.elapsed_step_time = clock() - self.clock_start
-            self.clock_start = clock()
+            self.elapsed_step_time = timer() - self.clock_start
+            self.clock_start = timer()
         
         #Check elapsed timed
         if self.time_limit_activated:
-            if self.time_limit-(time()-self.time_integration_start) < 0.0:
+            if self.time_limit-(timer()-self.time_integration_start) < 0.0:
                 raise TimeLimitExceeded("The time limit was exceeded at integration time %.8E."%self.t)
                 
         self.chattering_clear_counter += 1
@@ -262,7 +262,7 @@
             self.chattering_ok_print = 1
                 
         if self.display_progress:
-            if (time() - self.time_integration_start) > self.display_counter*10:
+            if (timer() - self.time_integration_start) > self.display_counter*10:
                 self.display_counter += 1
                 
                 sys.stdout.write(" Integrator time: %e" % self.t)
Index: src/algebraic.pyx
===================================================================
--- assimulo/algebraic.pyx	(revision 836)
+++ assimulo/algebraic.pyx	(revision 837)
@@ -17,7 +17,7 @@
 
 import numpy as N
 cimport numpy as N
-import time
+from timeit import default_timer as timer
 import pylab as P
 
 import itertools
@@ -102,13 +102,13 @@
         self.initialize()
         
         #Start of simulation, start the clock
-        time_start = time.clock()
+        time_start = timer()
         
         #Start the simulation
         self.y = self._solve(y)
         
         #End of simulation, stop the clock
-        time_stop = time.clock()
+        time_stop = timer()
         
         #Simulation complete, call finalize
         self.finalize()