# jeffrey-p-mcateer/apollon architecture

> Architecture diagram of the GitHub repository jeffrey-p-mcateer/apollon, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jeffrey-p-mcateer/apollon
- Repository: https://github.com/jeffrey-p-mcateer/apollon

## Overview

Key Components to Include:

##### Core System Components
- Input Processing Layer
- CSV Entity Data Parser
- TOML Configuration Parser
- Simulation Engine Core
- GPU Acceleration Layer (OpenCL)
- State Management System
- Output Generation System
- Animation/Video Generation
- Performance Metrics

##### Data Flow Architecture

**[Input Layer]**

**[Processing Layer]**

**[Execution Layer]**

**[Output Layer]**

Specific Implementation Details:

##### Input Layer (Blue Components)
- entities.csv (Initial State Data)
- cl-kernels.toml (OpenCL Configurations)
- simcontrol.toml (Simulation Parameters)

##### Processing Layer (Green Components)
- Rust Core Components:
- main.rs (Entry Point)
- structs.rs (Data Structures)
- utils.rs (Utility Functions)

##### Execution Layer (Orange Components)
- GPU Acceleration:
- OpenCL Kernel Execution
- State Transformation Pipeline
- Event Processing System:
- Discrete Event Queue
- State Update Mechanism

##### Output Layer (Purple Components)
- Video Generation Pipeline
- Performance Metrics Collection
- GIF/MP4 Export System

Important Architectural Considerations:

- Data flow from input files to processing
- State transitions in the simulation engine
- Output generation flow

##### Specific technology callouts
- Rust (Primary Implementation)
- OpenCL (GPU Acceleration)
- TOML (Configuration Format)
- CSV (Input Data Format)

##### Parallel processing
- GPU workload distribution
- Concurrent event processing

##### Timing and synchronization
- Event scheduling mechanism
- Frame capture points
- State synchronization points

##### State Management System

This will provide both a clear overview and detailed implementation insights where needed.

Remember to emphasize:
- The GPU-accelerated nature of the system
- The discrete event simulation core
- The configuration-driven architecture
- The video output pipeline

This design should capture both the high-performance aspects and the flexibility of the system while maintaining clarity about the overall architecture.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style Definitions
    classDef input fill:#a8d1f0,stroke:#000
    classDef core fill:#90EE90,stroke:#000
    classDef execution fill:#FFB347,stroke:#000
    classDef output fill:#DDA0DD,stroke:#000
    
    subgraph Input
        CSV["entities.csv"]:::input
        CLTOML["cl-kernels.toml"]:::input
        SIMTOML["simcontrol.toml"]:::input
    end

    subgraph Core
        MAIN["main.rs"]:::core
        STRUCTS["structs.rs"]:::core
        UTILS["utils.rs"]:::core
        CARGO["Cargo.toml"]:::core
    end

    subgraph "Execution Layer"
        GPU["GPU Acceleration<br/>(OpenCL)"]:::execution
        EVENT["Event Processing<br/>System"]:::execution
        STATE["State Management<br/>System"]:::execution
    end

    subgraph "Output Generation"
        VIDEO["Video Generation<br/>Pipeline"]:::output
        METRICS["Performance<br/>Metrics"]:::output
        EXPORT["GIF/MP4 Export"]:::output
        TESTS["Testing Suite"]:::output
    end

    %% Connections
    CSV --> MAIN
    CLTOML --> MAIN
    SIMTOML --> MAIN
    
    MAIN --> STRUCTS
    MAIN --> UTILS
    
    STRUCTS --> GPU
    UTILS --> GPU
    
    GPU --> STATE
    STATE --> EVENT
    EVENT --> STATE
    
    STATE --> VIDEO
    STATE --> METRICS
    VIDEO --> EXPORT
    METRICS --> TESTS

    %% Click Events
    click CSV "https://github.com/Jeffrey-P-McAteer/apollon/blob/master/example-data/entities.csv"
    click CLTOML "https://github.com/Jeffrey-P-McAteer/apollon/blob/master/example-data/cl-kernels.toml"
    click SIMTOML "https://github.com/Jeffrey-P-McAteer/apollon/blob/master/example-data/simcontrol.toml"
    click MAIN "https://github.com/Jeffrey-P-McAteer/apollon/blob/master/src/main.rs"
    click STRUCTS "https://github.com/Jeffrey-P-McAteer/apollon/blob/master/src/structs.rs"
    click UTILS "https://github.com/Jeffrey-P-McAteer/apollon/blob/master/src/utils.rs"
    click CARGO "https://github.com/Jeffrey-P-McAteer/apollon/blob/master/Cargo.toml"
    click TESTS "https://github.com/Jeffrey-P-McAteer/apollon/blob/master/simtest.py"
    click EXPORT "https://github.com/Jeffrey-P-McAteer/apollon/blob/master/example.mp4"

    %% Legend
    subgraph Legend
        L1["Input Components"]:::input
        L2["Core Components"]:::core
        L3["Execution Components"]:::execution
        L4["Output Components"]:::output
    end
```
