# MeshKernel 核心接口 模块:`meshkernel.meshkernel`。本页依据本地 MeshKernelPy `8.3.0` 源码生成,包含该模块定义的类、方法、函数和常量。签名及参数默认值以源码为准;原文未提供的说明会明确标记。 [返回 API 总览](modules.md) ## `MeshKernel` {#meshkernel} 继承:`object`。 该类是与 MeshKernel 库交互的入口。 **方法索引** - [`__init__`](#meshkernel---init--) - [`__del__`](#meshkernel---del--) - [`__get_exit_codes`](#meshkernel---get-exit-codes) - [`_allocate_state`](#meshkernel--allocate-state) - [`_set_undo_size`](#meshkernel--set-undo-size) - [`_deallocate_state`](#meshkernel--deallocate-state) - [`mesh2d_set`](#meshkernel-mesh2d-set) - [`mesh2d_add`](#meshkernel-mesh2d-add) - [`mesh2d_get`](#meshkernel-mesh2d-get) - [`_mesh2d_get_dimensions`](#meshkernel--mesh2d-get-dimensions) - [`mesh2d_delete`](#meshkernel-mesh2d-delete) - [`mesh2d_get_mesh_inner_boundaries_as_polygons`](#meshkernel-mesh2d-get-mesh-inner-boundaries-as-polygons) - [`mesh2d_delete_faces_in_polygons`](#meshkernel-mesh2d-delete-faces-in-polygons) - [`mesh2d_insert_edge`](#meshkernel-mesh2d-insert-edge) - [`mesh2d_insert_node`](#meshkernel-mesh2d-insert-node) - [`mesh2d_delete_node`](#meshkernel-mesh2d-delete-node) - [`mesh2d_move_node`](#meshkernel-mesh2d-move-node) - [`mesh2d_delete_edge`](#meshkernel-mesh2d-delete-edge) - [`mesh2d_get_edge`](#meshkernel-mesh2d-get-edge) - [`mesh2d_get_face_polygons`](#meshkernel-mesh2d-get-face-polygons) - [`mesh2d_get_filtered_face_polygons`](#meshkernel-mesh2d-get-filtered-face-polygons) - [`mesh2d_get_node_index`](#meshkernel-mesh2d-get-node-index) - [`mesh2d_get_hanging_edges`](#meshkernel-mesh2d-get-hanging-edges) - [`_mesh2d_count_hanging_edges`](#meshkernel--mesh2d-count-hanging-edges) - [`mesh2d_delete_hanging_edges`](#meshkernel-mesh2d-delete-hanging-edges) - [`mesh2d_make_global`](#meshkernel-mesh2d-make-global) - [`mesh2d_make_triangular_mesh_from_polygon`](#meshkernel-mesh2d-make-triangular-mesh-from-polygon) - [`mesh2d_make_triangular_mesh_from_samples`](#meshkernel-mesh2d-make-triangular-mesh-from-samples) - [`mesh2d_make_rectangular_mesh`](#meshkernel-mesh2d-make-rectangular-mesh) - [`mesh2d_make_rectangular_mesh_from_polygon`](#meshkernel-mesh2d-make-rectangular-mesh-from-polygon) - [`mesh2d_make_rectangular_mesh_on_extension`](#meshkernel-mesh2d-make-rectangular-mesh-on-extension) - [`polygon_refine`](#meshkernel-polygon-refine) - [`mesh2d_refine_based_on_samples`](#meshkernel-mesh2d-refine-based-on-samples) - [`mesh2d_refine_ridges_based_on_gridded_samples`](#meshkernel-mesh2d-refine-ridges-based-on-gridded-samples) - [`mesh2d_refine_based_on_gridded_samples`](#meshkernel-mesh2d-refine-based-on-gridded-samples) - [`mesh2d_refine_based_on_polygon`](#meshkernel-mesh2d-refine-based-on-polygon) - [`mesh2d_remove_disconnected_regions`](#meshkernel-mesh2d-remove-disconnected-regions) - [`mesh2d_rotate`](#meshkernel-mesh2d-rotate) - [`mesh2d_translate`](#meshkernel-mesh2d-translate) - [`polygon_get_included_points`](#meshkernel-polygon-get-included-points) - [`mesh2d_flip_edges`](#meshkernel-mesh2d-flip-edges) - [`_mesh2d_count_obtuse_triangles`](#meshkernel--mesh2d-count-obtuse-triangles) - [`mesh2d_get_obtuse_triangles_mass_centers`](#meshkernel-mesh2d-get-obtuse-triangles-mass-centers) - [`_mesh2d_count_small_flow_edge_centers`](#meshkernel--mesh2d-count-small-flow-edge-centers) - [`mesh2d_get_small_flow_edge_centers`](#meshkernel-mesh2d-get-small-flow-edge-centers) - [`mesh2d_delete_small_flow_edges_and_small_triangles`](#meshkernel-mesh2d-delete-small-flow-edges-and-small-triangles) - [`get_splines`](#meshkernel-get-splines) - [`mesh2d_get_mesh_boundaries_as_polygons`](#meshkernel-mesh2d-get-mesh-boundaries-as-polygons) - [`_mesh2d_count_mesh_boundaries_as_polygons`](#meshkernel--mesh2d-count-mesh-boundaries-as-polygons) - [`mesh2d_merge_nodes`](#meshkernel-mesh2d-merge-nodes) - [`mesh2d_merge_nodes_with_merging_distance`](#meshkernel-mesh2d-merge-nodes-with-merging-distance) - [`mesh2d_merge_two_nodes`](#meshkernel-mesh2d-merge-two-nodes) - [`mesh2d_get_nodes_in_polygons`](#meshkernel-mesh2d-get-nodes-in-polygons) - [`_mesh2d_count_nodes_in_polygons`](#meshkernel--mesh2d-count-nodes-in-polygons) - [`mesh1d_set`](#meshkernel-mesh1d-set) - [`mesh1d_add`](#meshkernel-mesh1d-add) - [`mesh1d_get`](#meshkernel-mesh1d-get) - [`_mesh1d_get_dimensions`](#meshkernel--mesh1d-get-dimensions) - [`contacts_set`](#meshkernel-contacts-set) - [`_contacts_get_dimensions`](#meshkernel--contacts-get-dimensions) - [`contacts_get`](#meshkernel-contacts-get) - [`contacts_compute_single`](#meshkernel-contacts-compute-single) - [`contacts_compute_multiple`](#meshkernel-contacts-compute-multiple) - [`contacts_compute_with_polygons`](#meshkernel-contacts-compute-with-polygons) - [`contacts_compute_with_points`](#meshkernel-contacts-compute-with-points) - [`contacts_compute_boundary`](#meshkernel-contacts-compute-boundary) - [`mesh2d_casulli_derefinement`](#meshkernel-mesh2d-casulli-derefinement) - [`mesh2d_casulli_derefinement_on_polygon`](#meshkernel-mesh2d-casulli-derefinement-on-polygon) - [`mesh2d_delete_property`](#meshkernel-mesh2d-delete-property) - [`mesh2d_set_property`](#meshkernel-mesh2d-set-property) - [`mesh2d_casulli_refinement_based_on_depths`](#meshkernel-mesh2d-casulli-refinement-based-on-depths) - [`mesh2d_casulli_refinement`](#meshkernel-mesh2d-casulli-refinement) - [`mesh2d_casulli_refinement_on_polygon`](#meshkernel-mesh2d-casulli-refinement-on-polygon) - [`mesh2d_compute_orthogonalization`](#meshkernel-mesh2d-compute-orthogonalization) - [`mesh2d_get_orthogonality`](#meshkernel-mesh2d-get-orthogonality) - [`mesh2d_get_property`](#meshkernel-mesh2d-get-property) - [`mesh2d_get_smoothness`](#meshkernel-mesh2d-get-smoothness) - [`mesh2d_connect_meshes`](#meshkernel-mesh2d-connect-meshes) - [`_get_error`](#meshkernel--get-error) - [`_get_geometry_error`](#meshkernel--get-geometry-error) - [`mesh2d_triangulation_interpolation`](#meshkernel-mesh2d-triangulation-interpolation) - [`mesh2d_averaging_interpolation`](#meshkernel-mesh2d-averaging-interpolation) - [`mesh2d_convert_projection`](#meshkernel-mesh2d-convert-projection) - [`get_projection`](#meshkernel-get-projection) - [`get_meshkernel_version`](#meshkernel-get-meshkernel-version) - [`get_meshkernelpy_version`](#meshkernel-get-meshkernelpy-version) - [`mkernel_get_separator`](#meshkernel-mkernel-get-separator) - [`mkernel_get_inner_outer_separator`](#meshkernel-mkernel-get-inner-outer-separator) - [`_execute_function`](#meshkernel--execute-function) - [`_curvilineargrid_get_dimensions`](#meshkernel--curvilineargrid-get-dimensions) - [`curvilineargrid_get`](#meshkernel-curvilineargrid-get) - [`curvilinear_compute_transfinite_from_splines`](#meshkernel-curvilinear-compute-transfinite-from-splines) - [`curvilinear_compute_orthogonal_from_splines`](#meshkernel-curvilinear-compute-orthogonal-from-splines) - [`curvilinear_compute_curvature`](#meshkernel-curvilinear-compute-curvature) - [`curvilinear_compute_smoothness`](#meshkernel-curvilinear-compute-smoothness) - [`curvilinear_convert_to_mesh2d`](#meshkernel-curvilinear-convert-to-mesh2d) - [`curvilinear_compute_rectangular_grid`](#meshkernel-curvilinear-compute-rectangular-grid) - [`curvilinear_compute_rectangular_grid_from_polygon`](#meshkernel-curvilinear-compute-rectangular-grid-from-polygon) - [`curvilinear_compute_rectangular_grid_on_extension`](#meshkernel-curvilinear-compute-rectangular-grid-on-extension) - [`curvilinear_refine`](#meshkernel-curvilinear-refine) - [`curvilinear_compute_transfinite_from_polygon`](#meshkernel-curvilinear-compute-transfinite-from-polygon) - [`curvilinear_compute_transfinite_from_triangle`](#meshkernel-curvilinear-compute-transfinite-from-triangle) - [`curvilinear_orthogonalize`](#meshkernel-curvilinear-orthogonalize) - [`curvilinear_frozen_line_is_valid`](#meshkernel-curvilinear-frozen-line-is-valid) - [`curvilinear_frozen_line_delete`](#meshkernel-curvilinear-frozen-line-delete) - [`curvilinear_frozen_line_add`](#meshkernel-curvilinear-frozen-line-add) - [`curvilinear_frozen_line_get`](#meshkernel-curvilinear-frozen-line-get) - [`curvilinear_frozen_lines_get_ids`](#meshkernel-curvilinear-frozen-lines-get-ids) - [`curvilinear_smoothing`](#meshkernel-curvilinear-smoothing) - [`curvilinear_smoothing_directional`](#meshkernel-curvilinear-smoothing-directional) - [`curvilinear_initialize_line_shift`](#meshkernel-curvilinear-initialize-line-shift) - [`curvilinear_set_line_line_shift`](#meshkernel-curvilinear-set-line-line-shift) - [`curvilinear_set_block_line_shift`](#meshkernel-curvilinear-set-block-line-shift) - [`curvilinear_move_node_line_shift`](#meshkernel-curvilinear-move-node-line-shift) - [`curvilinear_line_shift`](#meshkernel-curvilinear-line-shift) - [`curvilinear_move_node`](#meshkernel-curvilinear-move-node) - [`curvilinear_insert_face`](#meshkernel-curvilinear-insert-face) - [`curvilinear_line_attraction_repulsion`](#meshkernel-curvilinear-line-attraction-repulsion) - [`curvilinear_line_mirror`](#meshkernel-curvilinear-line-mirror) - [`curvilinear_delete_node`](#meshkernel-curvilinear-delete-node) - [`_get_num_coordinates`](#meshkernel--get-num-coordinates) - [`__map_to_valid_values`](#meshkernel---map-to-valid-values) ### `MeshKernel.__init__` {#meshkernel---init--} ```python __init__(self, projection: ProjectionType=ProjectionType.CARTESIAN) ``` MeshKernel 的构造函数。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `projection` | `ProjectionType` | `ProjectionType.CARTESIAN` | 投影类型,默认为 `ProjectionType.CARTESIAN`。 | **异常** - **`OSError`**:在不支持的操作系统上使用 MeshKernel 时抛出。 ### `MeshKernel.__del__` {#meshkernel---del--} ```python __del__(self) ``` 析构方法,用于释放实例持有的状态。 ### `MeshKernel.__get_exit_codes` {#meshkernel---get-exit-codes} ```python __get_exit_codes(self) ``` 此成员以内部名称定义,供理解实现及转换流程时参考。 保存后端退出码。 **返回值** 名为 exit_code 的整数枚举,包含后端退出码。 ### `MeshKernel._allocate_state` {#meshkernel--allocate-state} ```python _allocate_state(self, projection: ProjectionType) -> None ``` 此成员以内部名称定义,供理解实现及转换流程时参考。 创建一个新的空网格。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `projection` | `ProjectionType` | `必填` | 投影类型。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel._set_undo_size` {#meshkernel--set-undo-size} ```python _set_undo_size(self, undo_stack_size: int) -> None ``` 此成员以内部名称定义,供理解实现及转换流程时参考。 设置撤销栈的最大容量。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `undo_stack_size` | `int` | `必填` | 撤销栈的最大容量。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel._deallocate_state` {#meshkernel--deallocate-state} ```python _deallocate_state(self) -> None ``` 此成员以内部名称定义,供理解实现及转换流程时参考。 释放网格状态。 此方法由析构函数调用, 不应手动调用。 **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.mesh2d_set` {#meshkernel-mesh2d-set} ```python mesh2d_set(self, mesh2d: Mesh2d) -> None ``` 设置 MeshKernel 的二维网格状态。 注意,此操作会复制数据。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `mesh2d` | `Mesh2d` | `必填` | 用于设置状态的输入数据。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.mesh2d_add` {#meshkernel-mesh2d-add} ```python mesh2d_add(self, mesh2d: Mesh2d) -> None ``` 添加二维网格。 注意,此操作会复制数据。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `mesh2d` | `Mesh2d` | `必填` | 用于设置状态的输入数据。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.mesh2d_get` {#meshkernel-mesh2d-get} ```python mesh2d_get(self) -> Mesh2d ``` 从 MeshKernel 获取二维网格状态。 注意,此操作会复制数据。 **返回值** - **`Mesh2d`**:二维网格状态的副本。 ### `MeshKernel._mesh2d_get_dimensions` {#meshkernel--mesh2d-get-dimensions} ```python _mesh2d_get_dimensions(self) -> CMesh2d ``` 此成员以内部名称定义,供理解实现及转换流程时参考。 仅供内部使用。 获取 Mesh2d 的维度信息。 将 Mesh2D 结构体中的整数参数设置为对应维度。 传入 `mesh2d_get` 前,必须让结构体指针指向大小正确的内存。 **返回值** - **`Mesh2d`**:Mesh2d 的维度信息。 ### `MeshKernel.mesh2d_delete` {#meshkernel-mesh2d-delete} ```python mesh2d_delete(self, geometry_list: GeometryList, delete_option: DeleteMeshOption, invert_deletion: bool) -> None ``` 按指定策略删除多边形内部的部分网格。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `geometry_list` | `GeometryList` | `必填` | 描述操作区域多边形的 GeometryList。 | | `delete_option` | `DeleteMeshOption` | `必填` | 指定网格删除策略的选项。 | | `invert_deletion` | `bool` | `必填` | 是否反转删除区域。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.mesh2d_get_mesh_inner_boundaries_as_polygons` {#meshkernel-mesh2d-get-mesh-inner-boundaries-as-polygons} ```python mesh2d_get_mesh_inner_boundaries_as_polygons(self) -> GeometryList ``` 从 MeshKernel 获取内边界多边形。 **返回值** - **`GeometryList`**:描述网格内边界多边形的点序列。 ### `MeshKernel.mesh2d_delete_faces_in_polygons` {#meshkernel-mesh2d-delete-faces-in-polygons} ```python mesh2d_delete_faces_in_polygons(self, geometry_list: GeometryList) -> None ``` 删除位于一个或多个多边形内部的网格面。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `geometry_list` | `GeometryList` | `必填` | 描述删除区域多边形的 GeometryList。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.mesh2d_insert_edge` {#meshkernel-mesh2d-insert-edge} ```python mesh2d_insert_edge(self, start_node: int, end_node: int) -> int ``` 插入一条连接两个指定节点的二维网格边。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `start_node` | `int` | `必填` | 第一个节点的索引。 | | `end_node` | `int` | `必填` | 第二个节点的索引。 | **返回值** - **`int`**:新边的索引。 ### `MeshKernel.mesh2d_insert_node` {#meshkernel-mesh2d-insert-node} ```python mesh2d_insert_node(self, x: float, y: float) -> int ``` 在指定坐标处插入新节点。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `x` | `float` | `必填` | 新节点的 x 坐标。 | | `y` | `float` | `必填` | 新节点的 y 坐标。 | **返回值** - **`int`**:新节点的索引。 ### `MeshKernel.mesh2d_delete_node` {#meshkernel-mesh2d-delete-node} ```python mesh2d_delete_node(self, node_index: int) -> None ``` 删除给定索引 `index` 对应的 Mesh2d 节点。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `node_index` | `int` | `必填` | 待删除节点的索引。 | **异常** - **`InputError`**:`node_index` 小于 0 时抛出。 **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.mesh2d_move_node` {#meshkernel-mesh2d-move-node} ```python mesh2d_move_node(self, x: float, y: float, node_index: int) -> None ``` 将给定索引 `index` 对应的 Mesh2d 节点移动到指定位置。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `x` | `float` | `必填` | 节点新位置的 x 坐标。 | | `y` | `float` | `必填` | 节点新位置的 y 坐标。 | | `node_index` | `int` | `必填` | 待移动节点的索引。 | **异常** - **`InputError`**:`node_index` 小于 0 时抛出。 **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.mesh2d_delete_edge` {#meshkernel-mesh2d-delete-edge} ```python mesh2d_delete_edge(self, x_coordinate: float, y_coordinate: float) -> None ``` 删除距离指定点最近的二维网格边。 使用边中点的坐标计算边到该点的距离。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `x_coordinate` | `float` | `必填` | 源码未单独提供参数说明。 | | `y_coordinate` | `float` | `必填` | 源码未单独提供参数说明。 | 原文还列出了以下参数说明(名称可能与当前签名不一致): - **`x`(`float`)**:指定点的 x 坐标。 - **`y`(`float`)**:指定点的 y 坐标。 **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.mesh2d_get_edge` {#meshkernel-mesh2d-get-edge} ```python mesh2d_get_edge(self, x: float, y: float) -> int ``` 获取距离指定点最近的二维网格边。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `x` | `float` | `必填` | 指定点的 x 坐标。 | | `y` | `float` | `必填` | 指定点的 y 坐标。 | **返回值** - **`int`**:边的索引,使用无空缺数组索引。 ### `MeshKernel.mesh2d_get_face_polygons` {#meshkernel-mesh2d-get-face-polygons} ```python mesh2d_get_face_polygons(self, num_edges: int) -> GeometryList ``` 获取边数等于 num_edges 的网格面多边形。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `num_edges` | `int` | `必填` | 边数。 | **返回值** - **`GeometryList`**:生成的网格面多边形。 ### `MeshKernel.mesh2d_get_filtered_face_polygons` {#meshkernel-mesh2d-get-filtered-face-polygons} ```python mesh2d_get_filtered_face_polygons(self, property: Mesh2dProperty, min_value: float, max_value: float) -> GeometryList ``` 获取指标值位于最小值和最大值之间的多边形。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `property` | `Mesh2dProperty` | `必填` | 用于筛选位置的属性。 | | `min_value` | `float` | `必填` | 指标的最小值。 | | `max_value` | `float` | `必填` | 指标的最大值。 | **返回值** - **`GeometryList`**:生成的网格面多边形。 ### `MeshKernel.mesh2d_get_node_index` {#meshkernel-mesh2d-get-node-index} ```python mesh2d_get_node_index(self, x: float, y: float, search_radius: float) -> int ``` 在给定搜索半径内查找距离指定点最近的节点。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `x` | `float` | `必填` | 指定点的 x 坐标。 | | `y` | `float` | `必填` | 指定点的 y 坐标。 | | `search_radius` | `float` | `必填` | 搜索半径。 | **返回值** - **`int`**:节点索引,使用无空缺数组索引。 ### `MeshKernel.mesh2d_get_hanging_edges` {#meshkernel-mesh2d-get-hanging-edges} ```python mesh2d_get_hanging_edges(self) -> ndarray ``` 获取悬挂边的索引。悬挂边是指两个端点中有一个未连接到其他边的边。 **返回值** - **`ndarray`**:包含悬挂边索引的整数数组。 ### `MeshKernel._mesh2d_count_hanging_edges` {#meshkernel--mesh2d-count-hanging-edges} ```python _mesh2d_count_hanging_edges(self) -> int ``` 此成员以内部名称定义,供理解实现及转换流程时参考。 仅供内部使用。 统计二维网格中的悬挂边数。 悬挂边是指两个端点中有一个未连接到其他边的边。 **返回值** - **`int`**:悬挂边数。 ### `MeshKernel.mesh2d_delete_hanging_edges` {#meshkernel-mesh2d-delete-hanging-edges} ```python mesh2d_delete_hanging_edges(self) -> None ``` 删除 Mesh2d 中的悬挂边。 悬挂边是指两个端点中有一个未连接到其他边的边。 **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.mesh2d_make_global` {#meshkernel-mesh2d-make-global} ```python mesh2d_make_global(self, num_longitude_nodes: int, num_latitude_nodes: int) -> None ``` 按经度和纬度方向上给定的点数计算全球网格。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `num_longitude_nodes` | `int` | `必填` | 经度方向的点数。 | | `num_latitude_nodes` | `int` | `必填` | 纬度方向的点数(半球)。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.mesh2d_make_triangular_mesh_from_polygon` {#meshkernel-mesh2d-make-triangular-mesh-from-polygon} ```python mesh2d_make_triangular_mesh_from_polygon(self, polygon: GeometryList, scale_factor: float=float(-999.0)) -> None ``` 在多边形内部生成二维三角网格。三角形尺寸由 多边形边长确定。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `polygon` | `GeometryList` | `必填` | 多边形。 | | `scale_factor` | `float` | `float(-999.0)` | 三角剖分的缩放系数;若为负值,则使用默认值。 默认缩放系数取决于多边形。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.mesh2d_make_triangular_mesh_from_samples` {#meshkernel-mesh2d-make-triangular-mesh-from-samples} ```python mesh2d_make_triangular_mesh_from_samples(self, sample_points: GeometryList) -> None ``` 对采样点进行三角剖分,从采样点集合生成三角网格。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `sample_points` | `GeometryList` | `必填` | 采样点。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.mesh2d_make_rectangular_mesh` {#meshkernel-mesh2d-make-rectangular-mesh} ```python mesh2d_make_rectangular_mesh(self, make_grid_parameters: MakeGridParameters) -> None ``` 生成二维矩形网格。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `make_grid_parameters` | `MakeGridParameters` | `必填` | 生成均匀网格所用的参数。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.mesh2d_make_rectangular_mesh_from_polygon` {#meshkernel-mesh2d-make-rectangular-mesh-from-polygon} ```python mesh2d_make_rectangular_mesh_from_polygon(self, make_grid_parameters: MakeGridParameters, polygon: GeometryList) -> None ``` 在多边形内部生成二维矩形网格。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `make_grid_parameters` | `MakeGridParameters` | `必填` | 生成均匀网格所用的参数。 | | `polygon` | `GeometryList` | `必填` | 源码未单独提供参数说明。 | 原文还列出了以下参数说明(名称可能与当前签名不一致): - **`geometry_list`(`GeometryList`)**:生成网格的区域多边形。 **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.mesh2d_make_rectangular_mesh_on_extension` {#meshkernel-mesh2d-make-rectangular-mesh-on-extension} ```python mesh2d_make_rectangular_mesh_on_extension(self, make_grid_parameters: MakeGridParameters) -> None ``` 生成二维矩形网格。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `make_grid_parameters` | `MakeGridParameters` | `必填` | 生成均匀网格所用的参数。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.polygon_refine` {#meshkernel-polygon-refine} ```python polygon_refine(self, polygon: GeometryList, first_node: int, second_node: int, target_edge_length: float) -> GeometryList ``` 加密多边形边界上两个节点之间的区间,使其达到目标边长。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `polygon` | `GeometryList` | `必填` | 待加密的输入多边形。 | | `first_node` | `int` | `必填` | 加密区间的第一个节点索引。 | | `second_node` | `int` | `必填` | 加密区间的第二个节点索引。 | | `target_edge_length` | `float` | `必填` | 该区间的目标边长。 | **返回值** - **`GeometryList`**:加密后的多边形。 ### `MeshKernel.mesh2d_refine_based_on_samples` {#meshkernel-mesh2d-refine-based-on-samples} ```python mesh2d_refine_based_on_samples(self, samples: GeometryList, relative_search_radius: float, minimum_num_samples: int, mesh_refinement_params: MeshRefinementParameters, polygon: GeometryList=GeometryList()) -> None ``` 基于采样数据加密二维网格,通过连续划分网格面的边实现加密。 连续划分次数由采样值指定。 例如: - 值为 0 表示不划分,也不加密; - 值为 1 表示划分一次,一个四边形面生成 4 个面; - 值为 2 表示划分两次,一个四边形面生成 16 个面。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `samples` | `GeometryList` | `必填` | 采样数据。 | | `relative_search_radius` | `float` | `必填` | 相对于网格面尺寸的相对搜索半径, 用于某些插值算法。 | | `minimum_num_samples` | `int` | `必填` | 某些平均算法使用的最少采样点数。 | | `mesh_refinement_params` | `MeshRefinementParameters` | `必填` | 网格加密参数。 | | `polygon` | `GeometryList` | `GeometryList()` | 加密区域;若多边形为空,则考虑整个网格。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.mesh2d_refine_ridges_based_on_gridded_samples` {#meshkernel-mesh2d-refine-ridges-based-on-gridded-samples} ```python mesh2d_refine_ridges_based_on_gridded_samples(self, gridded_samples: GriddedSamples, relative_search_radius: float, minimum_num_samples: int, number_of_smoothing_iterations: int, mesh_refinement_params: MeshRefinementParameters, polygon: GeometryList=GeometryList()) -> None ``` 基于采样数据进行脊线加密,自动检测采样数据集中的脊线。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `gridded_samples` | `GriddedSamples` | `必填` | 网格采样数据。 | | `relative_search_radius` | `float` | `必填` | 相对于网格面尺寸的相对搜索半径, 用于某些插值算法。 | | `minimum_num_samples` | `int` | `必填` | 某些平均算法使用的最少采样点数。 | | `number_of_smoothing_iterations` | `int` | `必填` | 对输入采样数据集执行的平滑迭代次数。 | | `mesh_refinement_params` | `MeshRefinementParameters` | `必填` | 网格加密参数。 | | `polygon` | `GeometryList` | `GeometryList()` | 加密区域;若多边形为空,则考虑整个网格。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.mesh2d_refine_based_on_gridded_samples` {#meshkernel-mesh2d-refine-based-on-gridded-samples} ```python mesh2d_refine_based_on_gridded_samples(self, gridded_samples: GriddedSamples, mesh_refinement_params: MeshRefinementParameters, use_nodal_refinement: bool=True, polygon: GeometryList=GeometryList()) -> None ``` 基于网格采样数据和双线性插值计算网格加密。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `gridded_samples` | `GriddedSamples` | `必填` | 网格采样数据。 | | `mesh_refinement_params` | `MeshRefinementParameters` | `必填` | 网格加密参数。 | | `use_nodal_refinement` | `bool` | `True` | 是否使用节点处的水深值进行加密,默认为 True。 | | `polygon` | `GeometryList` | `GeometryList()` | 加密区域;若多边形为空,则考虑整个网格。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.mesh2d_refine_based_on_polygon` {#meshkernel-mesh2d-refine-based-on-polygon} ```python mesh2d_refine_based_on_polygon(self, polygon: GeometryList, mesh_refinement_params: MeshRefinementParameters) -> None ``` 在多边形内部加密二维网格,将多边形内的边 一分为二。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `polygon` | `GeometryList` | `必填` | 源码未单独提供参数说明。 | | `mesh_refinement_params` | `MeshRefinementParameters` | `必填` | 网格加密参数。 | 原文还列出了以下参数说明(名称可能与当前签名不一致): - **`samples`(`GeometryList`)**:闭合多边形。 **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.mesh2d_remove_disconnected_regions` {#meshkernel-mesh2d-remove-disconnected-regions} ```python mesh2d_remove_disconnected_regions(self) -> None ``` 移除二维网格中所有不连通的区域,仅保留占主导的区域。 **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.mesh2d_rotate` {#meshkernel-mesh2d-rotate} ```python mesh2d_rotate(self, centre_x: float, centre_y: float, angle: float) -> None ``` 绕旋转中心旋转二维网格。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `centre_x` | `float` | `必填` | 旋转中心的 x 坐标。 | | `centre_y` | `float` | `必填` | 旋转中心的 y 坐标。 | | `angle` | `float` | `必填` | 旋转角度,单位为度。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.mesh2d_translate` {#meshkernel-mesh2d-translate} ```python mesh2d_translate(self, translation_x: float, translation_y: float) -> None ``` 平移二维网格。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `translation_x` | `float` | `必填` | 平移向量的 x 分量。 | | `translation_y` | `float` | `必填` | 平移向量的 y 分量。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.polygon_get_included_points` {#meshkernel-polygon-get-included-points} ```python polygon_get_included_points(self, selecting_polygon: GeometryList, selected_polygon: GeometryList) -> GeometryList ``` 选择位于另一个多边形内部的多边形节点。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `selecting_polygon` | `GeometryList` | `必填` | 用于选择区域的多边形。 | | `selected_polygon` | `GeometryList` | `必填` | 待筛选节点所属的多边形。 | **返回值** - **`GeometryList`**:选择结果。选中情况保存在返回的 GeometryList 的 values 数组中, 0.0 表示未选中,1.0 表示选中。 ### `MeshKernel.mesh2d_flip_edges` {#meshkernel-mesh2d-flip-edges} ```python mesh2d_flip_edges(self, triangulation_required: bool, project_to_land_boundary_required: bool, selecting_polygon: GeometryList, land_boundaries: GeometryList) ``` 通过翻转二维网格边优化网格平滑性。 连接到超过六个其他节点的节点,通常被形状高度不均匀、 面积差异很大的网格面包围。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `triangulation_required` | `bool` | `必填` | 是否对非三角形单元进行三角剖分。 | | `project_to_land_boundary_required` | `bool` | `必填` | 是否需要投影到陆地边界。 | | `selecting_polygon` | `GeometryList` | `必填` | 执行边翻转操作的区域多边形。 | | `land_boundaries` | `GeometryList` | `必填` | 翻转边时需要考虑的陆地边界。 | ### `MeshKernel._mesh2d_count_obtuse_triangles` {#meshkernel--mesh2d-count-obtuse-triangles} ```python _mesh2d_count_obtuse_triangles(self) -> int ``` 此成员以内部名称定义,供理解实现及转换流程时参考。 仅供内部使用。 获取二维网格中钝角三角形的数量。 钝角三角形指有一个内角大于 90° 的三角形。 **返回值** - **`int`**:钝角三角形的数量。 ### `MeshKernel.mesh2d_get_obtuse_triangles_mass_centers` {#meshkernel-mesh2d-get-obtuse-triangles-mass-centers} ```python mesh2d_get_obtuse_triangles_mass_centers(self) -> GeometryList ``` 获取二维网格中钝角三角形的质心。 钝角三角形指有一个内角大于 90° 的三角形。 **返回值** - **`GeometryList`**:包含质心坐标的几何列表。 ### `MeshKernel._mesh2d_count_small_flow_edge_centers` {#meshkernel--mesh2d-count-small-flow-edge-centers} ```python _mesh2d_count_small_flow_edge_centers(self, small_flow_edges_length_threshold: float) -> int ``` 此成员以内部名称定义,供理解实现及转换流程时参考。 仅供内部使用。 统计二维网格中短流动边的数量。 流动边是连接网格面外心的边。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `small_flow_edges_length_threshold` | `float` | `必填` | 用于识别短流动边的长度阈值。 | **返回值** - **`int`**:短流动边的数量。 ### `MeshKernel.mesh2d_get_small_flow_edge_centers` {#meshkernel-mesh2d-get-small-flow-edge-centers} ```python mesh2d_get_small_flow_edge_centers(self, small_flow_edges_length_threshold: float) -> GeometryList ``` 获取二维网格中短流动边的中心。 流动边是连接网格面外心的边。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `small_flow_edges_length_threshold` | `float` | `必填` | 用于识别短流动边的长度阈值。 | **返回值** - **`int`**:包含短流动边中心坐标的几何列表。(原文将返回类型标为 int,实际返回 GeometryList。) ### `MeshKernel.mesh2d_delete_small_flow_edges_and_small_triangles` {#meshkernel-mesh2d-delete-small-flow-edges-and-small-triangles} ```python mesh2d_delete_small_flow_edges_and_small_triangles(self, small_flow_edges_length_threshold: float, min_fractional_area_triangles: float) -> None ``` 删除二维网格中所有短流动边和小三角形。 流动边是连接网格面外心的边。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `small_flow_edges_length_threshold` | `float` | `必填` | 用于识别短流动边的长度阈值。 | | `min_fractional_area_triangles` | `float` | `必填` | 网格面面积与相邻非三角形网格面平均面积之比, 此参数用于判断 三角形网格面是否过小。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.get_splines` {#meshkernel-get-splines} ```python get_splines(self, geometry_list: GeometryList, number_of_points_between_nodes: int) -> GeometryList ``` 获取两个拐点节点之间计算得到的样条曲线点。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `geometry_list` | `GeometryList` | `必填` | 样条曲线的输入拐点节点。 | | `number_of_points_between_nodes` | `int` | `必填` | 两个拐点节点之间生成的样条曲线点数。 | **返回值** - **`GeometryList`**:输出样条曲线。 ### `MeshKernel.mesh2d_get_mesh_boundaries_as_polygons` {#meshkernel-mesh2d-get-mesh-boundaries-as-polygons} ```python mesh2d_get_mesh_boundaries_as_polygons(self, geometry_list: GeometryList=GeometryList()) -> GeometryList ``` 将选择多边形内的网格边界提取为一系列相互分隔的多边形。 若多边形为空,则获取全部网格边界。 例如,若网格中有一个孔洞,则生成两个多边形, 分别表示内边界和外边界。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `geometry_list` | `GeometryList` | `GeometryList()` | 选择多边形。 | **返回值** - **`GeometryList`**:输出网格边界多边形。 ### `MeshKernel._mesh2d_count_mesh_boundaries_as_polygons` {#meshkernel--mesh2d-count-mesh-boundaries-as-polygons} ```python _mesh2d_count_mesh_boundaries_as_polygons(self, geometry_list: GeometryList) -> int ``` 此成员以内部名称定义,供理解实现及转换流程时参考。 仅供内部使用。获取选择多边形内部的网格边界数量。 若多边形为空,则考虑全部网格边界。 统计网格边界多边形包含的多边形节点数, 这些边界多边形由 mesh2d_get_mesh_boundaries_as_polygons 计算得到。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `geometry_list` | `GeometryList` | `必填` | 选择多边形。 | **返回值** - **`int`**:多边形节点数。 ### `MeshKernel.mesh2d_merge_nodes` {#meshkernel-mesh2d-merge-nodes} ```python mesh2d_merge_nodes(self, geometry_list: GeometryList) -> None ``` 合并二维网格节点,从而移除短边。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `geometry_list` | `GeometryList` | `必填` | 定义操作区域的多边形。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.mesh2d_merge_nodes_with_merging_distance` {#meshkernel-mesh2d-merge-nodes-with-merging-distance} ```python mesh2d_merge_nodes_with_merging_distance(self, geometry_list: GeometryList, merging_distance: float) -> None ``` 合并二维网格节点,从而移除短边。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `geometry_list` | `GeometryList` | `必填` | 定义操作区域的多边形。 | | `merging_distance` | `float` | `必填` | 两个节点之间的距离小于此值时进行合并。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.mesh2d_merge_two_nodes` {#meshkernel-mesh2d-merge-two-nodes} ```python mesh2d_merge_two_nodes(self, first_node: int, second_node: int) -> None ``` 将 `first_node` 合并到 `second_node`。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `first_node` | `int` | `必填` | 第一个待合并节点的索引。 | | `second_node` | `int` | `必填` | 第二个待合并节点的索引。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.mesh2d_get_nodes_in_polygons` {#meshkernel-mesh2d-get-nodes-in-polygons} ```python mesh2d_get_nodes_in_polygons(self, geometry_list: GeometryList, inside: bool) -> ndarray ``` 获取通过多边形选中的二维网格节点索引。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `geometry_list` | `GeometryList` | `必填` | 输入多边形。 | | `inside` | `bool` | `必填` | 选择多边形内部的节点(True)或外部的节点(False)。 | **返回值** - **`ndarray`**:包含选中节点索引的整数数组。 ### `MeshKernel._mesh2d_count_nodes_in_polygons` {#meshkernel--mesh2d-count-nodes-in-polygons} ```python _mesh2d_count_nodes_in_polygons(self, geometry_list: GeometryList, inside: bool) -> int ``` 此成员以内部名称定义,供理解实现及转换流程时参考。 仅供内部使用。 统计选中的网格节点索引数量。 调用方应在 `mesh2d_get_nodes_in_polygons` 前调用此函数, 以分配保存选择结果的整数数组。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `geometry_list` | `GeometryList` | `必填` | 源码未单独提供参数说明。 | | `inside` | `bool` | `必填` | 源码未单独提供参数说明。 | **返回值** - **`int`**:选中的节点数。 ### `MeshKernel.mesh1d_set` {#meshkernel-mesh1d-set} ```python mesh1d_set(self, mesh1d: Mesh1d) -> None ``` 设置 MeshKernel 的一维网格状态。 注意,此操作会复制数据。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `mesh1d` | `Mesh1d` | `必填` | 用于设置状态的输入数据。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.mesh1d_add` {#meshkernel-mesh1d-add} ```python mesh1d_add(self, mesh1d: Mesh1d) -> None ``` 添加一维网格。 注意,此操作会复制数据。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `mesh1d` | `Mesh1d` | `必填` | 用于设置状态的输入数据。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.mesh1d_get` {#meshkernel-mesh1d-get} ```python mesh1d_get(self) -> Mesh1d ``` 从 MeshKernel 获取一维网格状态。 注意,此操作会复制数据。 **返回值** - **`Mesh1d`**:一维网格状态的副本。(原文误写为二维。) ### `MeshKernel._mesh1d_get_dimensions` {#meshkernel--mesh1d-get-dimensions} ```python _mesh1d_get_dimensions(self) -> CMesh1d ``` 此成员以内部名称定义,供理解实现及转换流程时参考。 仅供内部使用。 获取 Mesh1d 的维度信息。 将 Mesh1D 结构体中的整数参数设置为对应维度。 传入 `mesh1d_get` 前,必须让结构体指针指向大小正确的内存。 **返回值** - **`CMesh1d`**:已设置维度信息的 CMesh1d。 ### `MeshKernel.contacts_set` {#meshkernel-contacts-set} ```python contacts_set(self, contacts: Contacts) -> None ``` 设置网格连接。 注意,此操作会复制数据。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `contacts` | `Contacts` | `必填` | 用于设置网格连接的输入数据。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel._contacts_get_dimensions` {#meshkernel--contacts-get-dimensions} ```python _contacts_get_dimensions(self) -> CContacts ``` 此成员以内部名称定义,供理解实现及转换流程时参考。 仅供内部使用。 获取 Contacts 的维度信息。 将 Contacts 结构体中的整数参数设置为对应维度。 传入 `contacts_get` 前,必须让结构体指针指向大小正确的内存。 **返回值** - **`CContacts`**:已设置维度信息的 Contacts。 ### `MeshKernel.contacts_get` {#meshkernel-contacts-get} ```python contacts_get(self) -> Contacts ``` 从 MeshKernel 获取 Mesh1d 和 Mesh2d 之间的连接。 注意,此操作会复制数据。 **返回值** - **`Contacts`**:网格连接。 ### `MeshKernel.contacts_compute_single` {#meshkernel-contacts-compute-single} ```python contacts_compute_single(self, node_mask: ndarray, polygons: GeometryList, projection_factor: float) -> None ``` 计算一维与二维网格的连接,使每个一维节点连接到一个二维网格面的外心。 一维网格的边界节点(仅关联一条一维边的节点)不会连接到任何二维网格面。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `node_mask` | `ndarray` | `必填` | 布尔数组,用于指定一维节点是否 参与连接。 | | `polygons` | `GeometryList` | `必填` | 用于选择连接生成区域的多边形。 | | `projection_factor` | `float` | `必填` | 当一维节点位于二维网格外部时,生成连接所用的 投影系数。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.contacts_compute_multiple` {#meshkernel-contacts-compute-multiple} ```python contacts_compute_multiple(self, node_mask: ndarray) -> None ``` 计算一维与二维网格的连接,使一个一维节点连接到 多个二维网格面的外心。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `node_mask` | `ndarray` | `必填` | 布尔数组,用于指定一维节点是否 参与连接。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.contacts_compute_with_polygons` {#meshkernel-contacts-compute-with-polygons} ```python contacts_compute_with_polygons(self, node_mask: ndarray, polygons: GeometryList) -> None ``` 计算一维与二维网格的连接,将每个多边形内的一个二维网格面连接到最近的一维节点。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `node_mask` | `ndarray` | `必填` | 布尔数组,用于指定一维节点是否 参与连接。 | | `polygons` | `GeometryList` | `必填` | 在这些多边形中,将距离一维节点最近的二维网格面与之连接。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.contacts_compute_with_points` {#meshkernel-contacts-compute-with-points} ```python contacts_compute_with_points(self, node_mask: ndarray, polygons: GeometryList=GeometryList()) -> None ``` 计算一维与二维网格的连接,将一维节点连接到包含 输入点的二维网格面的质心。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `node_mask` | `ndarray` | `必填` | 布尔数组,用于指定一维节点是否 参与连接。 | | `polygons` | `GeometryList` | `GeometryList()` | 用于选择待连接二维网格面的多边形。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.contacts_compute_boundary` {#meshkernel-contacts-compute-boundary} ```python contacts_compute_boundary(self, node_mask: ndarray, search_radius: float, polygons: GeometryList=GeometryList()) -> None ``` 计算一维与二维网格的连接,将一维节点连接到边界处最近的二维网格面。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `node_mask` | `ndarray` | `必填` | 布尔数组,用于指定一维节点是否 参与连接(1 表示生成连接,0 表示不生成连接)。 | | `search_radius` | `float` | `必填` | 搜索相邻二维网格面的半径,笛卡尔投影下以米为单位, 球面投影下以度为单位。若等于双精度缺失值, 则在内部计算搜索半径。 | | `polygons` | `GeometryList` | `GeometryList()` | 用于选择待连接二维网格面的多边形。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.mesh2d_casulli_derefinement` {#meshkernel-mesh2d-casulli-derefinement} ```python mesh2d_casulli_derefinement(self) -> None ``` 使用 Casulli 算法粗化整个网格。 **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.mesh2d_casulli_derefinement_on_polygon` {#meshkernel-mesh2d-casulli-derefinement-on-polygon} ```python mesh2d_casulli_derefinement_on_polygon(self, polygon: GeometryList) -> None ``` 使用 Casulli 算法粗化指定网格区域。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `polygon` | `GeometryList` | `必填` | 输入多边形。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.mesh2d_delete_property` {#meshkernel-mesh2d-delete-property} ```python mesh2d_delete_property(self, property_id: int) ``` 删除属性及其计算器。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `property_id` | `int` | `必填` | 属性标识符。 | ### `MeshKernel.mesh2d_set_property` {#meshkernel-mesh2d-set-property} ```python mesh2d_set_property(self, interpolation_parameters: InterpolationParameters, sample_data: GeometryList) -> int ``` 设置网格属性数据,采样数据点无需与二维网格节点重合。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `interpolation_parameters` | `InterpolationParameters` | `必填` | 插值所需的参数。 | | `sample_data` | `GeometryList` | `必填` | 采样数据及对应的采样点。 | **返回值** - **`int`**:属性标识符。 ### `MeshKernel.mesh2d_casulli_refinement_based_on_depths` {#meshkernel-mesh2d-casulli-refinement-based-on-depths} ```python mesh2d_casulli_refinement_based_on_depths(self, polygons: GeometryList, property_id: int, meshRefinementParameters: MeshRefinementParameters, minimumRefinementDepth: float) -> None ``` 根据水深值使用 Casulli 加密算法加密网格。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `polygons` | `GeometryList` | `必填` | 计算加密的区域多边形。 | | `property_id` | `int` | `必填` | 要使用的插值器标识符。 | | `meshRefinementParameters` | `MeshRefinementParameters` | `必填` | 指定网格加密方式的参数。 | | `minimumRefinementDepth` | `float` | `必填` | 水深值小于此阈值的节点不会被标记为需要加密。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.mesh2d_casulli_refinement` {#meshkernel-mesh2d-casulli-refinement} ```python mesh2d_casulli_refinement(self) -> None ``` 使用 Casulli 算法加密整个网格。 **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.mesh2d_casulli_refinement_on_polygon` {#meshkernel-mesh2d-casulli-refinement-on-polygon} ```python mesh2d_casulli_refinement_on_polygon(self, polygon: GeometryList) -> None ``` 使用 Casulli 算法加密指定网格区域。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `polygon` | `GeometryList` | `必填` | 输入多边形。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.mesh2d_compute_orthogonalization` {#meshkernel-mesh2d-compute-orthogonalization} ```python mesh2d_compute_orthogonalization(self, project_to_land_boundary_option: ProjectToLandBoundaryOption, orthogonalization_parameters: OrthogonalizationParameters, land_boundaries: GeometryList, selecting_polygon: GeometryList=GeometryList()) -> None ``` 对二维网格进行正交化。 该函数修改网格,使网格边与 连接网格面外心的线段之间尽量正交。 正交程度与网格平滑程度之间需要权衡;此处平滑性体现为网格面面积的均匀程度。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `project_to_land_boundary_option` | `ProjectToLandBoundaryOption` | `必填` | 用于确定如何贴合 陆地边界的选项。 | | `orthogonalization_parameters` | `OrthogonalizationParameters` | `必填` | 正交化参数。 | | `land_boundaries` | `GeometryList` | `必填` | 正交化过程中需要考虑的陆地边界。 | | `selecting_polygon` | `GeometryList` | `GeometryList()` | 执行正交化的区域多边形。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.mesh2d_get_orthogonality` {#meshkernel-mesh2d-get-orthogonality} ```python mesh2d_get_orthogonality(self) -> GeometryList ``` 获取网格正交性,以网格边与 连接网格面外心的线段之间的比值表示。 **返回值** - **`GeometryList`**:包含每条边正交性数值的几何列表。 ### `MeshKernel.mesh2d_get_property` {#meshkernel-mesh2d-get-property} ```python mesh2d_get_property(self, mesh2d_location: Mesh2dLocation, property: Mesh2dProperty) -> GeometryList ``` 获取指标值位于最小值和最大值之间的多边形。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `mesh2d_location` | `Mesh2dLocation` | `必填` | 属性所在的网格位置。 | | `property` | `Mesh2dProperty` | `必填` | 要获取的属性。 | **返回值** - **`GeometryList`**:包含属性值的结果几何列表。 ### `MeshKernel.mesh2d_get_smoothness` {#meshkernel-mesh2d-get-smoothness} ```python mesh2d_get_smoothness(self) ``` 获取平滑性,以两个相邻网格面面积的比值表示。 **返回值** - **`GeometryList`**:包含每条边平滑性数值的几何列表。 ### `MeshKernel.mesh2d_connect_meshes` {#meshkernel-mesh2d-connect-meshes} ```python mesh2d_connect_meshes(self, mesh2d: Mesh2d, connect: bool, polygon: GeometryList=GeometryList(), search_fraction: float=float(0.4)) -> None ``` 将网格连接到现有网格。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `mesh2d` | `Mesh2d` | `必填` | 要连接到现有网格的网格。 | | `connect` | `bool` | `必填` | 是否通过添加额外的边来连接网格。 | | `polygon` | `GeometryList` | `GeometryList()` | 连接网格时考虑的区域;若为空,表示考虑整个 计算域。 | | `search_fraction` | `float` | `float(0.4)` | 用于判断两条边是否足够接近、可以连接, 其值为最短边长的一个比例。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel._get_error` {#meshkernel--get-error} ```python _get_error(self) -> str ``` 此成员以内部名称定义,供理解实现及转换流程时参考。 源码未为此成员编写文档字符串;下面保留完整签名和参数信息。 **返回类型**:`str`。源码未单独说明返回值。 ### `MeshKernel._get_geometry_error` {#meshkernel--get-geometry-error} ```python _get_geometry_error(self) -> Tuple[int, Mesh2dLocation] ``` 此成员以内部名称定义,供理解实现及转换流程时参考。 获取几何错误信息。 **返回值** - **`index`(`int`)**:索引。 - **`location`(`int`)**:位置。 ### `MeshKernel.mesh2d_triangulation_interpolation` {#meshkernel-mesh2d-triangulation-interpolation} ```python mesh2d_triangulation_interpolation(self, samples: GeometryList, location_type: Mesh2dLocation) -> GeometryList ``` 对采样数据进行三角剖分插值。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `samples` | `GeometryList` | `必填` | 待插值的采样数据。 | | `location_type` | `Mesh2dLocation` | `必填` | 插值目标的网格位置类型。 | **返回值** - **`GeometryList`**:插值后的采样数据。 ### `MeshKernel.mesh2d_averaging_interpolation` {#meshkernel-mesh2d-averaging-interpolation} ```python mesh2d_averaging_interpolation(self, samples: GeometryList, location_type: Mesh2dLocation, averaging_method: AveragingMethod, relative_search_size: float, min_samples: int) -> GeometryList ``` 对采样数据进行平均插值。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `samples` | `GeometryList` | `必填` | 待插值的采样数据。 | | `location_type` | `Mesh2dLocation` | `必填` | 插值目标的网格位置类型。 | | `averaging_method` | `AveragingMethod` | `必填` | 平均方法。 | | `relative_search_size` | `float` | `必填` | 相对搜索范围。 | | `min_samples` | `int` | `必填` | 某些插值算法执行有效插值 所需的最少采样点数。 | **返回值** - **`GeometryList`**:插值后的采样数据。 ### `MeshKernel.mesh2d_convert_projection` {#meshkernel-mesh2d-convert-projection} ```python mesh2d_convert_projection(self, projection: ProjectionType, zone: str) -> None ``` 转换二维网格的投影。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `projection` | `ProjectionType` | `必填` | 新的网格投影。 | | `zone` | `str` | `必填` | UTM 分区及相关信息字符串。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.get_projection` {#meshkernel-get-projection} ```python get_projection(self) -> ProjectionType ``` 获取 MeshKernel 状态的投影类型。 **返回值** - **`ProjectionType`**:投影类型。 ### `MeshKernel.get_meshkernel_version` {#meshkernel-get-meshkernel-version} ```python get_meshkernel_version(self) -> str ``` 获取底层 C++ MeshKernel 库的版本。 **返回值** - **`str`**:版本字符串。 ### `MeshKernel.get_meshkernelpy_version` {#meshkernel-get-meshkernelpy-version} ```python get_meshkernelpy_version(self) -> str ``` 获取此 Python 封装库的版本。 **返回值** - **`str`**:版本字符串。 ### `MeshKernel.mkernel_get_separator` {#meshkernel-mkernel-get-separator} ```python mkernel_get_separator(self) -> float ``` 获取 MeshKernel 使用的分隔值。 **返回值** - **`float`**:分隔值。 ### `MeshKernel.mkernel_get_inner_outer_separator` {#meshkernel-mkernel-get-inner-outer-separator} ```python mkernel_get_inner_outer_separator(self) -> float ``` 获取 MeshKernel 用于分隔多边形外边界与内边界的分隔值。 **返回值** - **`float`**:多边形内/外边界分隔值。 ### `MeshKernel._execute_function` {#meshkernel--execute-function} ```python _execute_function(self, function, *args) ``` 此成员以内部名称定义,供理解实现及转换流程时参考。 执行 MeshKernel C 函数并检查其状态的辅助函数。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `function` | `Callable` | `必填` | 要调用的函数。 | | `args` | `未标注` | `不适用` | 可变位置参数。传递给 `function` 的参数。 | **异常** - **`MeshKernelError`**:当 MeshKernel 库 报告错误时抛出此异常。 ### `MeshKernel._curvilineargrid_get_dimensions` {#meshkernel--curvilineargrid-get-dimensions} ```python _curvilineargrid_get_dimensions(self) -> CCurvilinearGrid ``` 此成员以内部名称定义,供理解实现及转换流程时参考。 仅供内部使用。 获取曲线网格的维度信息。 将曲线网格结构体中的整数参数设置为对应维度。 传入 `curvilineargrid_get` 前,必须让结构体指针指向大小正确的内存。 **返回值** - **`CMesh1d`**:已设置维度信息的 CCurvilinearGrid。(原文返回类型标签为 CMesh1d。) ### `MeshKernel.curvilineargrid_get` {#meshkernel-curvilineargrid-get} ```python curvilineargrid_get(self) -> CurvilinearGrid ``` 从 MeshKernel 获取曲线网格状态。 注意,此操作会复制数据。 **返回值** - **`CurvilinearGrid`**:曲线网格状态的副本。 ### `MeshKernel.curvilinear_compute_transfinite_from_splines` {#meshkernel-curvilinear-compute-transfinite-from-splines} ```python curvilinear_compute_transfinite_from_splines(self, splines: GeometryList, curvilinear_parameters: CurvilinearParameters) -> None ``` 通过超限插值从样条曲线生成曲线网格。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `splines` | `GeometryList` | `必填` | 生成曲线网格所用的样条曲线。 | | `curvilinear_parameters` | `CurvilinearParameters` | `必填` | 曲线网格参数。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.curvilinear_compute_orthogonal_from_splines` {#meshkernel-curvilinear-compute-orthogonal-from-splines} ```python curvilinear_compute_orthogonal_from_splines(self, splines: GeometryList, curvilinear_parameters: CurvilinearParameters, splines_to_curvilinear_parameters: SplinesToCurvilinearParameters) -> None ``` 通过推进前沿法从样条曲线生成曲线网格。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `splines` | `GeometryList` | `必填` | 生成曲线网格所用的样条曲线。 | | `curvilinear_parameters` | `CurvilinearParameters` | `必填` | 曲线网格参数。 | | `splines_to_curvilinear_parameters` | `SplinesToCurvilinearParameters` | `必填` | 算法所需的 附加参数。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.curvilinear_compute_curvature` {#meshkernel-curvilinear-compute-curvature} ```python curvilinear_compute_curvature(self, direction: CurvilinearDirection) -> ndarray ``` 计算曲线网格的曲率。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `direction` | `CurvilinearDirection` | `必填` | 计算平滑性的方向。(此说明也出现在曲率方法中,按原文保留。) | **返回类型**:`ndarray`。源码未单独说明返回值。 ### `MeshKernel.curvilinear_compute_smoothness` {#meshkernel-curvilinear-compute-smoothness} ```python curvilinear_compute_smoothness(self, direction: CurvilinearDirection) -> ndarray ``` 计算曲线网格的平滑性。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `direction` | `CurvilinearDirection` | `必填` | 计算平滑性的方向。(此说明也出现在曲率方法中,按原文保留。) | **返回类型**:`ndarray`。源码未单独说明返回值。 ### `MeshKernel.curvilinear_convert_to_mesh2d` {#meshkernel-curvilinear-convert-to-mesh2d} ```python curvilinear_convert_to_mesh2d(self) -> None ``` 将曲线网格转换为非结构网格。 **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.curvilinear_compute_rectangular_grid` {#meshkernel-curvilinear-compute-rectangular-grid} ```python curvilinear_compute_rectangular_grid(self, make_grid_parameters: MakeGridParameters) -> None ``` 生成矩形网格。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `make_grid_parameters` | `MakeGridParameters` | `必填` | 生成均匀网格所用的参数。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.curvilinear_compute_rectangular_grid_from_polygon` {#meshkernel-curvilinear-compute-rectangular-grid-from-polygon} ```python curvilinear_compute_rectangular_grid_from_polygon(self, make_grid_parameters: MakeGridParameters, geometry_list: GeometryList) -> None ``` 根据多边形生成矩形网格。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `make_grid_parameters` | `MakeGridParameters` | `必填` | 生成均匀网格所用的参数。 | | `geometry_list` | `GeometryList` | `必填` | 生成网格的区域多边形。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.curvilinear_compute_rectangular_grid_on_extension` {#meshkernel-curvilinear-compute-rectangular-grid-on-extension} ```python curvilinear_compute_rectangular_grid_on_extension(self, make_grid_parameters: MakeGridParameters) -> None ``` 在指定范围内生成矩形网格。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `make_grid_parameters` | `MakeGridParameters` | `必填` | 生成均匀网格所用的参数。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.curvilinear_refine` {#meshkernel-curvilinear-refine} ```python curvilinear_refine(self, x_lower_left_corner: float, y_lower_left_corner: float, x_upper_right_corner: float, y_upper_right_corner: float, refinement: int) -> None ``` 曲线网格定向加密。 沿垂直于 lower_left_corner 和 upper_right_corner 所定义线段的方向添加网格线。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `x_lower_left_corner` | `float` | `必填` | 待加密网格块左下角的 x 坐标。 | | `y_lower_left_corner` | `float` | `必填` | 待加密网格块左下角的 y 坐标。 | | `x_upper_right_corner` | `float` | `必填` | 待加密网格块右上角的 x 坐标。 | | `y_upper_right_corner` | `float` | `必填` | 待加密网格块右上角的 y 坐标。 | | `refinement` | `int` | `必填` | 在左下角与右上角之间添加的网格线数量。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.curvilinear_compute_transfinite_from_polygon` {#meshkernel-curvilinear-compute-transfinite-from-polygon} ```python curvilinear_compute_transfinite_from_polygon(self, geometry_list: GeometryList, first_node: int, second_node: int, third_node: int, use_fourth_side: bool) -> None ``` 在多边形内部计算曲线网格,需要选取三个不同的多边形节点。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `geometry_list` | `GeometryList` | `必填` | 输入多边形。 | | `first_node` | `int` | `必填` | 第一个选中的节点。 | | `second_node` | `int` | `必填` | 第二个选中的节点。 | | `third_node` | `int` | `必填` | 第三个选中的节点。 | | `use_fourth_side` | `bool` | `必填` | 是否使用多边形的第四条边计算曲线网格。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.curvilinear_compute_transfinite_from_triangle` {#meshkernel-curvilinear-compute-transfinite-from-triangle} ```python curvilinear_compute_transfinite_from_triangle(self, geometry_list: GeometryList, first_node: int, second_node: int, third_node: int) -> None ``` 在三角形内部计算曲线网格,需要选取三个不同的多边形节点。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `geometry_list` | `GeometryList` | `必填` | 输入多边形。 | | `first_node` | `int` | `必填` | 第一个选中的节点。 | | `second_node` | `int` | `必填` | 第二个选中的节点。 | | `third_node` | `int` | `必填` | 第三个选中的节点。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.curvilinear_orthogonalize` {#meshkernel-curvilinear-orthogonalize} ```python curvilinear_orthogonalize(self, orthogonalization_parameters: OrthogonalizationParameters, x_lower_left_corner: float, y_lower_left_corner: float, x_upper_right_corner: float, y_upper_right_corner: float) -> None ``` 对曲线网格内指定网格块进行正交化。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `orthogonalization_parameters` | `OrthogonalizationParameters` | `必填` | 源码未单独提供参数说明。 | | `x_lower_left_corner` | `float` | `必填` | 网格块左下角的 x 坐标。 | | `y_lower_left_corner` | `float` | `必填` | 网格块左下角的 y 坐标。 | | `x_upper_right_corner` | `float` | `必填` | 网格块右上角的 x 坐标。 | | `y_upper_right_corner` | `float` | `必填` | 网格块右上角的 y 坐标。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.curvilinear_frozen_line_is_valid` {#meshkernel-curvilinear-frozen-line-is-valid} ```python curvilinear_frozen_line_is_valid(self, frozen_line_id: int) -> bool ``` 检查固定网格线标识符是否有效。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `frozen_line_id` | `int` | `必填` | 待验证的固定网格线标识符。 | **返回值** - **`bool`**:若 MeshKernel 状态中存在该固定网格线,则为 True,否则为 False。 ### `MeshKernel.curvilinear_frozen_line_delete` {#meshkernel-curvilinear-frozen-line-delete} ```python curvilinear_frozen_line_delete(self, frozen_line_id: int) ``` 删除曲线网格中的固定网格线。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `frozen_line_id` | `int` | `必填` | 待删除的固定网格线标识符。 | ### `MeshKernel.curvilinear_frozen_line_add` {#meshkernel-curvilinear-frozen-line-add} ```python curvilinear_frozen_line_add(self, x_first_grid_line_node: float, y_first_grid_line_node: float, x_second_grid_line_node: float, y_second_grid_line_node: float) -> int ``` 向 MeshKernel 状态添加固定网格线。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `x_first_grid_line_node` | `float` | `必填` | 第一个网格线节点的 x 坐标。 | | `y_first_grid_line_node` | `float` | `必填` | 第一个网格线节点的 y 坐标。 | | `x_second_grid_line_node` | `float` | `必填` | 第二个网格线节点的 x 坐标。 | | `y_second_grid_line_node` | `float` | `必填` | 第二个网格线节点的 y 坐标。 | **返回值** MeshKernel 状态中新添加的固定网格线标识符。 ### `MeshKernel.curvilinear_frozen_line_get` {#meshkernel-curvilinear-frozen-line-get} ```python curvilinear_frozen_line_get(self, frozen_line_id: int) -> tuple[float, float, float, float] ``` 获取曲线网格中固定网格线的坐标。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `frozen_line_id` | `int` | `必填` | 待获取的固定网格线标识符。若找不到该标识符, 则返回包含无效坐标的元组。 | **返回值** - **`tuple`**:包含以下内容的元组: - **`x_first_frozen_line_coordinate`(`float`)**:第一个固定网格线节点的 x 坐标。 - **`y_first_frozen_line_coordinate`(`float`)**:第一个固定网格线节点的 y 坐标。 - **`x_second_frozen_line_coordinate`(`float`)**:第二个固定网格线节点的 x 坐标。 - **`y_second_frozen_line_coordinate`(`float`)**:第二个固定网格线节点的 y 坐标。 ### `MeshKernel.curvilinear_frozen_lines_get_ids` {#meshkernel-curvilinear-frozen-lines-get-ids} ```python curvilinear_frozen_lines_get_ids(self) -> np.ndarray ``` 获取曲线网格中所有有效固定网格线的标识符。 **返回值** 包含固定网格线标识符的 NumPy 数组。 ### `MeshKernel.curvilinear_smoothing` {#meshkernel-curvilinear-smoothing} ```python curvilinear_smoothing(self, smoothing_iterations: int, x_lower_left_corner: float, y_lower_left_corner: float, x_upper_right_corner: float, y_upper_right_corner: float) -> None ``` 平滑曲线网格。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `smoothing_iterations` | `int` | `必填` | 要执行的平滑迭代次数。 | | `x_lower_left_corner` | `float` | `必填` | 待加密网格块左下角的 x 坐标。 | | `y_lower_left_corner` | `float` | `必填` | 待加密网格块左下角的 y 坐标。 | | `x_upper_right_corner` | `float` | `必填` | 待加密网格块右上角的 x 坐标。 | | `y_upper_right_corner` | `float` | `必填` | 待加密网格块右上角的 y 坐标。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.curvilinear_smoothing_directional` {#meshkernel-curvilinear-smoothing-directional} ```python curvilinear_smoothing_directional(self, smoothing_iterations: int, x_first_grid_line_node: float, y_first_grid_line_node: float, x_second_grid_line_node: float, y_second_grid_line_node: float, x_lower_left_corner: float, y_lower_left_corner: float, x_upper_right_corner: float, y_upper_right_corner: float) -> None ``` 沿指定线段方向平滑曲线网格。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `smoothing_iterations` | `int` | `必填` | 要执行的平滑迭代次数。 | | `x_first_grid_line_node` | `float` | `必填` | 第一个曲线网格节点的 x 坐标。 | | `y_first_grid_line_node` | `float` | `必填` | 第一个曲线网格节点的 y 坐标。 | | `x_second_grid_line_node` | `float` | `必填` | 第二个曲线网格节点的 x 坐标。 | | `y_second_grid_line_node` | `float` | `必填` | 第二个曲线网格节点的 y 坐标。 | | `x_lower_left_corner` | `float` | `必填` | 待加密网格块左下角的 x 坐标。 | | `y_lower_left_corner` | `float` | `必填` | 待加密网格块左下角的 y 坐标。 | | `x_upper_right_corner` | `float` | `必填` | 待加密网格块右上角的 x 坐标。 | | `y_upper_right_corner` | `float` | `必填` | 待加密网格块右上角的 y 坐标。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.curvilinear_initialize_line_shift` {#meshkernel-curvilinear-initialize-line-shift} ```python curvilinear_initialize_line_shift(self) -> None ``` 初始化曲线网格线平移算法。 **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.curvilinear_set_line_line_shift` {#meshkernel-curvilinear-set-line-line-shift} ```python curvilinear_set_line_line_shift(self, x_first_grid_line_node: float, y_first_grid_line_node: float, x_second_grid_line_node: float, y_second_grid_line_node: float) -> None ``` 设置待平移网格线的起点和终点节点。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `x_first_grid_line_node` | `float` | `必填` | 待平移网格线第一个节点的 x 坐标。 | | `y_first_grid_line_node` | `float` | `必填` | 待平移网格线第一个节点的 y 坐标。 | | `x_second_grid_line_node` | `float` | `必填` | 待平移网格线第二个节点的 x 坐标。 | | `y_second_grid_line_node` | `float` | `必填` | 待平移网格线第二个节点的 y 坐标。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.curvilinear_set_block_line_shift` {#meshkernel-curvilinear-set-block-line-shift} ```python curvilinear_set_block_line_shift(self, x_lower_left_corner: float, y_lower_left_corner: float, x_upper_right_corner: float, y_upper_right_corner: float) -> None ``` 定义曲线网格上的网格块,用于分配网格线平移量。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `x_lower_left_corner` | `float` | `必填` | 网格块左下角的 x 坐标。 | | `y_lower_left_corner` | `float` | `必填` | 网格块左下角的 y 坐标。 | | `x_upper_right_corner` | `float` | `必填` | 网格块右上角的 x 坐标。 | | `y_upper_right_corner` | `float` | `必填` | 网格块右上角的 y 坐标。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.curvilinear_move_node_line_shift` {#meshkernel-curvilinear-move-node-line-shift} ```python curvilinear_move_node_line_shift(self, x_from_coordinate: float, y_from_coordinate: float, x_to_coordinate: float, y_to_coordinate: float) -> None ``` 移动待平移网格线的一个节点。可以多次执行此操作。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `x_from_coordinate` | `float` | `必填` | 待移动节点的 x 坐标。 | | `y_from_coordinate` | `float` | `必填` | 待移动节点的 y 坐标。 | | `x_to_coordinate` | `float` | `必填` | 节点新位置的 x 坐标。 | | `y_to_coordinate` | `float` | `必填` | 节点新位置的 y 坐标。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.curvilinear_line_shift` {#meshkernel-curvilinear-line-shift} ```python curvilinear_line_shift(self) ``` 执行曲线网格线平移,并结束算法。 ### `MeshKernel.curvilinear_move_node` {#meshkernel-curvilinear-move-node} ```python curvilinear_move_node(self, x_from_point: float, y_from_point: float, x_to_point: float, y_to_point: float) -> None ``` 将曲线网格中的一个点从原位置移到新位置。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `x_from_point` | `float` | `必填` | 待移动点的 x 坐标。 | | `y_from_point` | `float` | `必填` | 待移动点的 y 坐标。 | | `x_to_point` | `float` | `必填` | 点的新 x 坐标。 | | `y_to_point` | `float` | `必填` | 点的新 y 坐标。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.curvilinear_insert_face` {#meshkernel-curvilinear-insert-face} ```python curvilinear_insert_face(self, x_coordinate: float, y_coordinate: float) -> None ``` 在曲线网格中插入新网格面。 通过线性外推在距离指定位置最近的边外侧插入新网格面。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `x_coordinate` | `float` | `必填` | 用于查找最近网格面的点的 x 坐标。 | | `y_coordinate` | `float` | `必填` | 用于查找最近网格面的点的 y 坐标。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.curvilinear_line_attraction_repulsion` {#meshkernel-curvilinear-line-attraction-repulsion} ```python curvilinear_line_attraction_repulsion(self, repulsion_parameter: float, x_first_grid_line_node: float, y_first_grid_line_node: float, x_second_grid_line_node: float, y_second_grid_line_node: float, x_lower_left_corner: float, y_lower_left_corner: float, x_upper_right_corner: float, y_upper_right_corner: float) ``` 将网格块内的网格线向另一条指定网格线吸引或排斥。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `repulsion_parameter` | `float` | `必填` | 排斥参数。 | | `x_first_grid_line_node` | `float` | `必填` | 第一个节点的 x 坐标。 | | `y_first_grid_line_node` | `float` | `必填` | 第一个节点的 y 坐标。 | | `x_second_grid_line_node` | `float` | `必填` | 第二个节点的 x 坐标。 | | `y_second_grid_line_node` | `float` | `必填` | 第二个节点的 y 坐标。 | | `x_lower_left_corner` | `float` | `必填` | 网格块左下角的 x 坐标。 | | `y_lower_left_corner` | `float` | `必填` | 网格块左下角的 y 坐标。 | | `x_upper_right_corner` | `float` | `必填` | 网格块右上角的 x 坐标。 | | `y_upper_right_corner` | `float` | `必填` | 网格块右上角的 y 坐标。 | ### `MeshKernel.curvilinear_line_mirror` {#meshkernel-curvilinear-line-mirror} ```python curvilinear_line_mirror(self, mirroring_factor: float, num_lines_to_mirror: int, x_first_grid_line_node: float, y_first_grid_line_node: float, x_second_grid_line_node: float, y_second_grid_line_node: float) -> None ``` 将边界网格线向外镜像扩展。边界网格线由起点和终点定义。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `mirroring_factor` | `float` | `必填` | 镜像系数。 | | `num_lines_to_mirror` | `int` | `必填` | 要镜像的网格线数量。 | | `x_first_grid_line_node` | `float` | `必填` | 第一个节点的 x 坐标。 | | `y_first_grid_line_node` | `float` | `必填` | 第一个节点的 y 坐标。 | | `x_second_grid_line_node` | `float` | `必填` | 第二个节点的 x 坐标。 | | `y_second_grid_line_node` | `float` | `必填` | 第二个节点的 y 坐标。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel.curvilinear_delete_node` {#meshkernel-curvilinear-delete-node} ```python curvilinear_delete_node(self, x_coordinate: float, y_coordinate: float) -> None ``` 删除距离指定点最近的节点。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `x_coordinate` | `float` | `必填` | 指定点的 x 坐标。 | | `y_coordinate` | `float` | `必填` | 指定点的 y 坐标。 | **返回类型**:`None`。源码未单独说明返回值。 ### `MeshKernel._get_num_coordinates` {#meshkernel--get-num-coordinates} ```python _get_num_coordinates(self, location_type) ``` 此成员以内部名称定义,供理解实现及转换流程时参考。 获取指定位置类型的网格坐标数量。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `location_type` | `Mesh2dLocation` | `必填` | 位置类型。 | **异常** - **`Exception`**:使用无效位置类型时抛出此异常。 ### `MeshKernel.__map_to_valid_values` {#meshkernel---map-to-valid-values} ```python __map_to_valid_values(self, geometry_list: GeometryList, location_type: Mesh2dLocation) ``` 此成员以内部名称定义,供理解实现及转换流程时参考。 从 geometry_list 中移除无效值。 **参数** | 名称 | 类型 | 默认值 | 中文说明 | | --- | --- | --- | --- | | `geometry_list` | `GeometryList` | `必填` | 输入几何列表。 | | `location_type` | `Mesh2dLocation` | `必填` | 位置类型。 | **异常** - **`Exception`**:使用无效位置类型时抛出此异常。