Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 22 additions & 16 deletions autotest/t075_ugridtests.py → autotest/t075_test_ugrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,10 @@ def test_voronoi_grid0(plot=False):

vor = VoronoiGrid(tri)
gridprops = vor.get_gridprops_vertexgrid()
ncpl = gridprops["ncpl"]
assert (
gridprops["ncpl"] == answer_ncpl
), "Number of cells should be {answer_ncpl}"
ncpl == answer_ncpl
), f"Number of cells should be {answer_ncpl}. Found {ncpl}"

voronoi_grid = VertexGrid(**gridprops, nlay=1)

Expand Down Expand Up @@ -326,9 +327,10 @@ def test_voronoi_grid1(plot=False):
vor = VoronoiGrid(tri)
gridprops = vor.get_gridprops_vertexgrid()
voronoi_grid = VertexGrid(**gridprops, nlay=1)
ncpl = gridprops["ncpl"]
assert (
gridprops["ncpl"] == answer_ncpl
), "Number of cells should be {answer_ncpl}"
ncpl == answer_ncpl
), f"Number of cells should be {answer_ncpl}. Found {ncpl}"

if plot:
import matplotlib.pyplot as plt
Expand All @@ -345,22 +347,23 @@ def test_voronoi_grid1(plot=False):
def test_voronoi_grid2(plot=False):

name = "vor2"
answer_ncpl = 5058
answer_ncpl = 538
theta = np.arange(0.0, 2 * np.pi, 0.2)
radius = 100.0
x = radius * np.cos(theta)
y = radius * np.sin(theta)
circle_poly = [(x, y) for x, y in zip(x, y)]
tri = Triangle(maximum_area=5, angle=30, model_ws=tpth)
tri = Triangle(maximum_area=50, angle=30, model_ws=tpth)
tri.add_polygon(circle_poly)
tri.build(verbose=False)

vor = VoronoiGrid(tri)
gridprops = vor.get_gridprops_vertexgrid()
voronoi_grid = VertexGrid(**gridprops, nlay=1)
ncpl = gridprops["ncpl"]
assert (
gridprops["ncpl"] == answer_ncpl
), "Number of cells should be {answer_ncpl}"
ncpl == answer_ncpl
), f"Number of cells should be {answer_ncpl}. Found {ncpl}"

if plot:
import matplotlib.pyplot as plt
Expand All @@ -377,7 +380,7 @@ def test_voronoi_grid2(plot=False):
def test_voronoi_grid3(plot=False):

name = "vor3"
answer_ncpl = 2375
answer_ncpl = 300

theta = np.arange(0.0, 2 * np.pi, 0.2)
radius = 100.0
Expand All @@ -391,7 +394,7 @@ def test_voronoi_grid3(plot=False):
y = radius * np.sin(theta) + 25.0
inner_circle_poly = [(x, y) for x, y in zip(x, y)]

tri = Triangle(maximum_area=10, angle=30, model_ws=tpth)
tri = Triangle(maximum_area=100, angle=30, model_ws=tpth)
tri.add_polygon(circle_poly)
tri.add_polygon(inner_circle_poly)
tri.add_hole((25, 25))
Expand All @@ -400,9 +403,10 @@ def test_voronoi_grid3(plot=False):
vor = VoronoiGrid(tri)
gridprops = vor.get_gridprops_vertexgrid()
voronoi_grid = VertexGrid(**gridprops, nlay=1)
ncpl = gridprops["ncpl"]
assert (
gridprops["ncpl"] == answer_ncpl
), "Number of cells should be {answer_ncpl}"
ncpl == answer_ncpl
), f"Number of cells should be {answer_ncpl}. Found {ncpl}"

if plot:
import matplotlib.pyplot as plt
Expand Down Expand Up @@ -435,9 +439,10 @@ def test_voronoi_grid4(plot=False):
vor = VoronoiGrid(tri)
gridprops = vor.get_gridprops_vertexgrid()
voronoi_grid = VertexGrid(**gridprops, nlay=1)
ncpl = gridprops["ncpl"]
assert (
gridprops["ncpl"] == answer_ncpl
), "Number of cells should be {answer_ncpl}"
ncpl == answer_ncpl
), f"Number of cells should be {answer_ncpl}. Found {ncpl}"

if plot:
import matplotlib.pyplot as plt
Expand Down Expand Up @@ -498,9 +503,10 @@ def test_voronoi_grid5(plot=False):
vor = VoronoiGrid(tri)
gridprops = vor.get_gridprops_vertexgrid()
voronoi_grid = VertexGrid(**gridprops, nlay=1)
ncpl = gridprops["ncpl"]
assert (
gridprops["ncpl"] == answer_ncpl
), "Number of cells should be {answer_ncpl}"
ncpl == answer_ncpl
), f"Number of cells should be {answer_ncpl}. Found {ncpl}"

if plot:
import matplotlib.pyplot as plt
Expand Down