# bastiensauty/cornea_meshing_package architecture

> Architecture diagram of the GitHub repository bastiensauty/cornea_meshing_package, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bastiensauty/cornea_meshing_package
- Repository: https://github.com/bastiensauty/cornea_meshing_package

## Overview

cornea is a Python tool for turning corneal surface parameters into a structured, tagged Gmsh mesh with per-element orientation vectors. Its main workflow loads parameters, constructs the two-conic geometry and square-to-cornea map, samples mesh nodes and element frames, exports and reads back the mesh, then checks the frames and produces plots. The package also exposes geometry and displacement APIs for Python callers. The CLI wiring is sampled; some mesh I/O implementation details are excerpted, so the graph avoids inferring internal calls beyond documented behavior.

Main entry points: [`cornea/__main__.py`](https://github.com/bastiensauty/cornea_meshing_package/blob/main/cornea/__main__.py) (CLI workflow), [`cornea/jacobian.py`](https://github.com/bastiensauty/cornea_meshing_package/blob/main/cornea/jacobian.py) (Frame readback), [`cornea/plots.py`](https://github.com/bastiensauty/cornea_meshing_package/blob/main/cornea/plots.py) (Plot generation), [`cornea/mesh_io.py`](https://github.com/bastiensauty/cornea_meshing_package/blob/main/cornea/mesh_io.py) (Element frames)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Inputs and CLI"]
  node_cli["CLI workflow<br/>[__main__.py]"]
  node_params["Parameters<br/>[params.py]"]
end

subgraph group_geometry["Corneal geometry"]
  node_geometry["Conic geometry<br/>[geometry.py]"]
  node_map["Coons map<br/>[geometry.py]"]
  node_displacement["Displacement API<br/>[geometry.py]"]
end

subgraph group_mesh["Mesh and frames"]
  node_nodes["Grid nodes<br/>[mesh_io.py]"]
  node_frames["Element frames<br/>[mesh_io.py]"]
  node_jacobian["Frame transforms<br/>[jacobian.py]"]
  node_writer["Gmsh writer<br/>[mesh_io.py]"]
end

subgraph group_outputs["Readback and outputs"]
  node_meshfile["Tagged Gmsh mesh"]
  node_reader["Mesh reader<br/>[mesh_io.py]"]
  node_readframes["Frame readback<br/>[jacobian.py]"]
  node_checks["Frame diagnostics<br/>[jacobian.py]"]
  node_plots["Plot generation<br/>[plots.py]"]
  node_figures["Mesh and field plots"]
end

node_user(("User"))

node_user -->|"runs"| node_cli
node_cli -->|"loads JSON"| node_params
node_params -->|"returns settings"| node_cli
node_cli -->|"constructs"| node_geometry
node_geometry -->|"defines boundaries"| node_map
node_cli -->|"builds grid"| node_nodes
node_nodes -->|"samples map"| node_map
node_cli -->|"computes frames"| node_frames
node_frames -->|"evaluates Jacobian"| node_map
node_frames -->|"pushes directions"| node_jacobian
node_cli -->|"exports mesh"| node_writer
node_writer -->|"writes mesh"| node_meshfile
node_cli -->|"plots nodes"| node_plots
node_plots -->|"writes figures"| node_figures
node_cli -->|"reads mesh"| node_reader
node_meshfile -->|"provides data"| node_reader
node_reader -->|"provides mesh"| node_readframes
node_cli -->|"extracts frames"| node_readframes
node_cli -->|"checks frames"| node_checks
node_readframes -->|"supplies vectors"| node_checks
node_cli -->|"plots readback"| node_plots
node_readframes -->|"supplies fields"| node_plots
node_cli -.->|"exposes API"| node_displacement

click node_cli "https://github.com/bastiensauty/cornea_meshing_package/blob/main/cornea/__main__.py"
click node_params "https://github.com/bastiensauty/cornea_meshing_package/blob/main/cornea/params.py"
click node_geometry "https://github.com/bastiensauty/cornea_meshing_package/blob/main/cornea/geometry.py"
click node_map "https://github.com/bastiensauty/cornea_meshing_package/blob/main/cornea/geometry.py"
click node_displacement "https://github.com/bastiensauty/cornea_meshing_package/blob/main/cornea/geometry.py"
click node_nodes "https://github.com/bastiensauty/cornea_meshing_package/blob/main/cornea/mesh_io.py"
click node_frames "https://github.com/bastiensauty/cornea_meshing_package/blob/main/cornea/mesh_io.py"
click node_jacobian "https://github.com/bastiensauty/cornea_meshing_package/blob/main/cornea/jacobian.py"
click node_writer "https://github.com/bastiensauty/cornea_meshing_package/blob/main/cornea/mesh_io.py"
click node_reader "https://github.com/bastiensauty/cornea_meshing_package/blob/main/cornea/mesh_io.py"
click node_readframes "https://github.com/bastiensauty/cornea_meshing_package/blob/main/cornea/jacobian.py"
click node_checks "https://github.com/bastiensauty/cornea_meshing_package/blob/main/cornea/jacobian.py"
click node_plots "https://github.com/bastiensauty/cornea_meshing_package/blob/main/cornea/plots.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_params,node_user toneBlue
class node_geometry,node_map,node_displacement toneAmber
class node_nodes,node_frames,node_jacobian,node_writer toneMint
class node_meshfile,node_reader,node_readframes,node_checks,node_plots,node_figures toneRose
```

## Components

### Inputs and CLI

- [CLI workflow](https://github.com/bastiensauty/cornea_meshing_package/blob/main/cornea/__main__.py): `cornea/__main__.py`
- [Parameters](https://github.com/bastiensauty/cornea_meshing_package/blob/main/cornea/params.py): `cornea/params.py`

### Corneal geometry

- [Conic geometry](https://github.com/bastiensauty/cornea_meshing_package/blob/main/cornea/geometry.py): `cornea/geometry.py`
- [Coons map](https://github.com/bastiensauty/cornea_meshing_package/blob/main/cornea/geometry.py): `cornea/geometry.py`
- [Displacement API](https://github.com/bastiensauty/cornea_meshing_package/blob/main/cornea/geometry.py): `cornea/geometry.py`

### Mesh and frames

- [Grid nodes](https://github.com/bastiensauty/cornea_meshing_package/blob/main/cornea/mesh_io.py): `cornea/mesh_io.py`
- [Element frames](https://github.com/bastiensauty/cornea_meshing_package/blob/main/cornea/mesh_io.py): `cornea/mesh_io.py`
- [Frame transforms](https://github.com/bastiensauty/cornea_meshing_package/blob/main/cornea/jacobian.py): `cornea/jacobian.py`
- [Gmsh writer](https://github.com/bastiensauty/cornea_meshing_package/blob/main/cornea/mesh_io.py): `cornea/mesh_io.py`

### Readback and outputs

- **Tagged Gmsh mesh**
- [Mesh reader](https://github.com/bastiensauty/cornea_meshing_package/blob/main/cornea/mesh_io.py): `cornea/mesh_io.py`
- [Frame readback](https://github.com/bastiensauty/cornea_meshing_package/blob/main/cornea/jacobian.py): `cornea/jacobian.py`
- [Frame diagnostics](https://github.com/bastiensauty/cornea_meshing_package/blob/main/cornea/jacobian.py): `cornea/jacobian.py`
- [Plot generation](https://github.com/bastiensauty/cornea_meshing_package/blob/main/cornea/plots.py): `cornea/plots.py`
- **Mesh and field plots**

### Other components

- **User**

## Connections

- User → CLI workflow: runs
- CLI workflow → Parameters: loads JSON
- Parameters → CLI workflow: returns settings
- CLI workflow → Conic geometry: constructs
- Conic geometry → Coons map: defines boundaries
- CLI workflow → Grid nodes: builds grid
- Grid nodes → Coons map: samples map
- CLI workflow → Element frames: computes frames
- Element frames → Coons map: evaluates Jacobian
- Element frames → Frame transforms: pushes directions
- CLI workflow → Gmsh writer: exports mesh
- Gmsh writer → Tagged Gmsh mesh: writes mesh
- CLI workflow → Plot generation: plots nodes
- Plot generation → Mesh and field plots: writes figures
- CLI workflow → Mesh reader: reads mesh
- Tagged Gmsh mesh → Mesh reader: provides data
- Mesh reader → Frame readback: provides mesh
- CLI workflow → Frame readback: extracts frames
- CLI workflow → Frame diagnostics: checks frames
- Frame readback → Frame diagnostics: supplies vectors
- CLI workflow → Plot generation: plots readback
- Frame readback → Plot generation: supplies fields
- CLI workflow → Displacement API: exposes API
