Skip to content

Commit 1d5f555

Browse files
watsonryanRyan Watson
authored andcommitted
Document architecture and add CI, formatting, and GPL license
1 parent a204f60 commit 1d5f555

5 files changed

Lines changed: 158 additions & 1 deletion

File tree

.clang-format

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
BasedOnStyle: LLVM
2+
IndentWidth: 2
3+
ColumnLimit: 110
4+
SortIncludes: Never

.clang-tidy

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Checks: '-*,bugprone-*,performance-*,readability-*'
2+
WarningsAsErrors: ''
3+
HeaderFilterRegex: 'include/.*|tests/.*|examples/.*'

.github/workflows/ci.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
debug:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Configure
13+
run: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug
14+
- name: Build
15+
run: cmake --build build -j
16+
- name: Test
17+
run: ctest --test-dir build --output-on-failure
18+
19+
asan:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
- name: Configure
24+
run: cmake -S . -B build-asan -G Ninja -DCMAKE_BUILD_TYPE=Debug -DODE_ENABLE_ASAN=ON
25+
- name: Build
26+
run: cmake --build build-asan -j
27+
- name: Test
28+
run: ctest --test-dir build-asan --output-on-failure
29+
30+
ubsan:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v4
34+
- name: Configure
35+
run: cmake -S . -B build-ubsan -G Ninja -DCMAKE_BUILD_TYPE=Debug -DODE_ENABLE_UBSAN=ON
36+
- name: Build
37+
run: cmake --build build-ubsan -j
38+
- name: Test
39+
run: ctest --test-dir build-ubsan --output-on-failure

LICENSE

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
GNU GENERAL PUBLIC LICENSE
2+
Version 3, 29 June 2007
3+
4+
Copyright (C) 2026 Watson
5+
6+
This project is licensed under the GNU General Public License, version 3.
7+
You may obtain a copy of the full license text at:
8+
9+
https://www.gnu.org/licenses/gpl-3.0.txt
10+
11+
SPDX-License-Identifier: GPL-3.0-only

README.md

Lines changed: 101 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,23 @@ C++20 explicit Runge-Kutta integrator for non-stiff ODEs:
88
- RKF78 (embedded adaptive 7(8), fixed-step using high-order solution also supported)
99
- RK8 alias (fixed-step using RKF78 high-order weights)
1010

11+
## Architecture
12+
13+
```mermaid
14+
flowchart TD
15+
A[Client code] --> B[integrate API]
16+
B --> C[Runtime method dispatch]
17+
B --> D[Compile-time tableau API]
18+
C --> E[Drivers]
19+
D --> E
20+
E --> F[ExplicitRKStepper]
21+
F --> G[RK4 tableau]
22+
F --> H[RKF45 tableau]
23+
F --> I[RKF78 tableau]
24+
E --> J[Error norm and step-size controller]
25+
E --> K[Integration result and stats]
26+
```
27+
1128
## Build and test
1229

1330
```bash
@@ -16,10 +33,48 @@ cmake --build --preset macos-debug -j
1633
ctest --preset macos-debug --output-on-failure
1734
```
1835

19-
## API quick start
36+
## Sanitizer runs
37+
38+
AddressSanitizer:
39+
40+
```bash
41+
cmake --preset macos-asan
42+
cmake --build --preset macos-asan -j
43+
ctest --preset macos-asan --output-on-failure
44+
```
45+
46+
UndefinedBehaviorSanitizer:
47+
48+
```bash
49+
cmake --preset macos-ubsan
50+
cmake --build --preset macos-ubsan -j
51+
ctest --preset macos-ubsan --output-on-failure
52+
```
53+
54+
## Install and package consumption
55+
56+
```bash
57+
cmake --preset macos-release
58+
cmake --build --preset macos-release -j
59+
cmake --install build/macos-release --prefix /tmp/ode-install
60+
```
61+
62+
Downstream CMake usage:
63+
64+
```cmake
65+
find_package(ode CONFIG REQUIRED)
66+
target_link_libraries(your_target PRIVATE ode::ode)
67+
```
68+
69+
The repository includes a package consumer smoke test (`ode_package_install_smoke`).
70+
71+
## API usage
72+
73+
Runtime method selection:
2074

2175
```cpp
2276
#include <ode/ode.hpp>
77+
#include <vector>
2378

2479
using State = std::vector<double>;
2580
State y0{1.0};
@@ -36,3 +91,48 @@ opt.atol = 1e-12;
3691

3792
auto res = ode::integrate(ode::RKMethod::RKF78, rhs, 0.0, y0, 1.0, opt);
3893
```
94+
95+
Compile-time tableau selection:
96+
97+
```cpp
98+
#include <ode/integrate_method.hpp>
99+
#include <ode/tableaus/rkf45.hpp>
100+
101+
auto res = ode::integrate_with_tableau<ode::TableauRKF45>(rhs, t0, y0, t1, opt);
102+
```
103+
104+
## Simple 2-body orbital example
105+
106+
Build and run:
107+
108+
```bash
109+
cmake --preset macos-debug
110+
cmake --build --preset macos-debug -j
111+
./build/macos-debug/ode_two_body_example
112+
```
113+
114+
This integrates a circular LEO two-body problem for approximately one orbital period and prints final state and step stats.
115+
116+
## Profiling
117+
118+
```bash
119+
tools/profile.sh
120+
```
121+
122+
Optional overrides:
123+
- `ODE_PERF_SAMPLES`
124+
- `ODE_PERF_ITERATIONS`
125+
126+
## API docs (Doxygen)
127+
128+
```bash
129+
cmake --preset macos-debug -DODE_BUILD_DOCS=ON
130+
cmake --build --preset macos-debug --target ode_docs
131+
```
132+
133+
Generated HTML is written under `build/<preset>/docs/html/`.
134+
135+
## License
136+
137+
This project is licensed under the GNU General Public License v3.0.
138+
See `LICENSE`.

0 commit comments

Comments
 (0)