# daniel-sundae/stochastic-differential-equations architecture

> Architecture diagram of the GitHub repository daniel-sundae/stochastic-differential-equations, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/daniel-sundae/stochastic-differential-equations
- Repository: https://github.com/daniel-sundae/stochastic-differential-equations

## Overview

##### Main Components Identification
- Model: This includes all the domain and business logic. In the file tree, the “src/Model” directory holds key files like “Calculations” (with PathEngine, TaskQueue, and ThreadPool) and other utility classes (PDFQuery, PathQuery, ProcessData, and Utils). These components indicate that the Model is responsible for heavy computational tasks, possibly processing simulation data or path calculation data, and managing multi-threaded processing.
- Presenter: The “src/Presenter” folder encapsulates the logic that bridges the Model and the View. With files like MainPresenter, InputHandler, and OutputHandler, it serves to handle, transform, and orchestrate user inputs and outputs between the UI and the backend logic.
- View: The “src/View” directory is split into “Inputs” and “Outputs” indicating a clear separation of presentation components for user inputs (like ActionManager, InputManager, SimulationManager, SettingsManager, DefinitionManager) and outputs (with components for charts and windows). The “MainWindow” probably acts as the central graphical container that ties these displays together.

##### Relationships and Interactions
- At startup, the AppInitializer (found in “src/AppInitializer.cpp/hpp”) likely configures the overall application, sets up application-wide dependencies, and launches the GUI.
- The Presenter acts as a mediator between the View and the Model. User interactions (captured via InputHandler and the subcomponents in “src/View/Inputs”) are passed on to the Presenter, which then delegates computational tasks to the Model.
- The Model uses components like the ThreadPool and TaskQueue to manage concurrent calculations (for path or PDF queries). Once the calculations complete, the Model sends results back via the Presenter to the View.
- The View then renders these results, likely through components such as DistributionChart and PathChart.

##### Architectural Patterns and Conventions
- Modularity: Use of clear directories for “include” (with constants and shared types) shows that the project maintains modularity by separating common definitions from implementation.

##### Technologies and Tools
- Build & Configuration: Note the CMakeLists.txt, CMakePresets.json, and configuration files (like .clang-tidy) which imply that the project is built using CMake and follows modern C++ standards.
- Code Quality: The inclusion of a .clang-tidy file suggests a rigorous approach to static analysis and code quality.

##### Additional Elements
- Multithreading aspects provided by components like ThreadPool and TaskQueue in the Model.
- Boundaries such as external libraries or system dependencies (if applicable, like C++ runtime, any GUI libraries used, etc.).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Application Initialization
    subgraph "Application Initialization"
        A1["AppInitializer"]:::startup
    end

    %% Model Layer
    subgraph "Model"
        %% Calculations Sub-layer
        subgraph "Calculations"
            M1["PathEngine"]:::model_calc
            M2["TaskQueue"]:::model_calc
            M3["ThreadPool"]:::model_calc
            M1 -->|manages| M2
            M2 -->|queues| M3
        end
        %% Utilities and Queries Sub-layer
        subgraph "Utilities/Queries"
            M4["PDFQuery"]:::model_util
            M5["PathQuery"]:::model_util
            M6["ProcessData"]:::model_util
            M7["Utils"]:::model_util
        end
    end

    %% Presenter Layer
    subgraph "Presenter"
        P1["MainPresenter"]:::presenter
        P2["InputHandler"]:::presenter
        P3["OutputHandler"]:::presenter
        P4["IPresenterComponent"]:::presenter
    end

    %% View Layer
    subgraph "View"
        %% Input Components
        subgraph "Inputs"
            V1["ActionManager"]:::view_input
            V2["InputManager"]:::view_input
            V3["DefinitionManager"]:::view_input
            V4["SettingsManager"]:::view_input
            V5["SimulationManager"]:::view_input
        end
        %% Output Components
        subgraph "Outputs"
            V6["DistributionChart"]:::view_output
            V7["OutputManager"]:::view_output
            V8["PathChart"]:::view_output
        end
        V9["MainWindow"]:::view_window
        V10["ViewUtils"]:::view_window
    end

    %% Data Flow Connections
    A1 -->|"init"| P1
    V1 -->|"userInput"| P2
    V2 -->|"userInput"| P2
    V3 -->|"userInput"| P2
    V4 -->|"userInput"| P2
    V5 -->|"userInput"| P2
    P2 -->|"relays"| P1
    P1 -->|"delegate"| M1
    M1 -->|"result"| P1
    %% Optional interactions with other Model utilities
    P1 -->|"query"| M4
    P1 -->|"query"| M5
    P1 -->|"process"| M6
    P1 -->|"utilize"| M7
    P1 -->|"prepareOutput"| P3
    P3 -->|"render"| V6
    P3 -->|"render"| V7
    P3 -->|"render"| V8
    P3 -->|"updateUI"| V9

    %% Click Events for Model Calculations
    click M1 "https://github.com/daniel-sundae/stochastic-differential-equations/blob/main/src/Model/Calculations/PathEngine.hpp"
    click M2 "https://github.com/daniel-sundae/stochastic-differential-equations/blob/main/src/Model/Calculations/TaskQueue.hpp"
    click M3 "https://github.com/daniel-sundae/stochastic-differential-equations/blob/main/src/Model/Calculations/ThreadPool.hpp"

    %% Click Events for Model Utilities and Queries
    click M4 "https://github.com/daniel-sundae/stochastic-differential-equations/blob/main/src/Model/PDFQuery.hpp"
    click M5 "https://github.com/daniel-sundae/stochastic-differential-equations/blob/main/src/Model/PathQuery.hpp"
    click M6 "https://github.com/daniel-sundae/stochastic-differential-equations/blob/main/src/Model/ProcessData.hpp"
    click M7 "https://github.com/daniel-sundae/stochastic-differential-equations/blob/main/src/Model/Utils.hpp"

    %% Click Events for Presenter Components
    click P1 "https://github.com/daniel-sundae/stochastic-differential-equations/blob/main/src/Presenter/MainPresenter.hpp"
    click P2 "https://github.com/daniel-sundae/stochastic-differential-equations/blob/main/src/Presenter/InputHandler.hpp"
    click P3 "https://github.com/daniel-sundae/stochastic-differential-equations/blob/main/src/Presenter/OutputHandler.hpp"
    click P4 "https://github.com/daniel-sundae/stochastic-differential-equations/blob/main/src/Presenter/IPresenterComponent.hpp"

    %% Click Events for View Input Components
    click V1 "https://github.com/daniel-sundae/stochastic-differential-equations/blob/main/src/View/Inputs/ActionManager.hpp"
    click V2 "https://github.com/daniel-sundae/stochastic-differential-equations/blob/main/src/View/Inputs/InputManager.hpp"
    click V3 "https://github.com/daniel-sundae/stochastic-differential-equations/blob/main/src/View/Inputs/DefinitionManager.hpp"
    click V4 "https://github.com/daniel-sundae/stochastic-differential-equations/blob/main/src/View/Inputs/SettingsManager.hpp"
    click V5 "https://github.com/daniel-sundae/stochastic-differential-equations/blob/main/src/View/Inputs/SimulationManager.hpp"

    %% Click Events for View Output Components
    click V6 "https://github.com/daniel-sundae/stochastic-differential-equations/blob/main/src/View/Outputs/DistributionChart.hpp"
    click V7 "https://github.com/daniel-sundae/stochastic-differential-equations/blob/main/src/View/Outputs/OutputManager.hpp"
    click V8 "https://github.com/daniel-sundae/stochastic-differential-equations/blob/main/src/View/Outputs/PathChart.hpp"

    %% Click Events for View Main Window and Utilities
    click V9 "https://github.com/daniel-sundae/stochastic-differential-equations/blob/main/src/View/MainWindow.hpp"
    click V10 "https://github.com/daniel-sundae/stochastic-differential-equations/blob/main/src/View/ViewUtils.hpp"

    %% Click Event for Application Initialization
    click A1 "https://github.com/daniel-sundae/stochastic-differential-equations/blob/main/src/AppInitializer.hpp"

    %% Styles
    classDef startup fill:#d3d3d3,stroke:#000,stroke-width:2px;
    classDef model fill:#add8e6,stroke:#000,stroke-width:2px;
    classDef model_calc fill:#87cefa,stroke:#000,stroke-width:2px;
    classDef model_util fill:#b0e0e6,stroke:#000,stroke-width:2px;
    classDef presenter fill:#90ee90,stroke:#000,stroke-width:2px;
    classDef view_input fill:#ffe4b5,stroke:#000,stroke-width:2px;
    classDef view_output fill:#ffdab9,stroke:#000,stroke-width:2px;
    classDef view_window fill:#fffacd,stroke:#000,stroke-width:2px;
```
