From 8d76c554444fbda78d85efeed0fbfa500dd06a6d Mon Sep 17 00:00:00 2001 From: "Brendan K. Krueger" Date: Tue, 8 Oct 2024 10:50:36 -0600 Subject: [PATCH] Documentation --- doc/sphinx/src/databox.rst | 45 +++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/doc/sphinx/src/databox.rst b/doc/sphinx/src/databox.rst index 624e187cf..439b615a5 100644 --- a/doc/sphinx/src/databox.rst +++ b/doc/sphinx/src/databox.rst @@ -14,7 +14,13 @@ To use databox, simply include the relevant header: #include -``DatBox`` is templated on underyling data type, which defaults to the +``DataBox`` Templates +^^^^^^^^^^^^^^^^^^^^^ + +Underlying Data Type +-------------------- + +``DataBox`` is templated on the underyling data type, which defaults to the ``Real`` type provided by ``ports-of-call``. (This is usually a ``double``.) @@ -30,6 +36,9 @@ single type, you may wish to declare a type alias such as: using DataBox = Spiner::DataBox +Interpolation Gridding +---------------------- + Spiner is also templated on how the interpolation gridding works. This template parameter is called ``Grid_t``. The available options at this time are: @@ -47,6 +56,40 @@ as, for example: More detail on the interpolation gridding is available below and in the interpolation section. +Transformations +--------------- + +Spiner performs linear interpolation of the data, but can apply transformations +to the data in order to enable interpolation methods like log-log, log-lin, +etc. Spiner will perform linear interpolation of the transformed variables. + +When constructing the gridding, ``Spiner::RegularGrid1D`` and +``Spiner::PiecewiseGrid1D`` are templated on the independent variable +transformation. Note that all independent variables will use the same +transformation. ``DataBox`` is templated on the dependent variable +transformation. In all cases, the default is a linear "transformation" (no +transformation to the data), so if you do not specify the transformation then +you get linear interpolation. The available transformations are in +``spiner/transformations.hpp`` and users can write custom transformations +following the examples there. + +For example, if the user wants to transform the independent variables with a +logarithm and the dependent variable with a custom arctangent transformation, +the declaration of the ``DataBox`` might look like + +.. code-block:: cpp + + using DataBox = Spiner::DataBox, CustomArctanTransform>; + +This would result in interpolation according to the equation + +.. math:: + + \arctan(y) = b + \sum m_i \log(x_i) + +where :math:`x_i` are the independent variables. + .. note:: In C++17 and later, you can also get the default type specialization by simply omitting the template arguments.