working on the containing simplex problem. the get containing simplex function works, if the point is in the domain. I am trying to force the domain to contain the point (placing points along perimiter of the mesh). I am not doing that right, but have to run
--HG-- rename : bin/qhull-029.txt => data/qhull-029.txt rename : bin/qhull-029.txt.gv => data/qhull-029.txt.gv
This commit is contained in:
-1002
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+2
-1
@@ -3,6 +3,7 @@
|
||||
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])
|
||||
@@ -10,7 +11,7 @@ except:
|
||||
total_points = 20
|
||||
|
||||
|
||||
print total_points
|
||||
log.info(total_points)
|
||||
g = random_grid(total_points)
|
||||
|
||||
open('/tmp/for_qhull.txt', 'w').write(g.for_qhull())
|
||||
|
||||
+18
-14
@@ -7,16 +7,19 @@ from baker.tools import exact_func, smberror, improved_answer
|
||||
from glob import glob
|
||||
from os import remove
|
||||
|
||||
import numpy as np
|
||||
|
||||
FILE_PREFIX='/tmp/qhull-'
|
||||
|
||||
for g in glob('%s*' % FILE_PREFIX):
|
||||
remove(g)
|
||||
|
||||
try:
|
||||
total_points = int(sys.argv[1])
|
||||
total_tries = int(sys.argv[2])
|
||||
total_points = int(sys.argv[1])
|
||||
random_points = int(sys.argv[2])
|
||||
total_tries = int(sys.argv[3])
|
||||
except:
|
||||
print "usage: app.py total_points total_tries"
|
||||
print "usage: app.py [total points in random grid] [number of random points to attempt] [total attempts]"
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
@@ -25,18 +28,19 @@ print "total points", total_points
|
||||
|
||||
|
||||
d = {True: 0, False: 0}
|
||||
for i in xrange(total_tries):
|
||||
for cur_try in xrange(total_tries):
|
||||
g = random_grid(total_points)
|
||||
open('%s%0.3d.txt' % (FILE_PREFIX, cur_try), 'w').write(g.for_qhull())
|
||||
|
||||
open('%s%0.3d.txt' % (FILE_PREFIX, i), 'w').write(g.for_qhull())
|
||||
for i in xrange(random_points):
|
||||
X = [np.random.rand(), np.random.rand()]
|
||||
exact = exact_func(X)
|
||||
|
||||
X = [0.3, 0.3]
|
||||
exact = exact_func(X)
|
||||
try:
|
||||
answer = g.run_baker(X)
|
||||
d[improved_answer(answer, exact)] += 1
|
||||
except smberror as e:
|
||||
print e
|
||||
print d
|
||||
|
||||
try:
|
||||
answer = g.run_baker(X)
|
||||
d[improved_answer(answer, exact)] += 1
|
||||
except smberror as e:
|
||||
print e
|
||||
|
||||
print d
|
||||
print d
|
||||
|
||||
@@ -24,9 +24,8 @@ q = [exact_func(i) for i in verts]
|
||||
|
||||
g = grid(verts,q)
|
||||
|
||||
X = [0.3, 0.3]
|
||||
X = [0.13206472640187261, 0.98644929172054607]
|
||||
|
||||
g.get_containing_simplex(X)
|
||||
exact = exact_func(X)
|
||||
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user