API Reference
This section provides detailed API documentation for all public classes and functions in mmgpy.
Quick Reference
Core Classes
| Class |
Description |
MmgAccessor (dataset.mmg) |
PyVista accessor exposing all MMG operations on pv.DataSet |
MeshKind |
Enumeration of mesh types |
Mesh |
Unified mesh class — deprecated in 0.12, removed in 0.13 |
Options Classes
Result Classes
Sizing Constraints
I/O Functions
Modules
Module Structure
mmgpy
├── Core Classes
│ ├── Mesh # Unified mesh class (auto-detects type)
│ └── MeshKind # Mesh type enumeration
│
├── Options
│ ├── Mmg3DOptions # 3D options
│ ├── Mmg2DOptions # 2D options
│ └── MmgSOptions # Surface options
│
├── Results & Validation
│ ├── RemeshResult # Operation statistics
│ ├── ValidationReport # Validation results
│ ├── ValidationIssue # Individual issues
│ └── QualityStats # Quality metrics
│
├── Sizing
│ ├── SphereSize # Spherical region
│ ├── BoxSize # Box region
│ ├── CylinderSize # Cylinder region
│ └── PointSize # Point-based sizing
│
├── I/O Functions
│ ├── read() # Load mesh
│ ├── from_pyvista() # From PyVista
│ └── to_pyvista() # To PyVista
│
├── mmgpy.metrics # Metric operations
│ ├── create_isotropic_metric()
│ ├── create_anisotropic_metric()
│ └── intersect_metrics()
│
└── mmgpy.lagrangian # Mesh motion
├── move_mesh()
└── propagate_displacement()
Basic Usage Pattern
import pyvista as pv
import mmgpy # noqa: F401 -- registers reader/writer + accessor
mesh = pv.read("input.mesh")
opts = mmgpy.Mmg3DOptions(hmax=0.1)
remeshed = mesh.mmg.remesh(opts)
report = remeshed.mmg.validate(detailed=True)
remeshed.save("output.vtk")
Type Hints
All public APIs are fully typed. Use with a type-aware IDE for autocomplete:
import pyvista as pv
import mmgpy # noqa: F401
from mmgpy import Mmg3DOptions
mesh: pv.UnstructuredGrid = pv.read("input.mesh")
opts: Mmg3DOptions = Mmg3DOptions(hmax=0.1)
remeshed: pv.UnstructuredGrid = mesh.mmg.remesh(opts)
import mmgpy
print(f"mmgpy version: {mmgpy.__version__}")
print(f"MMG version: {mmgpy.MMG_VERSION}")