@@ -1145,18 +1145,29 @@ def get_splines(
1145
1145
1146
1146
return geometry_list_out
1147
1147
1148
- def mesh2d_get_mesh_boundaries_as_polygons (self ) -> GeometryList :
1149
- """Retrieves the boundaries of a mesh as a series of separated polygons.
1148
+ def mesh2d_get_mesh_boundaries_as_polygons (
1149
+ self , geometry_list : GeometryList
1150
+ ) -> GeometryList :
1151
+ """Retrieves the boundaries of a mesh as a series of separated polygons within the selecting polygon.
1152
+ If the polygon is empty, all the mesh boundaries are retrieved.
1150
1153
1151
1154
For example, if a mesh has an single inner hole, two polygons will be generated,
1152
1155
one for the inner boundary and one for the outer boundary.
1153
1156
1157
+ Args:
1158
+ geometry_list (GeometryList): The selecting polygon.
1159
+
1154
1160
Returns:
1155
1161
GeometryList: The output network boundary polygon.
1156
1162
"""
1157
1163
1158
1164
# Get number of polygon nodes
1159
- number_of_polygon_nodes = self ._mesh2d_count_mesh_boundaries_as_polygons ()
1165
+ number_of_polygon_nodes = self ._mesh2d_count_mesh_boundaries_as_polygons (
1166
+ geometry_list
1167
+ )
1168
+
1169
+ # Create GeometryList instance
1170
+ c_geometry_list_in = CGeometryList .from_geometrylist (geometry_list )
1160
1171
1161
1172
# Create GeometryList instance
1162
1173
x_coordinates = np .empty (number_of_polygon_nodes , dtype = np .double )
@@ -1168,24 +1179,36 @@ def mesh2d_get_mesh_boundaries_as_polygons(self) -> GeometryList:
1168
1179
self ._execute_function (
1169
1180
self .lib .mkernel_mesh2d_get_mesh_boundaries_as_polygons ,
1170
1181
self ._meshkernelid ,
1182
+ byref (c_geometry_list_in ),
1171
1183
byref (c_geometry_list_out ),
1172
1184
)
1173
1185
1174
1186
return geometry_list_out
1175
1187
1176
- def _mesh2d_count_mesh_boundaries_as_polygons (self ) -> int :
1177
- """For internal use only.
1188
+ def _mesh2d_count_mesh_boundaries_as_polygons (
1189
+ self , geometry_list : GeometryList
1190
+ ) -> int :
1191
+ """For internal use only. Retrieves the number of boundaries of a mesh within the selecting polygon.
1192
+ If the polygon is empty, all the mesh boundaries are considered.
1178
1193
1179
1194
Counts the number of polygon nodes contained in the mesh boundary polygons
1180
1195
computed in function mesh2d_get_mesh_boundaries_as_polygons.
1181
1196
1197
+ Args:
1198
+ geometry_list (GeometryList): The selecting polygon.
1199
+
1182
1200
Returns:
1183
1201
int: The number of polygon nodes.
1184
1202
"""
1185
1203
number_of_polygon_nodes = c_int ()
1204
+
1205
+ # Create GeometryList instance
1206
+ c_geometry_list_in = CGeometryList .from_geometrylist (geometry_list )
1207
+
1186
1208
self ._execute_function (
1187
1209
self .lib .mkernel_mesh2d_count_mesh_boundaries_as_polygons ,
1188
1210
self ._meshkernelid ,
1211
+ byref (c_geometry_list_in ),
1189
1212
byref (number_of_polygon_nodes ),
1190
1213
)
1191
1214
return number_of_polygon_nodes .value
@@ -2171,32 +2194,6 @@ def curvilinear_refine(
2171
2194
c_int (refinement ),
2172
2195
)
2173
2196
2174
- def curvilinear_derefine (
2175
- self ,
2176
- x_lower_left_corner : float ,
2177
- y_lower_left_corner : float ,
2178
- x_upper_right_corner : float ,
2179
- y_upper_right_corner : float ,
2180
- ) -> None :
2181
- """Directional curvilinear grid derefinement.
2182
- Additional gridlines are removed perpendicularly to the segment defined by lower_left_corner
2183
- and upper_right_corner
2184
-
2185
- Args:
2186
- x_lower_left_corner (float): The x coordinate of the lower left corner of the block to refine.
2187
- y_lower_left_corner (float): The y coordinate of the lower left corner of the block to refine.
2188
- x_upper_right_corner (float): The x coordinate of the upper right corner of the block to refine.
2189
- y_upper_right_corner (float): The y coordinate of the upper right corner of the block to refine.
2190
- """
2191
- self ._execute_function (
2192
- self .lib .mkernel_curvilinear_derefine ,
2193
- self ._meshkernelid ,
2194
- c_double (x_lower_left_corner ),
2195
- c_double (y_lower_left_corner ),
2196
- c_double (x_upper_right_corner ),
2197
- c_double (y_upper_right_corner ),
2198
- )
2199
-
2200
2197
def curvilinear_compute_transfinite_from_polygon (
2201
2198
self ,
2202
2199
geometry_list : GeometryList ,
0 commit comments