.. ====================================================================== .. © (or copyright) 2019-2026. Triad National Security, LLC. All rights .. reserved. This program was produced under U.S. Government contract .. 89233218CNA000001 for Los Alamos National Laboratory (LANL), which is .. operated by Triad National Security, LLC for the U.S. Department of .. Energy/National Nuclear Security Administration. All rights in the .. program are reserved by Triad National Security, LLC, and the .. U.S. Department of Energy/National Nuclear Security .. Administration. The Government is granted for itself and others acting .. on its behalf a nonexclusive, paid-up, irrevocable worldwide license .. in this material to reproduce, prepare derivative works, distribute .. copies to the public, perform publicly and display publicly, and to .. permit others to do so. .. ====================================================================== .. _getting-started: Getting Started ================ The following provides a simple example of utilizing a ``DataBox``. .. code-block:: cpp #include #include using DataBox = Spiner::DataBox; int main() { // create a databox constexpr int NX1 = 2; constexpr int NX2 = 3; constexpr int NX3 = 4; DataBox db(NX3, NX2, NX1); // fill the databox with the flat index of each element for (int i = 0; i < db.size(); ++i) { db(i) = static_cast(i); } // set the interpolation ranges to [0,1] or each dimension for (int d = 0; d < db.rank(); ++d) { db.setRange(d, 0, 1, db.dim(d)); } // interpolate double val = db.interpToReal(0.2, 0.3, 0.4); // save to file db.saveHDF("my_data.sp5"); // load a new databox from file DataBox db2; db2.loadHDF("my_data.sp5"); // interpolate new databox to the same location double val2 = db2.itnerpToReal(0.2, 0.3, 0.4); // print the interpolated values and see they're the same std::cout << val1 << ", " val2 << ": " << (val1 - val2) << std::endl; // free the databoxes free(db); free(db2); return 0; } For more examples, please consult the test directory.