Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 32 additions & 7 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,40 @@
ARG VARIANT="3.7"
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}

# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
ARG NODE_VERSION="none"
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi

RUN apt-get update -y && \
apt install -y libgl1-mesa-glx libglu1-mesa libxcursor1 libxinerama1 && \
apt install -y libgl1-mesa-glx curl software-properties-common wget && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# [Optional] If your pip requirements rarely change, uncomment this section to add them to the image.
COPY requirements_dev.txt /tmp/pip-tmp/
RUN pip install -r /tmp/pip-tmp/requirements_dev.txt && rm -rf /tmp/pip-tmp
# Determine architecture and download appropriate Miniconda installer
USER vscode
WORKDIR /home/vscode
RUN ARCH=$(uname -m) && \
if [ "$ARCH" = "x86_64" ]; then \
MINICONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-py312_24.7.1-0-Linux-x86_64.sh"; \
elif [ "$ARCH" = "aarch64" ]; then \
MINICONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-py312_24.7.1-0-Linux-aarch64.sh"; \
else \
echo "Unsupported architecture: $ARCH"; exit 1; \
fi && \
wget $MINICONDA_URL && \
chmod +x $(basename $MINICONDA_URL) && \
./$(basename $MINICONDA_URL) -b && \
rm $(basename $MINICONDA_URL)



# Install Python dependencies from requirements_dev.txt if it exists
# Initialize conda and run package installs
RUN CONDA_PATH=/home/vscode/miniconda3/bin/conda && \
$CONDA_PATH init && \
$CONDA_PATH install -n base conda-libmamba-solver -y && \
$CONDA_PATH config --set solver libmamba && \
$CONDA_PATH install -n base -c conda-forge cadquery gmsh python-gmsh -y

RUN . /home/vscode/miniconda3/etc/profile.d/conda.sh && \
conda activate base && \
pip install ezdxf --upgrade


2 changes: 2 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@
"ms-python.vscode-pylance",
"eamodio.gitlens"
],

"postCreateCommand": "make install",
"remoteUser": "vscode"
}
27 changes: 27 additions & 0 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Publish Python Package

on:
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
pip install .

- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: dist/
37 changes: 37 additions & 0 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Python Tests

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11']

steps:
- uses: actions/checkout@v3

- name: Set up Conda
uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
channels: conda-forge,cadquery
channel-priority: flexible
activate-environment: test-env

- name: Install dependencies
shell: bash -l {0}
run: |
conda install -c conda-forge gmsh python-gmsh
conda install -c conda-forge -c cadquery cadquery=master
pip install -e ".[gmsh]"

- name: Test with unittest
shell: bash -l {0}
run: |
python -m unittest discover tests
9 changes: 6 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
"-p",
"*_test.py"
],
"python.testing.pytestEnabled": false,
"python.testing.unittestEnabled": true,
"python.linting.enabled": false,
"python.defaultInterpreterPath": "/opt/conda/bin/python",
"python.linting.pylintEnabled": true,
Expand All @@ -27,5 +25,10 @@
"python.linting.pylintArgs": [
"--extension-pkg-whitelist=numpy"
],
"python.analysis.typeCheckingMode": "basic",
"python.analysis.typeCheckingMode": "off",
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
}
107 changes: 106 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,109 @@
Release 1.0.0
# Changelog

## Release 2.0.0 (Enhancement/Split Branch)

### Major Refactoring & Architecture Changes
- [x] Complete package restructure with new modular architecture
- [x] Split core functionality into `meshql/core/` (ql.py, selector.py, transaction.py)
- [x] Organized GMSH operations into `meshql/gmsh/` module
- [x] Consolidated mesh operations in `meshql/mesh/` module
- [x] Enhanced preprocessing capabilities in `meshql/preprocessing/`
- [x] Migrated from setup.py to modern pyproject.toml build system
- [x] Added comprehensive Makefile for build and installation management

### New Features
- [x] **GeometryQL.gmsh() Static Method**: New entry point for creating GMSH-based geometries
- [x] **compute_mesh() Method**: Enhanced mesh generation with integrated transactions and preprocessing
- [x] **Mesh Marker Support**: Load and export meshes with physical group markers
- [x] Discrete entity creation for marker elements
- [x] Automatic physical group assignment from markers
- [x] Marker exclusion from main mesh when loading
- [x] **Enhanced Mesh Loading**: Direct import of meshly meshes into GMSH
- [x] **Ratio-based Geometry Splitting**: Split geometries using ratio parameters
- [x] **Advanced Split Operations**:
- [x] `from_plane()`: Split by plane with angle specification
- [x] `from_ratios()`: Split by ratio values along edges
- [x] `from_normals()`: Split by normal vectors
- [x] `from_anchor()`: Split from anchor points
- [x] `from_edge()`: Split from specific edges
- [x] `from_lines()`: Split using line definitions
- [x] **Python Notebook Visualizer**: Improved in-notebook mesh visualization with pythreejs
- [x] **print_val() Method**: Debug helper to print Workplane values in GeometryQL and Split

### Improvements
- [x] **Performance Optimizations**:
- [x] Replaced CQCache utility with new CacheService implementation
- [x] Direct workplane handling in Split class (no GeometryQL dependency)
- [x] Improved entity selection and filtering logic
- [x] Enhanced checksum generation for geometry tracking
- [x] Multi-level caching system for split operations and region groups
- [x] BREP caching for split workplane geometry (77% faster on subsequent runs)
- [x] Region group caching with deterministic checksums across sessions
- [x] Automatic cache invalidation and updating for nested splits
- [x] `CacheService.clear_cache()` method for cache management
- [x] **Refactored Entity Management**:
- [x] Replaced CQEntityContext with CQEntityMapper for better clarity
- [x] Introduced GeometryQLContext class with enhanced properties
- [x] Improved selection logic for complex entity filtering
- [x] **Enhanced Preprocessing**:
- [x] Flexible preprocessing mechanism using (Type, callback) tuples
- [x] Split class works independently with workplanes
- [x] Better region group handling and visualization
- [x] **Mesh Visualization Improvements**:
- [x] Refactored visualize_mesh function for better mesh extraction
- [x] Enhanced wireframe rendering for various mesh types
- [x] Simplified surface and volume mesh creation
- [x] Removed unused coordinate display and buffer mesh code
- [x] **Transaction System**:
- [x] Migrated from Python dataclasses to Pydantic models
- [x] Improved transaction context handling
- [x] Better lookup mechanism for previous transactions
- [x] Updated import structure for cleaner organization

### Bug Fixes
- [x] Fixed interior/exterior edge classification bug
- [x] Fixed issue with multiple physical groups having the same name
- [x] Corrected wire orientation to ensure consistent winding
- [x] Resolved split operation bugs for 2D geometries
- [x] Fixed `from_ratio()` to work correctly with reversed wires
- [x] Added None check for ql in `end()` method
- [x] Fixed visualizer compatibility with meshly

### Testing & Documentation
- [x] Comprehensive unit test suite added:
- [x] `tests/selector_test.py`: IndexSelector, FilterSelector, GroupSelector, Selection tests
- [x] `tests/shapes_test.py`: NACA airfoil, circle generation, sampling tests
- [x] `tests/split_test.py`: Split operation tests
- [x] `tests/cq_utils_test.py`: CadQuery utility function tests
- [x] `tests/entity_test.py`: Entity management tests
- [x] `tests/mesh_test.py`: Mesh loading and conversion tests
- [x] `tests/integration_test.py`: End-to-end workflow tests
- [x] Updated example notebooks:
- [x] `cube.ipynb`: Structured meshing with boundary layers
- [x] `naca0012.ipynb`: Airfoil meshing examples
- [x] `inviscid_wedge.ipynb`: Inviscid flow setup
- [x] `turbo.ipynb`: Turbomachinery with STEP import
- [x] `progression.ipynb`: Mesh refinement examples
- [x] Added `visualize_example.py` for standalone visualization demos
- [x] Created `scripts/gmsh_host_client.py` for opening and watching .msh files

### Dependencies
- [x] Updated to meshly==1.3.0a0
- [x] Updated to su2fmt@2.0.0
- [x] Added pythreejs==2.4.2 for notebook visualization
- [x] Maintained Python 3.8+ compatibility

### Removed/Deprecated
- [x] Removed setup.py in favor of pyproject.toml
- [x] Removed requirements_dev.txt
- [x] Removed deprecated `exporters.py` and `importers.py`
- [x] Consolidated functionality into `loaders.py`
- [x] Removed old transaction structure from `meshql/transactions/`
- [x] Removed standalone `entity.py`, `transaction.py`, and `ql.py` from root meshql/

---

## Release 1.0.0

- [x] Add su2fmt 3D mesh output
- [x] Add 3D import and export support
Expand Down
29 changes: 29 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Hypersim Build Pipeline Makefile

# Build Python package only
build-package:
@echo "📦 Building Python package..."
python -m build

# Clean build artifacts
clean:
@echo "🧹 Cleaning build artifacts..."
rm -rf dist/ build/ *.egg-info/
@echo "✅ Clean completed"

# Run tests
test:
@echo "🧪 Running tests..."
python -m unittest discover -s tests -v

# Install package in development mode
install:
@echo "📦 Installing package in development mode..."
pip install -e .
pip uninstall -y meshql

# Quick build without push (for testing)
build:
@echo "🏗️ Building locally (no push)..."
python -m build
@echo "✅ Local build completed"
Loading
Loading