# fire2a/c2fsb architecture

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

- Interactive diagram: https://gitdiagram.com/fire2a/c2fsb
- Repository: https://github.com/fire2a/c2fsb

## Overview

- Forest Data → Input Processing
- Weather Data → Input Processing
- Configuration Parameters → Input Processing

- Input Processing → Core Simulation
- Core Simulation → Output Processing

- Statistics → External Files
- Visualization → Plot Generation
- Grid Data → Forest State Output

##### Key Components Detail

a. Cell2FireC Core (Central Component)
- Forest Class
- CellsFBP Class
- Weather Processor
- Parallel Execution Manager

b. Python Wrapper (Outer Layer)
- Main Controller
- Statistics Module
- Visualization Module
- Data Parser

- Boost (C++)
- Eigen (C++)
- Python Libraries (numpy, pandas, matplotlib, etc.)

##### Version/Environment Information
- Python 3.6+ Requirement
- C++ Dependencies
- Operating System Compatibility

- The hybrid nature (C++/Python)
- Parallel processing capabilities
- Data flow through the system
- Clear separation of input/processing/output
- Integration points between components

Use a hierarchical layout with:
- Top: Input components
- Middle: Processing core
- Bottom: Output components

This will provide a clear understanding of the system's architecture while maintaining the necessary detail level for implementation and maintenance.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef input fill:#a8d1f0,stroke:#000
    classDef core fill:#ffb3b3,stroke:#000
    classDef output fill:#b3e6b3,stroke:#000
    classDef storage fill:#e6e6e6,stroke:#000
    classDef wrapper fill:#ffd9b3,stroke:#000

    %% Input Processing Layer
    subgraph InputLayer
        DI["Data Input Handler"]
        IV["Input Validation"]
        FP["File Parser"]
    end

    %% Core Simulation Layer
    subgraph CoreLayer
        SC["C++ Simulation Core"]
        FSC["Fire Spread Calculator"]
        WP["Weather Processor"]
        PCM["Parallel Computing Manager"]
        FM["Forest Manager"]
        FB["Fire Behavior"]
    end

    %% Output Processing Layer
    subgraph OutputLayer
        SG["Statistics Generator"]
        GM["Grid Manager"]
        VE["Visualization Engine"]
        RW["Results Writer"]
    end

    %% Python Wrapper
    subgraph WrapperLayer
        MC["Main Controller"]
        DG["Data Generator"]
        HM["Heuristics Module"]
    end

    %% Data Storage
    subgraph Storage
        ID["Input Data"]
        OE["Output Examples"]
        WD["Weather Data"]
    end

    %% Connections
    ID --> DI
    WD --> DI
    DI --> IV
    IV --> FP
    FP --> SC
    SC --> FSC
    SC --> WP
    SC --> PCM
    SC --> FM
    FM --> FB
    FSC --> RW
    RW --> SG
    SG --> GM
    GM --> VE
    MC --> SC
    DG --> SC
    HM --> SC

    %% Click Events
    click DI "https://github.com/fire2a/C2FSB/blob/main/Cell2Fire/ParseInputs.py"
    click FP "https://github.com/fire2a/C2FSB/blob/main/Cell2FireC/ReadCSV.cpp"
    click IV "https://github.com/fire2a/C2FSB/blob/main/Cell2FireC/ReadArgs.cpp"
    click SC "https://github.com/fire2a/C2FSB/blob/main/Cell2FireC/Cell2Fire.cpp"
    click FSC "https://github.com/fire2a/C2FSB/blob/main/Cell2FireC/CellsFBP.cpp"
    click FM "https://github.com/fire2a/C2FSB/blob/main/Cell2FireC/Forest.cpp"
    click FB "https://github.com/fire2a/C2FSB/blob/main/Cell2FireC/SpottingFBP.cpp"
    click SG "https://github.com/fire2a/C2FSB/blob/main/Cell2Fire/Stats.py"
    click GM "https://github.com/fire2a/C2FSB/blob/main/Cell2Fire/Output_Grid.py"
    click VE "https://github.com/fire2a/C2FSB/blob/main/Cell2Fire/Plot.py"
    click RW "https://github.com/fire2a/C2FSB/blob/main/Cell2FireC/WriteCSV.cpp"
    click MC "https://github.com/fire2a/C2FSB/blob/main/main.py"
    click DG "https://github.com/fire2a/C2FSB/blob/main/Cell2Fire/DataGeneratorC.py"
    click HM "https://github.com/fire2a/C2FSB/blob/main/Cell2Fire/Heuristics.py"
    click ID "https://github.com/fire2a/C2FSB/tree/main/data/"
    click OE "https://github.com/fire2a/C2FSB/tree/main/examples/"
    click WD "https://github.com/fire2a/C2FSB/blob/main/data/*/Weather.csv"

    %% Style Applications
    class DI,IV,FP input
    class SC,FSC,WP,PCM,FM,FB core
    class SG,GM,VE,RW output
    class MC,DG,HM wrapper
    class ID,OE,WD storage
```
