partially implemented using new data structure in point lookup
I spoke with Dr. Gorrell about first trying to call the nearest-neighbor routine, releasing the trapped exception where the matrix ends up being singular, and trapping it in the grid object's run_baker, where I could then call the connectivity-based lookup routine. Those are my next steps, as well as starting to think about pushing the 3D front ahead this week.
This commit is contained in:
parent
2792329eaa
commit
a25e6d03d1
@ -10,19 +10,26 @@ qfile = '/tmp/grid_regular.txt'
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
resolution = int(sys.argv[1])
|
||||
if resolution > 200:
|
||||
raise Exception
|
||||
except:
|
||||
resolution = 3
|
||||
|
||||
source_mesh = simple_rect_grid(resolution, resolution)
|
||||
X = [0.4, 0.001]
|
||||
(R, S) = source_mesh.get_points_conn(X)
|
||||
rx = int(sys.argv[1])
|
||||
ry = int(sys.argv[2])
|
||||
except ValueError as e:
|
||||
print e
|
||||
rx = 4
|
||||
ry = 4 * rx
|
||||
|
||||
source_mesh = simple_rect_grid(rx, ry)
|
||||
print source_mesh
|
||||
print R
|
||||
print S
|
||||
|
||||
X = [0.1, 0.1]
|
||||
|
||||
(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)
|
||||
|
||||
(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)
|
||||
|
||||
open(qfile, 'w').write(source_mesh.for_qhull())
|
||||
|
15
lib/grid.py
15
lib/grid.py
@ -111,6 +111,13 @@ class grid(object):
|
||||
"""
|
||||
this returns two grid objects: R and S.
|
||||
|
||||
this function differes from the get_simplex_and_nearest_points
|
||||
function in that it builds up the extra points based on
|
||||
connectivity information, not just nearest-neighbor.
|
||||
in theory, this will work much better for situations like
|
||||
points near a short edge in a boundary layer cell where the
|
||||
nearest points would all be colinear
|
||||
|
||||
R is a grid object that is the (a) containing simplex around point X
|
||||
S is a connectivity-based nearest-neighbor lookup, limited to 3 extra points
|
||||
"""
|
||||
@ -128,7 +135,7 @@ class grid(object):
|
||||
|
||||
if not simplex:
|
||||
raise AssertionError('no containing simplex found')
|
||||
simplex_set = set(simplex.verts)
|
||||
|
||||
R = self.create_mesh(simplex.verts)
|
||||
|
||||
|
||||
@ -139,7 +146,11 @@ class grid(object):
|
||||
|
||||
return R, S
|
||||
|
||||
def run_baker(self, X):
|
||||
def run_baker(self, X, connectivity_based = False):
|
||||
print >>sys.stderr, "suxor"
|
||||
if connectivity_based:
|
||||
(R, S) = self.get_points_conn(X)
|
||||
else:
|
||||
(R, S) = self.get_simplex_and_nearest_points(X)
|
||||
return run_baker(X, R, S)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user