GammaLib 2.0.0
Loading...
Searching...
No Matches
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 _______________________________________________ */
39class GSkyDir;
40
41/* __ Constants __________________________________________________________ */
42
43
44/***********************************************************************//**
45 * @class GEphemerides
46 *
47 * @brief Ephemerides class
48 *
49 * This class implements the JPL ephemerides.
50 ***************************************************************************/
51class GEphemerides : public GBase {
52
53public:
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
85protected:
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 ***************************************************************************/
112inline
113std::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 ***************************************************************************/
126inline
127int 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 ***************************************************************************/
140inline
142{
143 return (m_times.empty());
144}
145
146
147/***********************************************************************//**
148 * @brief Return ephemerides name
149 *
150 * @return Ephemerides name
151 ***************************************************************************/
152inline
153const 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 ***************************************************************************/
164inline
165void GEphemerides::name(const std::string& name)
166{
167 m_name = name;
168 return;
169}
170
171#endif /* GEPHEMERIDES_HPP */
Definition of interface for all GammaLib classes.
Filename class interface definition.
Time class interface definition.
GChatter
Definition GTypemaps.hpp:33
@ NORMAL
Definition GTypemaps.hpp:36
Vector class interface definition.
Interface class for all GammaLib classes.
Definition GBase.hpp:52
Ephemerides class.
std::vector< GVector > m_earth_dt
First derivative of Earth vectors.
GTime m_tstart
Ephemerides validity start time.
virtual std::string classname(void) const
Return class name.
void ephemeris(const GTime &time, GVector *rce, GVector *rcs, GVector *vce, double *etut) const
Get ephemeris vector and TBD->TT value for a given time.
void free_members(void)
Delete class members.
GFilename m_filename
Ephemerides filename.
std::vector< double > m_tdb2tt
TBD to TT conversion term.
GEphemerides & operator=(const GEphemerides &ephemerides)
Assignment operator.
std::vector< GVector > m_earth_d3t
Third derivative of Earth vectors.
virtual void clear(void)
Clear Ephemerides.
std::vector< GVector > m_sun
Sun vectors.
void fetch_data(void)
Fetch ephemerides data.
virtual GEphemerides * clone(void) const
Clone Ephemerides.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print Ephemerides.
void init_members(void)
Initialise class members.
void copy_members(const GEphemerides &ephemerides)
Copy class members.
virtual ~GEphemerides(void)
Destructor.
GEphemerides(void)
Void constructor.
std::vector< GVector > m_earth_d2t
Second derivative of Earth vectors.
std::string m_name
Ephemerides (e.g. DE200)
const std::string & name(void) const
Return ephemerides name.
bool is_empty(void) const
Signals if there are no ephemerides.
GTime m_tstop
Ephemerides validity stop time.
double geo2ssb(const GSkyDir &srcdir, const GTime &time) const
Get time difference between geocentric and SSB (seconds)
std::vector< GVector > m_earth
Earth vectors.
std::vector< GTime > m_times
Times of vectors.
void load(const GFilename &filename)
Load Ephemerides.
int size(void) const
Return number of ephemerides.
Filename class.
Definition GFilename.hpp:62
Sky direction class.
Definition GSkyDir.hpp:62
Time class.
Definition GTime.hpp:55
Vector class.
Definition GVector.hpp:46