# graealex/wavedudenext architecture

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

- Interactive diagram: https://gitdiagram.com/graealex/wavedudenext
- Repository: https://github.com/graealex/wavedudenext

## Overview

WaveDude Next is a Windows 2D optics wave simulator. Users build or open a project, configure sources and optical parts, run the simulation, inspect field and intensity frames and probe graphs, then export frames, video, or probe data. The graph separates the project/model, run and engine, inspection/rendering, and export stages, with workspace capabilities alongside them. Relationships are limited to README statements and references visible in the supplied source index; unsampled implementation details are not inferred.

Main entry points: [`WaveDudeNext/Model/Project.cs`](https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext/Model/Project.cs) (Project document), [`WaveDudeNext/Runs/SimulationRun.cs`](https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext/Runs/SimulationRun.cs) (Simulation run), [`WaveDudeNext.WPF/Panes/PreviewPane.xaml.cs`](https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext.WPF/Panes/PreviewPane.xaml.cs) (Frame preview), [`WaveDudeNext.WPF/MainWindow.xaml.cs`](https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext.WPF/MainWindow.xaml.cs) (Project editing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Workspace and editing"]
  node_app["Desktop workspace<br/>[App.xaml.cs]"]
  node_editor["Project editing<br/>[MainWindow.xaml.cs]"]
  node_live["Live preview<br/>[LivePreview.cs]"]
  node_manual["Built-in manual"]
end

subgraph group_model["Project and scene"]
  node_project["Project document<br/>[Project.cs]"]
  node_scene["Scene canvas<br/>[Scene.cs]"]
  node_sources["Sources<br/>[Source.cs]"]
  node_optics["Optical parts<br/>[OpticalPart.cs]"]
  node_simulation["Simulation settings<br/>[Simulation.cs]"]
  node_display["Display and probes<br/>[Display.cs]"]
end

subgraph group_compute["Simulation and runs"]
  node_composer["Scene composition<br/>[SceneComposer.cs]"]
  node_runhost["Run coordination<br/>[RunHost.cs]"]
  node_run["Simulation run<br/>[SimulationRun.cs]"]
  node_enginefactory["Engine selection"]
  node_cpu["CPU engine<br/>[WaveSimulator.cs]"]
  node_gpu["GPU engine"]
  node_frames[("Frame cache<br/>[FrameCache.cs]")]
end

subgraph group_inspect["Display and inspection"]
  node_preview["Frame preview"]
  node_renderer["Frame rendering<br/>[FrameRenderer.cs]"]
  node_probes["Probe sampling and graphs<br/>[ProbeSampler.cs]"]
end

subgraph group_output["Export and settings"]
  node_export["Export jobs and formats<br/>[ExportJob.cs]"]
  node_catalog["Color schemes"]
  node_settings["Application settings<br/>[Settings.cs]"]
end

node_user(("User"))
node_files["Project and image files"]

node_user -->|"uses"| node_app
node_app -->|"opens workspace"| node_editor
node_editor -.->|"edits"| node_project
node_files -->|"opens and saves"| node_project
node_project -->|"defines"| node_scene
node_project -->|"holds"| node_sources
node_project -->|"holds"| node_optics
node_project -->|"holds"| node_simulation
node_project -->|"holds"| node_display
node_editor -.->|"requests updates"| node_live
node_live -->|"composes scene"| node_composer
node_live -->|"coordinates runs"| node_runhost
node_composer -.->|"reads scene"| node_scene
node_runhost -.->|"starts run"| node_run
node_run -->|"creates engine"| node_enginefactory
node_enginefactory -->|"tries GPU"| node_gpu
node_enginefactory -->|"falls back"| node_cpu
node_run -.->|"stores frames"| node_frames
node_run -.->|"samples probes"| node_probes
node_preview -->|"reads run state"| node_run
node_preview -.->|"renders frames"| node_renderer
node_preview -->|"uses schemes"| node_catalog
node_user -->|"inspects results"| node_preview
node_user -->|"configures probes"| node_probes
node_user -->|"exports results"| node_export
node_export -.->|"reads frames"| node_frames
node_export -->|"exports CSV"| node_probes
node_settings -.->|"configures schemes"| node_catalog
node_user -->|"opens manual"| node_manual

click node_app "https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext.WPF/App.xaml.cs"
click node_editor "https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext.WPF/MainWindow.xaml.cs"
click node_live "https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext.UI/LivePreview.cs"
click node_project "https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext/Model/Project.cs"
click node_scene "https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext/Model/Scene.cs"
click node_sources "https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext/Model/Source.cs"
click node_optics "https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext/Model/OpticalPart.cs"
click node_simulation "https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext/Model/Simulation.cs"
click node_display "https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext/Model/Display.cs"
click node_composer "https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext.UI/SceneComposer.cs"
click node_runhost "https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext.UI/RunHost.cs"
click node_run "https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext/Runs/SimulationRun.cs"
click node_enginefactory "https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext/Engine/WaveEngineFactory.cs"
click node_cpu "https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext/Engine/WaveSimulator.cs"
click node_gpu "https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext/Engine/GpuWaveSimulator.cs"
click node_frames "https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext/Runs/FrameCache.cs"
click node_preview "https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext.WPF/Panes/PreviewPane.xaml.cs"
click node_renderer "https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext/Rendering/FrameRenderer.cs"
click node_probes "https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext/Probes/ProbeSampler.cs"
click node_export "https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext/Export/ExportJob.cs"
click node_catalog "https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext.UI/Rendering/ColorSchemeCatalog.cs"
click node_settings "https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext.UI/Settings.cs"
click node_manual "https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext.WPF/Help/ManualWindow.xaml.cs"

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_app,node_editor,node_live,node_manual,node_user toneBlue
class node_project,node_scene,node_sources,node_optics,node_simulation,node_display toneAmber
class node_composer,node_runhost,node_run,node_enginefactory,node_cpu,node_gpu,node_frames toneMint
class node_preview,node_renderer,node_probes toneRose
class node_export,node_catalog,node_settings,node_files toneIndigo
```

## Components

### Workspace and editing

- [Desktop workspace](https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext.WPF/App.xaml.cs): `WaveDudeNext.WPF/App.xaml.cs`
- [Project editing](https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext.WPF/MainWindow.xaml.cs): `WaveDudeNext.WPF/MainWindow.xaml.cs`
- [Live preview](https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext.UI/LivePreview.cs): `WaveDudeNext.UI/LivePreview.cs`
- [Built-in manual](https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext.WPF/Help/ManualWindow.xaml.cs): `WaveDudeNext.WPF/Help/ManualWindow.xaml.cs`

### Project and scene

- [Project document](https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext/Model/Project.cs): `WaveDudeNext/Model/Project.cs`
- [Scene canvas](https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext/Model/Scene.cs): `WaveDudeNext/Model/Scene.cs`
- [Sources](https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext/Model/Source.cs): `WaveDudeNext/Model/Source.cs`
- [Optical parts](https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext/Model/OpticalPart.cs): `WaveDudeNext/Model/OpticalPart.cs`
- [Simulation settings](https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext/Model/Simulation.cs): `WaveDudeNext/Model/Simulation.cs`
- [Display and probes](https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext/Model/Display.cs): `WaveDudeNext/Model/Display.cs`

### Simulation and runs

- [Scene composition](https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext.UI/SceneComposer.cs): `WaveDudeNext.UI/SceneComposer.cs`
- [Run coordination](https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext.UI/RunHost.cs): `WaveDudeNext.UI/RunHost.cs`
- [Simulation run](https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext/Runs/SimulationRun.cs): `WaveDudeNext/Runs/SimulationRun.cs`
- [Engine selection](https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext/Engine/WaveEngineFactory.cs): `WaveDudeNext/Engine/WaveEngineFactory.cs`
- [CPU engine](https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext/Engine/WaveSimulator.cs): `WaveDudeNext/Engine/WaveSimulator.cs`
- [GPU engine](https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext/Engine/GpuWaveSimulator.cs): `WaveDudeNext/Engine/GpuWaveSimulator.cs`
- [Frame cache](https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext/Runs/FrameCache.cs): `WaveDudeNext/Runs/FrameCache.cs`

### Display and inspection

- [Frame preview](https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext.WPF/Panes/PreviewPane.xaml.cs): `WaveDudeNext.WPF/Panes/PreviewPane.xaml.cs`
- [Frame rendering](https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext/Rendering/FrameRenderer.cs): `WaveDudeNext/Rendering/FrameRenderer.cs`
- [Probe sampling and graphs](https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext/Probes/ProbeSampler.cs): `WaveDudeNext/Probes/ProbeSampler.cs`

### Export and settings

- [Export jobs and formats](https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext/Export/ExportJob.cs): `WaveDudeNext/Export/ExportJob.cs`
- [Color schemes](https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext.UI/Rendering/ColorSchemeCatalog.cs): `WaveDudeNext.UI/Rendering/ColorSchemeCatalog.cs`
- [Application settings](https://github.com/graealex/wavedudenext/blob/master/WaveDudeNext.UI/Settings.cs): `WaveDudeNext.UI/Settings.cs`

### Other components

- **User**
- **Project and image files**

## Connections

- User → Desktop workspace: uses (evidence: `README.md`)
- Desktop workspace → Project editing: opens workspace (evidence: `README.md`)
- Project editing → Project document: edits
- Project and image files → Project document: opens and saves (evidence: `README.md`)
- Project document → Scene canvas: defines (evidence: `WaveDudeNext/Model/Project.cs`)
- Project document → Sources: holds (evidence: `WaveDudeNext/Model/Project.cs`)
- Project document → Optical parts: holds (evidence: `WaveDudeNext/Model/Project.cs`)
- Project document → Simulation settings: holds (evidence: `WaveDudeNext/Model/Project.cs`)
- Project document → Display and probes: holds (evidence: `WaveDudeNext/Model/Project.cs`)
- Project editing → Live preview: requests updates
- Live preview → Scene composition: composes scene (evidence: `WaveDudeNext.UI/LivePreview.cs`)
- Live preview → Run coordination: coordinates runs (evidence: `WaveDudeNext.UI/LivePreview.cs`)
- Scene composition → Scene canvas: reads scene
- Run coordination → Simulation run: starts run
- Simulation run → Engine selection: creates engine (evidence: `WaveDudeNext/Engine/WaveEngineFactory.cs`)
- Engine selection → GPU engine: tries GPU (evidence: `WaveDudeNext/Engine/WaveEngineFactory.cs`)
- Engine selection → CPU engine: falls back (evidence: `WaveDudeNext/Engine/WaveEngineFactory.cs`)
- Simulation run → Frame cache: stores frames
- Simulation run → Probe sampling and graphs: samples probes (evidence: `WaveDudeNext/Runs/SimulationRun.cs`)
- Frame preview → Simulation run: reads run state (evidence: `WaveDudeNext.WPF/Panes/PreviewPane.xaml.cs`)
- Frame preview → Frame rendering: renders frames
- Frame preview → Color schemes: uses schemes (evidence: `WaveDudeNext.WPF/Panes/PreviewPane.xaml.cs`)
- User → Frame preview: inspects results (evidence: `README.md`)
- User → Probe sampling and graphs: configures probes (evidence: `README.md`)
- User → Export jobs and formats: exports results (evidence: `README.md`)
- Export jobs and formats → Frame cache: reads frames
- Export jobs and formats → Probe sampling and graphs: exports CSV (evidence: `README.md`)
- Application settings → Color schemes: configures schemes
- User → Built-in manual: opens manual (evidence: `README.md`)
