# dlchao/flute architecture

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

- Interactive diagram: https://gitdiagram.com/dlchao/flute
- Repository: https://github.com/dlchao/flute

## Overview

FluTE is a stochastic, individual-based influenza epidemic simulator with day/night time steps. Users select a population dataset and configuration, then run the standard simulator or the single-index-case R0 variant to produce summaries and optional logs, tract, and individual files. The map separates configuration and population inputs, the epidemic model and its interventions, simulation entry points, and random-number support. Some internal stages are represented from documented capabilities rather than sampled implementation; edges are limited to relationships shown in the README or source index.

Main entry points: [`epimodel.cpp`](https://github.com/dlchao/flute/blob/master/epimodel.cpp) (Disease dynamics), [`R0model.cpp`](https://github.com/dlchao/flute/blob/master/R0model.cpp) (R0 estimation), [`flute.cpp`](https://github.com/dlchao/flute/blob/master/flute.cpp) (Standard simulation), [`epimodelparameters.cpp`](https://github.com/dlchao/flute/blob/master/epimodelparameters.cpp) (Parameter parsing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Inputs and configuration"]
  node_config["Run configuration"]
  node_population["Population datasets<br/>[one-tracts.dat]"]
  node_parameters["Parameter parsing"]
end

subgraph group_simulation["Epidemic simulation"]
  node_constants["Epidemic constants<br/>[params.cpp]"]
  node_population_model["Synthetic population<br/>[epimodel.cpp]"]
  node_disease["Disease dynamics<br/>[epimodel.cpp]"]
  node_contacts["Contact transmission<br/>[epimodel.cpp]"]
  node_travel["Travel and seeding<br/>[epimodel.cpp]"]
  node_vaccination["Vaccination strategies<br/>[epimodel.cpp]"]
  node_antivirals["Antiviral strategies<br/>[epimodel.cpp]"]
  node_nonpharmaceutical["Isolation and closure<br/>[epimodel.cpp]"]
end

subgraph group_analysis["Simulation modes and outputs"]
  node_standard["Standard simulation<br/>[flute.cpp]"]
  node_r0mode["R0 estimation<br/>[R0model.cpp]"]
  node_outputs["Simulation outputs"]
end

subgraph group_random["Random number generation"]
  node_rng["dSFMT generator<br/>[dSFMT.c]"]
  node_binomial["Binomial draws<br/>[bnldev.c]"]
end

node_user(("Simulator user"))

node_user -->|"runs"| node_standard
node_user -->|"runs"| node_r0mode
node_user -->|"selects"| node_config
node_user -->|"selects"| node_population
node_standard -->|"constructs"| node_parameters
node_r0mode -->|"constructs"| node_parameters
node_standard -.->|"runs"| node_population_model
node_r0mode -->|"extends"| node_population_model
node_parameters -->|"parses"| node_config
node_parameters -->|"creates"| node_outputs
node_population_model -->|"loads"| node_population
node_population_model -.->|"models"| node_disease
node_disease -.->|"transmits through"| node_contacts
node_disease -.->|"models"| node_travel
node_disease -.->|"applies"| node_vaccination
node_disease -.->|"applies"| node_antivirals
node_disease -.->|"applies"| node_nonpharmaceutical
node_disease -->|"uses"| node_constants
node_disease -->|"draws from"| node_rng
node_disease -->|"draws from"| node_binomial
node_r0mode -->|"draws from"| node_rng
node_standard -.->|"writes"| node_outputs
node_r0mode -->|"writes"| node_outputs

click node_config "https://github.com/dlchao/flute/blob/master/config-highrisk"
click node_population "https://github.com/dlchao/flute/blob/master/one-tracts.dat"
click node_parameters "https://github.com/dlchao/flute/blob/master/epimodelparameters.cpp"
click node_constants "https://github.com/dlchao/flute/blob/master/params.cpp"
click node_population_model "https://github.com/dlchao/flute/blob/master/epimodel.cpp"
click node_disease "https://github.com/dlchao/flute/blob/master/epimodel.cpp"
click node_contacts "https://github.com/dlchao/flute/blob/master/epimodel.cpp"
click node_travel "https://github.com/dlchao/flute/blob/master/epimodel.cpp"
click node_vaccination "https://github.com/dlchao/flute/blob/master/epimodel.cpp"
click node_antivirals "https://github.com/dlchao/flute/blob/master/epimodel.cpp"
click node_nonpharmaceutical "https://github.com/dlchao/flute/blob/master/epimodel.cpp"
click node_standard "https://github.com/dlchao/flute/blob/master/flute.cpp"
click node_r0mode "https://github.com/dlchao/flute/blob/master/R0model.cpp"
click node_outputs "https://github.com/dlchao/flute/blob/master/epimodelparameters.cpp"
click node_rng "https://github.com/dlchao/flute/blob/master/dSFMT.c"
click node_binomial "https://github.com/dlchao/flute/blob/master/bnldev.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_config,node_population,node_parameters,node_user toneBlue
class node_constants,node_population_model,node_disease,node_contacts,node_travel,node_vaccination,node_antivirals,node_nonpharmaceutical toneAmber
class node_standard,node_r0mode,node_outputs toneMint
class node_rng,node_binomial toneRose
```

## Components

### Inputs and configuration

- [Run configuration](https://github.com/dlchao/flute/blob/master/config-highrisk): `config-highrisk`
- [Population datasets](https://github.com/dlchao/flute/blob/master/one-tracts.dat): `one-tracts.dat`
- [Parameter parsing](https://github.com/dlchao/flute/blob/master/epimodelparameters.cpp): `epimodelparameters.cpp`

### Epidemic simulation

- [Epidemic constants](https://github.com/dlchao/flute/blob/master/params.cpp): `params.cpp`
- [Synthetic population](https://github.com/dlchao/flute/blob/master/epimodel.cpp): `epimodel.cpp`
- [Disease dynamics](https://github.com/dlchao/flute/blob/master/epimodel.cpp): `epimodel.cpp`
- [Contact transmission](https://github.com/dlchao/flute/blob/master/epimodel.cpp): `epimodel.cpp`
- [Travel and seeding](https://github.com/dlchao/flute/blob/master/epimodel.cpp): `epimodel.cpp`
- [Vaccination strategies](https://github.com/dlchao/flute/blob/master/epimodel.cpp): `epimodel.cpp`
- [Antiviral strategies](https://github.com/dlchao/flute/blob/master/epimodel.cpp): `epimodel.cpp`
- [Isolation and closure](https://github.com/dlchao/flute/blob/master/epimodel.cpp): `epimodel.cpp`

### Simulation modes and outputs

- [Standard simulation](https://github.com/dlchao/flute/blob/master/flute.cpp): `flute.cpp`
- [R0 estimation](https://github.com/dlchao/flute/blob/master/R0model.cpp): `R0model.cpp`
- [Simulation outputs](https://github.com/dlchao/flute/blob/master/epimodelparameters.cpp): `epimodelparameters.cpp`

### Random number generation

- [dSFMT generator](https://github.com/dlchao/flute/blob/master/dSFMT.c): `dSFMT.c`
- [Binomial draws](https://github.com/dlchao/flute/blob/master/bnldev.c): `bnldev.c`

### Other components

- **Simulator user**

## Connections

- Simulator user → Standard simulation: runs (evidence: `README`)
- Simulator user → R0 estimation: runs (evidence: `README`)
- Simulator user → Run configuration: selects (evidence: `README`)
- Simulator user → Population datasets: selects (evidence: `README`)
- Standard simulation → Parameter parsing: constructs (evidence: `flute.cpp`)
- R0 estimation → Parameter parsing: constructs (evidence: `R0model.cpp`)
- Standard simulation → Synthetic population: runs
- R0 estimation → Synthetic population: extends (evidence: `R0model.cpp`)
- Parameter parsing → Run configuration: parses (evidence: `README`)
- Parameter parsing → Simulation outputs: creates (evidence: `epimodelparameters.cpp`)
- Synthetic population → Population datasets: loads (evidence: `README`)
- Synthetic population → Disease dynamics: models (evidence: `epimodel.cpp`)
- Disease dynamics → Contact transmission: transmits through (evidence: `epimodel.cpp`)
- Disease dynamics → Travel and seeding: models (evidence: `epimodel.cpp`)
- Disease dynamics → Vaccination strategies: applies (evidence: `epimodel.cpp`)
- Disease dynamics → Antiviral strategies: applies (evidence: `epimodel.cpp`)
- Disease dynamics → Isolation and closure: applies (evidence: `epimodel.cpp`)
- Disease dynamics → Epidemic constants: uses (evidence: `epimodel.cpp`)
- Disease dynamics → dSFMT generator: draws from (evidence: `epimodel.cpp`)
- Disease dynamics → Binomial draws: draws from (evidence: `epimodel.cpp`)
- R0 estimation → dSFMT generator: draws from (evidence: `R0model.cpp`)
- Standard simulation → Simulation outputs: writes
- R0 estimation → Simulation outputs: writes (evidence: `R0model.cpp`)
