Skip to content

Commit

Permalink
[Fea] Support for SDFMesh based on warp-lang (#1009)
Browse files Browse the repository at this point in the history
* Support for SDFMesh based on warp-lang

* refine SDFMesh

* Fix direction of sdf derivative

* update related content in doc

* fix CI

* fix document

* Fix stl import error

* update
  • Loading branch information
HydrogenSulfate authored Nov 6, 2024
1 parent cf80482 commit 645e438
Show file tree
Hide file tree
Showing 6 changed files with 862 additions and 10 deletions.
1 change: 1 addition & 0 deletions docs/zh/api/geometry.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- Hypersphere
- Interval
- Mesh
- SDFMesh
- PointCloud
- Polygon
- Rectangle
Expand Down
13 changes: 10 additions & 3 deletions docs/zh/install_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,17 @@

#### 1.4.2 安装额外功能[可选]

如需使用 `.obj`, `.ply`, `.off`, `.stl`, `.mesh`, `.node`, `.poly` and `.msh` 等复杂几何文件构建几何(计算域),以及使用加密采样等功能,则需按照下方给出的命令,安装 open3d、
pybind11、pysdf、PyMesh 四个依赖库(上述**1.1 从 docker 镜像启动**中已安装上述依赖库)。
PaddleScience 提供了两种复杂几何类型,如下所示:

否则无法使用 `ppsci.geometry.Mesh` 等基于复杂几何文件的 API,因此也无法运行如 [Aneurysm](./examples/aneurysm.md) 等依赖 `ppsci.geometry.Mesh` API 的复杂案例。
| API 名称 | 支持文件类型 | 安装方式 | 使用方式 |
| -- | -- | -- | -- |
|[`ppsci.geometry.Mesh`](./api/geometry.md#ppsci.geometry.Mesh) | `.obj`, `.ply`, `.off`, `.stl`, `.mesh`, `.node`, `.poly` and `.msh`| 参考下方的 "PyMesh 安装命令"| `ppsci.geometry.Mesh(mesh_path)`|
|[`ppsci.geometry.SDFMesh`](./api/geometry.md#ppsci.geometry.SDFMesh "实验性功能") | `.stl` | `pip install warp-lang 'numpy-stl>=2.16,<2.17'` | `ppsci.geometry.SDFMesh.from_stl(stl_path)` |

!!! warning "相关案例运行说明"

[Bracket](./examples/aneurysm.md)、[Aneurysm](./examples/aneurysm.md) 等个别案例使用了 `ppsci.geometry.Mesh` 接口构建复杂几何,因此这些案例运行前需要按照下方给出的命令,安装 open3d、
pybind11、pysdf、PyMesh 四个依赖库(上述**1.1 从 docker 镜像启动**中已安装上述依赖库)。如使用 `ppsci.geometry.SDFMesh` 接口构建复杂几何,则只需要安装 `warp-lang` 即可。

=== "open3d 安装命令"

Expand Down
2 changes: 2 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ theme:
- content.tabs.link
- content.action.edit
- content.action.view
- content.tooltips
icon:
edit: material/pencil
view: material/eye
Expand Down Expand Up @@ -209,6 +210,7 @@ plugins:

# Extensions
markdown_extensions:
- abbr
- pymdownx.critic
- pymdownx.highlight:
anchor_linenums: true
Expand Down
2 changes: 2 additions & 0 deletions ppsci/geometry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from ppsci.geometry.geometry_nd import Hypercube
from ppsci.geometry.geometry_nd import Hypersphere
from ppsci.geometry.mesh import Mesh
from ppsci.geometry.mesh import SDFMesh
from ppsci.geometry.pointcloud import PointCloud
from ppsci.geometry.timedomain import TimeDomain
from ppsci.geometry.timedomain import TimeXGeometry
Expand All @@ -40,6 +41,7 @@
"Hypersphere",
"Interval",
"Mesh",
"SDFMesh",
"Polygon",
"Rectangle",
"Sphere",
Expand Down
Loading

0 comments on commit 645e438

Please sign in to comment.