1 /* 2 * Copyright (c) 2012-2014, The University of Oxford 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * 1. Redistributions of source code must retain the above copyright notice, 8 * this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * this list of conditions and the following disclaimer in the documentation 11 * and/or other materials provided with the distribution. 12 * 3. Neither the name of the University of Oxford nor the names of its 13 * contributors may be used to endorse or promote products derived from this 14 * software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 * POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29 #ifndef OSKAR_SPLINES_FIT_H_ 30 #define OSKAR_SPLINES_FIT_H_ 31 32 /** 33 * @file oskar_splines_fit.h 34 */ 35 36 #include <oskar_global.h> 37 #include <mem/oskar_mem.h> 38 39 #ifdef __cplusplus 40 extern "C" { 41 #endif 42 43 /** 44 * @brief 45 * Computes spline data from a list of data points. 46 * 47 * @details 48 * This function constructs splines from a list of data points. 49 * 50 * @param[in,out] spline Pointer to spline data structure. 51 * @param[in] num_points Number of data points in all arrays. 52 * @param[in] x_theta Array of x or theta positions. 53 * @param[in] y_phi Array of y or phi positions. 54 * @param[in] z_data Array of data points. 55 * @param[in] weight Array of data point weights. 56 * @param[in] fit_type If set, use a spherical fit; otherwise linear. 57 * @param[in] search_flag If set, use supplied average fractional error. 58 * @param[in,out] avg_frac_error On entry, the target average fractional error; 59 * on exit, the achieved average fractional error. 60 * @param[in] inc_factor Factor by which to increase average fractional 61 * error on failure. 62 * @param[in] smooth_factor A user-supplied smoothing factor. 63 * Ignored if \p search_flag parameter is clear. 64 * @param[in] epsilon Value of epsilon used for the fitting. 65 * @param[in,out] status Status return code. 66 */ 67 OSKAR_EXPORT 68 void oskar_splines_fit(oskar_Splines* spline, int num_points, double* x_theta, 69 double* y_phi, const double* z_data, const double* weight, 70 int fit_type, int search_flag, double* avg_frac_err, 71 double inc_factor, double smooth_factor, double epsilon, int* status); 72 73 #ifdef __cplusplus 74 } 75 #endif 76 77 #endif /* OSKAR_SPLINES_FIT_H_ */ 78