Skip to content

Commit

Permalink
returning to original defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
jgostick committed Jun 6, 2023
1 parent 69e6708 commit cc3742a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion openpnm/network/_delaunay.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Delaunay(Network):
========== ============================================================
reflect : bool, optional
If ``True`` (default) then the base points will be reflected across
If ``True`` then the base points will be reflected across
all the faces of the domain prior to performing the tessellation. This
feature is best combined with ``trim=True`` to prevent unreasonably long
connections between points on the surfaces.
Expand Down
7 changes: 3 additions & 4 deletions openpnm/network/_delaunay_voronoi_dual.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,12 @@ class DelaunayVoronoiDual(Network):
========== ============================================================
trim : bool, optional
If ``True`` (default) then all vertices laying outside the domain will
If ``True`` then all vertices laying outside the domain will
be removed. This is only useful if ``reflect=True``.
reflect : bool, optional
If ``True`` (default) then the base points will be reflected across
If ``True`` then the base points will be reflected across
all the faces of the domain prior to performing the tessellation. This
feature is best combined with ``trim=True`` to prevent unreasonably long
connections between points on the surfaces.
feature is best combined with ``trim=True``.
%(Network.parameters)s
Expand Down
6 changes: 3 additions & 3 deletions openpnm/network/_voronoi.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ class Voronoi(Network):
========== ============================================================
trim : bool, optional
If ``True`` (default) then all Voronoi vertices laying outside the domain
If ``True`` then all Voronoi vertices laying outside the domain
will be removed.
reflect : bool, optional
If ``True`` (default) then the base points will be reflected across
If ``True`` then the base points will be reflected across
all the faces of the domain prior to performing the tessellation. This
feature is best combined with ``trim=True`` to make nice flat faces
on all sides of the domain.
Expand All @@ -57,7 +57,7 @@ class Voronoi(Network):
"""

def __init__(self, shape, points, trim=True, reflect=True, **kwargs):
def __init__(self, shape, points, trim=False, reflect=False, **kwargs):
super().__init__(**kwargs)
net, vor = voronoi(points=points,
shape=shape,
Expand Down
10 changes: 10 additions & 0 deletions tests/unit/network/DelaunayTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ def test_delaunay_disk_with_2D_points(self):
assert np.all(tri.coords[:, -1] != pts[:, -1])
assert np.all(tri.coords[:, -1] == 0.0)

def test_delaunay_disk_with_prereflected_points(self):
np.random.seed(0)
rqz = np.random.rand(50, 3)*np.array([1, 2*np.pi, 1])
rqz = op._skgraph.generators.tools.reflect_base_points(rqz.T,
domain_size=[1, 1])
pts = np.vstack(op._skgraph.tools.cyl2cart(*rqz)).T
tri = op.network.Delaunay(points=pts, shape=[1, 1], reflect=False, trim=True)
assert tri.coords.shape == (50, 3)
assert_array_almost_equal(tri.coords, pts[:50, :], decimal=15)

def test_delaunay_disk_with_3D_points(self):
np.random.seed(0)
rqz = np.random.rand(50, 3)*np.array([1, 2*np.pi, 1])
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/network/VoronoiTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def test_voronoi_cube_num_points(self):
def test_voronoi_cube_points(self):
np.random.seed(0)
pts = np.random.rand(30, 3)
net = op.network.Voronoi(points=pts, shape=[1, 1, 1])
net = op.network.Voronoi(points=pts, shape=[1, 1, 1], reflect=False)
assert net.Np > 30
assert np.all(net.coords[:, -1] != 0.0)
assert np.all(op.topotools.dimensionality(net) == [True, True, True])
Expand Down

0 comments on commit cc3742a

Please sign in to comment.