Remove '+1's from fractal arrays to match removal from solid array.

这个提交包含在:
Craig Warren
2017-03-02 10:53:47 +00:00
父节点 73aa76730c
当前提交 6b0c978747

查看文件

@@ -1283,7 +1283,7 @@ def process_geometrycmds(geometry, G):
# If there is only 1 bin then a normal material is being used, otherwise a mixing model # If there is only 1 bin then a normal material is being used, otherwise a mixing model
if volume.nbins == 1: if volume.nbins == 1:
volume.fractalvolume = np.ones((volume.nx + 1, volume.ny + 1, volume.nz + 1), dtype=floattype) volume.fractalvolume = np.ones((volume.nx, volume.ny, volume.nz), dtype=floattype)
materialnumID = next(x.numID for x in G.materials if x.ID == volume.operatingonID) materialnumID = next(x.numID for x in G.materials if x.ID == volume.operatingonID)
volume.fractalvolume *= materialnumID volume.fractalvolume *= materialnumID
else: else:
@@ -1295,9 +1295,9 @@ def process_geometrycmds(geometry, G):
# Apply any rough surfaces and add any surface water to the 3D mask array # Apply any rough surfaces and add any surface water to the 3D mask array
for surface in volume.fractalsurfaces: for surface in volume.fractalsurfaces:
if surface.surfaceID == 'xminus': if surface.surfaceID == 'xminus':
for i in range(surface.fractalrange[0], surface.fractalrange[1] + 1): for i in range(surface.fractalrange[0], surface.fractalrange[1]):
for j in range(surface.ys, surface.yf + 1): for j in range(surface.ys, surface.yf):
for k in range(surface.zs, surface.zf + 1): for k in range(surface.zs, surface.zf):
if i > surface.fractalsurface[j - surface.ys, k - surface.zs]: if i > surface.fractalsurface[j - surface.ys, k - surface.zs]:
volume.mask[i - volume.xs, j - volume.ys, k - volume.zs] = 1 volume.mask[i - volume.xs, j - volume.ys, k - volume.zs] = 1
elif surface.filldepth > 0 and i > surface.filldepth: elif surface.filldepth > 0 and i > surface.filldepth:
@@ -1307,9 +1307,9 @@ def process_geometrycmds(geometry, G):
elif surface.surfaceID == 'xplus': elif surface.surfaceID == 'xplus':
if not surface.ID: if not surface.ID:
for i in range(surface.fractalrange[0], surface.fractalrange[1] + 1): for i in range(surface.fractalrange[0], surface.fractalrange[1] ):
for j in range(surface.ys, surface.yf + 1): for j in range(surface.ys, surface.yf):
for k in range(surface.zs, surface.zf + 1): for k in range(surface.zs, surface.zf):
if i < surface.fractalsurface[j - surface.ys, k - surface.zs]: if i < surface.fractalsurface[j - surface.ys, k - surface.zs]:
volume.mask[i - volume.xs, j - volume.ys, k - volume.zs] = 1 volume.mask[i - volume.xs, j - volume.ys, k - volume.zs] = 1
elif surface.filldepth > 0 and i < surface.filldepth: elif surface.filldepth > 0 and i < surface.filldepth:
@@ -1320,12 +1320,12 @@ def process_geometrycmds(geometry, G):
g = surface.grass[0] g = surface.grass[0]
# Build the blades of the grass # Build the blades of the grass
blade = 0 blade = 0
for j in range(surface.ys, surface.yf + 1): for j in range(surface.ys, surface.yf):
for k in range(surface.zs, surface.zf + 1): for k in range(surface.zs, surface.zf):
if surface.fractalsurface[j - surface.ys, k - surface.zs] > 0: if surface.fractalsurface[j - surface.ys, k - surface.zs] > 0:
height = 0 height = 0
blade += 1 blade += 1
for i in range(volume.xs, surface.fractalrange[1] + 1): for i in range(volume.xs, surface.fractalrange[1]):
if i < surface.fractalsurface[j - surface.ys, k - surface.zs] and volume.mask[i - volume.xs, j - volume.ys, k - volume.zs] != 1: if i < surface.fractalsurface[j - surface.ys, k - surface.zs] and volume.mask[i - volume.xs, j - volume.ys, k - volume.zs] != 1:
y, z = g.calculate_blade_geometry(blade - 1, height) y, z = g.calculate_blade_geometry(blade - 1, height)
# Add y, z coordinates to existing location # Add y, z coordinates to existing location
@@ -1339,8 +1339,8 @@ def process_geometrycmds(geometry, G):
height += 1 height += 1
# Build the roots of the grass # Build the roots of the grass
blade = 0 blade = 0
for j in range(surface.ys, surface.yf + 1): for j in range(surface.ys, surface.yf):
for k in range(surface.zs, surface.zf + 1): for k in range(surface.zs, surface.zf):
if surface.fractalsurface[j - surface.ys, k - surface.zs] > 0: if surface.fractalsurface[j - surface.ys, k - surface.zs] > 0:
depth = 0 depth = 0
blade += 1 blade += 1
@@ -1360,9 +1360,9 @@ def process_geometrycmds(geometry, G):
i -= 1 i -= 1
elif surface.surfaceID == 'yminus': elif surface.surfaceID == 'yminus':
for i in range(surface.xs, surface.xf + 1): for i in range(surface.xs, surface.xf):
for j in range(surface.fractalrange[0], surface.fractalrange[1] + 1): for j in range(surface.fractalrange[0], surface.fractalrange[1]):
for k in range(surface.zs, surface.zf + 1): for k in range(surface.zs, surface.zf):
if j > surface.fractalsurface[i - surface.xs, k - surface.zs]: if j > surface.fractalsurface[i - surface.xs, k - surface.zs]:
volume.mask[i - volume.xs, j - volume.ys, k - volume.zs] = 1 volume.mask[i - volume.xs, j - volume.ys, k - volume.zs] = 1
elif surface.filldepth > 0 and j > surface.filldepth: elif surface.filldepth > 0 and j > surface.filldepth:
@@ -1372,9 +1372,9 @@ def process_geometrycmds(geometry, G):
elif surface.surfaceID == 'yplus': elif surface.surfaceID == 'yplus':
if not surface.ID: if not surface.ID:
for i in range(surface.xs, surface.xf + 1): for i in range(surface.xs, surface.xf):
for j in range(surface.fractalrange[0], surface.fractalrange[1] + 1): for j in range(surface.fractalrange[0], surface.fractalrange[1]):
for k in range(surface.zs, surface.zf + 1): for k in range(surface.zs, surface.zf):
if j < surface.fractalsurface[i - surface.xs, k - surface.zs]: if j < surface.fractalsurface[i - surface.xs, k - surface.zs]:
volume.mask[i - volume.xs, j - volume.ys, k - volume.zs] = 1 volume.mask[i - volume.xs, j - volume.ys, k - volume.zs] = 1
elif surface.filldepth > 0 and j < surface.filldepth: elif surface.filldepth > 0 and j < surface.filldepth:
@@ -1385,12 +1385,12 @@ def process_geometrycmds(geometry, G):
g = surface.grass[0] g = surface.grass[0]
# Build the blades of the grass # Build the blades of the grass
blade = 0 blade = 0
for i in range(surface.xs, surface.xf + 1): for i in range(surface.xs, surface.xf):
for k in range(surface.zs, surface.zf + 1): for k in range(surface.zs, surface.zf):
if surface.fractalsurface[i - surface.xs, k - surface.zs] > 0: if surface.fractalsurface[i - surface.xs, k - surface.zs] > 0:
height = 0 height = 0
blade += 1 blade += 1
for j in range(volume.ys, surface.fractalrange[1] + 1): for j in range(volume.ys, surface.fractalrange[1]):
if j < surface.fractalsurface[i - surface.xs, k - surface.zs] and volume.mask[i - volume.xs, j - volume.ys, k - volume.zs] != 1: if j < surface.fractalsurface[i - surface.xs, k - surface.zs] and volume.mask[i - volume.xs, j - volume.ys, k - volume.zs] != 1:
x, z = g.calculate_blade_geometry(blade - 1, height) x, z = g.calculate_blade_geometry(blade - 1, height)
# Add x, z coordinates to existing location # Add x, z coordinates to existing location
@@ -1404,8 +1404,8 @@ def process_geometrycmds(geometry, G):
height += 1 height += 1
# Build the roots of the grass # Build the roots of the grass
blade = 0 blade = 0
for i in range(surface.xs, surface.xf + 1): for i in range(surface.xs, surface.xf):
for k in range(surface.zs, surface.zf + 1): for k in range(surface.zs, surface.zf):
if surface.fractalsurface[i - surface.xs, k - surface.zs] > 0: if surface.fractalsurface[i - surface.xs, k - surface.zs] > 0:
depth = 0 depth = 0
blade += 1 blade += 1
@@ -1425,9 +1425,9 @@ def process_geometrycmds(geometry, G):
j -= 1 j -= 1
elif surface.surfaceID == 'zminus': elif surface.surfaceID == 'zminus':
for i in range(surface.xs, surface.xf + 1): for i in range(surface.xs, surface.xf):
for j in range(surface.ys, surface.yf + 1): for j in range(surface.ys, surface.yf):
for k in range(surface.fractalrange[0], surface.fractalrange[1] + 1): for k in range(surface.fractalrange[0], surface.fractalrange[1]):
if k > surface.fractalsurface[i - surface.xs, j - surface.ys]: if k > surface.fractalsurface[i - surface.xs, j - surface.ys]:
volume.mask[i - volume.xs, j - volume.ys, k - volume.zs] = 1 volume.mask[i - volume.xs, j - volume.ys, k - volume.zs] = 1
elif surface.filldepth > 0 and k > surface.filldepth: elif surface.filldepth > 0 and k > surface.filldepth:
@@ -1437,9 +1437,9 @@ def process_geometrycmds(geometry, G):
elif surface.surfaceID == 'zplus': elif surface.surfaceID == 'zplus':
if not surface.ID: if not surface.ID:
for i in range(surface.xs, surface.xf + 1): for i in range(surface.xs, surface.xf):
for j in range(surface.ys, surface.yf + 1): for j in range(surface.ys, surface.yf):
for k in range(surface.fractalrange[0], surface.fractalrange[1] + 1): for k in range(surface.fractalrange[0], surface.fractalrange[1]):
if k < surface.fractalsurface[i - surface.xs, j - surface.ys]: if k < surface.fractalsurface[i - surface.xs, j - surface.ys]:
volume.mask[i - volume.xs, j - volume.ys, k - volume.zs] = 1 volume.mask[i - volume.xs, j - volume.ys, k - volume.zs] = 1
elif surface.filldepth > 0 and k < surface.filldepth: elif surface.filldepth > 0 and k < surface.filldepth:
@@ -1450,12 +1450,12 @@ def process_geometrycmds(geometry, G):
g = surface.grass[0] g = surface.grass[0]
# Build the blades of the grass # Build the blades of the grass
blade = 0 blade = 0
for i in range(surface.xs, surface.xf + 1): for i in range(surface.xs, surface.xf):
for j in range(surface.ys, surface.yf + 1): for j in range(surface.ys, surface.yf):
if surface.fractalsurface[i - surface.xs, j - surface.ys] > 0: if surface.fractalsurface[i - surface.xs, j - surface.ys] > 0:
height = 0 height = 0
blade += 1 blade += 1
for k in range(volume.zs, surface.fractalrange[1] + 1): for k in range(volume.zs, surface.fractalrange[1]):
if k < surface.fractalsurface[i - surface.xs, j - surface.ys] and volume.mask[i - volume.xs, j - volume.ys, k - volume.zs] != 1: if k < surface.fractalsurface[i - surface.xs, j - surface.ys] and volume.mask[i - volume.xs, j - volume.ys, k - volume.zs] != 1:
x, y = g.calculate_blade_geometry(blade - 1, height) x, y = g.calculate_blade_geometry(blade - 1, height)
# Add x, y coordinates to existing location # Add x, y coordinates to existing location
@@ -1469,8 +1469,8 @@ def process_geometrycmds(geometry, G):
height += 1 height += 1
# Build the roots of the grass # Build the roots of the grass
blade = 0 blade = 0
for i in range(surface.xs, surface.xf + 1): for i in range(surface.xs, surface.xf):
for j in range(surface.ys, surface.yf + 1): for j in range(surface.ys, surface.yf):
if surface.fractalsurface[i - surface.xs, j - surface.ys] > 0: if surface.fractalsurface[i - surface.xs, j - surface.ys] > 0:
depth = 0 depth = 0
blade += 1 blade += 1