Planetary Orbital Evolution due to Tides
Orbital evolution of two objects experiencing tides
InterpolatingFunctionALGLIB.h
1 #ifndef __INTERPOLATING_FUNCTION_ALGLIB_H
2 #define __INTERPOLATING_FUNCTION_ALGLIB_H
3 
4 #include "../Core/SharedLibraryExportMacros.h"
5 #include "Functions.h"
6 #include "SerializableSpline1dInterpolant.h"
7 #include "InterpSolutionIterator.h"
8 
9 namespace Core {
10 
12  class LIB_LOCAL InterpolatingFunctionALGLIB :
14  private:
15 #ifndef NO_SERIALIZE
16  friend class boost::serialization::access;
18 
20  //The second parameter should eventually be version
21  template<class Archive>
22  void serialize(Archive & ar, const unsigned int) {
23  ar & boost::serialization::base_object<OneArgumentDiffFunction>(
24  *this
25  );
26  ar & __spline;
27  ar & __min_x & __max_x;
28  }
29 #endif
30 
34 
36  double __min_x,
37 
39  __max_x;
40  public:
43 
49  const std::valarray<double> &x,
50 
52  const std::valarray<double> &y,
53 
56  const std::valarray<double> &yprime=
57  std::valarray<double>(),
58 
62  double smoothing=NaN,
63 
68  int degrees_of_freedom=-1
69  )
71  &(x[0]),
72  &(y[0]),
73  x.size(),
74  (yprime.size() ? &(yprime[0]) : NULL),
75  smoothing,
76  degrees_of_freedom
77  )
78  {
79  assert(x.size() == y.size());
80  assert(yprime.size() == 0 || yprime.size() == x.size());
81  }
82 
88  const double *x,
89 
91  const double *y,
92 
94  size_t num_points,
95 
98  const double *yprime = NULL,
99 
103  double smoothing=NaN,
104 
109  int degrees_of_freedom=-1);
110 
113  inline double operator()(double x) const
114  {return alglib::spline1dcalc(__spline, x);}
115 
121  inline const CubicSplineDerivatives *deriv(double x) const
122  {
123  double v, dv, d2v;
124  alglib::spline1ddiff(__spline, x, v, dv, d2v);
125  return new CubicSplineDerivatives(v, dv, d2v);
126  }
127 
129  inline double range_high() const {return __max_x;}
130 
132  inline double range_low() const {return __min_x;}
133 
136  InterpSolutionIterator crossings(double y=0) const;
137  }; //End InterpolatingFunctionALGLIB class
138  //BOOST_CLASS_EXPORT_GUID(OneArgumentDiffFunction,
139  // "OneArgumentDiffFunction")
140 
141 } //End Core namespace
142 
143 #ifndef NO_SERIALIZE
144  BOOST_CLASS_EXPORT_KEY(Core::InterpolatingFunctionALGLIB)
145  BOOST_CLASS_EXPORT_KEY(Core::ZeroFunction)
146 #endif
147 
148  //BOOST_CLASS_EXPORT_GUID(Core::InterpolatingFunctionALGLIB,
149  // "InterpolatingFunctionALGLIB")
150 
151 #endif
A hierarchy of classes representing functions.
SerializableSpline1dInterpolant __spline
The interpolating function information necessary to evaluate at any given point.
const CubicSplineDerivatives * deriv(double x) const
The derivatives of the interpolating function at the given abscissa.
double range_high() const
The maximum abscissa at which the function is defined.
A serializable (using boost serialization) alglib 1D interpolant.
A class representing a once differentiable function of a single argument.
Definition: Functions.h:104
InterpolatingFunctionALGLIB()
Needed by the Boost serializer.
An iterator over a set of solutions to an interpolating function.
double range_low() const
The minimum abscissa at which the function is defined.
double __min_x
The smallest abscissa covered by the spline points.
A class representing a function that is identically zero.
Definition: Functions.h:143
Function which interpolates, with possible smoothing, between points.
A class for the derivatives of a cubic spline (=0 for order>2).
Definition: Functions.h:77
InterpolatingFunctionALGLIB(const std::valarray< double > &x, const std::valarray< double > &y, const std::valarray< double > &yprime=std::valarray< double >(), double smoothing=NaN, int degrees_of_freedom=-1)
Constuct an interpolating function.
const double NaN
Not a number.
Definition: Common.h:33
double operator()(double x) const
Returns the value of the interpolating function at the given abscissa.
void serialize(Archive &ar, const unsigned int)
Serialize this function.