source: inundation/ga/storm_surge/pmesh/timing.py @ 1217

Last change on this file since 1217 was 349, checked in by duncan, 20 years ago

adding pmesh

File size: 1.6 KB
Line 
1"""
2Script to measure how long pmesh spends doing various methods
3"""
4from mesh import *
5from pmesh import *
6import time
7
8
9draw = Draw()
10#draw.run()
11n = 400
12times = []
13tinitial = time.time()
14times.append(("initial",time.time()-tinitial))
15#------------------------------------------
16mesh = Mesh()
17id = 0
18for i in range(n):
19    for j in range(n):
20       v = mesh.addUserVertex(i,j)
21       v.guiID = id
22       id += 1
23v1 = mesh.addUserVertex(-1,-1)
24v1.guiID = id
25id += 1
26v2 = mesh.addUserVertex(-1,n)
27v2.guiID = id
28id += 1
29v3 = mesh.addUserVertex(n,n)
30v3.guiID = id
31id += 1
32v4 = mesh.addUserVertex(n,-1)
33v4.guiID = id
34id += 1
35mesh.addUserSegment(v1,v2)
36mesh.addUserSegment(v2,v3)
37mesh.addUserSegment(v3,v4)
38mesh.addUserSegment(v4,v1)
39times.append(("user_outline_created",time.time() - tinitial ))
40#------------------------------------------
41#mesh.autoSegment()
42#times.append(("mesh_autosegmented",time.time() - tinitial ))
43#------------------------------------------
44mesh.generateMesh(mode = "Q",maxArea = 1)
45times.append(("mesh_generated",time.time() - tinitial ))
46#------------------------------------------
47draw.mesh = mesh
48draw.selectZoom(1.0)
49times.append(("zoomed",time.time() - tinitial ))
50#------------------------------------------
51
52
53#---------------------
54print "N is ", n
55for time in times:
56    print "%s  %0.12f" %(time[0],  time[1])
57
58
59#Results - mesh.py ver   1.84           1.85   
60# N     400     
61# initial                       0               0
62# user_outline_created  1.467999935     1.609999895
63# mesh_generated        21.70300007     22.3440001
64#zoomed                 32.81299996     33.5940001
65
66
67
Note: See TracBrowser for help on using the repository browser.