antioch-0.4.0
gsl_spliner_impl.C
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // Antioch - A Gas Dynamics Thermochemistry Library
5 //
6 // Copyright (C) 2014-2016 Paul T. Bauman, Benjamin S. Kirk,
7 // Sylvain Plessis, Roy H. Stonger
8 //
9 // Copyright (C) 2013 The PECOS Development Team
10 //
11 // This library is free software; you can redistribute it and/or
12 // modify it under the terms of the Version 2.1 GNU Lesser General
13 // Public License as published by the Free Software Foundation.
14 //
15 // This library is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
23 // Boston, MA 02110-1301 USA
24 //
25 //-----------------------------------------------------------------------el-
26 
27 #include "antioch_config.h" //only of we have GSL
28 
29 #ifdef ANTIOCH_HAVE_GSL
30 
32 
33 namespace Antioch
34 {
35  namespace AntiochPrivate
36  {
37  GSLSplinerImplementation::GSLSplinerImplementation()
38  :_acc(gsl_interp_accel_alloc()),
39  _spline(NULL)
40  {}
41 
42  GSLSplinerImplementation::~GSLSplinerImplementation()
43  {
44  this->spline_clear();
45  gsl_interp_accel_free(_acc);
46  }
47 
48  void GSLSplinerImplementation::spline_init( const double* x, const double* y, unsigned int size )
49  {
50  _spline = gsl_spline_alloc(gsl_interp_cspline, size);
51  gsl_spline_init(_spline, x, y, size);
52  }
53 
54  void GSLSplinerImplementation::spline_clear()
55  {
56  gsl_spline_free(_spline);
57  }
58 
59  double GSLSplinerImplementation::eval(double x) const
60  {
61  return gsl_spline_eval(_spline,x,_acc);
62  }
63 
64  double GSLSplinerImplementation::eval_deriv(double x) const
65  {
66  return gsl_spline_eval_deriv(_spline,x,_acc);
67  }
68 
69  } // end namespace AntiochPrivate
70 } // end namespace Antioch
71 
72 #endif// if ANTIOCH_HAVE_GSL
The parameters are reduced parameters.

Generated on Thu Jul 7 2016 11:09:46 for antioch-0.4.0 by  doxygen 1.8.8