39 lines
753 B
Python
Executable File
39 lines
753 B
Python
Executable File
#!/usr/bin/python2.6
|
|
|
|
import sys
|
|
from grid.DDD import simple_random_grid
|
|
from baker import get_phis_3D, run_baker_3D
|
|
from baker.tools import exact_func_3D
|
|
|
|
try:
|
|
total_points = int(sys.argv[1])
|
|
except:
|
|
total_points = 100
|
|
|
|
g = simple_random_grid(total_points)
|
|
|
|
open('/tmp/for_qhull.txt', 'w').write(g.for_qhull())
|
|
|
|
X = [0.5, 0.3, 0.4]
|
|
|
|
R, S = g.get_simplex_and_nearest_points(X, extra_points = 3, simplex_size=4)
|
|
|
|
|
|
print "R", R
|
|
print "S", S
|
|
|
|
exact = exact_func_3D(X)
|
|
print "exact solution: %0.6f" % exact
|
|
|
|
print "phi values: ", get_phis_3D(X, R.points)
|
|
r = run_baker_3D(X, R, S)
|
|
|
|
print 'qlin' , r['qlin']
|
|
print 'error', r['error']
|
|
print 'final', r['final']
|
|
|
|
if abs(r['final'] - exact) <= abs(r['qlin'] - exact):
|
|
print "win"
|
|
else:
|
|
print "failure"
|