2010-10-06 11:15:09 -07:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
import sys
|
|
|
|
|
2010-10-22 08:20:59 -07:00
|
|
|
import numpy as np
|
|
|
|
|
2010-10-23 15:57:44 -07:00
|
|
|
from interp.grid.gmsh import gmsh_grid
|
2010-10-29 11:39:45 -07:00
|
|
|
from interp.tools import exact_func, improved_answer
|
2010-10-06 11:15:09 -07:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
if len(sys.argv) != 2:
|
|
|
|
print >> sys.stderr, "usage: %s <gmsh file>" % sys.argv[0]
|
|
|
|
sys.exit(1)
|
|
|
|
|
2010-10-23 15:57:44 -07:00
|
|
|
g = gmsh_grid(sys.argv[1])
|
2010-11-01 14:52:45 -07:00
|
|
|
# g.dump_to_blender_files()
|
2010-10-06 11:15:09 -07:00
|
|
|
|
2010-10-29 11:39:45 -07:00
|
|
|
X = np.array([0.2, 0.5, 0.0])
|
2010-10-23 15:57:44 -07:00
|
|
|
R = g.get_containing_simplex(X)
|
2010-10-29 11:39:45 -07:00
|
|
|
print R
|
|
|
|
R, S = g.get_simplex_and_nearest_points(X, 10)
|
|
|
|
print "r", R
|
|
|
|
print "s", S
|
2010-10-06 11:15:09 -07:00
|
|
|
|
2010-10-29 11:39:45 -07:00
|
|
|
a = g.run_baker(X)
|
|
|
|
print a
|
|
|
|
e = exact_func(X)
|
|
|
|
print e
|
|
|
|
print improved_answer(a, e)
|
|
|
|
|
|
|
|
a = g.run_baker(X, extra_points = 5)
|
|
|
|
print a
|
|
|
|
e = exact_func(X)
|
|
|
|
print e
|
|
|
|
print improved_answer(a, e)
|
|
|
|
|
|
|
|
a = g.run_baker(X, extra_points = 7)
|
|
|
|
print a
|
|
|
|
e = exact_func(X)
|
|
|
|
print e
|
|
|
|
print improved_answer(a, e)
|
|
|
|
|
|
|
|
a = g.run_baker(X, order=3)
|
|
|
|
print a
|
|
|
|
e = exact_func(X)
|
|
|
|
print e
|
|
|
|
print improved_answer(a, e)
|
|
|
|
|
|
|
|
a = g.run_baker(X, order=3, extra_points = 5)
|
|
|
|
print a
|
|
|
|
e = exact_func(X)
|
|
|
|
print e
|
|
|
|
print improved_answer(a, e)
|
|
|
|
|
|
|
|
a = g.run_baker(X, order=3, extra_points = 7)
|
|
|
|
print a
|
|
|
|
e = exact_func(X)
|
|
|
|
print e
|
|
|
|
print improved_answer(a, e)
|
2010-11-01 14:52:45 -07:00
|
|
|
|
|
|
|
a = g.run_baker(X, order=3, extra_points = 10)
|
|
|
|
print a
|
|
|
|
e = exact_func(X)
|
|
|
|
print e
|
|
|
|
print improved_answer(a, e)
|