antioch-0.4.0
gsl_spliner_policy.h
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 #ifndef ANTIOCH_GSL_SPLINER_POLICY_H
28 #define ANTIOCH_GSL_SPLINER_POLICY_H
29 
30 // Antioch
32 
33 namespace Antioch
34 {
35  namespace AntiochPrivate
36  {
37 
39 
40  template<bool B /*has_size*/>
42  {
43  template <typename Scalar>
44  Scalar interpolation(const Scalar & x, const GSLSplinerShim& gsl_shim)
45  {return gsl_shim.eval(x);}
46 
47  template <typename Scalar>
48  Scalar dinterpolation(const Scalar & x, const GSLSplinerShim& gsl_shim)
49  {return gsl_shim.eval_deriv(x);}
50  };
51 
53 
55  template <>
56  struct GSLSplinerPolicy<true /*has_size*/>
57  {
58  template <typename VectorScalar>
59  VectorScalar interpolation(const VectorScalar & x, const GSLSplinerShim& gsl_shim)
60  {
61  VectorScalar out = zero_clone(x);
62  for(unsigned int i =0; i < x.size(); ++i)
63  {
64  out[i] = gsl_shim.eval(x[i]);
65  }
66  return out;
67  }
68 
69  template <typename VectorScalar>
70  VectorScalar dinterpolation(const VectorScalar & x, const GSLSplinerShim& gsl_shim)
71  {
72  VectorScalar out = zero_clone(x);
73  for(unsigned int i =0; i < x.size(); ++i)
74  {
75  out[i] = gsl_shim.eval_deriv(x[i]);
76  }
77  return out;
78  }
79  };
80 
81  } // end namespace AntiochPrivate
82 
83 } // end namespace Antioch
84 
85 #endif // ANTIOCH_GSL_SPLINER_POLICY_H
Scalar interpolation(const Scalar &x, const GSLSplinerShim &gsl_shim)
VectorScalar dinterpolation(const VectorScalar &x, const GSLSplinerShim &gsl_shim)
VectorScalar interpolation(const VectorScalar &x, const GSLSplinerShim &gsl_shim)
Scalar dinterpolation(const Scalar &x, const GSLSplinerShim &gsl_shim)
The parameters are reduced parameters.
_Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > zero_clone(const _Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > &ex)
Definition: eigen_utils.h:145

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