moved files around: now the grid benchmark/test script is gbench.py
--HG-- rename : bin/gmsh_bench.py => bin/gbench.py
This commit is contained in:
parent
c1fd006ee7
commit
487c132d12
@ -1,49 +0,0 @@
|
||||
import sys
|
||||
import time
|
||||
import pickle
|
||||
|
||||
import numpy as np
|
||||
|
||||
from optparse import OptionParser
|
||||
|
||||
import interp.bootstrap
|
||||
from interp.grid.delaunay import dgrid
|
||||
from interp.tools import improved_answer, friendly_exact_3D as exact
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) != 3:
|
||||
print >> sys.stderr, "usage: %s <number of random points> <number of attempted interps>" % sys.argv[0]
|
||||
sys.exit(1)
|
||||
|
||||
rcount, count = (int(i) for i in sys.argv[1:])
|
||||
|
||||
v = np.random.random((rcount, 3))
|
||||
pickle.dump(v, open('/tmp/v.p', 'w'))
|
||||
q = np.array([exact(x) for x in v])
|
||||
|
||||
start = time.time()
|
||||
g = dgrid(v,q)
|
||||
end = time.time()
|
||||
|
||||
print "cells: %d, verts: %d" % (len(g.cells), len(g.verts))
|
||||
print end - start, " seconds to instantiate the dgrid object"
|
||||
|
||||
results = {True:0, False:0}
|
||||
i = 0
|
||||
outside = 0
|
||||
while i < count:
|
||||
try:
|
||||
X = np.random.random((1,3))[0]
|
||||
|
||||
a = g.run_baker(X, order = 3, extra_points = 32)
|
||||
e = exact(X)
|
||||
|
||||
results[improved_answer(a, e)] += 1
|
||||
i += 1
|
||||
except Exception as e:
|
||||
print e
|
||||
outside += 1
|
||||
|
||||
print "total skipped points: %d" % outside
|
||||
print results
|
Loading…
Reference in New Issue
Block a user