GammaLib 2.2.0.dev
Loading...
Searching...
No Matches
GCOSPointing.cpp
Go to the documentation of this file.
1/***************************************************************************
2 * GCOSPointing.cpp - COSI pointing class *
3 * ----------------------------------------------------------------------- *
4 * copyright (C) 2026 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 GCOSPointing.cpp
23 * @brief COSI pointing class implementation
24 * @author Juergen Knoedlseder
25 */
26
27/* __ Includes ___________________________________________________________ */
28#ifdef HAVE_CONFIG_H
29#include <config.h>
30#endif
31#include "GCOSPointing.hpp"
32
33/* __ Method name definitions ____________________________________________ */
34
35/* __ Macros _____________________________________________________________ */
36
37/* __ Coding definitions _________________________________________________ */
38
39/* __ Debug definitions __________________________________________________ */
40
41
42
43/*==========================================================================
44 = =
45 = Constructors/destructors =
46 = =
47 ==========================================================================*/
48
49/***********************************************************************//**
50 * @brief Void constructor
51 ***************************************************************************/
53{
54 // Initialise class members
56
57 // Return
58 return;
59}
60
61
62/***********************************************************************//**
63 * @brief Copy constructor
64 *
65 * @param[in] pointing COSI pointing.
66 ***************************************************************************/
68{
69 // Initialise class members
71
72 // Copy members
73 copy_members(pointing);
74
75 // Return
76 return;
77}
78
79
80/***********************************************************************//**
81 * @brief Destructor
82 ***************************************************************************/
84{
85 // Free members
87
88 // Return
89 return;
90}
91
92
93/*==========================================================================
94 = =
95 = Operators =
96 = =
97 ==========================================================================*/
98
99/***********************************************************************//**
100 * @brief Assignment operator
101 *
102 * @param[in] pointing COSI pointing.
103 * @return COSI pointing.
104 ***************************************************************************/
106{
107 // Execute only if object is not identical
108 if (this != &pointing) {
109
110 // Free members
111 free_members();
112
113 // Initialise private members
114 init_members();
115
116 // Copy members
117 copy_members(pointing);
118
119 } // endif: object was not identical
120
121 // Return this object
122 return *this;
123}
124
125
126/*==========================================================================
127 = =
128 = Public methods =
129 = =
130 ==========================================================================*/
131
132/***********************************************************************//**
133 * @brief Clear pointing
134 ***************************************************************************/
136{
137 // Free members
138 free_members();
139
140 // Initialise private members
141 init_members();
142
143 // Return
144 return;
145}
146
147
148/***********************************************************************//**
149 * @brief Clone COSI pointing
150 *
151 * @return Pointer to deep copy of COSI pointing.
152 ***************************************************************************/
154{
155 return new GCOSPointing(*this);
156}
157
158
159/***********************************************************************//**
160 * @brief Print pointing information
161 *
162 * @param[in] chatter Chattiness.
163 * @return String containing pointing information.
164 ***************************************************************************/
165std::string GCOSPointing::print(const GChatter& chatter) const
166{
167 // Initialise result string
168 std::string result;
169
170 // Continue only if chatter is not silent
171 if (chatter != SILENT) {
172
173 // Append header
174 result.append("=== GCOSPointing ===");
175
176 // Append information
177 result.append("\n"+gammalib::parformat("Time stamp"));
178 result.append(m_time.print(gammalib::reduce(chatter)));
179 result.append("\n"+gammalib::parformat("Space craft x-axis"));
180 result.append(m_sc_x.print(gammalib::reduce(chatter)));
181 result.append("\n"+gammalib::parformat("Space craft z-axis"));
182 result.append(m_sc_z.print(gammalib::reduce(chatter)));
183 result.append("\n"+gammalib::parformat("Space craft altitude"));
184 result.append(gammalib::str(m_altitude) + " km");
185 result.append("\n"+gammalib::parformat("Earth zenith direction"));
186 result.append(m_earth_zenith.print(gammalib::reduce(chatter)));
187
188 } // endif: chatter was not silent
189
190 // Return result
191 return result;
192}
193
194
195/*==========================================================================
196 = =
197 = Private methods =
198 = =
199 ==========================================================================*/
200
201/***********************************************************************//**
202 * @brief Initialise class members
203 ***************************************************************************/
205{
206 // Initialise members
207 m_time.clear();
208 m_sc_x.clear();
209 m_sc_z.clear();
210 m_altitude = 0.0;
213 m_livetime = 0.0;
214
215 // Return
216 return;
217}
218
219
220/***********************************************************************//**
221 * @brief Copy class members
222 *
223 * @param[in] pointing COSI pointing.
224 ***************************************************************************/
226{
227 // Copy members
228 m_time = pointing.m_time;
229 m_sc_x = pointing.m_sc_x;
230 m_sc_z = pointing.m_sc_z;
231 m_altitude = pointing.m_altitude;
233 m_earth_nadir = pointing.m_earth_nadir;
234 m_livetime = pointing.m_livetime;
235
236 // Return
237 return;
238}
239
240
241/***********************************************************************//**
242 * @brief Delete class members
243 ***************************************************************************/
245{
246 // Return
247 return;
248}
COSI pointing class definition.
GChatter
Definition GTypemaps.hpp:33
@ SILENT
Definition GTypemaps.hpp:34
COSI pointing class.
GCOSPointing(void)
Void constructor.
double m_livetime
Lifetime (sec)
void copy_members(const GCOSPointing &pointing)
Copy class members.
GSkyDir m_sc_z
Space craft z-axis.
std::string print(const GChatter &chatter=NORMAL) const
Print pointing information.
GCOSPointing & operator=(const GCOSPointing &pointing)
Assignment operator.
virtual ~GCOSPointing(void)
Destructor.
void free_members(void)
Delete class members.
double m_altitude
Altitude above from Earth's ellipsoid (km)
void clear(void)
Clear pointing.
GTime m_time
Time stamp in UNIX seconds.
GSkyDir m_earth_nadir
Direction of Earth's nadir at SC location.
GSkyDir m_sc_x
Space craft x-axis.
GCOSPointing * clone(void) const
Clone COSI pointing.
void init_members(void)
Initialise class members.
GSkyDir m_earth_zenith
Direction of Earth's zenith at SC location.
void clear(void)
Clear sky direction.
Definition GSkyDir.cpp:186
std::string print(const GChatter &chatter=NORMAL) const
Print sky direction information.
Definition GSkyDir.cpp:1376
void clear(void)
Clear time.
Definition GTime.cpp:252
std::string print(const GChatter &chatter=NORMAL) const
Print time.
Definition GTime.cpp:1212
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
Definition GTools.cpp:1136
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.
Definition GTools.cpp:508
GChatter reduce(const GChatter &chatter)
Reduce chattiness by one level.
Definition GTypemaps.hpp:65