Skip to content

Commit

Permalink
Merge branch 'main' into feat/add-delaunay-class
Browse files Browse the repository at this point in the history
  • Loading branch information
tkoyama010 authored Aug 11, 2024
2 parents 8643b93 + de5b189 commit 8870735
Show file tree
Hide file tree
Showing 13 changed files with 72 additions and 104 deletions.
11 changes: 10 additions & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"files": [
"README.md"
"CONTRIBUTORS.md"
],
"imageSize": 100,
"commit": false,
Expand Down Expand Up @@ -42,6 +42,15 @@
"contributions": [
"maintenance"
]
},
{
"login": "dependabot",
"name": "Dependabot",
"avatar_url": "https://avatars.githubusercontent.com/u/27347476?v=4",
"profile": "https://github.com/features/security",
"contributions": [
"maintenance"
]
}
],
"contributorsPerLine": 7,
Expand Down
14 changes: 1 addition & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ ci:
autofix_prs: true
autoupdate_schedule: weekly
repos:
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.4.2
hooks:
- id: black
- repo: https://github.com/adamchainz/blacken-docs
rev: 1.18.0
hooks:
Expand All @@ -16,10 +12,6 @@ repos:
rev: 0.29.1
hooks:
- id: check-github-workflows
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
Expand Down Expand Up @@ -57,11 +49,6 @@ repos:
hooks:
- id: prettier
types_or: [yaml, markdown, html, css, scss, javascript, json, toml]
- repo: https://github.com/asottile/pyupgrade
rev: v3.17.0
hooks:
- id: pyupgrade
args: [--py39-plus, --keep-runtime-typing]
- repo: https://github.com/DanielNoord/pydocstringformatter
rev: v0.7.3
hooks:
Expand All @@ -83,6 +70,7 @@ repos:
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
- id: ruff-format
- repo: https://github.com/scientific-python/cookie
rev: 2024.04.23
hooks:
Expand Down
22 changes: 0 additions & 22 deletions AUTHORS.md

This file was deleted.

18 changes: 6 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ question, concern, feature request, or desire to contribute.
## Being Respectful

[![Contributor
Covenant](https://img.shields.io/badge/contributor%20covenant-2.1-4baaaa.svg?style=for-the-badge)](CODE_OF_CONDUCT.md)
Covenant](https://img.shields.io/badge/contributor%20covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md)

Please demonstrate empathy and kindness toward other people, other
software, and the communities who have worked diligently to build
Expand Down Expand Up @@ -140,7 +140,7 @@ original author to relicense the code.

## Development Practices

[![Nox](https://img.shields.io/badge/%F0%9F%A6%8A-Nox-D85E00.svg?style=for-the-badge)](https://github.com/wntrblm/nox)
[![Nox](https://img.shields.io/badge/%F0%9F%A6%8A-Nox-D85E00.svg)](https://github.com/wntrblm/nox)

This section provides a guide to how we conduct development in the
scikit-gmsh repository. Please follow the practices outlined here when
Expand Down Expand Up @@ -202,19 +202,15 @@ section](#creating-a-new-pull-request).

#### Coding Style

[![Code style:
black](https://img.shields.io/badge/code%20style-black-000000.svg?style=for-the-badge)](https://github.com/psf/black)
[![Imports:
isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=for-the-badge&labelColor=ef8336)](https://pycqa.github.io/isort/)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json&style=for-the-badge)](https://github.com/astral-sh/ruff)
[![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)
[![code style:
prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=for-the-badge)](https://github.com/prettier/prettier)
prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)

We adhere to [PEP 8](https://www.python.org/dev/peps/pep-0008/) wherever
possible, except that line widths are permitted to go beyond 79
characters to a max of 99 characters for code. This should tend to be
the exception rather than the norm. A uniform code style is enforced by
[black](https://github.com/psf/black) to prevent energy wasted on style
[Ruff](https://github.com/astral-sh/ruff) to prevent energy wasted on style
disagreements.

As for docstrings, scikit-gmsh follows the `numpydoc` style for its
Expand Down Expand Up @@ -555,9 +551,7 @@ style requirements:

$ pre-commit install
$ git commit -m "added my cool feature"
black....................................................................Passed
isort....................................................................Passed
flake8...................................................................Passed
ruff.....................................................................Passed
codespell................................................................Passed

The actual installation of the environment happens before the first
Expand Down
22 changes: 22 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tbody>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://allcontributors.org"><img src="https://avatars.githubusercontent.com/u/46410174?v=4?s=100" width="100px;" alt="All Contributors"/><br /><sub><b>All Contributors</b></sub></a><br /><a href="https://github.com/pyvista/scikit-gmsh/commits?author=all-contributors" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/features/security"><img src="https://avatars.githubusercontent.com/u/27347476?v=4?s=100" width="100px;" alt="Dependabot"/><br /><sub><b>Dependabot</b></sub></a><br /><a href="#maintenance-dependabot" title="Maintenance">🚧</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/tkoyama010"><img src="https://avatars.githubusercontent.com/u/7513610?v=4?s=100" width="100px;" alt="Tetsuo Koyama"/><br /><sub><b>Tetsuo Koyama</b></sub></a><br /><a href="#infra-tkoyama010" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://github.com/pyvista/scikit-gmsh/commits?author=tkoyama010" title="Tests">⚠️</a> <a href="https://github.com/pyvista/scikit-gmsh/commits?author=tkoyama010" title="Code">💻</a> <a href="#ideas-tkoyama010" title="Ideas, Planning, & Feedback">🤔</a> <a href="#maintenance-tkoyama010" title="Maintenance">🚧</a> <a href="https://github.com/pyvista/scikit-gmsh/issues?q=author%3Atkoyama010" title="Bug reports">🐛</a> <a href="https://github.com/pyvista/scikit-gmsh/commits?author=tkoyama010" title="Documentation">📖</a> <a href="#design-tkoyama010" title="Design">🎨</a> <a href="https://github.com/pyvista/scikit-gmsh/pulls?q=is%3Apr+reviewed-by%3Atkoyama010" title="Reviewed Pull Requests">👀</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://pre-commit.ci"><img src="https://avatars.githubusercontent.com/u/64617429?v=4?s=100" width="100px;" alt="pre-commit.ci"/><br /><sub><b>pre-commit.ci</b></sub></a><br /><a href="#maintenance-pre-commit-ci" title="Maintenance">🚧</a></td>
</tr>
</tbody>
</table>

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
42 changes: 6 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,9 @@

> Scikit for Gmsh to generate 3D finite element mesh.
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->

[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors-)

<!-- ALL-CONTRIBUTORS-BADGE:END -->

[![Contributing](https://img.shields.io/badge/PR-Welcome-%23FF8300.svg?style=flat-square)](https://github.com/pyvista/scikit-gmsh/issues)
[![GitHub Repo stars](https://img.shields.io/github/stars/pyvista/scikit-gmsh?style=flat-square)](https://github.com/pyvista/scikit-gmsh/stargazers)
[![All Contributors](https://img.shields.io/github/all-contributors/pyvista/scikit-gmsh?color=ee8449)](https://scikit-gmsh.readthedocs.io/en/latest/reference/about.html#contributors)
[![Contributing](https://img.shields.io/badge/PR-Welcome-%23FF8300.svg)](https://github.com/pyvista/scikit-gmsh/issues)
[![GitHub Repo stars](https://img.shields.io/github/stars/pyvista/scikit-gmsh)](https://github.com/pyvista/scikit-gmsh/stargazers)

Contributions are _very welcome_ .
This project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md).
Expand All @@ -28,22 +23,21 @@ Enjoying scikit-gmsh? Show your support with a [GitHub star](https://github.com/

## Table of Contents

[![Documentation Status](https://readthedocs.org/projects/scikit-gmsh/badge/?version=latest&style=flat-square)](https://scikit-gmsh.readthedocs.io/en/latest/?badge=latest)
[![Documentation Status](https://readthedocs.org/projects/scikit-gmsh/badge/?version=latest)](https://scikit-gmsh.readthedocs.io/en/latest/?badge=latest)

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

- [Installation](#installation)
- [Usage](#usage)
- [License](#license)
- [Contributors ✨](#contributors-)
- [Star History](#star-history)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

## Installation

[![pypi](https://img.shields.io/pypi/v/scikit-gmsh?style=flat-square&label=pypi&logo=python&logoColor=white)](https://pypi.org/project/scikit-gmsh/)
[![pypi](https://img.shields.io/pypi/v/scikit-gmsh?label=pypi&logo=python&logoColor=white)](https://pypi.org/project/scikit-gmsh/)

```shell
pip install scikit-gmsh
Expand Down Expand Up @@ -127,34 +121,10 @@ clipped = mesh.clip(origin=(0.0, 0.0, 0.0), normal=(0.0, 0.0, 1.0), crinkle=True

## License

[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg?style=flat-square)](https://www.gnu.org/licenses/gpl-3.0)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)

This software is published under the [GPLv3 license](https://www.gnu.org/licenses/gpl-3.0.en.html).

## Contributors ✨

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tbody>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/tkoyama010"><img src="https://avatars.githubusercontent.com/u/7513610?v=4?s=100" width="100px;" alt="Tetsuo Koyama"/><br /><sub><b>Tetsuo Koyama</b></sub></a><br /><a href="#infra-tkoyama010" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://github.com/pyvista/scikit-gmsh/commits?author=tkoyama010" title="Tests">⚠️</a> <a href="https://github.com/pyvista/scikit-gmsh/commits?author=tkoyama010" title="Code">💻</a> <a href="#ideas-tkoyama010" title="Ideas, Planning, & Feedback">🤔</a> <a href="#maintenance-tkoyama010" title="Maintenance">🚧</a> <a href="https://github.com/pyvista/scikit-gmsh/issues?q=author%3Atkoyama010" title="Bug reports">🐛</a> <a href="https://github.com/pyvista/scikit-gmsh/commits?author=tkoyama010" title="Documentation">📖</a> <a href="#design-tkoyama010" title="Design">🎨</a> <a href="https://github.com/pyvista/scikit-gmsh/pulls?q=is%3Apr+reviewed-by%3Atkoyama010" title="Reviewed Pull Requests">👀</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://allcontributors.org"><img src="https://avatars.githubusercontent.com/u/46410174?v=4?s=100" width="100px;" alt="All Contributors"/><br /><sub><b>All Contributors</b></sub></a><br /><a href="https://github.com/pyvista/scikit-gmsh/commits?author=all-contributors" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://pre-commit.ci"><img src="https://avatars.githubusercontent.com/u/64617429?v=4?s=100" width="100px;" alt="pre-commit.ci"/><br /><sub><b>pre-commit.ci</b></sub></a><br /><a href="#maintenance-pre-commit-ci" title="Maintenance">🚧</a></td>
</tr>
</tbody>
</table>

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!

## Star History

[![Star History Chart](https://api.star-history.com/svg?repos=pyvista/scikit-gmsh&type=Date)](https://star-history.com/#pyvista/scikit-gmsh&Date)
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from __future__ import annotations

import datetime
import os
from importlib.metadata import version as get_version
import os
from pathlib import Path

# -- Project information -----------------------------------------------------
Expand Down
5 changes: 5 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ We've marked content with a 🚧 to indicate that it's still under construction.
## 🚧 Overview

The `sikit-gmsh` package provides a simple interface to the `gmsh` library.

## Contributors

:::{include} ../CONTRIBUTORS.md
:parser: myst_parser.sphinx
5 changes: 3 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
"""Automation using nox."""

from __future__ import annotations

import nox


@nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12"])
@nox.session(python=["3.9", "3.10", "3.11", "3.12"])
def tests(session: nox.Session) -> None:
"""Run the unit and regular tests."""
session.install(".[test]")
session.run("pip", "install", "-r", "requirements_test.txt", *session.posargs)
session.run("pytest", *session.posargs)
9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,21 @@ ignore = [
]

[tool.ruff.lint.isort]
# Sort by name, don't cluster "from" vs "import"
force-sort-within-sections = true
# Combines "as" imports on the same line
combine-as-imports = true
required-imports = ["from __future__ import annotations"]
force-single-line = true

[tool.ruff.lint.per-file-ignores]
"docs/**" = ["INP001"]
"tests/**" = ["INP001", "S101"]

[tool.ruff.lint.pyupgrade]
# Preserve types, even if a file imports `from __future__ import annotations`.
keep-runtime-typing = true

[tool.setuptools.dynamic]
version = {attr = 'skgmsh.__version__'}
readme = {file = "README.md", content-type = "text/markdown"}
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""scikit-gmsh setuptools packaging."""

from __future__ import annotations

from pathlib import Path

from setuptools import setup
Expand Down
16 changes: 5 additions & 11 deletions src/skgmsh/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
from typing import TYPE_CHECKING

import gmsh
from pygmsh.helpers import extract_to_meshio
import pyvista as pv
import scooby
from pygmsh.helpers import extract_to_meshio

if TYPE_CHECKING:
from collections.abc import Sequence
Expand Down Expand Up @@ -45,9 +45,7 @@ class Report(scooby.Report): # type: ignore[misc]
"""

def __init__(
self: Report, ncol: int = 3, text_width: int = 80
) -> None: # numpydoc ignore=PR01
def __init__(self: Report, ncol: int = 3, text_width: int = 80) -> None: # numpydoc ignore=PR01
"""Generate a :class:`scooby.Report` instance."""
# mandatory packages
core: list[str] = [
Expand Down Expand Up @@ -148,9 +146,7 @@ def delaunay_3d(
gmsh.model.geo.add_line(face[1] + 1, face[2] + 1, i * 4 + 1)
gmsh.model.geo.add_line(face[2] + 1, face[3] + 1, i * 4 + 2)
gmsh.model.geo.add_line(face[3] + 1, face[0] + 1, i * 4 + 3)
gmsh.model.geo.add_curve_loop(
[i * 4 + 0, i * 4 + 1, i * 4 + 2, i * 4 + 3], i + 1
)
gmsh.model.geo.add_curve_loop([i * 4 + 0, i * 4 + 1, i * 4 + 2, i * 4 + 3], i + 1)
gmsh.model.geo.add_plane_surface([i + 1], i + 1)
gmsh.model.geo.remove_all_duplicates()
gmsh.model.geo.synchronize()
Expand Down Expand Up @@ -231,10 +227,8 @@ def frontal_delaunay_2d(
target_sizes = [target_sizes] * edge_source.number_of_points

embedded_points = []
for i, (target_size, point) in enumerate(zip(target_sizes, points)):
id_ = i + 1
gmsh.model.geo.add_point(point[0], point[1], point[2], target_size, id_)
embedded_points.append(id_)
for target_size, point in zip(target_sizes, points):
embedded_points.append(gmsh.model.geo.add_point(point[0], point[1], point[2], target_size))

for i in range(lines[0] - 1):
id_ = i + 1
Expand Down
8 changes: 2 additions & 6 deletions tests/test_skgmsh.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ def test_frontal_delaunay_2d_recombine() -> None:

@pytest.mark.parametrize("edge_source", EDGE_SOURCES)
@pytest.mark.parametrize("target_sizes", [2.0, [1.0, 2.0, 3.0, 4.0]])
def test_frontal_delaunay_2d(
edge_source: pv.Polygon, target_sizes: float | Sequence[float]
) -> None:
def test_frontal_delaunay_2d(edge_source: pv.Polygon, target_sizes: float | Sequence[float]) -> None:
"""Frontal-Delaunay 2D mesh algorithm test code."""
mesh = sg.frontal_delaunay_2d(edge_source, target_sizes=target_sizes)
assert mesh.number_of_points > edge_source.number_of_points
Expand All @@ -57,9 +55,7 @@ def test_frontal_delaunay_2d(
# https://github.com/pyvista/scikit-gmsh/pull/125


@pytest.mark.parametrize(
"target_sizes", [0.5, [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]]
)
@pytest.mark.parametrize("target_sizes", [0.5, [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]])
def test_delaunay_3d(target_sizes: float | Sequence[float]) -> None:
"""Delaunay 3D mesh algorithm test code."""
edge_source = pv.Cube()
Expand Down

0 comments on commit 8870735

Please sign in to comment.