Line data Source code
1 1 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : /// \file 5 : /// Defines function linearize. 6 : 7 : #pragma once 8 : 9 : #include <cstddef> 10 : 11 : /// \cond 12 : class DataVector; 13 : template <size_t> 14 : class Mesh; 15 : namespace gsl { 16 : template <class> 17 : class not_null; 18 : } // namespace gsl 19 : /// \endcond 20 : 21 : /// @{ 22 : /*! 23 : * \ingroup NumericalAlgorithmsGroup 24 : * \brief Truncate u to a linear function in each dimension. 25 : * 26 : * Ex in 2D: \f$u^{Lin} = U_0 + U_x x + U_y y + U_{xy} xy\f$ 27 : * 28 : * \warning the `gsl::not_null` variant assumes `*result` is of the correct 29 : * size. 30 : */ 31 : template <size_t Dim> 32 1 : void linearize(gsl::not_null<DataVector*> result, const DataVector& u, 33 : const Mesh<Dim>& mesh); 34 : template <size_t Dim> 35 1 : DataVector linearize(const DataVector& u, const Mesh<Dim>& mesh); 36 : /// @} 37 : 38 : /// @{ 39 : /*! 40 : * \ingroup NumericalAlgorithmsGroup 41 : * \brief Truncate u to a linear function in the given dimension. 42 : * 43 : * **Parameters** 44 : * - `u` the function to linearize. 45 : * - `mesh` the Mesh of the grid on the manifold on which `u` is 46 : * located. 47 : * - `d` the dimension that is to be linearized. 48 : * 49 : * \warning the `gsl::not_null` variant assumes `*result` is of the correct 50 : * size. 51 : */ 52 : template <size_t Dim> 53 1 : void linearize(gsl::not_null<DataVector*> result, const DataVector& u, 54 : const Mesh<Dim>& mesh, size_t d); 55 : template <size_t Dim> 56 1 : DataVector linearize(const DataVector& u, const Mesh<Dim>& mesh, size_t d); 57 : /// @}