Structure

pyRat is structured as a somewhat hybrid C++ and Python project.

Repository structure

pyrat/
├── figs/           ← Figures and images
├── include/        ← C++ header files
├── scripts/        ← Various utility scripts
├── src/            ← C++ and Python source files
│   ├── common/     ← Rat-Common bindings
│   ├── dmsh/       ← Rat-DistMesh bindings
│   ├── mat/        ← Rat-Materials bindings
│   ├── mlfmm/      ← Rat-MLFMM bindings
│   ├── models/     ← Rat-Models bindings
│   ├── pyrat/      ← Python sources for other submodules
│   ├── utils/      ← C++ utilities (e.g. type cast)
│   ├── rat.cpp/    ← pyrat.rat submodule definition
├── tests/          ← Python unit tests
├── .gitignore      ← Git ignored items (e.g. build)
├── CHANGELOG.md    ← Changelog for evolution tracking
├── CMakeLists.txt  ← C++ CMake configuration file
├── CONTRIBUTING.md ← Contributing guidelines file
├── LICENSE.md      ← MIT license file
├── pyproject.toml  ← Python project specifications
├── README.md       ← Repository simple information

The C++ part is used to build the pyrat.rat submodule which acts as the bridge between Python and Rat C++ libraries. It is then aggregated into a global pyrat Python module along with other pure Python submodules shipping various helpers.

All bindings and their documentations are defined in the header files within the include and src directories.

The CMakeLists.txt configuration file uses macros defined by pybind11 to easily define a Python module and how to compile it. It then links the produced rat library to the Rat-Models library which transitively links to all other dependencies.

Module structure

        ---
align: center
alt: pyRat Python module structure
name: pyrat_python_module_structure
config:
    theme: 'neutral'
---

    flowchart LR
        pyrat(pyrat)

        subgraph python["Python"]
            direction TB

            cli(cli) --> pyrat
            col(col) --> pyrat
            log(log) --> pyrat
            meta(meta) --> pyrat
        end

        subgraph cpp["C++"]
            direction TB

                subgraph cmn_["Rat-Common submodule"]
                    direction TB
                    cmn(cmn)
                    Elements --> cmn
                    Extra --> cmn
                    Gauss --> cmn
                    Log --> cmn
                end

            rat --> pyrat
            cmn --> rat
            dmsh(dmsh) --> rat
            mat(mat) --> rat
            mlfmm(mlfmm) --> rat
            models(models) --> rat
        end