3dcc10ea0e
--HG-- rename : bin/qhull-029.txt => data/qhull-029.txt rename : bin/qhull-029.txt.gv => data/qhull-029.txt.gv
46 lines
927 B
Python
Executable File
46 lines
927 B
Python
Executable File
#!/usr/bin/python2.6
|
|
|
|
import sys
|
|
from grid.DDD import random_grid
|
|
from baker import get_phis_3D, run_baker_3D
|
|
from baker.tools import logging as log
|
|
from baker.tools import exact_func_3D, smberror, improved_answer
|
|
try:
|
|
total_points = int(sys.argv[1])
|
|
except:
|
|
total_points = 20
|
|
|
|
|
|
log.info(total_points)
|
|
g = random_grid(total_points)
|
|
|
|
open('/tmp/for_qhull.txt', 'w').write(g.for_qhull())
|
|
|
|
X = [0.3, 0.3, 0.4]
|
|
|
|
R, S = g.get_simplex_and_nearest_points(X, extra_points = 6, simplex_size=4)
|
|
|
|
print "R\n", R
|
|
print "S\n", S
|
|
|
|
exact = exact_func_3D(X)
|
|
print "exact solution: %0.6f" % exact
|
|
|
|
phis = get_phis_3D(X, R.points)
|
|
print "phi values (should all be positive): ", phis, sum(phis)
|
|
if [i for i in phis if i < 0.0]:
|
|
print "problems"
|
|
|
|
try:
|
|
r = run_baker_3D(X, R, S)
|
|
improved_answer(r, exact)
|
|
except smberror as e:
|
|
print e
|
|
|
|
|
|
try:
|
|
answer = g.run_baker(X)
|
|
improved_answer(answer, exact)
|
|
except smberror as e:
|
|
print e
|