GammaLib  2.1.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GCOMOad.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GCOMOad.cpp - COMPTEL Orbit Aspect Data class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2017-2023 by Juergen Knodlseder *
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 GCOMOad.cpp
23  * @brief COMPTEL Orbit Aspect Data class implementation
24  * @author Juergen Knodlseder
25  */
26 
27 /* __ Includes ___________________________________________________________ */
28 #ifdef HAVE_CONFIG_H
29 #include <config.h>
30 #endif
31 #include "GTools.hpp"
32 #include "GCOMOad.hpp"
33 
34 /* __ Method name definitions ____________________________________________ */
35 
36 /* __ Macros _____________________________________________________________ */
37 
38 /* __ Coding definitions _________________________________________________ */
39 
40 /* __ Debug definitions __________________________________________________ */
41 
42 
43 
44 /*==========================================================================
45  = =
46  = Constructors/destructors =
47  = =
48  ==========================================================================*/
49 
50 /***********************************************************************//**
51  * @brief Void constructor
52  ***************************************************************************/
54 {
55  // Initialise class members
56  init_members();
57 
58  // Return
59  return;
60 }
61 
62 
63 /***********************************************************************//**
64  * @brief Copy constructor
65  *
66  * @param[in] oad COMPTEL Orbit Aspect Data.
67  ***************************************************************************/
69 {
70  // Initialise class members
71  init_members();
72 
73  // Copy members
74  copy_members(oad);
75 
76  // Return
77  return;
78 }
79 
80 
81 /***********************************************************************//**
82  * @brief Destructor
83  ***************************************************************************/
85 {
86  // Free members
87  free_members();
88 
89  // Return
90  return;
91 }
92 
93 
94 /*==========================================================================
95  = =
96  = Operators =
97  = =
98  ==========================================================================*/
99 
100 /***********************************************************************//**
101  * @brief Assignment operator
102  *
103  * @param[in] oad COMPTEL Orbit Aspect Data.
104  * @return COMPTEL Orbit Aspect Data.
105  ***************************************************************************/
107 {
108  // Execute only if object is not identical
109  if (this != &oad) {
110 
111  // Free members
112  free_members();
113 
114  // Initialise private members
115  init_members();
116 
117  // Copy members
118  copy_members(oad);
119 
120  } // endif: object was not identical
121 
122  // Return this object
123  return *this;
124 }
125 
126 
127 /*==========================================================================
128  = =
129  = Public methods =
130  = =
131  ==========================================================================*/
132 
133 /***********************************************************************//**
134  * @brief Clear COMPTEL Orbit Aspect Data
135  ***************************************************************************/
136 void GCOMOad::clear(void)
137 {
138  // Free members
139  free_members();
140 
141  // Initialise private members
142  init_members();
143 
144  // Return
145  return;
146 }
147 
148 
149 /***********************************************************************//**
150  * @brief Clone COMPTEL Orbit Aspect Data
151  *
152  * @return Pointer to deep copy of COMPTEL Orbit Aspect Data.
153  ***************************************************************************/
155 {
156  return new GCOMOad(*this);
157 }
158 
159 
160 /***********************************************************************//**
161  * @brief Print COMPTEL Orbit Aspect Data
162  *
163  * @param[in] chatter Chattiness.
164  * @return String containing COMPTEL Orbit Aspect Data information.
165  ***************************************************************************/
166 std::string GCOMOad::print(const GChatter& chatter) const
167 {
168  // Initialise result string
169  std::string result;
170 
171  // Continue only if chatter is not silent
172  if (chatter != SILENT) {
173 
174  // Append header
175  result.append("=== GCOMOad ===");
176 
177  // Append information
178  result.append("\n"+gammalib::parformat("COMPTEL time"));
179  result.append(gammalib::str(m_tjd));
180  result.append(":");
181  result.append(gammalib::str(m_tics));
182  result.append("\n"+gammalib::parformat("Superpacket MJD range"));
183  result.append(gammalib::str(m_tstart.mjd()));
184  result.append(" - ");
185  result.append(gammalib::str(m_tstop.mjd()));
186  result.append(" days");
187  result.append("\n"+gammalib::parformat("Superpacket UTC range"));
188  result.append(m_tstart.utc());
189  result.append(" - ");
190  result.append(m_tstop.utc());
191 
192  } // endif: chatter was not silent
193 
194  // Return result
195  return result;
196 }
197 
198 
199 /*==========================================================================
200  = =
201  = Private methods =
202  = =
203  ==========================================================================*/
204 
205 /***********************************************************************//**
206  * @brief Initialise class members
207  ***************************************************************************/
209 {
210  // Initialise members
211  m_tstart.clear();
212  m_tstop.clear();
213  m_zaxis.clear();
214  m_xaxis.clear();
215  m_tjd = 0;
216  m_tics = 0;
217  m_gcaz = 0.0;
218  m_gcel = 0.0;
219  m_georad = 0.0;
220  m_ehora = 0.0;
221  m_pos = GVector(3);
222  m_posang = 1.0e30;
223 
224  // Return
225  return;
226 }
227 
228 
229 /***********************************************************************//**
230  * @brief Copy class members
231  *
232  * @param[in] oad COMPTEL Orbit Aspect Data.
233  ***************************************************************************/
235 {
236  // Copy members
237  m_tstart = oad.m_tstart;
238  m_tstop = oad.m_tstop;
239  m_zaxis = oad.m_zaxis;
240  m_xaxis = oad.m_xaxis;
241  m_tjd = oad.m_tjd;
242  m_tics = oad.m_tics;
243  m_gcaz = oad.m_gcaz;
244  m_gcel = oad.m_gcel;
245  m_georad = oad.m_georad;
246  m_ehora = oad.m_ehora;
247  m_pos = oad.m_pos;
248  m_posang = oad.m_posang;
249 
250  // Return
251  return;
252 }
253 
254 
255 /***********************************************************************//**
256  * @brief Delete class members
257  ***************************************************************************/
259 {
260  // Return
261  return;
262 }
GSkyDir m_zaxis
Telescope z-axis.
Definition: GCOMOad.hpp:101
virtual ~GCOMOad(void)
Destructor.
Definition: GCOMOad.cpp:84
virtual std::string print(const GChatter &chatter=NORMAL) const
Print COMPTEL Orbit Aspect Data.
Definition: GCOMOad.cpp:166
GSkyDir m_xaxis
Telescope x-axis.
Definition: GCOMOad.hpp:102
GCOMOad(void)
Void constructor.
Definition: GCOMOad.cpp:53
int m_tics
Tics of OAD record.
Definition: GCOMOad.hpp:104
void clear(void)
Clear time.
Definition: GTime.cpp:252
Gammalib tools definition.
GTime m_tstop
Stop time of superpacket.
Definition: GCOMOad.hpp:100
COMPTEL Orbit Aspect Data class.
Definition: GCOMOad.hpp:49
void free_members(void)
Delete class members.
Definition: GCOMOad.cpp:258
GChatter
Definition: GTypemaps.hpp:33
double m_posang
X-axis position angle in COMPTEL system.
Definition: GCOMOad.hpp:112
virtual void clear(void)
Clear COMPTEL Orbit Aspect Data.
Definition: GCOMOad.cpp:136
float m_gcaz
Geocentre azimuth angle (deg)
Definition: GCOMOad.hpp:105
float m_georad
Apparent radius of Earth (deg)
Definition: GCOMOad.hpp:107
void init_members(void)
Initialise class members.
Definition: GCOMOad.cpp:208
float m_ehora
Earth Horizon Angle of telescope pointing (deg)
Definition: GCOMOad.hpp:108
void clear(void)
Clear sky direction.
Definition: GSkyDir.cpp:164
int m_tjd
TJD of OAD record.
Definition: GCOMOad.hpp:103
GTime m_tstart
Start time of superpacket.
Definition: GCOMOad.hpp:99
double mjd(void) const
Return time in Modified Julian Days (TT)
Definition: GTime.cpp:320
GCOMOad & operator=(const GCOMOad &oad)
Assignment operator.
Definition: GCOMOad.cpp:106
Vector class.
Definition: GVector.hpp:46
void copy_members(const GCOMOad &oad)
Copy class members.
Definition: GCOMOad.cpp:234
float m_gcel
Geocentre zenith angle (deg)
Definition: GCOMOad.hpp:106
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
Definition: GTools.cpp:1143
std::string utc(const int &precision=0) const
Return time as string in UTC time system.
Definition: GTime.cpp:465
GVector m_pos
Position vector (km)
Definition: GCOMOad.hpp:109
virtual GCOMOad * clone(void) const
Clone COMPTEL Orbit Aspect Data.
Definition: GCOMOad.cpp:154
COMPTEL Orbit Aspect Data class definition.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.
Definition: GTools.cpp:489