# cnes/radiativetransfercode-osoaa architecture

> Architecture diagram of the GitHub repository cnes/radiativetransfercode-osoaa, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cnes/radiativetransfercode-osoaa
- Repository: https://github.com/cnes/radiativetransfercode-osoaa

## Overview

##### Project type and purpose
- OSOAA is a **scientific desktop application** combining
- A **Fortran core** (radiative‐transfer engine)
- A **Java Swing GUI** (ihm/)
- **Shell scripts** for batch runs (exe/)
- **Data files** and **configuration** (fic/, ihm/conf/)
- Purpose: compute polarized radiative transfer in the coupled ocean‐atmosphere, offering both GUI and CLI.

##### File structure
- Top-level directories:
- doc/ → user manuals and tutorial PDFs
- gen/ → Makefile templates for building the Fortran engine
- src/ + inc/ → Fortran sources and headers (OSOAA_MAIN.F, OSOAA_*.F, OSOAA.h)
- ihm/ → Java UI project
- fic/ → static data files (optical coefficients, reference tables)
- exe/ → shell scripts to launch demos or batch runs
- log4j.properties → logging configuration for Java

##### README insights
- Confirms layered architecture (core engine + GUI)
- Emphasizes user‐friendly interface and scripting capabilities
- Indicates heavy reliance on configuration (.properties) and external data sets

##### Main components
A. **User Interface (Java Swing)**
– Package: ihm/src/osoaa/usl (forms, common/UI)
– Dependencies: forms-1.3.0.jar, miglayout, log4j
B. **Business Logic Layer (Java BLL)**
– ihm/src/osoaa/bll: command management, domain enums, preferences factory
C. **Data Access Layer (Java DAL)**
– ihm/src/osoaa/dal: reads/writes preferences, properties via PropertiesManager
D. **Process Invocation Utilities**
– Common code: ProcessBuilderUtils in common/process
– Shell scripts in exe/ (run_OSOAA_demo.csh, .ksh)
E. **Fortran Computational Engine**
– src/*.F files plus inc/OSOAA.h
– Built via Makefile_OSOAA.* in gen/
– Produces a native executable (osoaa.bin or similar)
F. **Configuration & Data Files**
– ihm/conf/*.properties: models, geometry, output specs
– fic/*.txt: optical coefficients, reference data
G. **Build Tools**
– Java: Ant script (ihm/gen/build.xml) → produces OSOAAUI.jar
– Fortran: Makefiles
H. **Output & Logging**
– Radiance results files (location depends on properties)
– Java logging via log4j

##### Relationships & data flows
1. **User** → interacts with **Java UI** (Swing)
2. UI → calls **BLL CommandManager** → resolves user actions
3. BLL → uses **DAL** to load/save preferences & .properties
4. BLL → uses **ProcessBuilderUtils** or shell scripts to launch the Fortran engine
5. **Fortran engine** reads input parameters + configuration files + data files → performs computation → writes output files
6. Java UI polls or reads output files → displays results (tables, plots)
7. Logging occurs at Java side (log4j) and Fortran side (console or files)

##### Architectural patterns & design principles
- **Layered architecture**: UI (usl) → BLL → DAL → Engine
- **Factory pattern** for preferences (PreferencesFactory)
- **Command pattern** (ICommandManager / DALCommandManager) for decoupling UI actions from execution
- **Separation of concerns**: Java handles all orchestration, Fortran focuses on numerics
- **Configuration-driven**: .properties files control models and output specifics

## Diagram (Mermaid)

```mermaid
flowchart TB
    User(("User")):::external

    subgraph "Java Swing UI (UI Layer)"
        UI["OSOAAUI.jar (Java Swing)"]:::frontend
    end

    subgraph "Business Logic Layer"
        BLL["CommandManager & BLL"]:::frontend
    end

    subgraph "Data Access Layer"
        DAL["DAL & PropertiesManager"]:::frontend
    end

    subgraph "Process Invocation Utilities"
        PBU["ProcessBuilderUtils"]:::frontend
        Shell["Shell Scripts (Batch)"]:::scripts
    end

    subgraph "Fortran Engine"
        FOR["OSOAA Engine (Fortran Executable)"]:::backend
    end

    subgraph "Configuration & Data"
        Props[".properties files"]:::config
        Data["Static Data Files"]:::config
    end

    subgraph "Build Tools"
        Ant["Ant Build (build.xml)"]:::build
        Mk["Fortran Makefiles"]:::build
    end

    subgraph "Dependencies & Logging"
        Libs["forms.jar, miglayout, log4j"]:::external
        LogConf["log4j.properties"]:::config
    end

    User -->|"interacts with"| UI
    UI -->|"invokeAction()"| BLL
    BLL -->|"loadSavePrefs()"| DAL
    BLL -->|"launchEngine()"| PBU
    BLL -->|"launchBatch()"| Shell
    PBU -->|"exec osoaa.bin"| FOR
    Shell -->|"run_OSOAA_demo.csh/ksh"| FOR
    FOR -->|"writes output files"| UI
    UI -->|"readOutput()"| FOR
    DAL -->|"read/write"| Props
    FOR -->|"read"| Data
    Props -->|"configures"| FOR
    Ant -->|"build UI"| UI
    Mk -->|"build Engine"| FOR
    UI -.->|"uses"| Libs
    UI -.->|"logging"| LogConf

    click UI "https://github.com/cnes/radiativetransfercode-osoaa/blob/master/ihm/bin/OSOAAUI.jar"
    click Shell "https://github.com/cnes/radiativetransfercode-osoaa/blob/master/exe/run_OSOAA_demo.csh"
    click Shell "https://github.com/cnes/radiativetransfercode-osoaa/blob/master/exe/run_OSOAA_demo.ksh"
    click PBU "https://github.com/cnes/radiativetransfercode-osoaa/blob/master/ihm/src/osoaa/common/process/ProcessBuilderUtils.java"
    click BLL "https://github.com/cnes/radiativetransfercode-osoaa/tree/master/ihm/src/osoaa/bll"
    click DAL "https://github.com/cnes/radiativetransfercode-osoaa/tree/master/ihm/src/osoaa/dal"
    click Ant "https://github.com/cnes/radiativetransfercode-osoaa/blob/master/ihm/gen/build.xml"
    click Mk "https://github.com/cnes/radiativetransfercode-osoaa/blob/master/gen/Makefile_OSOAA.f77"
    click Mk "https://github.com/cnes/radiativetransfercode-osoaa/blob/master/gen/Makefile_OSOAA.g77"
    click Mk "https://github.com/cnes/radiativetransfercode-osoaa/blob/master/gen/Makefile_OSOAA.gfortran"
    click Props "https://github.com/cnes/radiativetransfercode-osoaa/tree/master/ihm/conf"
    click Data "https://github.com/cnes/radiativetransfercode-osoaa/tree/master/fic"
    click FOR "https://github.com/cnes/radiativetransfercode-osoaa/blob/master/src/OSOAA_MAIN.F"
    click FOR "https://github.com/cnes/radiativetransfercode-osoaa/blob/master/inc/OSOAA.h"
    click Libs "https://github.com/cnes/radiativetransfercode-osoaa/blob/master/ihm/lib/forms-1.3.0.jar"
    click Libs "https://github.com/cnes/radiativetransfercode-osoaa/blob/master/ihm/lib/miglayout15-swing.jar"
    click Libs "https://github.com/cnes/radiativetransfercode-osoaa/blob/master/ihm/lib/log4j-1.2.17.jar"
    click LogConf "https://github.com/cnes/radiativetransfercode-osoaa/blob/master/ihm/log4j.properties"
    click LogConf "https://github.com/cnes/radiativetransfercode-osoaa/blob/master/log4j.properties"
    click DOC1 "https://github.com/cnes/radiativetransfercode-osoaa/blob/master/doc/OSOAA-V2.0_UserManual-V2.0.pdf"
    click DOC2 "https://github.com/cnes/radiativetransfercode-osoaa/blob/master/doc/OSOAA_TUTORIAL_V2.0.pdf"

    classDef frontend fill:#D6EAF8,stroke:#1B4F72,color:#1B4F72
    classDef backend fill:#D5F5E3,stroke:#186A3B,color:#186A3B
    classDef config fill:#FCF3CF,stroke:#B7950B,color:#B7950B
    classDef scripts fill:#F2F3F4,stroke:#566573,color:#566573
    classDef build fill:#F2F4F4,stroke:#7B7D7D,color:#7B7D7D
    classDef external fill:#FADBD8,stroke:#922B21,color:#922B21
```
