GammaLib  2.1.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GEphemerides.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GEphemerides.hpp - Ephemerides class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2022 by Juergen Knoedlseder *
5  * ----------------------------------------------------------------------- *
6  * *
7  * This program is free software: you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation, either version 3 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This program is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU General Public License *
18  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
19  * *
20  ***************************************************************************/
21 /**
22  * @file GEphemerides.hpp
23  * @brief Ephemerides class definition
24  * @author Juergen Knoedlseder
25  */
26 
27 #ifndef GEPHEMERIDES_HPP
28 #define GEPHEMERIDES_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include <string>
32 #include <vector>
33 #include "GBase.hpp"
34 #include "GFilename.hpp"
35 #include "GTime.hpp"
36 #include "GVector.hpp"
37 
38 /* __ Forward declarations _______________________________________________ */
39 class GSkyDir;
40 
41 /* __ Constants __________________________________________________________ */
42 
43 
44 /***********************************************************************//**
45  * @class GEphemerides
46  *
47  * @brief Ephemerides class
48  *
49  * This class implements the JPL ephemerides.
50  ***************************************************************************/
51 class GEphemerides : public GBase {
52 
53 public:
54  // Constructors and destructors
55  GEphemerides(void);
56  GEphemerides(const GEphemerides& ephemerides);
57  virtual ~GEphemerides(void);
58 
59  // Operators
60  GEphemerides& operator=(const GEphemerides& ephemerides);
61 
62  // Implemented pure virtual base class methods
63  virtual void clear(void);
64  virtual GEphemerides* clone(void) const;
65  virtual std::string classname(void) const;
66  virtual std::string print(const GChatter& chatter = NORMAL) const;
67 
68  // Other methods
69  int size(void) const;
70  bool is_empty(void) const;
71  const std::string& name(void) const;
72  void name(const std::string& name);
73  void load(const GFilename& filename);
74  void ephemeris(const GTime& time,
75  GVector* rce,
76  GVector* rcs,
77  GVector* vce,
78  double* etut) const;
79  double geo2ssb(const GSkyDir& srcdir,
80  const GTime& time) const;
81  double geo2ssb(const GSkyDir& srcdir,
82  const GTime& time,
83  const GVector& obs) const;
84 
85 protected:
86  // Protected methods
87  void init_members(void);
88  void copy_members(const GEphemerides& ephemerides);
89  void free_members(void);
90  void fetch_data(void);
91 
92  // Protected members
93  std::string m_name; //!< Ephemerides (e.g. DE200)
94  GFilename m_filename; //!< Ephemerides filename
95  GTime m_tstart; //!< Ephemerides validity start time
96  GTime m_tstop; //!< Ephemerides validity stop time
97  std::vector<GTime> m_times; //!< Times of vectors
98  std::vector<GVector> m_earth; //!< Earth vectors
99  std::vector<GVector> m_earth_dt; //!< First derivative of Earth vectors
100  std::vector<GVector> m_earth_d2t; //!< Second derivative of Earth vectors
101  std::vector<GVector> m_earth_d3t; //!< Third derivative of Earth vectors
102  std::vector<GVector> m_sun; //!< Sun vectors
103  std::vector<double> m_tdb2tt; //!< TBD to TT conversion term
104 };
105 
106 
107 /***********************************************************************//**
108  * @brief Return class name
109  *
110  * @return String containing the class name ("GEphemerides").
111  ***************************************************************************/
112 inline
113 std::string GEphemerides::classname(void) const
114 {
115  return ("GEphemerides");
116 }
117 
118 
119 /***********************************************************************//**
120  * @brief Return number of ephemerides
121  *
122  * @return Number of ephemerides.
123  *
124  * Returns the number of ephemerides.
125  ***************************************************************************/
126 inline
127 int GEphemerides::size(void) const
128 {
129  return (int)m_times.size();
130 }
131 
132 
133 /***********************************************************************//**
134  * @brief Signals if there are no ephemerides
135  *
136  * @return True if there are no ephemerides, false otherwise.
137  *
138  * Signals if there are no ephemerides.
139  ***************************************************************************/
140 inline
141 bool GEphemerides::is_empty(void) const
142 {
143  return (m_times.empty());
144 }
145 
146 
147 /***********************************************************************//**
148  * @brief Return ephemerides name
149  *
150  * @return Ephemerides name
151  ***************************************************************************/
152 inline
153 const std::string& GEphemerides::name(void) const
154 {
155  return (m_name);
156 }
157 
158 
159 /***********************************************************************//**
160  * @brief Set ephemerides name
161  *
162  * @param[in] name Ephemerides name.
163  ***************************************************************************/
164 inline
165 void GEphemerides::name(const std::string& name)
166 {
167  m_name = name;
168  return;
169 }
170 
171 #endif /* GEPHEMERIDES_HPP */
GFilename m_filename
Ephemerides filename.
void copy_members(const GEphemerides &ephemerides)
Copy class members.
std::string m_name
Ephemerides (e.g. DE200)
bool is_empty(void) const
Signals if there are no ephemerides.
Definition of interface for all GammaLib classes.
Time class.
Definition: GTime.hpp:55
virtual std::string print(const GChatter &chatter=NORMAL) const
Print Ephemerides.
virtual GEphemerides * clone(void) const
Clone Ephemerides.
GEphemerides & operator=(const GEphemerides &ephemerides)
Assignment operator.
GEphemerides(void)
Void constructor.
Filename class.
Definition: GFilename.hpp:62
Interface class for all GammaLib classes.
Definition: GBase.hpp:52
double geo2ssb(const GSkyDir &srcdir, const GTime &time) const
Get time difference between geocentric and SSB (seconds)
void init_members(void)
Initialise class members.
Ephemerides class.
virtual void clear(void)
Clear Ephemerides.
GChatter
Definition: GTypemaps.hpp:33
Vector class interface definition.
std::vector< GTime > m_times
Times of vectors.
void ephemeris(const GTime &time, GVector *rce, GVector *rcs, GVector *vce, double *etut) const
Get ephemeris vector and TBD-&gt;TT value for a given time.
std::vector< GVector > m_earth_dt
First derivative of Earth vectors.
void load(const GFilename &filename)
Load Ephemerides.
std::vector< double > m_tdb2tt
TBD to TT conversion term.
std::vector< GVector > m_earth_d3t
Third derivative of Earth vectors.
GTime m_tstop
Ephemerides validity stop time.
virtual ~GEphemerides(void)
Destructor.
std::vector< GVector > m_earth
Earth vectors.
void fetch_data(void)
Fetch ephemerides data.
void free_members(void)
Delete class members.
GTime m_tstart
Ephemerides validity start time.
Vector class.
Definition: GVector.hpp:46
std::vector< GVector > m_earth_d2t
Second derivative of Earth vectors.
int size(void) const
Return number of ephemerides.
Sky direction class.
Definition: GSkyDir.hpp:62
std::vector< GVector > m_sun
Sun vectors.
Time class interface definition.
Filename class interface definition.
virtual std::string classname(void) const
Return class name.
const std::string & name(void) const
Return ephemerides name.