@@ -50,6 +50,8 @@ def p(x) :
50
50
51
51
class TestEdgeIntersection (TestFixture ):
52
52
53
+ plotting = False
54
+
53
55
def setUp (self ):
54
56
self .penalty_length = 0.1
55
57
self .edge_smoothing = 0.2
@@ -185,7 +187,8 @@ def test_plot_smoothness(self):
185
187
N = 4000
186
188
S = np .linspace (0.0 , 13.0 , N )
187
189
188
- # fig, axs = pyplot.subplots(1, 3, gridspec_kw={'width_ratios' : [2.,1.,1.]})
190
+ if self .plotting :
191
+ fig , axs = pyplot .subplots (1 , 3 , gridspec_kw = {'width_ratios' : [2. ,1. ,1. ]})
189
192
190
193
def edge_0 (step , edge0_mod ):
191
194
s = S [step ]
@@ -260,37 +263,38 @@ def force_vs_time(step, e, n, d):
260
263
def force_at_time (step , e , n , d ):
261
264
return [S [step ]],[fs [n ,d ][step ]]
262
265
263
- # p = slide_plot(fig, axs, times)
264
- # p.plot(0, mesh0, 'ko-')
265
- # p.plot(0, mesh1, 'ko-')
266
- # p.plot(0, mesh2, 'ko-')
267
- # p.plot(0, mesh3, 'ko-')
268
- # p.arrow(0, arrows0)
269
-
270
- # axs[0].set_aspect('equal')
271
- # axs[0].set_xlim([-1.0, 3.0])
272
- # axs[0].set_ylim([-0.81, 0.81])
273
- # axs[0].set_yticks(np.linspace(-0.8, 0.8, 17))
274
-
275
- # p.plot(1, energy_vs_time, 'k')
276
- # p.plot(1, energy_at_time, 'go')
277
-
278
- # #xlim = [2.0, 2.6]
279
- # #axs[1].set_xlim(xlim)
280
- # axs[1].legend(['energy'])
281
-
282
- # p.plot(2, partial(force_vs_time,e=0,n=0,d=0), 'r--')
283
- # p.plot(2, partial(force_at_time,e=0,n=0,d=0), 'ro')
284
- # p.plot(2, partial(force_vs_time,e=0,n=0,d=1), 'r')
285
- # p.plot(2, partial(force_at_time,e=0,n=0,d=1), 'ro')
286
- # p.plot(2, partial(force_vs_time,e=0,n=1,d=0), 'g--')
287
- # p.plot(2, partial(force_at_time,e=0,n=1,d=0), 'go')
288
- # p.plot(2, partial(force_vs_time,e=0,n=1,d=1), 'g')
289
- # p.plot(2, partial(force_at_time,e=0,n=1,d=1), 'go')
290
-
291
- # #axs[2].set_xlim(xlim)
292
- # axs[2].legend(['force_x r', '_nolegend_', 'force_y r', '_nolegend_', 'force_x l', '_nolegend_', 'force_y l', '_nolegend_'])
293
- # p.show()
266
+ if self .plotting :
267
+ p = slide_plot (fig , axs , times )
268
+ p .plot (0 , mesh0 , 'ko-' )
269
+ p .plot (0 , mesh1 , 'ko-' )
270
+ p .plot (0 , mesh2 , 'ko-' )
271
+ p .plot (0 , mesh3 , 'ko-' )
272
+ p .arrow (0 , arrows0 )
273
+
274
+ axs [0 ].set_aspect ('equal' )
275
+ axs [0 ].set_xlim ([- 1.0 , 3.0 ])
276
+ axs [0 ].set_ylim ([- 0.81 , 0.81 ])
277
+ axs [0 ].set_yticks (np .linspace (- 0.8 , 0.8 , 17 ))
278
+
279
+ p .plot (1 , energy_vs_time , 'k' )
280
+ p .plot (1 , energy_at_time , 'go' )
281
+
282
+ #xlim = [2.0, 2.6]
283
+ #axs[1].set_xlim(xlim)
284
+ axs [1 ].legend (['energy' ])
285
+
286
+ p .plot (2 , partial (force_vs_time ,e = 0 ,n = 0 ,d = 0 ), 'r--' )
287
+ p .plot (2 , partial (force_at_time ,e = 0 ,n = 0 ,d = 0 ), 'ro' )
288
+ p .plot (2 , partial (force_vs_time ,e = 0 ,n = 0 ,d = 1 ), 'r' )
289
+ p .plot (2 , partial (force_at_time ,e = 0 ,n = 0 ,d = 1 ), 'ro' )
290
+ p .plot (2 , partial (force_vs_time ,e = 0 ,n = 1 ,d = 0 ), 'g--' )
291
+ p .plot (2 , partial (force_at_time ,e = 0 ,n = 1 ,d = 0 ), 'go' )
292
+ p .plot (2 , partial (force_vs_time ,e = 0 ,n = 1 ,d = 1 ), 'g' )
293
+ p .plot (2 , partial (force_at_time ,e = 0 ,n = 1 ,d = 1 ), 'go' )
294
+
295
+ #axs[2].set_xlim(xlim)
296
+ axs [2 ].legend (['force_x r' , '_nolegend_' , 'force_y r' , '_nolegend_' , 'force_x l' , '_nolegend_' , 'force_y l' , '_nolegend_' ])
297
+ p .show ()
294
298
295
299
296
300
def untest_roundoff (self ):
0 commit comments