Skip to content

Commit 97bedb6

Browse files
[Python] Cast SWIG arrays when using them as parameters
1 parent 2463965 commit 97bedb6

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

python/example/PutHorizon.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@
266266
"resqml_points = fesapi.DoubleArray(6)\n",
267267
"for i in range(6):\n",
268268
" resqml_points.setitem(i, i*100)\n",
269-
"horizon_grid_2d_representation.setGeometryAsArray2dOfExplicitZ(resqml_points, 2, 3, hdf_proxy,\n",
269+
"horizon_grid_2d_representation.setGeometryAsArray2dOfExplicitZ(resqml_points.cast(), 2, 3, hdf_proxy,\n",
270270
" 0.0, 0.0, 0.0,\n",
271271
" 1.0, 0.0, 0.0, 25.0,\n",
272272
" 0.0, 1.0, 0.0, 50.0)"

python/example/etp_client_example.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def start_etp_server(client_session):
7979
nb_xyz_points = ijk_grid.getXyzPointCountOfAllPatches()
8080
print("XYZ points count :", nb_xyz_points)
8181
xyz_points = fesapi.DoubleArray(nb_xyz_points * 3)
82-
ijk_grid.getXyzPointsOfAllPatches(xyz_points)
82+
ijk_grid.getXyzPointsOfAllPatches(xyz_points.cast())
8383

8484
ijk_grid.loadSplitInformation()
8585
origin_index = ijk_grid.getXyzPointIndexFromCellCorner(0, 0, 0, 0)
@@ -94,7 +94,7 @@ def start_etp_server(client_session):
9494

9595
if isinstance(prop, fesapi.Resqml2_ContinuousProperty):
9696
prop_values = fesapi.DoubleArray(ijk_grid.getICellCount() * ijk_grid.getJCellCount() * ijk_grid.getKCellCount())
97-
prop.getDoubleValuesOfPatch(0, prop_values)
97+
prop.getDoubleValuesOfPatch(0, prop_values.cast())
9898
print("Cell 0,0,0 has prop value ", prop_values.getitem(0))
9999
print("Cell 1,0,0 has prop value ", prop_values.getitem(1))
100100
print("Cell 2,0,0 has prop value ", prop_values.getitem(2))
@@ -116,7 +116,7 @@ def start_etp_server(client_session):
116116
nb_z_points = grid2d.getNodeCountAlongIAxis() * grid2d.getNodeCountAlongJAxis()
117117
print(f"XYZ points count : {nb_z_points}")
118118
z_points = fesapi.DoubleArray(nb_z_points)
119-
grid2d.getZValues(z_points)
119+
grid2d.getZValues(z_points.cast())
120120

121121
print("Z value at index 0 : ", z_points.getitem(0))
122122
print("Z value at index 1 : ", z_points.getitem(1))

0 commit comments

Comments
 (0)