Online Resource 2 -- C++ implementation and the radial grids it reads
=====================================================================

This archive accompanies Section 5 of

  A dual-boundary-tracking finite element method for the finite-column
  Lamm equation

It contains everything needed to rebuild the paired timings reported
there, without any further download.

Contents
--------
  dbtfem.cpp         C++17 implementation of the solver.  One translation
                     unit, standard library only, no build system.  It
                     contains BOTH paths of the comparison: the masked
                     path (MASKED), which advances only the two active
                     node blocks and supplies the plateau between them in
                     closed form, and the full-grid path (PLAIN), which
                     advances every node of the same mesh with the same
                     Crank-Nicolson update and a cached Thomas
                     factorisation.  Both paths live in one binary; there
                     is no second source file and no compile-time switch.
  data/              30 text dumps, one per (case, alpha) pair: six cases
                     Ex1-Ex6 times alpha = 5, 10, 20, 40, 80.  Each dump
                     holds the radial grid, the physical parameters, the
                     requested output times, the Python profile at every
                     output time for both paths, and the active-boundary
                     index quadruple per output time.
  results/           The measured timings behind the ratios quoted in
                     Section 5, as produced by the binary below, with one
                     derived column appended (speedup, see below).
                     timings.csv and timings_b.csv are the same
                     command run twice, in two interleaved sessions; each
                     row is one (case, alpha) configuration.  Columns:
                     case, alpha, N, n_steps, dbt_ms (masked path, median
                     over --reps runs), plain_ms (full-grid path, same),
                     the four min/max columns behind those medians,
                     ratio_dbt = dbt_ms/plain_ms, and speedup =
                     plain_ms/dbt_ms, the same ratio the other way round.
                     results/README.txt repeats this and gives the one
                     command that rewrites both files.

The radial grid is not regenerated in C++: it is read from these dumps, so
that the two languages, and the two paths within each language, solve on
identical meshes with identical time steps.  Only the grid and the output
times are consumed by the binary; the profiles and index quadruples are the
Python side's own record of the run and are kept for inspection.

Build and run
-------------
  g++ -std=c++17 -O3 -ffp-contract=off dbtfem.cpp -o dbtfem_bench

  ./dbtfem_bench --reps 9 data/Ex1_a5.txt data/Ex2_a5.txt    # any subset
  ./dbtfem_bench --reps 9 --csv timings.csv data/*.txt       # all 30

Each line printed is: case, alpha, N, steps, masked path in ms, full-grid
path in ms, and their ratio masked/full-grid (last column).  A ratio below
1 therefore means the masked path is the faster of the two; the speed-up
quoted in Section 5 is its reciprocal, full-grid/masked.  Times are medians
over --reps runs of the solve loop alone; reading the dump and building the
grid objects are outside the timer.

The ratios quoted in Section 5 are full-grid/masked from these two columns,
measured in two interleaved sessions on one machine (g++ 15.2 with -O3,
single thread, Intel Core Ultra 9 285K).  Both sessions ship in results/, so
the ratio of any configuration can be read from either file; the two agree
closely wherever a pass lasts long enough to be timed well, and diverge
where the whole solve takes a fraction of a millisecond.  Absolute times are
machine dependent and are not meant to be reproduced exactly.

Dump format
-----------
Plain ASCII, magic line `DBTFEM_PY_DUMP 1`, then `key value` header lines
terminated by `DATA`, then whitespace-separated numeric blocks.  The full
grammar is the read_dump() function in dbtfem.cpp; nothing else is needed
to parse or regenerate these files.
