Skip to content

Commit

Permalink
Merge branch 'main' into doc/paper-draft
Browse files Browse the repository at this point in the history
  • Loading branch information
tkoyama010 authored Jan 24, 2024
2 parents fe7a3f0 + 9ecfcea commit 8c8b4ce
Show file tree
Hide file tree
Showing 11 changed files with 102 additions and 47 deletions.
27 changes: 27 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
documentation:
- any:
- changed-files:
- any-glob-to-any-file: "docs/**/*"
- any-glob-to-any-file: "examples/**/*"
- any-glob-to-any-file: "examples_trame/**/*"
- any-glob-to-any-file: "./*.md"
maintenance:
- any:
- changed-files:
- any-glob-to-any-file: ".github/**/*"
- any-glob-to-any-file: "codecov.yml"
- any-glob-to-any-file: ".flake8"
- any-glob-to-any-file: "Makefile"
- any-glob-to-any-file: "pyproject.toml"
- any-glob-to-any-file: ".pre-commit-config.yaml"
dependencies:
- any:
- changed-files:
- any-glob-to-any-file: "requirements*"
- any-glob-to-any-file: "environment.yml"
- any-glob-to-any-file: ".pre-commit-config.yaml"
docker:
- any:
- changed-files:
- any-glob-to-any-file: "docker/**/*"
- any-glob-to-any-file: ".dockerignore"
File renamed without changes.
12 changes: 12 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: "Pull Request Labeler"
on:
- pull_request_target

jobs:
labeler:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5
2 changes: 1 addition & 1 deletion .github/workflows/testing-and-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repos:
- id: numpydoc-validation
files: ^src/pvgmsh/
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.13
rev: v0.1.14
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
Expand Down Expand Up @@ -66,7 +66,7 @@ repos:
- id: rst-directive-colons
- id: rst-inline-touching-normal
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.1.0"
rev: "v4.0.0-alpha.8"
hooks:
- id: prettier
types_or: [yaml, markdown, html, css, scss, javascript, json]
44 changes: 35 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ PyVista accessors for Gmsh to generate 3D finite element mesh.

[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![Documentation Status](https://readthedocs.org/projects/pvgmsh/badge/?version=latest)](https://pvgmsh.readthedocs.io/en/latest/?badge=latest)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/pyvista/pvgmsh/main.svg)](https://results.pre-commit.ci/latest/github/pyvista/pvgmsh/main)
[![NEP29](https://raster.shields.io/badge/follows-NEP29-orange.png)](https://numpy.org/neps/nep-0029-deprecation_policy.html)

## Motivation

Expand Down Expand Up @@ -42,18 +44,31 @@ To visualize the model we can use PyVista.

```python
plotter = pv.Plotter()
_ = plotter.add_mesh(mesh, show_edges=True, line_width=4, color="white", lighting=False)
_ = plotter.add_mesh(edge_source, show_edges=True, line_width=4, color="red")
_ = plotter.add_points(edge_source.points, style="points", point_size=20, color="red")
_ = plotter.add_mesh(
mesh,
show_edges=True,
line_width=4,
color="white",
lighting=False,
edge_color=[153, 153, 153],
)
_ = plotter.add_mesh(edge_source, show_edges=True, line_width=4, color=[214, 39, 40])
_ = plotter.add_points(
edge_source.points, style="points", point_size=20, color=[214, 39, 40]
)
_ = plotter.add_legend(
[[" source", "red"], [" mesh ", "black"]], bcolor="white", face="r"
[[" edge source", [214, 39, 40]], [" mesh ", [153, 153, 153]]],
bcolor="white",
face="r",
)
plotter.show(cpos="xy")
```

</details>

![frontal_delaunay_2d_01](https://github.com/pyvista/pvgmsh/raw/main/frontal_delaunay_2d_01.png)
<h1 align="center">
<img src="https://github.com/pyvista/pvgmsh/raw/main/frontal_delaunay_2d_01.png" width="500">
</h1>

We can also generate a 3D mesh.

Expand All @@ -67,9 +82,18 @@ mesh = pm.delaunay_3d(edge_source, target_size=0.5)

```python
plotter = pv.Plotter()
_ = plotter.add_mesh(mesh, show_edges=True, line_width=4, color="white", lighting=False)
_ = plotter.add_mesh(edge_source.extract_all_edges(), line_width=4, color="red")
_ = plotter.add_points(edge_source.points, style="points", point_size=20, color="red")
_ = plotter.add_mesh(
mesh,
show_edges=True,
line_width=4,
color="white",
lighting=False,
edge_color=[153, 153, 153],
)
_ = plotter.add_mesh(edge_source.extract_all_edges(), line_width=4, color=[214, 39, 40])
_ = plotter.add_points(
edge_source.points, style="points", point_size=20, color=[214, 39, 40]
)
plotter.enable_parallel_projection()
_ = plotter.add_axes(
box=True,
Expand All @@ -86,4 +110,6 @@ plotter.show()

</details>

![delaunay_3d_01](https://github.com/pyvista/pvgmsh/raw/main/delaunay_3d_01.png)
<h1 align="center">
<img src="https://github.com/pyvista/pvgmsh/raw/main/delaunay_3d_01.png" width="500">
</h1>
8 changes: 4 additions & 4 deletions branding/logo/logomark/pvgmsh_logo_icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified delaunay_3d_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontal_delaunay_2d_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 21 additions & 11 deletions src/pvgmsh/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@
import pyvista as pv
from pygmsh.helpers import extract_to_meshio

from pvgmsh._version import __version__ # noqa: F401

INITIAL_MESH_ONLY_2D = 3
FRONTAL_DELAUNAY_2D = 6
DELAUNAY_3D = 1

# major, minor, patch
version_info = 0, 0, "dev0"

# Nice string for the version
__version__ = ".".join(map(str, version_info))


def frontal_delaunay_2d(
edge_source: pv.PolyData,
Expand Down Expand Up @@ -62,10 +66,10 @@ def frontal_delaunay_2d(
N Arrays: 0
>>> plotter = pv.Plotter(off_screen=True)
>>> _ = plotter.add_mesh(mesh, show_edges=True, line_width=2, color="white", lighting=False)
>>> _ = plotter.add_mesh(edge_source, show_edges=True, line_width=4, color="red")
>>> _ = plotter.add_points(edge_source.points, style="points", point_size=20, color="red")
>>> _ = plotter.add_legend([[" source", "red"], [" mesh ", "black"]], bcolor="white", face="r")
>>> _ = plotter.add_mesh(mesh, show_edges=True, line_width=4, color="white", lighting=False, edge_color=[153, 153, 153])
>>> _ = plotter.add_mesh(edge_source, show_edges=True, line_width=4, color=[214, 39, 40])
>>> _ = plotter.add_points(edge_source.points, style="points", point_size=20, color=[214, 39, 40])
>>> _ = plotter.add_legend([[" edge source", [214, 39, 40]], [" mesh ", [153, 153, 153]]], bcolor="white", face="r")
>>> plotter.show(cpos="xy", screenshot="frontal_delaunay_2d_01.png")
"""
points = edge_source.points
Expand Down Expand Up @@ -143,13 +147,19 @@ def delaunay_3d(
N Arrays: 0
>>> plotter = pv.Plotter(off_screen=True)
>>> _ = plotter.add_mesh(mesh, show_edges=True, line_width=4, color="white", lighting=False)
>>> _ = plotter.add_mesh(edge_source.extract_all_edges(), line_width=8, color="red")
>>> _ = plotter.add_points(edge_source.points, style="points", point_size=40, color="red")
>>> plotter.enable_anti_aliasing()
>>> _ = plotter.add_mesh(mesh, show_edges=True, line_width=4, color="white", lighting=False, edge_color=[153, 153, 153])
>>> _ = plotter.add_mesh(edge_source.extract_all_edges(), line_width=4, color=[214, 39, 40])
>>> _ = plotter.add_points(edge_source.points, style="points", point_size=20, color=[214, 39, 40])
>>> plotter.enable_parallel_projection()
>>> _ = plotter.add_axes(
... box=True, box_args={"opacity": 0.5, "color_box": True, "x_face_color": "white", "y_face_color": "white", "z_face_color": "white"}
... box=True,
... box_args={
... "opacity": 0.5,
... "color_box": True,
... "x_face_color": "white",
... "y_face_color": "white",
... "z_face_color": "white",
... },
... )
>>> plotter.show(screenshot="delaunay_3d_01.png")
"""
Expand Down
20 changes: 0 additions & 20 deletions src/pvgmsh/_version.py

This file was deleted.

0 comments on commit 8c8b4ce

Please sign in to comment.