You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The performance of mesh deletion was significantly reduced. In mk2 the ALL_FACE_CIRCUMCENTERS was used and in mk3 there is the new INSIDE_NOT_INTERSECTED. This is 16 to 70 times as slow, timings are in the comments at the lon/lat min/max values.
To Reproduce
This is a dfm_tools testcase, so not standalone. This is because it is a realistic usecase.
import dfm_tools as dfmt
import numpy as np
import meshkernel
import datetime as dt
lon_min,lon_max,lat_min,lat_max = -6,2,48.5,51.2 # mk2 5.8 sec, mk3 403.9 sec
# lon_min,lon_max,lat_min,lat_max = -2,2,48.5,49.2 # mk2 1.07 sec, mk3 16.27 sec
dxy = 0.2
# generate a simple rectangular grid of 4480 cells
mk = dfmt.make_basegrid(lon_min, lon_max, lat_min, lat_max, dx=dxy, dy=dxy)
# remove cells with custom ldb_gdf (can also come from polyfile)
bbox = (lon_min, lat_min, lon_max, lat_max)
coastlines_gdf = dfmt.get_coastlines_gdb(bbox=bbox, res='h')
print('>> deleting grid with coastlines: ',end='')
dtstart = dt.datetime.now()
for coastline_geom in coastlines_gdf['geometry']:
xx, yy = coastline_geom.exterior.coords.xy
xx = np.array(xx)
yy = np.array(yy)
try:
delete_option = meshkernel.DeleteMeshOption.INSIDE_NOT_INTERSECTED # mk 3.0.0
except AttributeError:
delete_option = meshkernel.DeleteMeshOption.ALL_FACE_CIRCUMCENTERS # mk 2.1.0
delete_pol_geom = meshkernel.GeometryList(x_coordinates=xx, y_coordinates=yy)
mk.mesh2d_delete(geometry_list=delete_pol_geom,
delete_option=delete_option,
invert_deletion=False)
print(f'{(dt.datetime.now()-dtstart).total_seconds():.2f} sec')
Expected behavior
Better performance.
Version info (please complete the following information):
OS: [e.g. Windows]
Version mk 2.1.0 and 3.0.0
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
Describe the bug
The performance of mesh deletion was significantly reduced. In mk2 the
ALL_FACE_CIRCUMCENTERS
was used and in mk3 there is the newINSIDE_NOT_INTERSECTED
. This is 16 to 70 times as slow, timings are in the comments at the lon/lat min/max values.To Reproduce
This is a dfm_tools testcase, so not standalone. This is because it is a realistic usecase.
Expected behavior
Better performance.
Version info (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: