# michael-hartmann/caps architecture

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

- Interactive diagram: https://gitdiagram.com/michael-hartmann/caps
- Repository: https://github.com/michael-hartmann/caps

## Overview

##### Main Components
- Core Computation Engine
- Material Models
- Numerical Methods
- Interface Layer
- External Libraries Integration

##### Component Details and Relationships

- Subcomponents:
- Casimir Force Calculator
- Free Energy Computer
- Temperature Effects Handler

b) Material Models (Left side):
- Perfect Reflectors
- Drude Model
- Plasma Model

c) Numerical Methods (Right side):
- HODLR Solver (Fast direct solver)
- Quadpack Integration
- Bessel Functions
- Matrix Operations

d) Interface Layer (Top):
- MPI Parallelization Interface
- Command Line Interface
- Configuration Handler

e) External Libraries (Bottom):
- HODLR
- Eigen
- LAPACK
- Cquadpack

##### Key Architectural Patterns to Highlight
- Modular design for different material models
- Parallel processing capability
- Hierarchical solver structure
- Plugin architecture for different computational methods

##### Performance-Critical Paths
- Main computational pipeline
- Optimization points
- Parallel execution paths

Remember to include notes about the scalability aspects, particularly regarding the ability to handle large aspect ratios (R/L~5,000) and the MPI parallelization capabilities.

This architectural representation will help developers understand both the high-level structure and the detailed interactions between components while maintaining focus on the scientific computing aspects of the project.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Core Computation Engine
    subgraph CoreEngine["Core Computation Engine"]
        CasimirCalc["Casimir Force Calculator"]
        FreeEnergy["Free Energy Computer"]
        CoreCalc["Core Calculations"]
    end

    %% Material Models
    subgraph Materials["Material Models"]
        PerfectRef["Perfect Reflectors"]
        DrudeModel["Drude Model"]
        PlasmaModel["Plasma Model"]
        MatImpl["Material Implementation"]
        MatData["Material Data"]
        MatProc["Material Processing"]
    end

    %% Numerical Methods
    subgraph NumMethods["Numerical Methods"]
        HODLR["HODLR Solver"]
        Quadpack["Quadpack Integration"]
        Bessel["Bessel Functions"]
        Matrix["Matrix Operations"]
    end

    %% Interface Layer
    subgraph Interface["Interface Layer"]
        CLI["Command Line Interface"]
        Config["Configuration Handler"]
        Utils["Utilities"]
    end

    %% External Libraries
    subgraph ExtLibs["External Libraries"]
        HODLRLib["HODLR Library"]
        EigenLib["Eigen"]
        QuadpackLib["Quadpack"]
    end

    %% Relationships
    CLI --> CasimirCalc
    Config --> CoreCalc
    Utils --> CoreCalc
    
    MatImpl --> CasimirCalc
    MatData --> MatImpl
    MatProc --> MatData

    HODLR --> CoreCalc
    Quadpack --> CoreCalc
    Bessel --> CoreCalc
    Matrix --> CoreCalc

    CasimirCalc --> FreeEnergy
    CoreCalc --> FreeEnergy

    HODLRLib --> HODLR
    EigenLib --> HODLRLib
    QuadpackLib --> Quadpack

    %% Click Events
    click CasimirCalc "https://github.com/michael-hartmann/caps/blob/master/src/caps.c"
    click FreeEnergy "https://github.com/michael-hartmann/caps/blob/master/src/fcqs.c"
    click CoreCalc "https://github.com/michael-hartmann/caps/blob/master/src/caps_logdetD.c"
    click MatImpl "https://github.com/michael-hartmann/caps/blob/master/src/material.c"
    click MatData "https://github.com/michael-hartmann/caps/tree/master/materials/raw/"
    click MatProc "https://github.com/michael-hartmann/caps/blob/master/materials/plot.py"
    click HODLR "https://github.com/michael-hartmann/caps/tree/master/src/libhodlr/"
    click Quadpack "https://github.com/michael-hartmann/caps/tree/master/src/cquadpack/"
    click Bessel "https://github.com/michael-hartmann/caps/blob/master/src/bessel.c"
    click Matrix "https://github.com/michael-hartmann/caps/blob/master/src/matrix.c"
    click CLI "https://github.com/michael-hartmann/caps/blob/master/src/argparse.c"
    click Config "https://github.com/michael-hartmann/caps/blob/master/src/include/constants.h"
    click Utils "https://github.com/michael-hartmann/caps/blob/master/src/utils.c"
    click HODLRLib "https://github.com/michael-hartmann/caps/tree/master/src/libhodlr/"
    click EigenLib "https://github.com/michael-hartmann/caps/tree/master/src/libhodlr/include/Eigen/"
    click QuadpackLib "https://github.com/michael-hartmann/caps/tree/master/src/cquadpack/"

    %% Styling
    classDef core fill:#2b4b6b,color:white
    classDef material fill:#2d5a27,color:white
    classDef numerical fill:#a85c00,color:white
    classDef interface fill:#4a7296,color:white
    classDef external fill:#666666,color:white

    class CasimirCalc,FreeEnergy,CoreCalc core
    class PerfectRef,DrudeModel,PlasmaModel,MatImpl,MatData,MatProc material
    class HODLR,Quadpack,Bessel,Matrix numerical
    class CLI,Config,Utils interface
    class HODLRLib,EigenLib,QuadpackLib external
```
