messing around with the gmsh3D parser
This commit is contained in:
parent
bb174094ab
commit
f03da63c4d
@ -8,6 +8,15 @@ import interp.bootstrap
|
|||||||
from interp.grid.gmsh import gmsh_grid3D
|
from interp.grid.gmsh import gmsh_grid3D
|
||||||
from interp.tools import exact_func_3D, improved_answer, log
|
from interp.tools import exact_func_3D, improved_answer, log
|
||||||
|
|
||||||
|
from interp.grid import grid
|
||||||
|
|
||||||
|
def exact(X):
|
||||||
|
x = X[0]
|
||||||
|
y = X[1]
|
||||||
|
z = X[2]
|
||||||
|
return 1+ x*x + y*y + z*z
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if len(sys.argv) != 2:
|
if len(sys.argv) != 2:
|
||||||
@ -15,23 +24,25 @@ if __name__ == '__main__':
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
g = gmsh_grid3D(sys.argv[1])
|
g = gmsh_grid3D(sys.argv[1])
|
||||||
|
g.q = np.array([exact(x) for x in g.verts])
|
||||||
|
|
||||||
X = np.array([0.2, 0.5, 0.01])
|
X = np.array([0.2, 0.5, 0.01])
|
||||||
R = g.get_containing_simplex(X)
|
R = g.get_containing_simplex(X)
|
||||||
R, S = g.get_simplex_and_nearest_points(X, 10)
|
R, S = g.get_simplex_and_nearest_points(X, 10)
|
||||||
# print R
|
print R
|
||||||
# print "r", R
|
print "r", R
|
||||||
# print "s", S
|
print "s", S
|
||||||
|
|
||||||
# results = {True:0, False:0}
|
results = {True:0, False:0}
|
||||||
# for i in xrange(10):
|
for i in xrange(1000):
|
||||||
# X = np.random.random((1,3))[0]
|
X = np.random.random((1,3))[0]
|
||||||
|
|
||||||
# a = g.run_baker(X, order = 5, extra_points = 25)
|
a = g.run_baker(X, order = 4, extra_points = 32)
|
||||||
# e = exact_func_3D(X)
|
e = exact_func_3D(X)
|
||||||
# ia = improved_answer(a, e)
|
results[improved_answer(a, e)] += 1
|
||||||
# results[ia] += 1
|
|
||||||
|
|
||||||
# print results
|
print results
|
||||||
# g.normalize_q()
|
g.normalize_q()
|
||||||
# print g.toxml()
|
# print g.toxml()
|
||||||
|
|
||||||
|
igg = grid(g.verts, g.q)
|
||||||
|
Loading…
Reference in New Issue
Block a user