Metadata-Version: 2.4
Name: quadmesh
Version: 0.2.5
Summary: QuADMESH+ converts an existing shallow-water triangulation into a quadrilateral mesh by merging adjacent triangle pairs layer by layer (https://github.com/domattioli/QuADMESH).
Author: Dominik Mattioli
License: PolyForm Noncommercial License 1.0.0
        
        <https://polyformproject.org/licenses/noncommercial/1.0.0>
        
        Required Notice: Copyright (c) 2018-2026 Dominik Mattioli
        
        ## Acceptance
        
        In order to get any license under these terms, you must agree to them as both
        strict obligations and conditions to all your licenses.
        
        ## Copyright License
        
        The licensor grants you a copyright license for the software to do everything
        you might do with the software that would otherwise infringe the licensor's
        copyright in it for any permitted purpose. However, you may only distribute the
        software according to Distribution License and make changes or new works based
        on the software according to Changes and New Works License.
        
        ## Distribution License
        
        The licensor grants you an additional copyright license to distribute copies of
        the software. Your license to distribute covers distributing the software with
        changes and new works permitted by Changes and New Works License.
        
        ## Notices
        
        You must ensure that anyone who gets a copy of any part of the software from you
        also gets a copy of these terms or the URL for them above, as well as copies of
        any plain-text lines beginning with Required Notice: that the licensor provided
        with the software. For example:
        
        Required Notice: Copyright (c) 2018-2026 Dominik Mattioli
        
        ## Changes and New Works License
        
        The licensor grants you an additional copyright license to make changes and new
        works based on the software for any permitted purpose.
        
        ## Patent License
        
        The licensor grants you a patent license for the software that covers patent
        claims the licensor can license, or becomes able to license, that you would
        infringe by using the software.
        
        ## Noncommercial Purposes
        
        Any noncommercial purpose is a permitted purpose.
        
        ## Personal Uses
        
        Personal use for research, experiment, and testing for the benefit of public
        knowledge, personal study, private entertainment, hobby projects, amateur
        pursuits, or religious observance, without any anticipated commercial
        application, is use for a permitted purpose.
        
        ## Noncommercial Organizations
        
        Use by any charitable organization, educational institution, public research
        organization, public safety or health organization, environmental protection
        organization, or government institution is use for a permitted purpose
        regardless of the source of funding or obligations resulting from the funding.
        
        ## Fair Use
        
        You may have "fair use" rights for the software under the law. These terms do
        not limit them.
        
        ## No Other Rights
        
        These terms do not allow you to sublicense or transfer any of your licenses to
        anyone else, or prevent the licensor from granting licenses to anyone else.
        These terms do not imply any other licenses.
        
        ## Patent Defense
        
        If you make any written claim that the software infringes or contributes to
        infringement of any patent, your patent license for the software granted under
        these terms ends immediately. If your company makes such a claim, your patent
        license ends immediately for work on behalf of your company.
        
        ## Violations
        
        The first time you are notified in writing that you have violated any of these
        terms, or done anything with the software not covered by your licenses, your
        licenses can nonetheless continue if you come into full compliance with these
        terms, and take practical steps to correct past violations, within 32 days of
        receiving notice. Otherwise, all your licenses end immediately.
        
        ## No Liability
        
        As far as the law allows, the software comes as is, without any warranty or
        condition, and the licensor will not be liable to you for any damages arising
        out of these terms or the use or nature of the software, under any kind of legal
        claim.
        
        ## Definitions
        
        The licensor is the individual or entity offering these terms, and the software
        is the software the licensor makes available under these terms.
        
        You refers to the individual or entity agreeing to these terms.
        
        Your company is any legal entity, sole proprietorship, or other kind of
        organization that you work for, plus all organizations that have control over,
        are under the control of, or are under common control with that organization.
        Control means ownership of substantially all the assets of an entity, or the
        power to direct its management and policies by vote, contract, or otherwise.
        Control can be direct or indirect.
        
        Your licenses are all the licenses granted to you for the software under these
        terms.
        
        Use means anything you do with the software requiring one of your licenses.
        
        ----------------------------------------------------------------------------
        
        ADDITIONAL RESTRICTION — NO AI/ML TRAINING (licensor-added term)
        
        This is an additional term layered on top of the PolyForm Noncommercial License
        1.0.0 above. Because of it, this combined document is NOT the unmodified
        PolyForm Noncommercial License 1.0.0.
        
        Notwithstanding any permitted purpose above, you may NOT, without a separate
        written license from the licensor, use the software or any part of it:
        
          (a) as training data, fine-tuning data, evaluation data, or other input for
              any machine-learning or artificial-intelligence model, system, or
              dataset; or
        
          (b) for automated code generation, model distillation, or the construction of
              embeddings, indexes, or retrieval corpora derived from the software.
        
        This restriction applies even to otherwise-permitted noncommercial use.
        
        COMMERCIAL AND AI-TRAINING LICENSES
        
        For commercial use, or for AI/ML training rights, contact: slick-sadly-snort@duck.com
        
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.24
Requires-Dist: scipy>=1.10
Requires-Dist: chilmesh>=1.5.5
Requires-Dist: matplotlib>=3.6
Provides-Extra: dev
Requires-Dist: pytest>=7; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Provides-Extra: plot
Requires-Dist: matplotlib>=3.6; extra == "plot"
Provides-Extra: bench-quadriflow
Requires-Dist: pyquadriflow; (sys_platform == "linux" or sys_platform == "win32") and extra == "bench-quadriflow"
Provides-Extra: bench
Requires-Dist: quadmesh[bench-quadriflow]; extra == "bench"
Dynamic: license-file

<h1 align="center">
  <img src="videos/quadmesh_logo.gif" alt="QuADMESH logo: triangles in, quads out" width="680">
</h1>

<p align="center">
  <strong>A Quadrangular ADvanced, automatic unstructured MESH generator for 2D shallow-water models.</strong><br>
  Python API and port of the MATLAB library and 'QuADMESH+' <a href="https://github.com/user-attachments/files/19724263/QuADMESH-Thesis.pdf">
    <img src="https://img.shields.io/badge/Thesis-QuADMESH-ba0c2f?style=flat-square&logo=book&logoColor=white&labelColor=cfd4d8" alt="QuADMESH Thesis"></a> 
</p>

<p align="center">
  <strong><a href="https://scholar.google.com/citations?user=IBFSkOcAAAAJ&hl=en">Dominik Mattioli</a><sup>1†</sup>, <a href="https://scholar.google.com/citations?user=mYPzjIwAAAAJ&hl=en">Ethan Kubatko</a><sup>2</sup></strong><br>
  <sup>†</sup>Corresponding author | <sup>1</sup>Unaffiliated | <sup>2</sup>Ohio State University (<a href="https://ceg.osu.edu/computational-hydrodynamics-and-informatics-laboratory"><img src="https://img.shields.io/badge/The CHIL-a7b1b7?labelColor=ba0c2f&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHJlY3QgeD0iNCIgeT0iMiIgd2lkdGg9IjE2IiBoZWlnaHQ9IjIwIiByeD0iNyIgZmlsbD0iI2ZmZmZmZiIvPjxyZWN0IHg9IjguNSIgeT0iNyIgd2lkdGg9IjciIGhlaWdodD0iMTAiIHJ4PSIzIiBmaWxsPSIjYmEwYzJmIi8+PC9zdmc+" alt="CHIL"></a>)
</p>

- Converts an existing, validated shallow-water triangulation into quadrilaterals by merging adjacent triangle pairs.
- Reuses the input vertices; triangle pairing adds no points. `can_remove_edges=False` stops boundary-edge collapse.
- Leaves zero interior residual triangles (triangles with no domain-boundary edge), checked by `tests/test_no_interior_tris.py`.
- Adds points only to clear leftover boundary triangles; this step is on by default and `point_insert=False` turns it off.
- Returns a quad-pure mesh by default; `remove_boundary_tris=False` keeps leftover boundary triangles instead.

> **Attention MATLAB users:** This Python library is the actively developed successor to the original MATLAB code, which is no longer maintained and is frozen under [`archive/matlab`](https://github.com/domattioli/quadmesh/tree/development/archive/matlab).

<p align="center">
  <a href="https://pypi.org/project/quadmesh/"><img src="https://img.shields.io/pypi/v/quadmesh.svg?label=PyPI" alt="PyPI version"></a>
  <a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/python-3.10%2B-blue" alt="Python 3.10+"></a>
  <a href="https://github.com/domattioli/QuADMESH/actions/workflows/tests.yml"><img src="https://github.com/domattioli/QuADMESH/actions/workflows/tests.yml/badge.svg" alt="Tests"></a>
  <a href="https://github.com/domattioli/QuADMESH/issues"><img src="https://img.shields.io/github/issues/domattioli/QuADMESH.svg" alt="Open issues"></a>
  <a href="https://doi.org/10.5281/zenodo.20350483"><img src="https://zenodo.org/badge/DOI/10.5281/zenodo.20350483.svg" alt="DOI"></a>
  <a href="LICENSE"><img src="https://img.shields.io/badge/License-PolyForm%20NC%20%2B%20No--AI-red.svg" alt="License"></a>
</p>

## Table of Contents

1. [Status & Roadmap](#1-status--roadmap)
2. [Installation](#2-installation)
3. [Quick Start](#3-quick-start)
4. [Meshes from the Valence registry](#4-meshes-from-the-valence-registry)
5. [Limitations](#5-limitations)
6. [Documentation](#6-documentation)
7. [Citation](#7-citation)
8. [Related Projects](#8-related-projects)
9. [Contributing & Contact](#9-contributing--contact)
10. [License](#10-license)

---

## 1. Status & Roadmap

**Current release: 0.2.0. Next: 0.2.5 (unreleased); see [CHANGELOG](CHANGELOG.md).**

The default `method="quadmesh+"` runs the thesis per-layer sweep and leaves zero interior residual triangles; CI checks this on the meshes bundled with `chilmesh.data`. Algorithm and MATLAB parity status: [`docs/algorithm.md`](docs/algorithm.md).

- Now: boundary-layer walkability and post-process quality tuning.
- Next: pre- and post-processing quality work; performance; evaluate a C++ or Rust backend; wire `tri2quad(aggressive=)` to CHILmesh `merge_elements`.
- Future: formal integration within a unified ecosystem including <a href="https://github.com/domattioli/ADMESH"><img src="https://img.shields.io/pypi/v/admesh2D?label=ADMESH&color=9ae6b4&labelColor=2f855a&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZmZmZmZmIiBzdHJva2Utd2lkdGg9IjEuNSIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIj48cGF0aCBkPSJNMiAyMSBMMTIgMiBMMjIgMjEgWiBNMTIgMiBMNyAyMSBNMTIgMiBMMTcgMjEgTTcgMjEgTDEyIDEyIEwxNyAyMSBNMTIgMTIgTDEyIDIiLz48L3N2Zz4=" alt="ADMESH PyPI version"></a> and <a href="https://github.com/domattioli/CHILmesh"><img src="https://img.shields.io/pypi/v/chilmesh?label=CHILmesh&color=caf0f8&labelColor=0077b6&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZmZmZmZmIiBzdHJva2Utd2lkdGg9IjEuOCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIj48cGF0aCBkPSJNMSA4IHEzIC00IDYgMCB0NiAwIHQ2IDAgdDYgMCBNMSAxMyBxMyAtNCA2IDAgdDYgMCB0NiAwIHQ2IDAgTTEgMTggcTMgLTQgNiAwIHQ2IDAgdDYgMCB0NiAwIi8%2BPC9zdmc%2B" alt="CHILmesh PyPI version"></a>

Headline result: on ENPAC2003 (531,680 triangles), QuADMESH 0.1.0 with chilmesh 1.0.0 produced 274,321 quads with zero interior residual triangles in 773 s, single-threaded. Details: [docs/benchmarks](docs/benchmarks/README.md).

[Back to top](#table-of-contents)

## 2. Installation

```bash
pip install quadmesh                # release from PyPI
pip install -e ".[dev]"             # from a clone, plus pytest
pip install -e ".[plot]"            # plus matplotlib for quality plots
```

`chilmesh` is an external dependency and is not vendored. Mesh-dependent tests need a Valence token; see [tests/fixtures/README.md](tests/fixtures/README.md).

[Back to top](#table-of-contents)

## 3. Quick Start

```bash
python -m quadmesh.cli input.14 -o output.14
```

Useful flags: `--polygon domain.poly` (domain boundary), `--no-post-process`, `--n-smooth-iter N`, `--preserve-boundary`. Run `python -m quadmesh.cli --help` for all of them. The MATLAB to Python function map is in [MAPPING.md](docs/MAPPING.md).

[Back to top](#table-of-contents)

## 4. Meshes from the Valence registry

`quadmesh --from-registry NAME -o out.14` ships in 0.2.5 (unreleased). Test meshes are available through Valence, a token-gated mesh service.

1. Sign in with GitHub at https://valence-api.iqh766c2.workers.dev .
2. A GitHub account at least 30 days old gets a token at once. The page shows it once; copy it then.
3. A token allows 500 downloads per day (reset at midnight UTC) and expires after one year.

```bash
export VALENCE_TOKEN=<your token>; quadmesh --from-registry Block_O.14 -o out.14
```

[Back to top](#table-of-contents)

## 5. Limitations

- Converts an existing, validated triangulation. It does not generate meshes from scratch.
- Boundary-layer quads have the lowest quality, and some can be concave ([#90](https://github.com/domattioli/quadmesh/issues/90)).
- The default post-process may drop boundary vertices; use `preserve_boundary=True` to keep them.

[Back to top](#table-of-contents)

## 6. Documentation

- [Algorithm](docs/algorithm.md) and [MATLAB mapping](docs/MAPPING.md)
- [Python quickstart](docs/python-quickstart.md)
- [Performance and benchmarks](docs/benchmarks/README.md) (`quadmesh-bench`, diagnostics)
- [Repository layout](docs/repository-layout.md), [share your mesh](docs/share-your-mesh.md)

[Back to top](#table-of-contents)

## 7. Citation

**Algorithm and theory** (cite the original thesis):

> Mattioli, DO (2017). QuADMESH+: A Quadrangular ADvanced Mesh Generator for Hydrodynamic Models. The Ohio State University, OhioLINK - Electronic Theses and Dissertations Center. Master's Thesis. http://rave.ohiolink.edu/etdc/view?acc_num=osu1500627779532088

**This software** (cite the Zenodo release):

> Mattioli, DO, Kubatko, EJ (2026). QuADMESH: A Quadrangular ADvanced, automatic unstructured MESH generator for 2D hydrodynamic domains. Zenodo. https://doi.org/10.5281/zenodo.20350483

The DOI resolves to the latest release; version DOIs are on the [Zenodo record](https://doi.org/10.5281/zenodo.20350483).

[Back to top](#table-of-contents)

## 8. Related Projects

- [ADMESH](https://github.com/domattioli/ADMESH): Python port of the ADMESH adaptive mesh generator.
- [CHILmesh](https://github.com/domattioli/CHILmesh): mesh data structure, smoother, and quality analysis.

[Back to top](#table-of-contents)

## 9. Contributing & Contact

See [CONTRIBUTING.md](CONTRIBUTING.md). To share a mesh, open an issue in this repository (https://github.com/domattioli/quadmesh/issues/new).

Dominik Mattioli (repo owner): [GitHub](https://github.com/domattioli) | Ethan J. Kubatko: [kubatko.3@osu.edu](mailto:kubatko.3@osu.edu)

[Back to top](#table-of-contents)

## 10. License

Noncommercial and research use only. PolyForm Noncommercial License 1.0.0 with an additional No-AI/ML-training restriction; see [LICENSE](LICENSE) and [AI-USAGE.md](https://github.com/domattioli/quadmesh/blob/development/docs/AI-USAGE.md).

Commercial or AI-training licenses: contact domattioli via mango-kooky-okay@duck.com

[Back to top](#table-of-contents)
