Skip to content

Commit 1c549e3

Browse files
refactor: mesh-doctor as a package (#183)
* Create package * Add annotations from __future__ * Update all documentation and install procedures * Improve mesh-doctor command line * Use meshAction instead of action in allChecks and mainChecks to avoid redundant reading of input file * Correct skipped tests
1 parent a0222b7 commit 1c549e3

File tree

77 files changed

+3000
-1890
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+3000
-1890
lines changed

.github/workflows/README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Tests each Python package independently to ensure:
2929
- `geos-xml-tools` - XML preprocessing and formatting
3030
- `geos-xml-viewer` - XML viewing tools
3131
- `hdf5-wrapper` - HDF5 file handling wrapper
32+
- `mesh-doctor` - Tools to perform checks on vtkUnstructuredGrids
3233
- `pygeos-tools` - GEOS Python tools
3334

3435
### Jobs
@@ -240,9 +241,10 @@ GEOS integration tests are **automatically triggered** when changes affect:
240241

241242
#### GEOS-Integrated Packages
242243
- `geos-utils/` - Core utilities used of goesPythonPackages
243-
- `geos-mesh/` - Mesh conversion (`convert_abaqus`, `mesh-doctor`)
244+
- `geos-mesh/` - Mesh conversion (`convert_abaqus`)
244245
- `geos-xml-tools/` - XML preprocessing (`preprocess_xml`, `format_xml`)
245246
- `hdf5-wrapper/` - HDF5 I/O wrapper
247+
- `mesh-doctor/` - Checks of vtkUnstructuredGrid before using in GEOS
246248
- `pygeos-tools/` - Python tools for GEOS
247249
- `geos-ats/` - Automated testing framework
248250

@@ -305,7 +307,6 @@ The CI uses the following decision matrix:
305307
**Tests Will Run (Required + Label)**
306308
```
307309
Changes:
308-
- geos-mesh/src/mesh_converter.py
309310
- geos-xml-tools/src/preprocessor.py
310311
Labels: test-geos-integration
311312
Result: GEOS integration will run (changes affect integrated packages)
@@ -374,6 +375,7 @@ Result: GEOS integration forced (tests will run regardless of changes)
374375
│ pip install geos-mesh │
375376
│ pip install geos-xml-tools │
376377
│ pip install hdf5-wrapper │
378+
│ pip install mesh-doctor │
377379
│ pip install pygeos-tools │
378380
│ pip install geos-ats │
379381
└─────────────────────────────────────────────┘
@@ -402,9 +404,10 @@ Result: GEOS integration forced (tests will run regardless of changes)
402404
| Package | Tools | Purpose |
403405
|--------------------|-----------------------------------------------------|---------------------------------------------------------------------|
404406
| **geos-xml-tools** | `preprocess_xml`;`format_xml` | Preprocess XML input files;Format XML for readability |
405-
| **geos-mesh** | `convert_abaqus`;`mesh-doctor` | Convert Abaqus meshes to VTU/GMSH;Validate and fix mesh quality |
407+
| **geos-mesh** | `convert_abaqus`;`mesh-doctor` | Convert Abaqus meshes to VTU/GMSH |
406408
| **geos-ats** | `run_geos_ats`;`setup_ats_environment`;`geos_ats_*` | Run automated test suite;Setup test environment;Various test checks |
407409
| **hdf5-wrapper** | Python API | HDF5 file I/O operations |
410+
| **mesh-doctor** | `mesh-doctor` | Validate and fix mesh quality |
408411
| **pygeos-tools** | Python API | GEOS workflow utilities |
409412
| **geos-utils** | Python API | Common utility functions |
410413

.github/workflows/python-package.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ jobs:
6868
- geos-trame
6969
- geos-xml-tools
7070
- geos-xml-viewer
71+
- mesh-doctor
7172
- hdf5-wrapper
7273
- pygeos-tools
7374
include:
@@ -77,6 +78,8 @@ jobs:
7778
dependencies: "geos-utils geos-geomechanics"
7879
- package-name: geos-processing
7980
dependencies: "geos-utils geos-mesh geos-geomechanics"
81+
- package-name: mesh-doctor
82+
dependencies: "geos-utils geos-mesh"
8083
- package-name: pygeos-tools
8184
dependencies: "geos-utils geos-mesh"
8285
- package-name: geos-timehistory
@@ -201,6 +204,7 @@ jobs:
201204
"geos-mesh"
202205
"geos-xml-tools"
203206
"hdf5-wrapper"
207+
"mesh-doctor"
204208
"pygeos-tools"
205209
"geos-ats"
206210
)

.github/workflows/typing-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
max-parallel: 3
1717
matrix:
1818
# add packages to check typing
19-
package-name: ["geos-geomechanics", "geos-processing", "geos-timehistory", "geos-utils", "geos-trame", "geos-xml-tools", "hdf5-wrapper"]
19+
package-name: ["geos-geomechanics", "geos-processing", "geos-timehistory", "geos-utils", "geos-trame", "geos-xml-tools", "hdf5-wrapper", "mesh-doctor"]
2020

2121
steps:
2222
- uses: actions/checkout@v4

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ GEOS Python packages dependency tree (inter-dependency and main external depende
7373
│ └── hdf5-wrapper
7474
|
7575
├── mesh-doctor
76-
│ ├── geos-prep
77-
│ └── pyvista
76+
│ ├── geos-utils
77+
│ └── geos-mesh
7878
|
7979
├── geos-trame
8080
│ ├── geos-xml-tools

docs/conf.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,43 @@
1414
#
1515
import os
1616
import sys
17+
import subprocess
1718

1819
# Add python modules to be documented
1920
python_root = '..'
2021
python_modules = ( 'geos-ats', 'geos-geomechanics', 'geos-mesh', 'geos-processing', 'geos-pv', 'geos-timehistory',
21-
'geos-utils', 'geos-xml-tools', 'geos-xml-viewer', 'hdf5-wrapper', 'pygeos-tools' )
22+
'geos-utils', 'geos-xml-tools', 'geos-xml-viewer', 'hdf5-wrapper', 'mesh-doctor', 'pygeos-tools' )
2223

2324

2425
for m in python_modules:
2526
sys.path.insert( 0, os.path.abspath( os.path.join( python_root, m, 'src' ) ) )
2627

28+
# Install mesh-doctor in editable mode if not already available
29+
# This ensures mesh-doctor command is available for sphinxcontrib.programoutput
30+
try:
31+
subprocess.run( [ sys.executable, '-m', 'geos.mesh_doctor.cli', '--help' ],
32+
capture_output=True, check=True, timeout=5 )
33+
except ( subprocess.CalledProcessError, subprocess.TimeoutExpired, FileNotFoundError ):
34+
# mesh-doctor not available, install it and its dependencies in editable mode
35+
print( "Installing mesh-doctor dependencies for documentation generation..." )
36+
packages_to_install = [ 'geos-utils', 'geos-mesh', 'mesh-doctor' ]
37+
for pkg in packages_to_install:
38+
pkg_path = os.path.abspath( os.path.join( python_root, pkg ) )
39+
try:
40+
print( f" Installing {pkg}..." )
41+
subprocess.run( [ sys.executable, '-m', 'pip', 'install', '-e', pkg_path ],
42+
check=True, capture_output=True )
43+
except subprocess.CalledProcessError as e:
44+
print( f"Warning: Could not install {pkg}: {e}" )
45+
print( "Documentation may be incomplete." )
46+
break
47+
else:
48+
print( "mesh-doctor installed successfully." )
49+
2750
# -- Project information -----------------------------------------------------
2851

2952
project = u'GEOS Python Packages'
30-
copyright = u'2018-2024 Lawrence Livermore National Security, The Board of Trustees of the Leland Stanford Junior University, TotalEnergies, and GEOSX Contributors.'
53+
copyright = u'2018-2025 Lawrence Livermore National Security, The Board of Trustees of the Leland Stanford Junior University, TotalEnergies, and GEOS Contributors.'
3154
author = u'GEOS Contributors'
3255

3356
# The short X.Y version

docs/geos-mesh.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ GEOS Mesh tools
77
:maxdepth: 1
88
:caption: Contents:
99

10-
./geos_mesh_docs/doctor
11-
1210
./geos_mesh_docs/converter
1311

1412
./geos_mesh_docs/io

0 commit comments

Comments
 (0)