# thliebig/openems architecture

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

- Interactive diagram: https://gitdiagram.com/thliebig/openems
- Repository: https://github.com/thliebig/openems

## Overview

##### Main Components (Top Level)

a) Core Engine Layer:
- FDTD (Finite-Difference Time-Domain) Engine
- Common Processing Components
- NF2FF (Near-field to Far-field) Transformer

b) Interface Layer:
- MATLAB Interface
- Python Interface
- Command-line Interface

c) Tools & Utilities Layer
- File I/O (HDF5, VTK)
- Signal Processing
- Array Operations

##### Key Relationships to Highlight

- How the MATLAB/Python interfaces connect to the core FDTD engine
- Data flow from the FDTD engine through the processing components
- Demonstrate how the NF2FF transformer interacts with the field data
- Relationship between the tools layer and other components

##### Detailed Component Breakdown

- Base Engine
- Cylindrical Engine
- Multi-grid Engine
- MPI/Parallel Processing
- Extensions (show as connected modules):
- PML (Perfectly Matched Layer)
- Materials (Lorentz, Dispersive)
- Excitation
- Boundary Conditions

##### Data Flow Indicators

- Input flow from interfaces to engine
- Processing flow through FDTD solver
- Output data flow to visualization/analysis tools
- Parallel processing communication paths

##### Technical Details

Annotations for:
- File formats supported (HDF5, VTK)
- Key algorithms (FDTD, NF2FF)
- Supported material types
- Boundary condition types

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Core["Core Engine Layer"]
        FDTD["FDTD Engine"]:::core
        click FDTD "https://github.com/thliebig/openEMS/blob/master/FDTD/engine.cpp"
        Common["Common Processing"]:::core
        click Common "https://github.com/thliebig/openEMS/tree/master/Common/"
        NF2FF["NF2FF Transformer"]:::core
        click NF2FF "https://github.com/thliebig/openEMS/tree/master/nf2ff/"
        
        subgraph Extensions["Engine Extensions"]
            PML["PML"]:::extension
            click PML "https://github.com/thliebig/openEMS/blob/master/FDTD/extensions/engine_ext_upml.h"
            LM["Lorentz Materials"]:::extension
            click LM "https://github.com/thliebig/openEMS/blob/master/FDTD/extensions/engine_ext_lorentzmaterial.h"
            DM["Dispersive Materials"]:::extension
            click DM "https://github.com/thliebig/openEMS/blob/master/FDTD/extensions/engine_ext_dispersive.h"
            EX["Excitation"]:::extension
            click EX "https://github.com/thliebig/openEMS/blob/master/FDTD/extensions/engine_ext_excitation.h"
        end

        subgraph Engines["Specialized Engines"]
            PP["Parallel Processing"]:::engine
            click PP "https://github.com/thliebig/openEMS/blob/master/FDTD/engine_mpi.h"
            CE["Cylindrical Engine"]:::engine
            click CE "https://github.com/thliebig/openEMS/blob/master/FDTD/engine_cylinder.h"
            MGE["Multi-grid Engine"]:::engine
            click MGE "https://github.com/thliebig/openEMS/blob/master/FDTD/engine_cylindermultigrid.h"
        end
    end

    subgraph Interface["Interface Layer"]
        MATLAB["MATLAB Interface"]:::interface
        click MATLAB "https://github.com/thliebig/openEMS/tree/master/matlab/"
        Python["Python Interface"]:::interface
        click Python "https://github.com/thliebig/openEMS/tree/master/python/openEMS/"
        CLI["Command-line Interface"]:::interface
        click CLI "https://github.com/thliebig/openEMS/blob/master/openems.cpp"
    end

    subgraph Tools["Tools & Utilities Layer"]
        FileIO["File I/O (HDF5, VTK)"]:::tool
        click FileIO "https://github.com/thliebig/openEMS/blob/master/tools/hdf5_file_reader.h"
        SignalProc["Signal Processing"]:::tool
        click SignalProc "https://github.com/thliebig/openEMS/blob/master/tools/signal.h"
        ArrayOps["Array Operations"]:::tool
        click ArrayOps "https://github.com/thliebig/openEMS/blob/master/tools/array_ops.h"
    end

    %% Connections
    MATLAB --> FDTD
    Python --> FDTD
    CLI --> FDTD
    FDTD --> Common
    Common --> NF2FF
    
    PML --> FDTD
    LM --> FDTD
    DM --> FDTD
    EX --> FDTD
    
    PP --> FDTD
    CE --> FDTD
    MGE --> FDTD
    
    FDTD --> FileIO
    FDTD --> SignalProc
    FDTD --> ArrayOps

    %% Styles
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef interface fill:#2ecc71,stroke:#27ae60,color:white
    classDef tool fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef extension fill:#f1c40f,stroke:#f39c12,color:black
    classDef engine fill:#e74c3c,stroke:#c0392b,color:white

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Interfaces"]:::interface
        L3["Tools"]:::tool
        L4["Extensions"]:::extension
        L5["Specialized Engines"]:::engine
    end
```
