# ra3xdh/qucs_s architecture

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

- Interactive diagram: https://gitdiagram.com/ra3xdh/qucs_s
- Repository: https://github.com/ra3xdh/qucs_s

## Overview

##### Project type and purpose
- Qucs-S is an open-source, desktop GUI application for electronic circuit simulation.

##### File structure
Top-level directories and their roles:
- qucs/            ← Core C++ application (UI, data model, controller)
– dialogs/       ← Qt dialogs for user interactions
– components/    ← in-memory models of circuit elements & simulation routines
– extsimkernels/ ← adapters for external SPICE kernels
– geometry/, magnetics/ ← shared utility modules
– python/        ← Python post-processing scripts (qucs-py)
– third_party/   ← bundled SPICE-related code
- library/         ← device and subcircuit libraries (SPICE models, symbol definitions)
- examples/        ← sample schematics for various engines
- qucs-* tools/    ← small standalone utilities (filter, attenuator, power combining, etc.)
- CMakeLists.txt & cmake/ ← build and install infrastructure
- translations/    ← localization files (.ts)

##### README for additional insights
- States supported kernels and GUI focus.
- Emphasizes Qt6 + CMake build, external dependency on ngspice at runtime.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "User Interface Layer"
        direction TB
        QtDialogs["Qt6 Dialogs"]:::ui
        SchematicWidgets["Schematic Rendering & Widgets"]:::ui
    end

    subgraph "Core Controller & Data Model"
        direction TB
        ProjectModel["Project & Element Model"]:::core
        NetlistGen["Netlist Generator"]:::core
        SimManager["Simulation Manager & Adapter Selection"]:::core
    end

    subgraph "Simulation Kernel Adapters"
        direction TB
        NgspiceAdapter["Ngspice Adapter"]:::adapter
        XyceAdapter["Xyce Adapter"]:::adapter
        CommonAdapter["Common Adapter Utilities"]:::adapter
    end

    subgraph "External Simulation Engines"
        direction TB
        Ngspice["Ngspice"]:::external
        Xyce["Xyce"]:::external
        SpiceOpus["SpiceOpus"]:::external
        Qucsator["Qucsator"]:::external
    end

    subgraph "Result Parser & Data Storage"
        direction TB
        PythonParser["Python Post-Processing Scripts"]:::parser
        CPPParser["C++ Result Parsers"]:::parser
    end

    subgraph "Visualization & Rendering"
        direction TB
        Diagrams["Diagrams & Plots"]:::viz
    end

    subgraph "Component Library"
        direction TB
        Library["Device Models & Symbols"]:::lib
    end

    subgraph "Build & Deployment"
        direction TB
        Build["CMake Build Scripts"]:::build
    end

    subgraph "Third-Party SPICE Code"
        direction TB
        ThirdParty["Bundled SPICE Code"]:::lib
    end

    subgraph "Auxiliary Utilities"
        direction TB
        Utils["Standalone CLI Tools"]:::util
    end

    %% Connections
    QtDialogs -->|"user action"| ProjectModel
    SchematicWidgets -->|renders model| ProjectModel
    ProjectModel -->|generate netlist| NetlistGen
    NetlistGen -->|select adapter| SimManager
    SimManager -->|invoke| NgspiceAdapter
    SimManager -->|invoke| XyceAdapter
    SimManager -->|invoke| CommonAdapter
    NgspiceAdapter -->|spawn process| Ngspice
    XyceAdapter -->|spawn process| Xyce
    CommonAdapter -->|spawn process| SpiceOpus
    CommonAdapter -->|spawn process| Qucsator
    Ngspice -->|output data| CPPParser
    Xyce -->|output data| CPPParser
    SpiceOpus -->|output data| CPPParser
    Qucsator -->|output data| CPPParser
    CPPParser -->|parsed results| ProjectModel
    ProjectModel -->|update UI| SchematicWidgets
    CPPParser -->|optionally| PythonParser
    PythonParser -->|reports| Diagrams
    ProjectModel -->|data| Diagrams

    Library -->|provides symbols| SchematicWidgets
    Library -->|provides models| NetlistGen

    Build -->|builds| QtDialogs
    Build -->|builds| SchematicWidgets
    Build -->|builds| ProjectModel
    Build -->|builds| NetlistGen
    Build -->|builds| SimManager
    Build -->|builds| Adapters
    Build -->|includes| ThirdParty

    Utils -->|tools for users| ProjectModel

    %% Click Events
    click QtDialogs "https://github.com/ra3xdh/qucs_s/tree/current/qucs/dialogs/"
    click SchematicWidgets "https://github.com/ra3xdh/qucs_s/tree/current/qucs/"
    click ProjectModel "https://github.com/ra3xdh/qucs_s/blob/current/qucs/projectView.cpp"
    click NetlistGen "https://github.com/ra3xdh/qucs_s/blob/current/qucs/components/spicefile.cpp"
    click SimManager "https://github.com/ra3xdh/qucs_s/blob/current/qucs/extsimkernels/abstractspicekernel.h"
    click NgspiceAdapter "https://github.com/ra3xdh/qucs_s/blob/current/qucs/extsimkernels/ngspice.cpp"
    click XyceAdapter "https://github.com/ra3xdh/qucs_s/blob/current/qucs/extsimkernels/xyce.cpp"
    click CommonAdapter "https://github.com/ra3xdh/qucs_s/blob/current/qucs/extsimkernels/CdlNetlistWriter.cpp"
    click PythonParser "https://github.com/ra3xdh/qucs_s/blob/current/qucs/python/parse_result.py"
    click CPPParser "https://github.com/ra3xdh/qucs_s/blob/current/qucs/components/spicefile.cpp"
    click Diagrams "https://github.com/ra3xdh/qucs_s/tree/current/qucs/diagrams/"
    click Library "https://github.com/ra3xdh/qucs_s/tree/current/library/"
    click Build "https://github.com/ra3xdh/qucs_s/blob/current/CMakeLists.txt"
    click ThirdParty "https://github.com/ra3xdh/qucs_s/tree/current/qucs/third_party/"
    click Utils "https://github.com/ra3xdh/qucs_s/tree/current/qucs-activefilter/"

    %% Styles
    classDef ui fill:#add8e6,stroke:#333,stroke-width:1px
    classDef core fill:#90ee90,stroke:#333,stroke-width:1px
    classDef adapter fill:#ffcc99,stroke:#333,stroke-width:1px
    classDef external fill:#ff9999,stroke:#333,stroke-width:1px
    classDef parser fill:#e0ffff,stroke:#333,stroke-width:1px
    classDef viz fill:#f0e68c,stroke:#333,stroke-width:1px
    classDef lib fill:#d3d3d3,stroke:#333,stroke-width:1px
    classDef build fill:#dda0dd,stroke:#333,stroke-width:1px
    classDef util fill:#afeeee,stroke:#333,stroke-width:1px
```
