Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/corecel/grid/NonuniformGridData.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 //------------------------------- -*- C++ -*- -------------------------------//
0002 // Copyright Celeritas contributors: see top-level COPYRIGHT file for details
0003 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0004 //---------------------------------------------------------------------------//
0005 //! \file corecel/grid/NonuniformGridData.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include "corecel/Types.hh"
0010 #include "corecel/data/Collection.hh"
0011 
0012 namespace celeritas
0013 {
0014 //---------------------------------------------------------------------------//
0015 /*!
0016  * A grid of increasing, sorted 1D data.
0017  *
0018  * \c derivative stores the second derivative of the interpolating cubic
0019  * spline. If it is non-empty, cubic spline interpolation will be used.
0020  * Otherwise the interpolation will be linear-linear.
0021  *
0022  * \todo Piecewise polynomial spline interpolation is currently unsupported.
0023  */
0024 struct NonuniformGridRecord
0025 {
0026     ItemRange<real_type> grid;  //!< x grid
0027     ItemRange<real_type> value;  //!< f(x) value
0028     ItemRange<real_type> derivative;
0029     size_type spline_order{1};
0030 
0031     //! Whether the record is initialized and valid
0032     explicit CELER_FUNCTION operator bool() const
0033     {
0034         return grid.size() >= 2 && value.size() == grid.size()
0035                && (derivative.empty() || grid.size() == derivative.size())
0036                && spline_order == 1;
0037     }
0038 };
0039 
0040 //---------------------------------------------------------------------------//
0041 }  // namespace celeritas