GammaLib  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GPulsarEphemeris.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GPulsarEphemeris.hpp - Pulsar ephemeris 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 GPulsarEphemeris.hpp
23  * @brief Pulsar ephemeris class definition
24  * @author Juergen Knoedlseder
25  */
26 
27 #ifndef GPULSAREPHEMERIS_HPP
28 #define GPULSAREPHEMERIS_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include <string>
32 #include "GBase.hpp"
33 #include "GTime.hpp"
34 #include "GSkyDir.hpp"
35 
36 /* __ Forward declarations _______________________________________________ */
37 
38 /* __ Constants __________________________________________________________ */
39 
40 
41 /***********************************************************************//**
42  * @class GPulsarEphemeris
43  *
44  * @brief Pulsar ephemeris class
45  *
46  * This class implements an ephemeris for a pulsar.
47  ***************************************************************************/
48 class GPulsarEphemeris : public GBase {
49 
50 public:
51  // Constructors and destructors
52  GPulsarEphemeris(void);
53  GPulsarEphemeris(const GPulsarEphemeris& ephemeris);
54  virtual ~GPulsarEphemeris(void);
55 
56  // Operators
57  GPulsarEphemeris& operator=(const GPulsarEphemeris& ephemeris);
58 
59  // Implemented pure virtual base class methods
60  virtual void clear(void);
61  virtual GPulsarEphemeris* clone(void) const;
62  virtual std::string classname(void) const;
63  virtual std::string print(const GChatter& chatter = NORMAL) const;
64 
65  // Other methods
66  const std::string& name(void) const;
67  void name(const std::string& name);
68  const GSkyDir& dir(void) const;
69  void dir(const GSkyDir& dir);
70  const GTime& tstart(void) const;
71  void tstart(const GTime& tstart);
72  const GTime& tstop(void) const;
73  void tstop(const GTime& tstop);
74  const std::string& timesys(void) const;
75  void timesys(const std::string& timesys);
76  GTime t0(void) const;
77  void t0(const GTime& t0);
78  double phase(void) const;
79  void phase(const double& phase);
80  double f0(void) const;
81  void f0(const double& f0);
82  double f1(void) const;
83  void f1(const double& f1);
84  double f2(void) const;
85  void f2(const double& f2);
86  double phase(const GTime& time,
87  const std::string& timesys) const;
88 
89 protected:
90  // Protected methods
91  void init_members(void);
92  void copy_members(const GPulsarEphemeris& ephemeris);
93  void free_members(void);
94 
95  // Protected members
96  std::string m_name; //!< Pulsar name
97  GTime m_tstart; //!< Validity start time
98  GTime m_tstop; //!< Validity stop time
99  GSkyDir m_dir; //!< Pulsar sky direction
100  std::string m_timesys; //!< Time system of pulsar ephemeris
101  GTime m_t0; //!< Reference epoch of pulsar ephemeris
102  double m_phase; //!< Pulse phase
103  double m_f0; //!< Pulsar frequency (Hz)
104  double m_f1; //!< Pulsar frequency derivative (s^-2)
105  double m_f2; //!< Pulsar second frequency derivative (s^-3)
106 };
107 
108 
109 /***********************************************************************//**
110  * @brief Return class name
111  *
112  * @return String containing the class name ("GPulsarEphemeris").
113  ***************************************************************************/
114 inline
115 std::string GPulsarEphemeris::classname(void) const
116 {
117  return ("GPulsarEphemeris");
118 }
119 
120 
121 /***********************************************************************//**
122  * @brief Returns pulsar name
123  *
124  * @return Pulsar name.
125  ***************************************************************************/
126 inline
127 const std::string& GPulsarEphemeris::name(void) const
128 {
129  // Return
130  return m_name;
131 }
132 
133 
134 /***********************************************************************//**
135  * @brief Set pulsar name
136  *
137  * @param[in] name Pulsar name.
138  ***************************************************************************/
139 inline
140 void GPulsarEphemeris::name(const std::string& name)
141 {
142  m_name = name;
143  return;
144 }
145 
146 
147 /***********************************************************************//**
148  * @brief Returns pulsar sky direction
149  *
150  * @return Pulsar sky direction.
151  ***************************************************************************/
152 inline
153 const GSkyDir& GPulsarEphemeris::dir(void) const
154 {
155  // Return
156  return m_dir;
157 }
158 
159 
160 /***********************************************************************//**
161  * @brief Set pulsar sky direction
162  *
163  * @param[in] dir Pulsar sky direction.
164  ***************************************************************************/
165 inline
167 {
168  m_dir = dir;
169  return;
170 }
171 
172 
173 /***********************************************************************//**
174  * @brief Returns validity start time
175  *
176  * @return Validity start time.
177  ***************************************************************************/
178 inline
179 const GTime& GPulsarEphemeris::tstart(void) const
180 {
181  // Return
182  return m_tstart;
183 }
184 
185 
186 /***********************************************************************//**
187  * @brief Set validity start time
188  *
189  * @param[in] tstart Validity start time.
190  ***************************************************************************/
191 inline
192 void GPulsarEphemeris::tstart(const GTime& tstart)
193 {
194  m_tstart = tstart;
195  return;
196 }
197 
198 
199 /***********************************************************************//**
200  * @brief Returns validity stop time
201  *
202  * @return Validity stop time.
203  ***************************************************************************/
204 inline
205 const GTime& GPulsarEphemeris::tstop(void) const
206 {
207  // Return
208  return m_tstop;
209 }
210 
211 
212 /***********************************************************************//**
213  * @brief Set validity stop time
214  *
215  * @param[in] tstop Validity stop time.
216  ***************************************************************************/
217 inline
218 void GPulsarEphemeris::tstop(const GTime& tstop)
219 {
220  m_tstop = tstop;
221  return;
222 }
223 
224 
225 /***********************************************************************//**
226  * @brief Returns pulsar ephemeris time system
227  *
228  * @return Pulsar ephemeris time system.
229  *
230  * The pulsar ephemeris time system is one of "TT", "TAI" or "UTC".
231  ***************************************************************************/
232 inline
233 const std::string& GPulsarEphemeris::timesys(void) const
234 {
235  // Return
236  return (m_timesys);
237 }
238 
239 
240 /***********************************************************************//**
241  * @brief Set pulsar ephemeris time system
242  *
243  * @param[in] timesys Pulsar ephemeris time system.
244  *
245  * The pulsar ephemeris time system is one of "TT", "TAI" or "UTC".
246  ***************************************************************************/
247 inline
248 void GPulsarEphemeris::timesys(const std::string& timesys)
249 {
250  m_timesys = timesys;
251  return;
252 }
253 
254 
255 /***********************************************************************//**
256  * @brief Returns reference epoch of pulsar ephemeris
257  *
258  * @return Reference epoch of pulsar ephemeris.
259  ***************************************************************************/
260 inline
262 {
263  return (m_t0);
264 }
265 
266 
267 /***********************************************************************//**
268  * @brief Set reference epoch of pulsar ephemeris
269  *
270  * @param[in] t0 Reference epoch of pulsar ephemeris.
271  ***************************************************************************/
272 inline
274 {
275  m_t0 = t0;
276  return;
277 }
278 
279 
280 /***********************************************************************//**
281  * @brief Returns pulse phase
282  *
283  * @return Pulse phase.
284  ***************************************************************************/
285 inline
286 double GPulsarEphemeris::phase(void) const
287 {
288  return (m_phase);
289 }
290 
291 
292 /***********************************************************************//**
293  * @brief Set pulse phase
294  *
295  * @param[in] phase Pulse phase.
296  ***************************************************************************/
297 inline
298 void GPulsarEphemeris::phase(const double& phase)
299 {
300  m_phase = phase;
301  return;
302 }
303 
304 
305 /***********************************************************************//**
306  * @brief Returns pulsar frequency (Hz)
307  *
308  * @return Pulsar frequency (Hz).
309  ***************************************************************************/
310 inline
311 double GPulsarEphemeris::f0(void) const
312 {
313  return (m_f0);
314 }
315 
316 
317 /***********************************************************************//**
318  * @brief Set pulsar frequency (Hz)
319  *
320  * @param[in] f0 Pulsar frequency (Hz).
321  ***************************************************************************/
322 inline
323 void GPulsarEphemeris::f0(const double& f0)
324 {
325  m_f0 = f0;
326  return;
327 }
328 
329 
330 /***********************************************************************//**
331  * @brief Returns pulsar frequency derivative (s^-2)
332  *
333  * @return Pulsar frequency derivative (s^-2).
334  ***************************************************************************/
335 inline
336 double GPulsarEphemeris::f1(void) const
337 {
338  return (m_f1);
339 }
340 
341 
342 /***********************************************************************//**
343  * @brief Set pulsar frequency derivative (s^-2)
344  *
345  * @param[in] f1 Pulsar frequency derivative (s^-2).
346  ***************************************************************************/
347 inline
348 void GPulsarEphemeris::f1(const double& f1)
349 {
350  m_f1 = f1;
351  return;
352 }
353 
354 
355 /***********************************************************************//**
356  * @brief Returns pulsar second frequency derivative (s^-3)
357  *
358  * @return Pulsar second frequency derivative (s^-3).
359  ***************************************************************************/
360 inline
361 double GPulsarEphemeris::f2(void) const
362 {
363  return (m_f2);
364 }
365 
366 
367 /***********************************************************************//**
368  * @brief Set pulsar second frequency derivative (s^-3)
369  *
370  * @param[in] f2 Pulsar second frequency derivative (s^-3).
371  ***************************************************************************/
372 inline
373 void GPulsarEphemeris::f2(const double& f2)
374 {
375  m_f2 = f2;
376  return;
377 }
378 
379 #endif /* GPULSAREPHEMERIS_HPP */
double f2(void) const
Returns pulsar second frequency derivative (s^-3)
double m_f1
Pulsar frequency derivative (s^-2)
Sky direction class interface definition.
const std::string & name(void) const
Returns pulsar name.
GPulsarEphemeris & operator=(const GPulsarEphemeris &ephemeris)
Assignment operator.
const GSkyDir & dir(void) const
Returns pulsar sky direction.
void free_members(void)
Delete class members.
GTime t0(void) const
Returns reference epoch of pulsar ephemeris.
Definition of interface for all GammaLib classes.
Time class.
Definition: GTime.hpp:55
void copy_members(const GPulsarEphemeris &ephemeris)
Copy class members.
const std::string & timesys(void) const
Returns pulsar ephemeris time system.
GTime m_tstart
Validity start time.
double m_f0
Pulsar frequency (Hz)
void init_members(void)
Initialise class members.
virtual std::string classname(void) const
Return class name.
virtual void clear(void)
Clear Pulsar ephemeris.
const GTime & tstop(void) const
Returns validity stop time.
double m_f2
Pulsar second frequency derivative (s^-3)
Interface class for all GammaLib classes.
Definition: GBase.hpp:52
virtual std::string print(const GChatter &chatter=NORMAL) const
Print Pulsar ephemeris.
std::string m_timesys
Time system of pulsar ephemeris.
virtual GPulsarEphemeris * clone(void) const
Clone Pulsar ephemeris.
double m_phase
Pulse phase.
GChatter
Definition: GTypemaps.hpp:33
double f1(void) const
Returns pulsar frequency derivative (s^-2)
Pulsar ephemeris class.
GSkyDir m_dir
Pulsar sky direction.
GTime m_tstop
Validity stop time.
double f0(void) const
Returns pulsar frequency (Hz)
virtual ~GPulsarEphemeris(void)
Destructor.
GTime m_t0
Reference epoch of pulsar ephemeris.
const GTime & tstart(void) const
Returns validity start time.
Sky direction class.
Definition: GSkyDir.hpp:62
Time class interface definition.
std::string m_name
Pulsar name.
GPulsarEphemeris(void)
Void constructor.
double phase(void) const
Returns pulse phase.