updated the interp.grid.DD module to count points correctly
This commit is contained in:
parent
5ef402982c
commit
985a16bb22
@ -30,33 +30,28 @@ class rect_grid(basegrid):
|
||||
class random_grid(rect_grid):
|
||||
def __init__(self, num_verts = 10):
|
||||
verts = []
|
||||
q = []
|
||||
|
||||
r = np.random
|
||||
appx_side_res = int(np.sqrt(num_verts))
|
||||
delta = 1.0 / float(appx_side_res)
|
||||
|
||||
for x in xrange(appx_side_res + 1):
|
||||
verts.append([0,0])
|
||||
verts.append([1,0])
|
||||
verts.append([0,1])
|
||||
verts.append([1,1])
|
||||
|
||||
for x in xrange(1,appx_side_res):
|
||||
cur_x = x * delta
|
||||
for cur_y in (0, 1):
|
||||
new_point = [cur_x, cur_y]
|
||||
verts.append(new_point)
|
||||
q.append(exact_func(new_point))
|
||||
|
||||
for y in xrange(appx_side_res + 1):
|
||||
for y in xrange(1,appx_side_res):
|
||||
cur_y = y * delta
|
||||
for cur_x in (0, 1):
|
||||
new_point = [cur_x, cur_y]
|
||||
verts.append(new_point)
|
||||
q.append(exact_func(new_point))
|
||||
|
||||
for i in xrange(num_verts):
|
||||
cur_x = r.rand()
|
||||
cur_y = r.rand()
|
||||
verts.extend(np.random.random((num_verts - 4*appx_side_res, 2)))
|
||||
|
||||
verts.append([cur_x, cur_y])
|
||||
q.append( exact_func( (cur_x, cur_y) ) )
|
||||
basegrid.__init__(self, verts, q)
|
||||
|
||||
self.verts = np.array(self.verts)
|
||||
self.q = np.array(self.q)
|
||||
q = np.zeros(len(verts))
|
||||
basegrid.__init__(self, np.array(verts), q)
|
||||
|
Loading…
Reference in New Issue
Block a user