2010-02-14 19:56:41 -08:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
|
|
|
import sys
|
|
|
|
import pickle
|
|
|
|
|
|
|
|
from grid import simple_rect_grid, simple_random_grid
|
2010-02-21 19:52:51 -08:00
|
|
|
from baker import run_baker
|
2010-02-14 19:56:41 -08:00
|
|
|
|
2010-03-05 07:58:07 -08:00
|
|
|
from tools import smberror
|
|
|
|
|
2010-02-14 19:56:41 -08:00
|
|
|
qfile = '/tmp/grid_regular.txt'
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
try:
|
2010-02-26 13:44:29 -08:00
|
|
|
rx = int(sys.argv[1])
|
|
|
|
ry = int(sys.argv[2])
|
2010-03-05 07:58:07 -08:00
|
|
|
except (IndexError, ValueError) as e:
|
|
|
|
print "problem with argv: %s" % e
|
2010-02-26 13:44:29 -08:00
|
|
|
rx = 4
|
|
|
|
ry = 4 * rx
|
2010-02-21 19:52:51 -08:00
|
|
|
|
2010-02-26 13:44:29 -08:00
|
|
|
source_mesh = simple_rect_grid(rx, ry)
|
|
|
|
|
2010-03-05 07:58:07 -08:00
|
|
|
# print source_mesh
|
2010-02-26 13:44:29 -08:00
|
|
|
|
2010-03-05 07:58:07 -08:00
|
|
|
X = [0.1, 0.1]
|
2010-02-26 13:44:29 -08:00
|
|
|
|
2010-03-05 07:58:07 -08:00
|
|
|
try:
|
|
|
|
(R, S) = source_mesh.get_simplex_and_nearest_points(X, extra_points=4)
|
|
|
|
print "R for nearest-neighbor:\n", R
|
|
|
|
print "S for nearest-neighbor:\n", S
|
|
|
|
print run_baker(X, R, S)
|
|
|
|
except smberror as e:
|
|
|
|
print "caught error: %s" % e
|
|
|
|
(R, S) = source_mesh.get_points_conn(X)
|
|
|
|
print "R for connectivity:\n", R
|
|
|
|
print "S for connectivity:\n", S
|
|
|
|
print run_baker(X, R, S)
|
|
|
|
|
|
|
|
|
|
|
|
print "repeating the above just using the grid object:"
|
|
|
|
print source_mesh.run_baker(X)
|
2010-02-21 19:52:51 -08:00
|
|
|
open(qfile, 'w').write(source_mesh.for_qhull())
|