# teuben/nemo architecture

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

- Interactive diagram: https://gitdiagram.com/teuben/nemo
- Repository: https://github.com/teuben/nemo

## Overview

NEMO is a scientific toolbox for stellar dynamics, particle simulation, stellar orbits, image processing, and tabular data. Its central user workflow is to run command-line tools that create or transform domain objects—tables, snapshots, images, and orbits—and pass results to analysis or plotting tools, often through Unix pipes. The tree also shows supporting numerical, FITS, and graphics code, plus specialized contributed algorithms. Edges for the example command pipelines are documented in the README; unsampled subsystem paths indicate scope, not inspected implementation details.

Main entry points: [`src/nbody`](https://github.com/teuben/nemo/tree/master/src/nbody) (Snapshot tools), [`src/kernel/tab`](https://github.com/teuben/nemo/tree/master/src/kernel/tab) (Table tools), [`src/image`](https://github.com/teuben/nemo/tree/master/src/image) (Image tools), [`src/orbit`](https://github.com/teuben/nemo/tree/master/src/orbit) (Orbit tools)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflows["Scientific workflows"]
  node_tabletools["Table tools"]
  node_snapshottools["Snapshot tools"]
  node_imagetools["Image tools"]
  node_orbittools["Orbit tools"]
  node_nbodyevolution["N-body evolution"]
end

subgraph group_data["Data and formats"]
  node_snapshotio["Snapshot I/O"]
  node_fitsio["FITS interface<br/>[fitsio.h]"]
  node_fitsaliases["FITS aliases<br/>[longnam.h]"]
  node_imagefits["Image FITS<br/>[fits.c]"]
  node_tablestorage["Table storage<br/>[table.c]"]
end

subgraph group_runtime["Runtime foundations"]
  node_cli["Command interface<br/>[main.c]"]
  node_parameters["Parameter parsing<br/>[getparam.c]"]
  node_commonheaders["Common definitions<br/>[stdinc.h]"]
  node_mathfunctions["Math functions<br/>[mathfns.h]"]
  node_mpfit["Least-squares fitting<br/>[mpfit.c]"]
end

subgraph group_visualization["Visualization"]
  node_animation["Animation engine"]
  node_animationdata["Frame data<br/>[frame_data.h]"]
  node_graphicsdriver["X11 graphics driver<br/>[X11.c]"]
  node_graphicsapi["VOGL interface<br/>[vogl.h]"]
end

subgraph group_specialized["Specialized algorithms"]
  node_hop["HOP group finder<br/>[hop.c]"]
  node_kdsearch["KD-tree search<br/>[kd.h]"]
  node_bh_tree["Barnes-Hut tree<br/>[BHtree.C]"]
  node_bh_types["Tree data types<br/>[BHtree.h]"]
  node_quadrupole["Quadrupole forces<br/>[quadforce.c]"]
  node_treeio["Tree-code I/O<br/>[treeio.c]"]
end

node_user(("NEMO user"))

node_user -->|"runs commands"| node_tabletools
node_tabletools -->|"pipes table"| node_tabletools
node_user -->|"runs commands"| node_snapshottools
node_snapshottools -->|"pipes snapshot"| node_snapshottools
node_user -->|"runs commands"| node_imagetools
node_imagetools -->|"pipes image"| node_imagetools
node_user -->|"runs commands"| node_orbittools
node_orbittools -->|"pipes orbit"| node_orbittools
node_snapshottools -.->|"uses formats"| node_snapshotio
node_imagefits -.->|"uses FITS"| node_fitsio
node_fitsio -->|"includes aliases"| node_fitsaliases
node_animation -->|"uses frames"| node_animationdata
node_graphicsdriver -->|"uses API"| node_graphicsapi
node_hop -->|"uses KD-tree"| node_kdsearch
node_bh_tree -->|"uses types"| node_bh_types
node_user -.->|"runs simulations"| node_nbodyevolution
node_user -.->|"uses fitting"| node_mpfit
node_user -.->|"uses forces"| node_quadrupole
node_user -.->|"uses tree tools"| node_treeio

click node_tabletools "https://github.com/teuben/nemo/tree/master/src/kernel/tab"
click node_snapshottools "https://github.com/teuben/nemo/tree/master/src/nbody"
click node_imagetools "https://github.com/teuben/nemo/tree/master/src/image"
click node_orbittools "https://github.com/teuben/nemo/tree/master/src/orbit"
click node_nbodyevolution "https://github.com/teuben/nemo/tree/master/src/nbody/evolve"
click node_snapshotio "https://github.com/teuben/nemo/tree/master/inc/snapshot"
click node_fitsio "https://github.com/teuben/nemo/blob/master/inc/cfitsio/fitsio.h"
click node_fitsaliases "https://github.com/teuben/nemo/blob/master/inc/cfitsio/longnam.h"
click node_imagefits "https://github.com/teuben/nemo/blob/master/src/image/fits/fits.c"
click node_tablestorage "https://github.com/teuben/nemo/blob/master/src/kernel/tab/table.c"
click node_cli "https://github.com/teuben/nemo/blob/master/src/kernel/io/main.c"
click node_parameters "https://github.com/teuben/nemo/blob/master/src/kernel/io/getparam.c"
click node_commonheaders "https://github.com/teuben/nemo/blob/master/inc/stdinc.h"
click node_mathfunctions "https://github.com/teuben/nemo/blob/master/inc/mathfns.h"
click node_mpfit "https://github.com/teuben/nemo/blob/master/usr/lib/cmpfit/mpfit.c"
click node_animation "https://github.com/teuben/nemo/blob/master/src/nbody/glnemo/src/animation_engine.cpp"
click node_animationdata "https://github.com/teuben/nemo/blob/master/src/nbody/glnemo/src/frame_data.h"
click node_graphicsdriver "https://github.com/teuben/nemo/blob/master/usr/vogl/drivers/X11.c"
click node_graphicsapi "https://github.com/teuben/nemo/blob/master/usr/vogl/src/vogl.h"
click node_hop "https://github.com/teuben/nemo/blob/master/usr/deisenst/hop/hop.c"
click node_kdsearch "https://github.com/teuben/nemo/blob/master/usr/deisenst/hop/kd.h"
click node_bh_tree "https://github.com/teuben/nemo/blob/master/usr/kawai/nbody/BHtree.C"
click node_bh_types "https://github.com/teuben/nemo/blob/master/usr/kawai/nbody/BHtree.h"
click node_quadrupole "https://github.com/teuben/nemo/blob/master/inc/multicode/quadforce.c"
click node_treeio "https://github.com/teuben/nemo/blob/master/usr/koda/etude/treeio.c"

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_tabletools,node_snapshottools,node_imagetools,node_orbittools,node_nbodyevolution,node_user toneBlue
class node_snapshotio,node_fitsio,node_fitsaliases,node_imagefits,node_tablestorage toneAmber
class node_cli,node_parameters,node_commonheaders,node_mathfunctions,node_mpfit toneMint
class node_animation,node_animationdata,node_graphicsdriver,node_graphicsapi toneRose
class node_hop,node_kdsearch,node_bh_tree,node_bh_types,node_quadrupole,node_treeio toneIndigo
```

## Components

### Scientific workflows

- [Table tools](https://github.com/teuben/nemo/tree/master/src/kernel/tab): `src/kernel/tab`
- [Snapshot tools](https://github.com/teuben/nemo/tree/master/src/nbody): `src/nbody`
- [Image tools](https://github.com/teuben/nemo/tree/master/src/image): `src/image`
- [Orbit tools](https://github.com/teuben/nemo/tree/master/src/orbit): `src/orbit`
- [N-body evolution](https://github.com/teuben/nemo/tree/master/src/nbody/evolve): `src/nbody/evolve`

### Data and formats

- [Snapshot I/O](https://github.com/teuben/nemo/tree/master/inc/snapshot): `inc/snapshot`
- [FITS interface](https://github.com/teuben/nemo/blob/master/inc/cfitsio/fitsio.h): `inc/cfitsio/fitsio.h`
- [FITS aliases](https://github.com/teuben/nemo/blob/master/inc/cfitsio/longnam.h): `inc/cfitsio/longnam.h`
- [Image FITS](https://github.com/teuben/nemo/blob/master/src/image/fits/fits.c): `src/image/fits/fits.c`
- [Table storage](https://github.com/teuben/nemo/blob/master/src/kernel/tab/table.c): `src/kernel/tab/table.c`

### Runtime foundations

- [Command interface](https://github.com/teuben/nemo/blob/master/src/kernel/io/main.c): `src/kernel/io/main.c`
- [Parameter parsing](https://github.com/teuben/nemo/blob/master/src/kernel/io/getparam.c): `src/kernel/io/getparam.c`
- [Common definitions](https://github.com/teuben/nemo/blob/master/inc/stdinc.h): `inc/stdinc.h`
- [Math functions](https://github.com/teuben/nemo/blob/master/inc/mathfns.h): `inc/mathfns.h`
- [Least-squares fitting](https://github.com/teuben/nemo/blob/master/usr/lib/cmpfit/mpfit.c): `usr/lib/cmpfit/mpfit.c`

### Visualization

- [Animation engine](https://github.com/teuben/nemo/blob/master/src/nbody/glnemo/src/animation_engine.cpp): `src/nbody/glnemo/src/animation_engine.cpp`
- [Frame data](https://github.com/teuben/nemo/blob/master/src/nbody/glnemo/src/frame_data.h): `src/nbody/glnemo/src/frame_data.h`
- [X11 graphics driver](https://github.com/teuben/nemo/blob/master/usr/vogl/drivers/X11.c): `usr/vogl/drivers/X11.c`
- [VOGL interface](https://github.com/teuben/nemo/blob/master/usr/vogl/src/vogl.h): `usr/vogl/src/vogl.h`

### Specialized algorithms

- [HOP group finder](https://github.com/teuben/nemo/blob/master/usr/deisenst/hop/hop.c): `usr/deisenst/hop/hop.c`
- [KD-tree search](https://github.com/teuben/nemo/blob/master/usr/deisenst/hop/kd.h): `usr/deisenst/hop/kd.h`
- [Barnes-Hut tree](https://github.com/teuben/nemo/blob/master/usr/kawai/nbody/BHtree.C): `usr/kawai/nbody/BHtree.C`
- [Tree data types](https://github.com/teuben/nemo/blob/master/usr/kawai/nbody/BHtree.h): `usr/kawai/nbody/BHtree.h`
- [Quadrupole forces](https://github.com/teuben/nemo/blob/master/inc/multicode/quadforce.c): `inc/multicode/quadforce.c`
- [Tree-code I/O](https://github.com/teuben/nemo/blob/master/usr/koda/etude/treeio.c): `usr/koda/etude/treeio.c`

### Other components

- **NEMO user**

## Connections

- NEMO user → Table tools: runs commands
- Table tools → Table tools: pipes table
- NEMO user → Snapshot tools: runs commands
- Snapshot tools → Snapshot tools: pipes snapshot
- NEMO user → Image tools: runs commands
- Image tools → Image tools: pipes image
- NEMO user → Orbit tools: runs commands
- Orbit tools → Orbit tools: pipes orbit
- Snapshot tools → Snapshot I/O: uses formats
- Image FITS → FITS interface: uses FITS
- FITS interface → FITS aliases: includes aliases (evidence: `inc/cfitsio/fitsio.h`)
- Animation engine → Frame data: uses frames
- X11 graphics driver → VOGL interface: uses API (evidence: `usr/vogl/drivers/X11.c`)
- HOP group finder → KD-tree search: uses KD-tree (evidence: `usr/deisenst/hop/hop.c`)
- Barnes-Hut tree → Tree data types: uses types (evidence: `usr/kawai/nbody/BHtree.C`)
- NEMO user → N-body evolution: runs simulations
- NEMO user → Least-squares fitting: uses fitting
- NEMO user → Quadrupole forces: uses forces
- NEMO user → Tree-code I/O: uses tree tools
