1 /***************************************************************************** 2 * Copyright (C) 2004-2018 The pykep development team, * 3 * Advanced Concepts Team (ACT), European Space Agency (ESA) * 4 * * 5 * https://gitter.im/esa/pykep * 6 * https://github.com/esa/pykep * 7 * * 8 * act@esa.int * 9 * * 10 * This program is free software; you can redistribute it and/or modify * 11 * it under the terms of the GNU General Public License as published by * 12 * the Free Software Foundation; either version 2 of the License, or * 13 * (at your option) any later version. * 14 * * 15 * This program 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 * 18 * GNU General Public License for more details. * 19 * * 20 * You should have received a copy of the GNU General Public License * 21 * along with this program; if not, write to the * 22 * Free Software Foundation, Inc., * 23 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 24 *****************************************************************************/ 25 26 #ifndef KEP_TOOLBOX_PLANET_J2_H 27 #define KEP_TOOLBOX_PLANET_J2_H 28 29 #include <string> 30 #include <vector> 31 32 #include <keplerian_toolbox/detail/visibility.hpp> 33 #include <keplerian_toolbox/epoch.hpp> 34 #include <keplerian_toolbox/exceptions.hpp> 35 #include <keplerian_toolbox/serialization.hpp> 36 #include <keplerian_toolbox/planet/base.hpp> 37 38 namespace kep_toolbox 39 { 40 namespace planet 41 { 42 43 /// A Keplerian Planet 44 /** 45 * This class allows to instantiate a planet having keplerian ephemerides 46 * 47 * @author Dario Izzo (dario.izzo _AT_ googlemail.com) 48 */ 49 50 class KEP_TOOLBOX_DLL_PUBLIC j2 : public base 51 { 52 53 static const array6D default_elements; 54 55 public: 56 j2(const epoch &ref_epoch = kep_toolbox::epoch(0), const array6D &elem = default_elements, 57 double mu_central_body = 0.1, double mu_self = 0.1, double radius = 0.1, double safe_radius = 0.1, 58 double J2RG2 = 0., const std::string &name = "Unknown"); 59 j2(const epoch &ref_epoch, const array3D &r0, const array3D &v0, double mu_central_body, double mu_self, 60 double radius, double safe_radius, double J2RG2 = 0., const std::string &name = "Unknown"); 61 62 planet_ptr clone() const override; 63 std::string human_readable_extra() const override; 64 65 /** @name Getters */ 66 //@{ 67 array6D get_elements() const; 68 kep_toolbox::epoch get_ref_epoch() const; 69 double get_ref_mjd2000() const; 70 double get_mean_motion() const; 71 //@} 72 73 /** @name Setters */ 74 //@{ 75 void set_elements(const array6D &); 76 void set_ref_epoch(const kep_toolbox::epoch &); 77 void set_ref_mjd2000(const double &); 78 //@} 79 80 private: 81 void eph_impl(double mjd2000, array3D &r, array3D &v) const override; 82 83 friend class boost::serialization::access; 84 template <class Archive> serialize(Archive & ar,const unsigned int)85 void serialize(Archive &ar, const unsigned int) 86 { 87 ar &boost::serialization::base_object<base>(*this); 88 ar &m_r; 89 ar &m_v; 90 ar &m_keplerian_elements; 91 ar &m_mean_motion; 92 ar &m_ref_mjd2000; 93 ar &m_J2RG2; 94 } 95 96 protected: 97 array6D m_keplerian_elements; 98 array3D m_r, m_v; 99 double m_mean_motion; 100 double m_ref_mjd2000; 101 double m_J2RG2; 102 }; 103 } 104 } /// End of namespace kep_toolbox 105 106 BOOST_CLASS_EXPORT_KEY(kep_toolbox::planet::j2) 107 108 #endif // KEP_TOOLBOX_PLANET_J2_H 109