Skip to content

Commit

Permalink
Remove broken function Layer.copy
Browse files Browse the repository at this point in the history
This function has thrown an IndexError on the parameters
since 45e1c38 (7 years ago as of this
commit). We have not gotten a bug report of this. We can therefore be pretty sure nobody is using it.
In order to work properly, the call to _copy should not have the first argument layer.
  • Loading branch information
eivindjahren committed Apr 10, 2024
1 parent 94e39fd commit 3405c73
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 13 deletions.
7 changes: 0 additions & 7 deletions python/resdata/grid/faults/layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
class Layer(BaseCClass):
TYPE_NAME = "rd_layer"
_alloc = ResdataPrototype("void* layer_alloc(int, int)", bind=False)
_copy = ResdataPrototype("void layer_memcpy(rd_layer, rd_layer)")
_free = ResdataPrototype("void layer_free(rd_layer)")
_get_nx = ResdataPrototype("int layer_get_nx(rd_layer)")
_get_ny = ResdataPrototype("int layer_get_ny(rd_layer)")
Expand Down Expand Up @@ -54,12 +53,6 @@ def __init__(self, nx, ny):
else:
raise ValueError("Invalid input - no Layer object created")

@classmethod
def copy(cls, src):
layer = Layer(src.getNX(), src.getNY())
layer._copy(src)
return layer

def _assert_ij(self, i, j):
if i < 0 or i >= self.getNX():
raise ValueError("Invalid layer i:%d" % i)
Expand Down
6 changes: 0 additions & 6 deletions python/tests/rd_tests/test_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ def test_create_layer(self):
layer = Layer(10, 10)
self.assertTrue(isinstance(layer, Layer))

def test_layer_copy(self):
layer = Layer(10, 10)
layer_copy = Layer.copy(layer)
assert layer.get_nx() == layer_copy.get_nx()
assert layer.get_ny() == layer_copy.get_ny()

def test_add_cell(self):
layer = Layer(10, 10)
with self.assertRaises(ValueError):
Expand Down

0 comments on commit 3405c73

Please sign in to comment.