DD random grid now has points along edges

This commit is contained in:
Stephen McQuay 2011-05-21 08:29:35 -06:00
parent 22f9bb0c7d
commit 10601471d1

View File

@ -1,6 +1,8 @@
from interp.grid.delaunay import dgrid as basegrid from interp.grid.delaunay import dgrid as basegrid
from interp.tools import baker_exact_2D as exact_func from interp.tools import baker_exact_2D as exact_func
from itertools import product
import numpy as np import numpy as np
class rect_grid(basegrid): class rect_grid(basegrid):
@ -29,15 +31,12 @@ class rect_grid(basegrid):
class random_grid(rect_grid): class random_grid(rect_grid):
def __init__(self, num_verts = 10): def __init__(self, num_verts = 10):
verts = []
appx_side_res = int(np.sqrt(num_verts)) appx_side_res = int(np.sqrt(num_verts))
delta = 1.0 / float(appx_side_res) delta = 1.0 / float(appx_side_res)
verts.append([0,0]) # load up corners:
verts.append([1,0]) verts = [i for i in product((0,1), repeat = 2)]
verts.append([0,1])
verts.append([1,1])
for x in xrange(1,appx_side_res): for x in xrange(1,appx_side_res):
cur_x = x * delta cur_x = x * delta