2010-11-01 14:51:40 -07:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
import sys
|
2011-02-21 15:48:21 -08:00
|
|
|
import cProfile
|
2010-11-01 14:51:40 -07:00
|
|
|
|
|
|
|
import numpy as np
|
|
|
|
|
|
|
|
import interp.bootstrap
|
2010-11-01 19:20:05 -07:00
|
|
|
from interp.grid.gmsh import gmsh_grid3D
|
2011-03-21 11:13:46 -07:00
|
|
|
from interp.tools import improved_answer, exact
|
2010-11-01 19:20:05 -07:00
|
|
|
|
2011-03-21 11:13:46 -07:00
|
|
|
def test_success(input_file, count):
|
|
|
|
g = gmsh_grid3D(input_file)
|
2011-02-15 14:22:54 -08:00
|
|
|
g.q = np.array([exact(x) for x in g.verts])
|
2010-11-01 14:51:40 -07:00
|
|
|
|
2011-02-15 14:22:54 -08:00
|
|
|
results = {True:0, False:0}
|
2011-02-20 18:23:57 -08:00
|
|
|
# import pdb; pdb.set_trace()
|
2011-03-21 11:13:46 -07:00
|
|
|
for i in xrange(count):
|
2011-02-15 14:22:54 -08:00
|
|
|
X = np.random.random((1,3))[0]
|
2010-11-01 14:51:40 -07:00
|
|
|
|
2011-02-20 18:23:57 -08:00
|
|
|
a = g.run_baker(X, order = 3, extra_points = 32)
|
|
|
|
e = exact(X)
|
|
|
|
|
2011-02-15 14:22:54 -08:00
|
|
|
results[improved_answer(a, e)] += 1
|
2010-11-01 14:51:40 -07:00
|
|
|
|
2011-03-21 11:13:46 -07:00
|
|
|
return results
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
if len(sys.argv) != 3:
|
|
|
|
print >> sys.stderr, "usage: %s <input file> <number of attempts>" % sys.argv[0]
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
input_file, count = sys.argv[1:]
|
2011-02-15 14:22:54 -08:00
|
|
|
|
2011-03-21 11:13:46 -07:00
|
|
|
print test_success(input_file, int(count))
|