Planetary Orbital Evolution due to Tides
Orbital evolution of two objects experiencing tides
SerializableSpline1dInterpolant.h
1 #ifndef __SERIALIZABLE_SPLINE_1D_INTERPOLANT_H
2 #define __SERIALIZABLE_SPLINE_1D_INTERPOLANT_H
3 
4 #include "../Core/SharedLibraryExportMacros.h"
5 #include "../third_party_libs/alglib/alglib/src/interpolation.h"
6 
7 #include <boost/serialization/base_object.hpp>
8 #include <boost/archive/text_oarchive.hpp>
9 #include <boost/archive/text_iarchive.hpp>
10 #include <boost/serialization/export.hpp>
11 
12 namespace Core {
13 
16  public alglib::spline1dinterpolant
17  {
18  private:
19  friend class boost::serialization::access;
20 
26  template<class Archive> void serialize(
28  Archive & ar,
29 
31  const unsigned int
32  );
33  public:
36  friend std::ostream &operator<<(
38  std::ostream &os,
39 
42  );
43  }; //End SerializableSpline1dInterpolant class.
44 
46  std::ostream &operator<<(
48  std::ostream &os,
49 
51  const alglib::real_1d_array &array);
52 
53  template<class Archive> void SerializableSpline1dInterpolant::serialize(
54  Archive & ar,
55  const unsigned int
56  )
57  {
58  ar & p_struct->periodic;
59  ar & p_struct->n;
60  ar & p_struct->k;
61  ar & p_struct->c.cnt;
62  ar & p_struct->c.datatype;
63  ar & p_struct->x.cnt;
64  ar & p_struct->x.datatype;
65  if (Archive::is_loading::value) {
66  using namespace alglib_impl;
67  ae_state state;
68  ae_vector_init(&p_struct->c,
69  (p_struct->n - 1) * 4 + 2,
70  p_struct->c.datatype,
71  &state);
72  ae_vector_init(&p_struct->x,
73  p_struct->n,
74  p_struct->x.datatype,
75  &state);
76  }
77  for (
78  int node_index=0;
79  node_index < p_struct->n - 1;
80  node_index++
81  ) {
82  double *coef=(p_struct->c.ptr.p_double + 4 * node_index);
83  ar & coef[0] & coef[1] & coef[2] & coef[3];
84  ar & p_struct->x.ptr.p_double[node_index];
85  }
86  ar & p_struct->x.ptr.p_double[p_struct->n - 1];
87  } //End SerializableSpline1dInterpolant::serialize definition.
88 
89 } //End Core namespace.
90 
91 #endif
A serializable (using boost serialization) alglib 1D interpolant.
void serialize(Archive &ar, const unsigned int)