1 /** 2 * @file funcs.h Header for a file containing miscellaneous 3 * numerical functions. 4 */ 5 6 // This file is part of Cantera. See License.txt in the top-level directory or 7 // at https://cantera.org/license.txt for license and copyright information. 8 9 #ifndef CT_FUNCS_H 10 #define CT_FUNCS_H 11 12 #include "cantera/base/ct_defs.h" 13 14 namespace Cantera 15 { 16 17 //! Linearly interpolate a function defined on a discrete grid. 18 /*! 19 * Vector xpts contains a monotonic sequence of grid points, and vector fpts 20 * contains function values defined at these points. The value returned is the 21 * linear interpolate at point x. If x is outside the range of xpts, the value 22 * of fpts at the nearest end is returned. 23 * 24 * @param x value of the x coordinate 25 * @param xpts value of the grid points 26 * @param fpts value of the interpolant at the grid points 27 * @returns the value of of the interpolated function at x. 28 */ 29 doublereal linearInterp(doublereal x, const vector_fp& xpts, 30 const vector_fp& fpts); 31 } 32 33 #endif 34