libsc  1.6.0
src/sc_bspline.h
00001 /*
00002   This file is part of the SC Library.
00003   The SC Library provides support for parallel scientific applications.
00004 
00005   Copyright (C) 2010 The University of Texas System
00006 
00007   The SC Library is free software; you can redistribute it and/or
00008   modify it under the terms of the GNU Lesser General Public
00009   License as published by the Free Software Foundation; either
00010   version 2.1 of the License, or (at your option) any later version.
00011 
00012   The SC Library is distributed in the hope that it will be useful,
00013   but WITHOUT ANY WARRANTY; without even the implied warranty of
00014   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015   Lesser General Public License for more details.
00016 
00017   You should have received a copy of the GNU Lesser General Public
00018   License along with the SC Library; if not, write to the Free Software
00019   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00020   02110-1301, USA.
00021 */
00022 
00023 #ifndef SC_BSPLINE_H
00024 #define SC_BSPLINE_H
00025 
00026 #include <sc_dmatrix.h>
00027 
00028 SC_EXTERN_C_BEGIN;
00029 
00030 typedef struct
00031 {
00032   int                 d; 
00033   int                 p; 
00034   int                 n; 
00035   int                 m; 
00036   int                 l; 
00037   int                 cacheknot;        /* previously evaluated knot interval */
00038   sc_dmatrix_t       *points;   /* (p + 1) x d array of points, not owned */
00039   sc_dmatrix_t       *knots;    /* m + 1 array of knots */
00040   int                 knots_owned;
00041   sc_dmatrix_t       *works;    /* Workspace ((n + 1) * (n + 1)) x d */
00042   int                 works_owned;
00043 }
00044 sc_bspline_t;
00045 
00050 int                 sc_bspline_min_number_points (int n);
00051 
00056 int                 sc_bspline_min_number_knots (int n);
00057 
00063 sc_dmatrix_t       *sc_bspline_knots_new (int n, sc_dmatrix_t * points);
00064 
00071 sc_dmatrix_t       *sc_bspline_knots_new_length (int n,
00072                                                  sc_dmatrix_t * points);
00073 
00079 sc_dmatrix_t       *sc_bspline_knots_new_periodic (int n,
00080                                                    sc_dmatrix_t * points);
00081 
00089 sc_dmatrix_t       *sc_bspline_knots_new_length_periodic (int n,
00090                                                           sc_dmatrix_t *
00091                                                           points);
00092 
00104 void                sc_bspline_make_points_periodic (int n, sc_dmatrix_t *
00105                                                      points);
00106 
00112 sc_dmatrix_t       *sc_bspline_workspace_new (int n, int d);
00113 
00124 sc_bspline_t       *sc_bspline_new (int n, sc_dmatrix_t * points,
00125                                     sc_dmatrix_t * knots,
00126                                     sc_dmatrix_t * works);
00127 
00130 void                sc_bspline_destroy (sc_bspline_t * bs);
00131 
00137 void                sc_bspline_evaluate (sc_bspline_t * bs,
00138                                          double t, double *result);
00139 
00145 void                sc_bspline_derivative (sc_bspline_t * bs,
00146                                            double t, double *result);
00147 
00154 void                sc_bspline_derivative_n (sc_bspline_t * bs, int order,
00155                                              double t, double *result);
00156 
00162 void                sc_bspline_derivative2 (sc_bspline_t * bs,
00163                                             double t, double *result);
00164 
00165 SC_EXTERN_C_END;
00166 
00167 #endif /* !SC_BSPLINE_H */
 All Data Structures Files Functions Variables Typedefs Defines