Files
mkdocs/doc/meshkernelpy/api/meshkernel.py_structures.md
T
2026-10-10 21:56:35 +08:00

880 lines
33 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Python 数据结构与枚举
模块:`meshkernel.py_structures`。本页依据本地 MeshKernelPy `8.3.0` 源码生成,包含该模块定义的类、方法、函数和常量。签名及参数默认值以源码为准;原文未提供的说明会明确标记。
[返回 API 总览](modules.md)
## `DeleteMeshOption` {#deletemeshoption}
继承:`IntEnum`。
删除多边形内部网格时使用的策略。
**枚举成员**
| 名称 | 值 | 中文说明 |
| --- | --- | --- |
| `INSIDE_NOT_INTERSECTED` | `0` | 删除位于多边形内部、未与边界相交的网格。 |
| `INSIDE_AND_INTERSECTED` | `1` | 删除位于多边形内部及与边界相交的网格。 |
| `FACES_WITH_INCLUDED_CIRCUMCENTERS` | `2` | 删除外心位于多边形内部的网格面。 |
## `ProjectToLandBoundaryOption` {#projecttolandboundaryoption}
继承:`IntEnum`。
投影到陆地边界的策略。
**枚举成员**
| 名称 | 值 | 中文说明 |
| --- | --- | --- |
| `DO_NOT_PROJECT_TO_LANDBOUNDARY` | `0` | 不投影到陆地边界。 |
| `TO_ORIGINAL_NETBOUNDARY` | `1` | 投影到原始网格边界。 |
| `OUTER_MESH_BOUNDARY_TO_LANDBOUNDARY` | `2` | 将网格外边界投影到陆地边界。 |
| `INNER_AND_OUTER_MESH_BOUNDARY_TO_LANDBOUNDARY` | `3` | 将网格内外边界投影到陆地边界。 |
| `WHOLE_MESH` | `4` | 处理整个网格。 |
## `RefinementType` {#refinementtype}
继承:`IntEnum`。
加密类型。
**枚举成员**
| 名称 | 值 | 中文说明 |
| --- | --- | --- |
| `WAVE_COURANT` | `1` | 根据采样水深加密,使库朗数判据不被超过。 |
| `REFINEMENT_LEVELS` | `2` | 递归加密指定的固定次数。 |
| `RIDGE_DETECTION` | `3` | 基于脊线检测进行加密。 |
## `Mesh2dLocation` {#mesh2dlocation}
继承:`IntEnum`。
二维网格位置类型。
**枚举成员**
| 名称 | 值 | 中文说明 |
| --- | --- | --- |
| `FACES` | `0` | 网格面。 |
| `NODES` | `1` | 节点。 |
| `EDGES` | `2` | 网格边。 |
## `Mesh2dProperty` {#mesh2dproperty}
继承:`IntEnum`。
二维网格上的不同属性。
**枚举成员**
| 名称 | 值 | 中文说明 |
| --- | --- | --- |
| `ORTHOGONALITY` | `0` | 正交性。 |
| `EDGE_LENGTHS` | `1` | 边长。 |
| `FACE_CIRCUMCENTER` | `2` | 网格面外心。 |
| `NETLINK_CONTOUR_POLYGON` | `3` | 网格连接的轮廓多边形。 |
| `FACE_BOUNDS` | `4` | 网格面边界。 |
| `SMOOTHNESS` | `5` | 平滑性。 |
## `AveragingMethod` {#averagingmethod}
继承:`IntEnum`。
平均方法。
**枚举成员**
| 名称 | 值 | 中文说明 |
| --- | --- | --- |
| `SIMPLE_AVERAGING` | `1` | 计算简单算术平均值。 |
| `CLOSEST_POINT` | `2` | 取距离插值位置最近的采样点的值。 |
| `MAX` | `3` | 取采样值的最大值。 |
| `MIN` | `4` | 取采样值的最小值。 |
| `INVERSE_WEIGHT_DISTANCE` | `5` | 计算反距离加权平均值。 |
| `MIN_ABS` | `6` | 取最小绝对值。 |
## `ProjectionType` {#projectiontype}
继承:`IntEnum`。
投影类型。
**枚举成员**
| 名称 | 值 | 中文说明 |
| --- | --- | --- |
| `CARTESIAN` | `0` | 笛卡尔坐标投影。 |
| `SPHERICAL` | `1` | 球面坐标投影。 |
| `SPHERICALACCURATE` | `2` | 高精度球面坐标投影。 |
## `InterpolationValues` {#interpolationvalues}
继承:`IntEnum`。
网格采样数据中待插值数值的可选类型。
**枚举成员**
| 名称 | 值 | 中文说明 |
| --- | --- | --- |
| `SHORT` | `0` | 短整数类型。 |
| `FLOAT` | `1` | 单精度浮点类型。 |
| `INT` | `2` | 整数类型。 |
| `DOUBLE` | `3` | 双精度浮点类型。 |
## `InterpolationType` {#interpolationtype}
继承:`IntEnum`。
点云插值类型。
**枚举成员**
| 名称 | 值 | 中文说明 |
| --- | --- | --- |
| `TRIANGULATION` | `0` | 三角剖分插值。 |
| `AVERAGING` | `1` | 平均插值。 |
## `Mesh2d` {#mesh2d}
继承:`object`。
此类用于获取和设置二维网格数据。
**属性说明**
- **`node_x`(`ndarray`)**:描述节点 x 坐标的一维双精度数组。
- **`node_y`(`ndarray`)**:描述节点 y 坐标的一维双精度数组。
- **`edge_nodes`(`ndarray, 可选`)**:描述每条二维网格边端点节点的一维整数数组。
- **`face_nodes`(`ndarray, 可选`)**:描述组成每个二维网格面的节点的一维整数数组。
- **`nodes_per_face`(`ndarray, 可选`)**:描述组成每个二维网格面的节点的一维整数数组。(原文如此;实际为每个面的节点数。)
- **`edge_x`(`ndarray, 可选`)**:描述网格边中点 x 坐标的一维双精度数组。
- **`edge_y`(`ndarray, 可选`)**:描述网格边中点 y 坐标的一维双精度数组。
- **`face_x`(`ndarray, 可选`)**:描述网格面质心 x 坐标的一维双精度数组。
- **`face_y`(`ndarray, 可选`)**:描述网格面质心 y 坐标的一维双精度数组。
- **`edge_faces`(`ndarray, 可选`)**:描述每条边关联的网格面索引的一维整数数组。
- **`face_edges`(`ndarray, 可选`)**:描述每个网格面关联的边索引的一维整数数组。
**方法索引**
- [`__init__`](#mesh2d---init--)
- [`remove_invalid_values`](#mesh2d-remove-invalid-values)
- [`__eq__`](#mesh2d---eq--)
- [`almost_equal`](#mesh2d-almost-equal)
- [`plot_edges`](#mesh2d-plot-edges)
- [`plot_faces`](#mesh2d-plot-faces)
### `Mesh2d.__init__` {#mesh2d---init--}
```python
__init__(self, node_x=np.empty(0, dtype=np.double), node_y=np.empty(0, dtype=np.double), edge_nodes=np.empty(0, dtype=np.int32), face_nodes=np.empty(0, dtype=np.int32), nodes_per_face=np.empty(0, dtype=np.int32), edge_x=np.empty(0, dtype=np.double), edge_y=np.empty(0, dtype=np.double), face_x=np.empty(0, dtype=np.double), face_y=np.empty(0, dtype=np.double), edge_faces=np.empty(0, dtype=np.int32), face_edges=np.empty(0, dtype=np.int32))
```
构造实例。源码没有单独编写此构造函数的文档字符串,参数及默认值如下。
**参数**
| 名称 | 类型 | 默认值 | 中文说明 |
| --- | --- | --- | --- |
| `node_x` | `未标注` | `np.empty(0, dtype=np.double)` | 源码未单独提供参数说明。 |
| `node_y` | `未标注` | `np.empty(0, dtype=np.double)` | 源码未单独提供参数说明。 |
| `edge_nodes` | `未标注` | `np.empty(0, dtype=np.int32)` | 源码未单独提供参数说明。 |
| `face_nodes` | `未标注` | `np.empty(0, dtype=np.int32)` | 源码未单独提供参数说明。 |
| `nodes_per_face` | `未标注` | `np.empty(0, dtype=np.int32)` | 源码未单独提供参数说明。 |
| `edge_x` | `未标注` | `np.empty(0, dtype=np.double)` | 源码未单独提供参数说明。 |
| `edge_y` | `未标注` | `np.empty(0, dtype=np.double)` | 源码未单独提供参数说明。 |
| `face_x` | `未标注` | `np.empty(0, dtype=np.double)` | 源码未单独提供参数说明。 |
| `face_y` | `未标注` | `np.empty(0, dtype=np.double)` | 源码未单独提供参数说明。 |
| `edge_faces` | `未标注` | `np.empty(0, dtype=np.int32)` | 源码未单独提供参数说明。 |
| `face_edges` | `未标注` | `np.empty(0, dtype=np.int32)` | 源码未单独提供参数说明。 |
### `Mesh2d.remove_invalid_values` {#mesh2d-remove-invalid-values}
```python
remove_invalid_values(self, float_invalid_value: float)
```
移除数组中可能存在的无效值。 同时移除其他数组中对应的条目。
**参数**
| 名称 | 类型 | 默认值 | 中文说明 |
| --- | --- | --- | --- |
| `float_invalid_value` | `float` | `必填` | 浮点无效值。 |
### `Mesh2d.__eq__` {#mesh2d---eq--}
```python
__eq__(self, other: Mesh2d)
```
此成员以内部名称定义,供理解实现及转换流程时参考。
检查此网格是否与另一个网格完全相等。
**参数**
| 名称 | 类型 | 默认值 | 中文说明 |
| --- | --- | --- | --- |
| `other` | `Mesh2d` | `必填` | 用于比较的网格。 |
### `Mesh2d.almost_equal` {#mesh2d-almost-equal}
```python
almost_equal(self, other: Mesh2d, rtol: float=1e-05, atol: float=1e-08) -> bool
```
根据给定的相对容差和绝对容差,检查此网格是否与另一个网格近似相等。 容差只适用于浮点数组(node_x、node_y、face_x、face_y、edge_x 和 edge_y;原文将 face_y 写作 faces_y)。 每个浮点数组都必须满足以下条件: absolute(self.float_array - other.float_array) <= (atol + rtol * absolute(other.float_array)) 包含索引和计数的数组(face_edges、face_nodes、edge_faces、edge_nodes、nodes_per_face) 在两个网格中必须完全相等。
**参数**
| 名称 | 类型 | 默认值 | 中文说明 |
| --- | --- | --- | --- |
| `other` | `Mesh2d` | `必填` | 用于比较的网格。 |
| `rtol` | `float` | `1e-05` | 相对容差,默认为 1.0e-5。 |
| `atol` | `float` | `1e-08` | 绝对容差,默认为 1.0e-8。 |
**返回类型**:`bool`。源码未单独说明返回值。
### `Mesh2d.plot_edges` {#mesh2d-plot-edges}
```python
plot_edges(self, ax, *args, **kwargs)
```
在指定坐标轴上绘制网格边。 `args` 和 `kwargs` 作为 matplotlib 的 `plot` 方法参数传入。
**参数**
| 名称 | 类型 | 默认值 | 中文说明 |
| --- | --- | --- | --- |
| `ax` | `matplotlib.axes.Axes` | `必填` | 绘制网格边所用的坐标轴对象。 |
| `args` | `未标注` | `不适用` | 可变位置参数。源码未单独提供参数说明。 |
| `kwargs` | `未标注` | `不适用` | 可变关键字参数。源码未单独提供参数说明。 |
### `Mesh2d.plot_faces` {#mesh2d-plot-faces}
```python
plot_faces(self, ax, *args, **kwargs)
```
在指定坐标轴上绘制网格面。 `args` 和 `kwargs` 作为 matplotlib 的 `plot` 方法参数传入。
**参数**
| 名称 | 类型 | 默认值 | 中文说明 |
| --- | --- | --- | --- |
| `ax` | `matplotlib.axes.Axes` | `必填` | 绘制网格面所用的坐标轴对象。 |
| `args` | `未标注` | `不适用` | 可变位置参数。源码未单独提供参数说明。 |
| `kwargs` | `未标注` | `不适用` | 可变关键字参数。源码未单独提供参数说明。 |
## `GeometryList` {#geometrylist}
继承:`object`。
用于描述几何对象列表的类。
**属性说明**
- **`x_coordinates`(`ndarray`)**:描述节点 x 坐标的一维双精度数组。
- **`y_coordinates`(`ndarray`)**:描述节点 y 坐标的一维双精度数组。
- **`values`(`ndarray, 可选`)**:描述节点数值的一维双精度数组。
- **`geometry_separator`(`float, 可选`)**:坐标中的几何分隔值,默认为 `-999.0`。
- **`inner_outer_separator`(`float, 可选`)**:用于分隔多边形内边界和外边界的 值,默认为 `-998.0`。
**方法索引**
- [`__init__`](#geometrylist---init--)
### `GeometryList.__init__` {#geometrylist---init--}
```python
__init__(self, x_coordinates=np.empty(0, dtype=np.double), y_coordinates=np.empty(0, dtype=np.double), values=np.empty(0, dtype=np.double), geometry_separator=-999.0, inner_outer_separator=-998.0)
```
构造实例。源码没有单独编写此构造函数的文档字符串,参数及默认值如下。
**参数**
| 名称 | 类型 | 默认值 | 中文说明 |
| --- | --- | --- | --- |
| `x_coordinates` | `未标注` | `np.empty(0, dtype=np.double)` | 源码未单独提供参数说明。 |
| `y_coordinates` | `未标注` | `np.empty(0, dtype=np.double)` | 源码未单独提供参数说明。 |
| `values` | `未标注` | `np.empty(0, dtype=np.double)` | 源码未单独提供参数说明。 |
| `geometry_separator` | `未标注` | `-999.0` | 源码未单独提供参数说明。 |
| `inner_outer_separator` | `未标注` | `-998.0` | 源码未单独提供参数说明。 |
## `InterpolationParameters` {#interpolationparameters}
继承:`object`。
保存属性插值参数的类。
**属性说明**
- **`interpolation_type`(`int, 可选`)**:要使用的插值类型。
- **`method`(`int, 可选`)**:要使用的平均方法。
- **`absolute_search_radius`(`float, 可选`)**:绝对搜索半径。
- **`relative_search_radius`(`float, 可选`)**:相对搜索半径。
- **`use_closest_if_none_found`(`bool, 可选`)**:若多边形内未找到点,则使用最近的点。
- **`minimum_number_of_samples`(`int, 可选`)**:某些平均方法所需的最少采样点数。
**方法索引**
- [`__init__`](#interpolationparameters---init--)
### `InterpolationParameters.__init__` {#interpolationparameters---init--}
```python
__init__(self, interpolation_type=1, method=1, absolute_search_radius=100.0, relative_search_radius=1.0, use_closest_if_none_found=True, minimum_number_of_samples=10)
```
构造实例。源码没有单独编写此构造函数的文档字符串,参数及默认值如下。
**参数**
| 名称 | 类型 | 默认值 | 中文说明 |
| --- | --- | --- | --- |
| `interpolation_type` | `未标注` | `1` | 源码未单独提供参数说明。 |
| `method` | `未标注` | `1` | 源码未单独提供参数说明。 |
| `absolute_search_radius` | `未标注` | `100.0` | 源码未单独提供参数说明。 |
| `relative_search_radius` | `未标注` | `1.0` | 源码未单独提供参数说明。 |
| `use_closest_if_none_found` | `未标注` | `True` | 源码未单独提供参数说明。 |
| `minimum_number_of_samples` | `未标注` | `10` | 源码未单独提供参数说明。 |
## `OrthogonalizationParameters` {#orthogonalizationparameters}
继承:`object`。
保存正交化参数的类。
**属性说明**
- **`outer_iterations`(`int, 可选`)**:正交化的外层迭代次数。对于复杂网格, 应增大此值。默认为 `2`。
- **`boundary_iterations`(`int, 可选`)**:网格正交化过程中 itatp 内的边界迭代次数。 默认为 `25`。
- **`inner_iterations`(`int, 可选`)**:网格正交化过程中 itbnd 内的内部迭代次数。 默认为 `25`。
- **`orthogonalization_to_smoothing_factor`(`float, 可选`)**:控制网格平滑(0)与网格正交化(1)之间 权重的系数,默认为 `0.975`。
- **`orthogonalization_to_smoothing_factor_at_boundary`(`float, 可选`)**:边界上的最小 ATPF 值。 默认为 `1.0`。
- **`areal_to_angle_smoothing_factor`(`float, 可选`)**:在平滑器(1.0)与面积均匀化(0.0)之间调节的系数。 默认为 `1.0`。
**方法索引**
- [`__init__`](#orthogonalizationparameters---init--)
### `OrthogonalizationParameters.__init__` {#orthogonalizationparameters---init--}
```python
__init__(self, outer_iterations=2, boundary_iterations=25, inner_iterations=25, orthogonalization_to_smoothing_factor=0.975, orthogonalization_to_smoothing_factor_at_boundary=1.0, areal_to_angle_smoothing_factor=1.0)
```
构造实例。源码没有单独编写此构造函数的文档字符串,参数及默认值如下。
**参数**
| 名称 | 类型 | 默认值 | 中文说明 |
| --- | --- | --- | --- |
| `outer_iterations` | `未标注` | `2` | 源码未单独提供参数说明。 |
| `boundary_iterations` | `未标注` | `25` | 源码未单独提供参数说明。 |
| `inner_iterations` | `未标注` | `25` | 源码未单独提供参数说明。 |
| `orthogonalization_to_smoothing_factor` | `未标注` | `0.975` | 源码未单独提供参数说明。 |
| `orthogonalization_to_smoothing_factor_at_boundary` | `未标注` | `1.0` | 源码未单独提供参数说明。 |
| `areal_to_angle_smoothing_factor` | `未标注` | `1.0` | 源码未单独提供参数说明。 |
## `CurvilinearGrid` {#curvilineargrid}
继承:`object`。
此类用于获取和设置曲线网格数据。
**属性说明**
- **`node_x`(`ndarray`)**:描述节点 x 坐标的一维双精度数组。
- **`node_y`(`ndarray`)**:描述节点 y 坐标的一维双精度数组。
- **`num_m`(`int`)**:曲线网格沿 m 方向的节点数。
- **`num_n`(`int`)**:曲线网格沿 n 方向的节点数。
**方法索引**
- [`__init__`](#curvilineargrid---init--)
- [`plot_edges`](#curvilineargrid-plot-edges)
### `CurvilinearGrid.__init__` {#curvilineargrid---init--}
```python
__init__(self, node_x, node_y, num_m, num_n)
```
构造实例。源码没有单独编写此构造函数的文档字符串,参数及默认值如下。
**参数**
| 名称 | 类型 | 默认值 | 中文说明 |
| --- | --- | --- | --- |
| `node_x` | `未标注` | `必填` | 源码未单独提供参数说明。 |
| `node_y` | `未标注` | `必填` | 源码未单独提供参数说明。 |
| `num_m` | `未标注` | `必填` | 源码未单独提供参数说明。 |
| `num_n` | `未标注` | `必填` | 源码未单独提供参数说明。 |
### `CurvilinearGrid.plot_edges` {#curvilineargrid-plot-edges}
```python
plot_edges(self, ax, *args, **kwargs)
```
在指定坐标轴上绘制网格边。 `args` 和 `kwargs` 作为 matplotlib 的 `plot` 方法参数传入。
**参数**
| 名称 | 类型 | 默认值 | 中文说明 |
| --- | --- | --- | --- |
| `ax` | `matplotlib.axes.Axes` | `必填` | 绘制网格边所用的坐标轴对象。 |
| `args` | `未标注` | `不适用` | 可变位置参数。源码未单独提供参数说明。 |
| `kwargs` | `未标注` | `不适用` | 可变关键字参数。源码未单独提供参数说明。 |
## `CurvilinearParameters` {#curvilinearparameters}
继承:`object`。
保存从样条曲线生成曲线网格所需参数的类。
**属性说明**
- **`m_refinement`(`int, 可选`)**:生成规则网格时的 m 方向加密系数,默认为 `2000`。
- **`n_refinement`(`int, 可选`)**:生成规则网格时的 n 方向加密系数,默认为 `40`。
- **`smoothing_iterations`(`int, 可选`)**:规则网格平滑的内部迭代次数,默认为 `25`。
- **`smoothing_parameter`(`float, 可选`)**:平滑参数,默认为 `0.5`。
- **`attraction_parameter`(`float, 可选`)**:吸引/排斥参数,默认为 `0.0`。
**方法索引**
- [`__init__`](#curvilinearparameters---init--)
### `CurvilinearParameters.__init__` {#curvilinearparameters---init--}
```python
__init__(self, m_refinement=2000, n_refinement=40, smoothing_iterations=10, smoothing_parameter=0.5, attraction_parameter=0.0)
```
构造实例。源码没有单独编写此构造函数的文档字符串,参数及默认值如下。
**参数**
| 名称 | 类型 | 默认值 | 中文说明 |
| --- | --- | --- | --- |
| `m_refinement` | `未标注` | `2000` | 源码未单独提供参数说明。 |
| `n_refinement` | `未标注` | `40` | 源码未单独提供参数说明。 |
| `smoothing_iterations` | `未标注` | `10` | 源码未单独提供参数说明。 |
| `smoothing_parameter` | `未标注` | `0.5` | 源码未单独提供参数说明。 |
| `attraction_parameter` | `未标注` | `0.0` | 源码未单独提供参数说明。 |
## `SplinesToCurvilinearParameters` {#splinestocurvilinearparameters}
继承:`object`。
保存使用推进前沿法从样条曲线生成曲线网格 所需附加参数的类。
**属性说明**
- **`aspect_ratio`(`float, 可选`)**:纵横比,默认为 `0.1`。
- **`aspect_ratio_grow_factor`(`float, 可选`)**:纵横比增长系数,默认为 `1.1`。
- **`average_width`(`float, 可选`)**:中心样条曲线上的平均网格宽度,默认为 `0.005`。
- **`curvature_adapted_grid_spacing`(`int, 可选`)**:随曲率调整网格间距的选项,默认为 `1`。
- **`grow_grid_outside`(`int, 可选`)**:是否在指定网格高度之外扩展网格,默认为 `0`。
- **`maximum_num_faces_in_uniform_part`(`int, 可选`)**:均匀部分的最大层数,默认为 `5`。
- **`nodes_on_top_of_each_other_tolerance`(`float, 可选`)**:节点重合判定容差,默认为 `0.0001`。
- **`min_cosine_crossing_angles`(`float, 可选`)**:交叉角余弦绝对值允许的最小值。 默认为 `0.95`。
- **`check_front_collisions`(`int, 可选`)**:是否检查与前沿其他部分的碰撞,默认为 `0`。
- **`remove_skinny_triangles`(`int, 可选`)**:是否检查与前沿其他部分的碰撞,默认为 `1`。(原说明与前一字段重复;字段名称表示移除细长三角形。)
**方法索引**
- [`__init__`](#splinestocurvilinearparameters---init--)
### `SplinesToCurvilinearParameters.__init__` {#splinestocurvilinearparameters---init--}
```python
__init__(self, aspect_ratio=0.1, aspect_ratio_grow_factor=1.1, average_width=500.0, curvature_adapted_grid_spacing=1, grow_grid_outside=False, maximum_num_faces_in_uniform_part=5, nodes_on_top_of_each_other_tolerance=0.0001, min_cosine_crossing_angles=0.95, check_front_collisions=False, remove_skinny_triangles=True)
```
构造实例。源码没有单独编写此构造函数的文档字符串,参数及默认值如下。
**参数**
| 名称 | 类型 | 默认值 | 中文说明 |
| --- | --- | --- | --- |
| `aspect_ratio` | `未标注` | `0.1` | 源码未单独提供参数说明。 |
| `aspect_ratio_grow_factor` | `未标注` | `1.1` | 源码未单独提供参数说明。 |
| `average_width` | `未标注` | `500.0` | 源码未单独提供参数说明。 |
| `curvature_adapted_grid_spacing` | `未标注` | `1` | 源码未单独提供参数说明。 |
| `grow_grid_outside` | `未标注` | `False` | 源码未单独提供参数说明。 |
| `maximum_num_faces_in_uniform_part` | `未标注` | `5` | 源码未单独提供参数说明。 |
| `nodes_on_top_of_each_other_tolerance` | `未标注` | `0.0001` | 源码未单独提供参数说明。 |
| `min_cosine_crossing_angles` | `未标注` | `0.95` | 源码未单独提供参数说明。 |
| `check_front_collisions` | `未标注` | `False` | 源码未单独提供参数说明。 |
| `remove_skinny_triangles` | `未标注` | `True` | 源码未单独提供参数说明。 |
## `MeshRefinementParameters` {#meshrefinementparameters}
继承:`object`。
保存二维网格加密参数的类。
**属性说明**
- **`refine_intersected`(`bool`)**:是否处理与多边形相交的网格面,默认为 `False`。
- **`use_mass_center_when_refining`(`bool`)**:加密过程中划分网格面时, 是否使用质心,默认为 `True`。
- **`min_edge_size`(`float`)**:最小边长,默认为 `0.5`。
- **`refinement_type`(`RefinementType`)**:加密判据类型,默认为 `RefinementType.REFINEMENT_LEVELS`。
- **`connect_hanging_nodes`(`bool`)**:是否在迭代结束时连接悬挂节点,默认为 `True`。
- **`account_for_samples_outside`(`bool`)**:是否考虑网格面外的采样数据,默认为 `False`。
- **`max_refinement_iterations`(`int, 可选`)**:最大加密迭代次数,默认为 `10`。
- **`smoothing_iterations`(`int, 可选`)**:平滑迭代次数,默认为 `5`。
- **`max_courant_time`(`double, 可选`)**:最大库朗时间,单位为秒,默认为 `120`。
- **`directional_refinement`(`bool, 可选`)**:定向加密选项,当平滑迭代次数 大于 0 时不可使用,默认为 `False`。
**方法索引**
- [`__init__`](#meshrefinementparameters---init--)
### `MeshRefinementParameters.__init__` {#meshrefinementparameters---init--}
```python
__init__(self, refine_intersected=False, use_mass_center_when_refining=True, min_edge_size=0.5, refinement_type=RefinementType.REFINEMENT_LEVELS, connect_hanging_nodes=True, account_for_samples_outside_face=False, max_refinement_iterations=10, smoothing_iterations=5, max_courant_time=120.0, directional_refinement=False)
```
构造实例。源码没有单独编写此构造函数的文档字符串,参数及默认值如下。
**参数**
| 名称 | 类型 | 默认值 | 中文说明 |
| --- | --- | --- | --- |
| `refine_intersected` | `未标注` | `False` | 源码未单独提供参数说明。 |
| `use_mass_center_when_refining` | `未标注` | `True` | 源码未单独提供参数说明。 |
| `min_edge_size` | `未标注` | `0.5` | 源码未单独提供参数说明。 |
| `refinement_type` | `未标注` | `RefinementType.REFINEMENT_LEVELS` | 源码未单独提供参数说明。 |
| `connect_hanging_nodes` | `未标注` | `True` | 源码未单独提供参数说明。 |
| `account_for_samples_outside_face` | `未标注` | `False` | 源码未单独提供参数说明。 |
| `max_refinement_iterations` | `未标注` | `10` | 源码未单独提供参数说明。 |
| `smoothing_iterations` | `未标注` | `5` | 源码未单独提供参数说明。 |
| `max_courant_time` | `未标注` | `120.0` | 源码未单独提供参数说明。 |
| `directional_refinement` | `未标注` | `False` | 源码未单独提供参数说明。 |
## `MakeGridParameters` {#makegridparameters}
继承:`object`。
保存以 C 兼容方式创建新曲线网格所需参数的类。
**属性说明**
- **`num_columns`(`int, 可选`)**:x 方向的列数,默认为 `3`。
- **`num_rows`(`int, 可选`)**:y 方向的行数,默认为 `3`。(原文称为列数。)
- **`angle`(`float, 可选`)**:网格角度,默认为 `0.0`。
- **`origin_x`(`float, 可选`)**:左下角原点的 x 坐标。 默认为 `0.0`。
- **`origin_y`(`float, 可选`)**:左下角原点的 y 坐标。 默认为 `0.0`。
- **`block_size_x`(`float, 可选`)**:x 方向的网格块尺寸,仅用于方形网格。 默认为 `10.0`。
- **`block_size_y`(`float, 可选`)**:y 方向的网格块尺寸,仅用于方形网格。 默认为 `10.0`。
- **`upper_right_x`(`float, 可选`)**:右上角的 x 坐标。 默认为 `0.0`。
- **`upper_right_y`(`float, 可选`)**:右上角的 y 坐标。 默认为 `0.0`。
**方法索引**
- [`__init__`](#makegridparameters---init--)
### `MakeGridParameters.__init__` {#makegridparameters---init--}
```python
__init__(self, num_columns=3, num_rows=3, angle=0.0, origin_x=0.0, origin_y=0.0, block_size_x=10.0, block_size_y=10.0, upper_right_x=0.0, upper_right_y=0.0)
```
构造实例。源码没有单独编写此构造函数的文档字符串,参数及默认值如下。
**参数**
| 名称 | 类型 | 默认值 | 中文说明 |
| --- | --- | --- | --- |
| `num_columns` | `未标注` | `3` | 源码未单独提供参数说明。 |
| `num_rows` | `未标注` | `3` | 源码未单独提供参数说明。 |
| `angle` | `未标注` | `0.0` | 源码未单独提供参数说明。 |
| `origin_x` | `未标注` | `0.0` | 源码未单独提供参数说明。 |
| `origin_y` | `未标注` | `0.0` | 源码未单独提供参数说明。 |
| `block_size_x` | `未标注` | `10.0` | 源码未单独提供参数说明。 |
| `block_size_y` | `未标注` | `10.0` | 源码未单独提供参数说明。 |
| `upper_right_x` | `未标注` | `0.0` | 源码未单独提供参数说明。 |
| `upper_right_y` | `未标注` | `0.0` | 源码未单独提供参数说明。 |
## `Mesh1d` {#mesh1d}
继承:`object`。
此类用于获取和设置一维网格数据。
**属性说明**
- **`node_x`(`ndarray`)**:描述节点 x 坐标的一维双精度数组。
- **`node_y`(`ndarray`)**:描述节点 y 坐标的一维双精度数组。
- **`edge_nodes`(`ndarray, 可选`)**:描述每条网格边端点节点的一维整数数组。
**方法索引**
- [`__init__`](#mesh1d---init--)
- [`remove_invalid_values`](#mesh1d-remove-invalid-values)
- [`plot_edges`](#mesh1d-plot-edges)
### `Mesh1d.__init__` {#mesh1d---init--}
```python
__init__(self, node_x, node_y, edge_nodes)
```
构造实例。源码没有单独编写此构造函数的文档字符串,参数及默认值如下。
**参数**
| 名称 | 类型 | 默认值 | 中文说明 |
| --- | --- | --- | --- |
| `node_x` | `未标注` | `必填` | 源码未单独提供参数说明。 |
| `node_y` | `未标注` | `必填` | 源码未单独提供参数说明。 |
| `edge_nodes` | `未标注` | `必填` | 源码未单独提供参数说明。 |
### `Mesh1d.remove_invalid_values` {#mesh1d-remove-invalid-values}
```python
remove_invalid_values(self, float_invalid_value: float)
```
移除数组中可能存在的无效值。
**参数**
| 名称 | 类型 | 默认值 | 中文说明 |
| --- | --- | --- | --- |
| `float_invalid_value` | `float` | `必填` | 浮点无效值。 |
### `Mesh1d.plot_edges` {#mesh1d-plot-edges}
```python
plot_edges(self, ax, *args, **kwargs)
```
在指定坐标轴上绘制网格边。 `args` 和 `kwargs` 作为 matplotlib 的 `plot` 方法参数传入。
**参数**
| 名称 | 类型 | 默认值 | 中文说明 |
| --- | --- | --- | --- |
| `ax` | `matplotlib.axes.Axes` | `必填` | 绘制网格边所用的坐标轴对象。 |
| `args` | `未标注` | `不适用` | 可变位置参数。源码未单独提供参数说明。 |
| `kwargs` | `未标注` | `不适用` | 可变关键字参数。源码未单独提供参数说明。 |
## `Contacts` {#contacts}
继承:`object`。
此类描述一维与二维网格之间的连接。
**属性说明**
- **`mesh1d_indices`(`ndarray`)**:描述一维网格节点索引的一维整数数组。
- **`mesh2d_indices`(`ndarray`)**:描述二维网格面索引的一维整数数组。
**方法索引**
- [`__init__`](#contacts---init--)
- [`remove_invalid_values`](#contacts-remove-invalid-values)
- [`plot_edges`](#contacts-plot-edges)
### `Contacts.__init__` {#contacts---init--}
```python
__init__(self, mesh1d_indices, mesh2d_indices)
```
构造实例。源码没有单独编写此构造函数的文档字符串,参数及默认值如下。
**参数**
| 名称 | 类型 | 默认值 | 中文说明 |
| --- | --- | --- | --- |
| `mesh1d_indices` | `未标注` | `必填` | 源码未单独提供参数说明。 |
| `mesh2d_indices` | `未标注` | `必填` | 源码未单独提供参数说明。 |
### `Contacts.remove_invalid_values` {#contacts-remove-invalid-values}
```python
remove_invalid_values(self, int_invalid_value: int)
```
移除数组中可能存在的无效值。 同时移除其他数组中对应的条目。
**参数**
| 名称 | 类型 | 默认值 | 中文说明 |
| --- | --- | --- | --- |
| `int_invalid_value` | `int` | `必填` | 整数无效值。 |
### `Contacts.plot_edges` {#contacts-plot-edges}
```python
plot_edges(self, ax, mesh1d, mesh2d, *args, **kwargs)
```
在指定坐标轴上绘制网格边。 `args` 和 `kwargs` 作为 matplotlib 的 `plot` 方法参数传入。
**参数**
| 名称 | 类型 | 默认值 | 中文说明 |
| --- | --- | --- | --- |
| `ax` | `matplotlib.axes.Axes` | `必填` | 绘制网格边所用的坐标轴对象。 |
| `mesh1d` | `Mesh1d` | `必填` | 绘制连接所用的一维网格实例。 |
| `mesh2d` | `Mesh2d` | `必填` | 绘制连接所用的二维网格实例。 |
| `args` | `未标注` | `不适用` | 可变位置参数。源码未单独提供参数说明。 |
| `kwargs` | `未标注` | `不适用` | 可变关键字参数。源码未单独提供参数说明。 |
## `GriddedSamples` {#griddedsamples}
继承:`object`。
保存均匀或非均匀网格采样数据的类。
**属性说明**
- **`num_x`(`int, 可选`)**:x 方向的采样坐标数,采样网格点数为 num_x × num_y。 默认为 `0`。
- **`num_y`(`int, 可选`)**:y 方向的采样坐标数,采样网格点数为 num_x × num_y。 默认为 `0`。
- **`x_origin`(`float, 可选`)**:采样网格原点的 x 坐标,默认为 `0.0`。
- **`y_origin`(`float, 可选`)**:采样网格原点的 y 坐标,默认为 `0.0`。
- **`cell_size`(`float, 可选`)**:固定的采样网格边长,默认为 `0.0`。
- **`x_coordinates`(`ndarray, 可选`)**:x 方向非均匀网格间距对应的坐标。
- **`y_coordinates`(`ndarray, 可选`)**:y 方向非均匀网格间距对应的坐标。
- **`values`(`ndarray`)**:采样值。
**方法索引**
- [`__init__`](#griddedsamples---init--)
### `GriddedSamples.__init__` {#griddedsamples---init--}
```python
__init__(self, num_x=0, num_y=0, x_origin=0.0, y_origin=0.0, cell_size=0.0, x_coordinates=np.empty(0, dtype=np.double), y_coordinates=np.empty(0, dtype=np.double), values=np.empty(0, dtype=np.float32))
```
构造实例。源码没有单独编写此构造函数的文档字符串,参数及默认值如下。
**参数**
| 名称 | 类型 | 默认值 | 中文说明 |
| --- | --- | --- | --- |
| `num_x` | `未标注` | `0` | 源码未单独提供参数说明。 |
| `num_y` | `未标注` | `0` | 源码未单独提供参数说明。 |
| `x_origin` | `未标注` | `0.0` | 源码未单独提供参数说明。 |
| `y_origin` | `未标注` | `0.0` | 源码未单独提供参数说明。 |
| `cell_size` | `未标注` | `0.0` | 源码未单独提供参数说明。 |
| `x_coordinates` | `未标注` | `np.empty(0, dtype=np.double)` | 源码未单独提供参数说明。 |
| `y_coordinates` | `未标注` | `np.empty(0, dtype=np.double)` | 源码未单独提供参数说明。 |
| `values` | `未标注` | `np.empty(0, dtype=np.float32)` | 源码未单独提供参数说明。 |
## `CurvilinearDirection` {#curvilineardirection}
继承:`IntEnum`。
曲线网格算法使用的方向。
**枚举成员**
| 名称 | 值 | 中文说明 |
| --- | --- | --- |
| `M` | `0` | 沿 m 方向。 |
| `N` | `1` | 沿 n 方向。 |