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_SPICE_H 27 #define KEP_TOOLBOX_PLANET_SPICE_H 28 29 #include <string> 30 31 #include <keplerian_toolbox/planet/base.hpp> 32 #include <keplerian_toolbox/detail/visibility.hpp> 33 #include <keplerian_toolbox/serialization.hpp> 34 #include <keplerian_toolbox/util/spice_utils.hpp> 35 36 namespace kep_toolbox 37 { 38 namespace planet 39 { 40 41 /// A planet using the SPICE Toolbox 42 /** 43 * This class allows to instantiate a planet that uses SPICE toolbox 44 * to compute the ephemerides. 45 * 46 * NOTE: The class does not check upon construction that the required kernels are loaded 47 * in memory. Its only when the ephemerides are actually called that an exception is thrown 48 * in case the required kernels are not loaded 49 * 50 * @see http://naif.jpl.nasa.gov/naif/toolkit.html 51 * 52 * @author Dario Izzo (dario.izzo _AT_ googlemail.com) 53 */ 54 55 class KEP_TOOLBOX_DLL_PUBLIC spice : public base 56 { 57 public: 58 spice(const std::string & = "CHURYUMOV-GERASIMENKO", const std::string & = "SUN", 59 const std::string & = "ECLIPJ2000", const std::string & = "NONE", 60 double = 0, // mu_central_body 61 double = 0, // mu_self 62 double = 0, // radius 63 double = 0 // safe_radius 64 ); 65 planet_ptr clone() const override; 66 std::string human_readable_extra() const override; 67 68 private: 69 void eph_impl(double mjd2000, array3D &r, array3D &v) const override; 70 71 friend class boost::serialization::access; 72 template <class Archive> serialize(Archive & ar,const unsigned int)73 void serialize(Archive &ar, const unsigned int) 74 { 75 ar &boost::serialization::base_object<base>(*this); 76 ar &const_cast<std::string &>(m_target); 77 ar &const_cast<std::string &>(m_observer); 78 ar &const_cast<std::string &>(m_reference_frame); 79 ar &const_cast<std::string &>(m_aberrations); 80 } 81 82 const std::string m_target; 83 const std::string m_observer; 84 const std::string m_reference_frame; 85 const std::string m_aberrations; 86 87 // Dummy variables that store intermidiate values to transfer to and from SPICE 88 mutable SpiceDouble m_state[6]; 89 mutable SpiceDouble m_lt; 90 }; 91 } // namespace planet 92 } // namespace kep_toolbox 93 94 BOOST_CLASS_EXPORT_KEY(kep_toolbox::planet::spice) 95 96 #endif // KEP_TOOLBOX_PLANET_SPICE_H 97