Skip to content
Open
1 change: 1 addition & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ build:
apt_packages:
- libfltk1.3-dev
- libfreetype6-dev
- libgeos-dev
- libgl1-mesa-dev
- libglu1
- libocct-data-exchange-dev
Expand Down
30 changes: 30 additions & 0 deletions docs/_templates/class.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{{ fullname | escape | underline}}

.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}
:members:
:show-inheritance:
:inherited-members:

{% block methods %}
{% if methods %}
.. rubric:: {{ _('Methods') }}

.. autosummary::
{% for item in methods %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block attributes %}
{% if attributes %}
.. rubric:: {{ _('Attributes') }}

.. autosummary::
{% for item in attributes %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
5 changes: 5 additions & 0 deletions docs/_templates/function.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{{ fullname | escape | underline}}

.. currentmodule:: {{ module }}

.. autofunction:: {{ objname }}
55 changes: 55 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# API Reference

This page provides the full API reference for scikit-gmsh.

## Overview

scikit-gmsh provides a Python interface to the Gmsh mesh generator, offering both object-oriented and functional APIs for 2D and 3D mesh generation. The library integrates seamlessly with PyVista and supports Shapely geometries.

## Main Classes

```{eval-rst}
.. autosummary::
:toctree: generated/
:template: class.rst

skgmsh.Delaunay2D
skgmsh.Delaunay3D
```

## Functions

```{eval-rst}
.. autosummary::
:toctree: generated/
:template: function.rst

skgmsh.delaunay_3d
skgmsh.frontal_delaunay_2d
skgmsh.generate_mesh
```

## Utility Classes

```{eval-rst}
.. autosummary::
:toctree: generated/
:template: class.rst

skgmsh.Report
```

## Constants

The following constants are available for mesh algorithm configuration:

```{eval-rst}
.. autodata:: skgmsh.INITIAL_MESH_ONLY_2D
.. autodata:: skgmsh.FRONTAL_DELAUNAY_2D
.. autodata:: skgmsh.DELAUNAY_3D
.. autodata:: skgmsh.INITIAL_MESH_ONLY_3D
.. autodata:: skgmsh.SILENT
.. autodata:: skgmsh.SIMPLE
.. autodata:: skgmsh.TRUE
.. autodata:: skgmsh.FALSE
```
131 changes: 108 additions & 23 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,44 @@
from importlib.metadata import version as get_version
import os
from pathlib import Path
import sys

# Add the package to the Python path
sys.path.insert(0, str(Path(__file__).parent.parent / "src"))

# Mock imports for documentation building
autodoc_mock_imports = [
"gmsh",
"scooby",
"numpy",
"shapely",
"pyvista",
"numpy.typing",
"shapely.geometry",
"pyvista.plotting.utilities.sphinx_gallery",
]

# Try to import pyvista for gallery setup, but skip if not available
try:
import pyvista
from pyvista.plotting.utilities.sphinx_gallery import DynamicScraper

pyvista.set_error_output_file("errors.txt")
pyvista.OFF_SCREEN = True # Not necessary - simply an insurance policy
pyvista.set_plot_theme("document")
pyvista.BUILDING_GALLERY = True
os.environ["PYVISTA_BUILDING_GALLERY"] = "true"

import pyvista
from pyvista.plotting.utilities.sphinx_gallery import DynamicScraper
if os.environ.get("READTHEDOCS") or os.environ.get("CI"):
pyvista.start_xvfb()

pyvista.set_error_output_file("errors.txt")
pyvista.OFF_SCREEN = True # Not necessary - simply an insurance policy
pyvista.set_plot_theme("document")
pyvista.BUILDING_GALLERY = True
os.environ["PYVISTA_BUILDING_GALLERY"] = "true"
has_pyvista = True
except ImportError:
# Create a mock DynamicScraper for when pyvista is not available
class DynamicScraper:
"""Mock DynamicScraper class for when pyvista is not available."""

if os.environ.get("READTHEDOCS") or os.environ.get("CI"):
pyvista.start_xvfb()
has_pyvista = False

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
Expand Down Expand Up @@ -50,10 +76,67 @@
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = ["myst_parser", "pyvista.ext.plot_directive", "pyvista.ext.viewer_directive", "sphinx_design", "sphinx_gallery.gen_gallery"]
extensions = [
"myst_parser",
"sphinx_design",
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.napoleon",
"sphinx.ext.viewcode",
"sphinx.ext.intersphinx",
]

# Add pyvista extensions and gallery if available
if has_pyvista:
try:
import importlib.util

if importlib.util.find_spec("sphinx_gallery"):
extensions.extend(["pyvista.ext.plot_directive", "pyvista.ext.viewer_directive", "sphinx_gallery.gen_gallery"])
has_gallery = True
else:
has_gallery = False
except ImportError:
has_gallery = False
else:
has_gallery = False
templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# -- Autodoc configuration --------------------------------------------------

autodoc_default_options = {
"members": True,
"member-order": "bysource",
"special-members": "__init__",
"undoc-members": True,
"exclude-members": "__weakref__",
}

autosummary_generate = True
autosummary_imported_members = True

# -- Napoleon settings -------------------------------------------------------
napoleon_google_docstring = True
napoleon_numpy_docstring = True
napoleon_include_init_with_doc = False
napoleon_include_private_with_doc = False
napoleon_include_special_with_doc = True
napoleon_use_admonition_for_examples = False
napoleon_use_admonition_for_notes = False
napoleon_use_admonition_for_references = False
napoleon_use_ivar = False
napoleon_use_param = True
napoleon_use_rtype = True

# -- Intersphinx configuration ----------------------------------------------
intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"numpy": ("https://numpy.org/doc/stable/", None),
"pyvista": ("https://docs.pyvista.org/", None),
"shapely": ("https://shapely.readthedocs.io/en/stable/", None),
}


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
Expand Down Expand Up @@ -136,16 +219,18 @@

# -- sphinx_gallery settings -------------------------------------------------

sphinx_gallery_conf = {
"backreferences_dir": None,
"doc_module": "pyvista",
"download_all_examples": False,
"examples_dirs": ["../examples/"],
"filename_pattern": r"\.py",
"first_notebook_cell": ("%matplotlib inline\nfrom pyvista import set_plot_theme\nset_plot_theme('document')\n"),
"gallery_dirs": ["./examples"],
"image_scrapers": (DynamicScraper(), "matplotlib"),
"pypandoc": True,
"remove_config_comments": True,
"reset_modules_order": "both",
}
# Gallery configuration only if available
if has_gallery:
sphinx_gallery_conf = {
"backreferences_dir": None,
"doc_module": "pyvista",
"download_all_examples": False,
"examples_dirs": ["../examples/"],
"filename_pattern": r"\.py",
"first_notebook_cell": ("%matplotlib inline\nfrom pyvista import set_plot_theme\nset_plot_theme('document')\n"),
"gallery_dirs": ["./examples"],
"image_scrapers": (DynamicScraper(), "matplotlib"),
"pypandoc": True,
"remove_config_comments": True,
"reset_modules_order": "both",
}
31 changes: 31 additions & 0 deletions docs/generated/skgmsh.Delaunay2D.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
skgmsh.Delaunay2D
=================

.. currentmodule:: skgmsh

.. autoclass:: Delaunay2D
:members:
:show-inheritance:
:inherited-members:



.. rubric:: Methods

.. autosummary::

~Delaunay2D.__init__
~Delaunay2D.disable_recombine
~Delaunay2D.enable_recombine





.. rubric:: Attributes

.. autosummary::

~Delaunay2D.cell_size
~Delaunay2D.edge_source
~Delaunay2D.mesh
29 changes: 29 additions & 0 deletions docs/generated/skgmsh.Delaunay3D.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
skgmsh.Delaunay3D
=================

.. currentmodule:: skgmsh

.. autoclass:: Delaunay3D
:members:
:show-inheritance:
:inherited-members:



.. rubric:: Methods

.. autosummary::

~Delaunay3D.__init__





.. rubric:: Attributes

.. autosummary::

~Delaunay3D.cell_size
~Delaunay3D.edge_source
~Delaunay3D.mesh
39 changes: 39 additions & 0 deletions docs/generated/skgmsh.Report.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
skgmsh.Report
=============

.. currentmodule:: skgmsh

.. autoclass:: Report
:members:
:show-inheritance:
:inherited-members:



.. rubric:: Methods

.. autosummary::

~Report.__init__
~Report.to_dict





.. rubric:: Attributes

.. autosummary::

~Report.architecture
~Report.cpu_count
~Report.date
~Report.filesystem
~Report.machine
~Report.mkl_info
~Report.packages
~Report.platform
~Report.python_environment
~Report.sys_version
~Report.system
~Report.total_ram
6 changes: 6 additions & 0 deletions docs/generated/skgmsh.delaunay_3d.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
skgmsh.delaunay\_3d
===================

.. currentmodule:: skgmsh

.. autofunction:: delaunay_3d
6 changes: 6 additions & 0 deletions docs/generated/skgmsh.frontal_delaunay_2d.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
skgmsh.frontal\_delaunay\_2d
============================

.. currentmodule:: skgmsh

.. autofunction:: frontal_delaunay_2d
6 changes: 6 additions & 0 deletions docs/generated/skgmsh.generate_mesh.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
skgmsh.generate\_mesh
=====================

.. currentmodule:: skgmsh

.. autofunction:: generate_mesh
11 changes: 9 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
# scikit-gmsh documentation

:::{include} ../README.md
:parser: myst_parser.sphinx
:::

```{toctree}
:maxdepth: 2
:caption: Contents

api
```

## Contributors

:::{include} ../CONTRIBUTORS.md
:parser: myst_parser.sphinx
:::
Loading