# AD0002 - Architecture
### Author: Angus Forrest
### Date: 30/10/2025

## Context

## Alternatives

## Implementation
```
 Package                                          
  ┌-----------------┐                               
  |                 |                               
  | ┌─────────────┐ |  Build/Compile┌──────────────┐
  | │             │ |◄--------------│              │
  | │ astrodrift  │ |               │ Github CI    │
  | │             │ |               │              │
  | └┬┬───────────┘ |               └───┬─────────┬┘
  |  ││Alias        |                   |         | 
  | ┌▼▼───────────┐ |                   |         | 
  | │             ├-+-------┐Test Suite |         | 
  | │ drift       │ |      ┌▼───────────▼┐        | 
  | │             │ |      │             │        | 
  | └┬┬───────────┘ |      │ pytest      │        | 
  |  ││pyo3 binding |      │             │        | 
  | ┌▼▼───────────┐ |      └─────────────┘        | 
  | │             ├───┬---------------┐Test Suite | 
  | │ drift-rs    │ | │ext. dep.     ┌▼───────────▼┐
  | │             │ |┌▼────────────┐ │             │
  | └┬┬───────────┘ |│             │ │ cargo units │
  |  ││Interface    |│ drift-utils │ │             │
  | ┌▼▼───────────┐ |│             │ └─────────────┘
  | │             │ |└─────────────┘                
  | │ kernels     │ |                               
  | │             │ |                               
  | └─────────────┘ |                               
  |                 |                               
  └-----------------┘                               
```

The project's architecture is broken into four main levels. ```astrodrift``` -- the package wrapper, ```drift``` -- the python library wrapper, ```drift-rs``` -- the rust wrapper, ```kernels```. Some of these layers have additional related code, ```pytest``` and ```cargo units``` being the test suites for drift and drift-rs respectively, and ```drift-utils``` being separately maintained crate that provides rust level implementations of cpu based algorithms. Astrodrift can be thought of as a monolithic package that allows for parsing of integrator systems to be optimised and lowered to a GPU CUDA level. This process is done through the ```drift``` to ```drift-rs``` pyo3 binding handling end-user constructions to then be parsed by the ```drift-rs``` to ```kernels``` interface parser. The ```kernels``` implementation can be thought of as collection unchanging engines that are required to be composed and called correctly from ```drift-rs```.
Users are expected to download astrodrift package from pypi allowing them to use the drift library python wrapper.

