smbinterp/bin/test2d-qhull-specific.py

32 lines
626 B
Python
Executable File

#!/usr/bin/python2.6
import sys
from grid.DD import grid
from grid.qhull import parse_qhull_file
from baker import get_phis, run_baker
from baker.tools import exact_func, smberror, improved_answer
from glob import glob
from os import remove
FILE_PREFIX='/tmp/qhull-'
try:
verts = parse_qhull_file(sys.argv[1], verbose=True)
X = [float(sys.argv[2]), float(sys.argv[3])]
except:
print "usage: app.py qhullinputfile X Y"
sys.exit(1)
q = [exact_func(i) for i in verts]
g = grid(verts,q)
exact = exact_func(X)
try:
answer = g.run_baker(X)
d[improved_answer(answer, exact)] += 1
except smberror as e:
print e