# wildmeshing/ftetwild architecture

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

- Interactive diagram: https://gitdiagram.com/wildmeshing/ftetwild
- Repository: https://github.com/wildmeshing/ftetwild

## Overview

fTetWild is a command-line and C++ tetrahedral mesher. Its principal workflow accepts a triangle surface mesh, optionally applies preprocessing and sizing/Boolean controls, generates and improves tetrahedra, then writes a mesh. The README documents these product stages and options; source excerpts confirm mesh I/O and the cut-configuration table, but do not expose the main runtime call graph. Dashed, uncited edges therefore mark likely internal handoffs rather than inspected calls.

Main entry points: [`src/main.cpp`](https://github.com/wildmeshing/ftetwild/blob/master/src/main.cpp) (CLI entry), [`src/MeshImprovement.cpp`](https://github.com/wildmeshing/ftetwild/blob/master/src/MeshImprovement.cpp) (Mesh improvement), [`src/FloatTetDelaunay.cpp`](https://github.com/wildmeshing/ftetwild/blob/master/src/FloatTetDelaunay.cpp) (Tet generation), [`src/MeshIO.cpp`](https://github.com/wildmeshing/ftetwild/blob/master/src/MeshIO.cpp) (Mesh export)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Meshing workflow"]
  node_cli["CLI entry<br/>[main.cpp]"]
  node_parameters["Meshing options<br/>[Parameters.h]"]
end

subgraph group_geometry["Geometry operations"]
  node_simplify["Surface preprocessing<br/>[Simplification.cpp]"]
  node_surface["Surface mesh<br/>[MeshIO.cpp]"]
  node_insertion["Triangle insertion"]
  node_tetra["Tet generation"]
  node_cutmesh["Cut mesh<br/>[CutMesh.cpp]"]
  node_localops["Local operations"]
  node_improve["Mesh improvement"]
  node_collapse["Edge collapsing<br/>[EdgeCollapsing.cpp]"]
  node_split["Edge splitting<br/>[EdgeSplitting.cpp]"]
  node_swap["Edge swapping<br/>[EdgeSwapping.cpp]"]
  node_smooth["Vertex smoothing"]
  node_simplifyout["Coarsening<br/>[Simplification.cpp]"]
end

subgraph group_io["Mesh I/O"]
  node_writer["Mesh export<br/>[MeshIO.cpp]"]
  node_mshread["MSH loader<br/>[MshLoader.cpp]"]
  node_mshwrite["MSH saver<br/>[MshSaver.cpp]"]
end

subgraph group_cut["Cut configurations"]
  node_cuttable["Cut table<br/>[auto_table.cpp]"]
  node_cutbuilder["Cut table builder<br/>[build_cut_table.py]"]
  node_tableexport["Table code export"]
  node_cutplot["Cut configuration plot<br/>[plot-tet.py]"]
end

node_user(("Meshing user"))
node_result["Tetrahedral mesh"]

node_user -->|"invokes"| node_cli
node_cli -.->|"loads input"| node_surface
node_cli -.->|"configures"| node_parameters
node_surface -.->|"preprocesses"| node_simplify
node_simplify -.->|"prepares surface"| node_insertion
node_insertion -.->|"inserts constraints"| node_tetra
node_tetra -.->|"uses cuts"| node_cutmesh
node_cutmesh -.->|"reads configurations"| node_cuttable
node_tetra -.->|"optimizes mesh"| node_improve
node_improve -.->|"may apply"| node_collapse
node_improve -.->|"may apply"| node_split
node_improve -.->|"may apply"| node_swap
node_improve -.->|"may apply"| node_smooth
node_cli -.->|"may coarsen"| node_simplifyout
node_cli -.->|"exports mesh"| node_writer
node_writer -.->|"writes MSH"| node_mshwrite
node_writer -->|"produces"| node_result
node_cli -.->|"loads sizing mesh"| node_mshread
node_cutbuilder -->|"provides table"| node_tableexport
node_cutbuilder -->|"provides configurations"| node_cutplot
node_cli -.->|"uses cut cases"| node_cuttable

click node_cli "https://github.com/wildmeshing/ftetwild/blob/master/src/main.cpp"
click node_parameters "https://github.com/wildmeshing/ftetwild/blob/master/src/Parameters.h"
click node_simplify "https://github.com/wildmeshing/ftetwild/blob/master/src/Simplification.cpp"
click node_surface "https://github.com/wildmeshing/ftetwild/blob/master/src/MeshIO.cpp"
click node_insertion "https://github.com/wildmeshing/ftetwild/blob/master/src/TriangleInsertion.cpp"
click node_tetra "https://github.com/wildmeshing/ftetwild/blob/master/src/FloatTetDelaunay.cpp"
click node_cutmesh "https://github.com/wildmeshing/ftetwild/blob/master/src/CutMesh.cpp"
click node_localops "https://github.com/wildmeshing/ftetwild/blob/master/src/LocalOperations.cpp"
click node_improve "https://github.com/wildmeshing/ftetwild/blob/master/src/MeshImprovement.cpp"
click node_collapse "https://github.com/wildmeshing/ftetwild/blob/master/src/EdgeCollapsing.cpp"
click node_split "https://github.com/wildmeshing/ftetwild/blob/master/src/EdgeSplitting.cpp"
click node_swap "https://github.com/wildmeshing/ftetwild/blob/master/src/EdgeSwapping.cpp"
click node_smooth "https://github.com/wildmeshing/ftetwild/blob/master/src/VertexSmoothing.cpp"
click node_simplifyout "https://github.com/wildmeshing/ftetwild/blob/master/src/Simplification.cpp"
click node_writer "https://github.com/wildmeshing/ftetwild/blob/master/src/MeshIO.cpp"
click node_mshread "https://github.com/wildmeshing/ftetwild/blob/master/src/external/MshLoader.cpp"
click node_mshwrite "https://github.com/wildmeshing/ftetwild/blob/master/src/external/MshSaver.cpp"
click node_cuttable "https://github.com/wildmeshing/ftetwild/blob/master/src/auto_table.cpp"
click node_cutbuilder "https://github.com/wildmeshing/ftetwild/blob/master/python/build_cut_table.py"
click node_tableexport "https://github.com/wildmeshing/ftetwild/blob/master/python/generate-table-code.py"
click node_cutplot "https://github.com/wildmeshing/ftetwild/blob/master/python/plot-tet.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_parameters,node_user toneBlue
class node_simplify,node_surface,node_insertion,node_tetra,node_cutmesh,node_localops,node_improve,node_collapse,node_split,node_swap,node_smooth,node_simplifyout toneAmber
class node_writer,node_mshread,node_mshwrite toneMint
class node_cuttable,node_cutbuilder,node_tableexport,node_cutplot toneRose
class node_result toneIndigo
```

## Components

### Meshing workflow

- [CLI entry](https://github.com/wildmeshing/ftetwild/blob/master/src/main.cpp): `src/main.cpp`
- [Meshing options](https://github.com/wildmeshing/ftetwild/blob/master/src/Parameters.h): `src/Parameters.h`

### Geometry operations

- [Surface preprocessing](https://github.com/wildmeshing/ftetwild/blob/master/src/Simplification.cpp): `src/Simplification.cpp`
- [Surface mesh](https://github.com/wildmeshing/ftetwild/blob/master/src/MeshIO.cpp): `src/MeshIO.cpp`
- [Triangle insertion](https://github.com/wildmeshing/ftetwild/blob/master/src/TriangleInsertion.cpp): `src/TriangleInsertion.cpp`
- [Tet generation](https://github.com/wildmeshing/ftetwild/blob/master/src/FloatTetDelaunay.cpp): `src/FloatTetDelaunay.cpp`
- [Cut mesh](https://github.com/wildmeshing/ftetwild/blob/master/src/CutMesh.cpp): `src/CutMesh.cpp`
- [Local operations](https://github.com/wildmeshing/ftetwild/blob/master/src/LocalOperations.cpp): `src/LocalOperations.cpp`
- [Mesh improvement](https://github.com/wildmeshing/ftetwild/blob/master/src/MeshImprovement.cpp): `src/MeshImprovement.cpp`
- [Edge collapsing](https://github.com/wildmeshing/ftetwild/blob/master/src/EdgeCollapsing.cpp): `src/EdgeCollapsing.cpp`
- [Edge splitting](https://github.com/wildmeshing/ftetwild/blob/master/src/EdgeSplitting.cpp): `src/EdgeSplitting.cpp`
- [Edge swapping](https://github.com/wildmeshing/ftetwild/blob/master/src/EdgeSwapping.cpp): `src/EdgeSwapping.cpp`
- [Vertex smoothing](https://github.com/wildmeshing/ftetwild/blob/master/src/VertexSmoothing.cpp): `src/VertexSmoothing.cpp`
- [Coarsening](https://github.com/wildmeshing/ftetwild/blob/master/src/Simplification.cpp): `src/Simplification.cpp`

### Mesh I/O

- [Mesh export](https://github.com/wildmeshing/ftetwild/blob/master/src/MeshIO.cpp): `src/MeshIO.cpp`
- [MSH loader](https://github.com/wildmeshing/ftetwild/blob/master/src/external/MshLoader.cpp): `src/external/MshLoader.cpp`
- [MSH saver](https://github.com/wildmeshing/ftetwild/blob/master/src/external/MshSaver.cpp): `src/external/MshSaver.cpp`

### Cut configurations

- [Cut table](https://github.com/wildmeshing/ftetwild/blob/master/src/auto_table.cpp): `src/auto_table.cpp`
- [Cut table builder](https://github.com/wildmeshing/ftetwild/blob/master/python/build_cut_table.py): `python/build_cut_table.py`
- [Table code export](https://github.com/wildmeshing/ftetwild/blob/master/python/generate-table-code.py): `python/generate-table-code.py`
- [Cut configuration plot](https://github.com/wildmeshing/ftetwild/blob/master/python/plot-tet.py): `python/plot-tet.py`

### Other components

- **Meshing user**
- **Tetrahedral mesh**

## Connections

- Meshing user → CLI entry: invokes
- CLI entry → Surface mesh: loads input
- CLI entry → Meshing options: configures
- Surface mesh → Surface preprocessing: preprocesses
- Surface preprocessing → Triangle insertion: prepares surface
- Triangle insertion → Tet generation: inserts constraints
- Tet generation → Cut mesh: uses cuts
- Cut mesh → Cut table: reads configurations
- Tet generation → Mesh improvement: optimizes mesh
- Mesh improvement → Edge collapsing: may apply
- Mesh improvement → Edge splitting: may apply
- Mesh improvement → Edge swapping: may apply
- Mesh improvement → Vertex smoothing: may apply
- CLI entry → Coarsening: may coarsen
- CLI entry → Mesh export: exports mesh
- Mesh export → MSH saver: writes MSH
- Mesh export → Tetrahedral mesh: produces
- CLI entry → MSH loader: loads sizing mesh
- Cut table builder → Table code export: provides table (evidence: `python/generate-table-code.py`)
- Cut table builder → Cut configuration plot: provides configurations (evidence: `python/plot-tet.py`)
- CLI entry → Cut table: uses cut cases
