GammaLib 2.0.0
Loading...
Searching...
No Matches
GModelSpatialEllipticalGeneralGauss.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GModelSpatialEllipticalGeneralGauss.hpp - Generalised elliptical *
3 * Gaussian source model class *
4 * ----------------------------------------------------------------------- *
5 * copyright (C) 2022 by Luigi Tibaldo *
6 * ----------------------------------------------------------------------- *
7 * *
8 * This program is free software: you can redistribute it and/or modify *
9 * it under the terms of the GNU General Public License as published by *
10 * the Free Software Foundation, either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This program is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
20 * *
21 ***************************************************************************/
22/**
23 * @file GModelSpatialEllipticalGeneralGauss.hpp
24 * @brief Generalised elliptical gaussian model class interface definition
25 * @author Luigi Tibaldo
26 */
27
28#ifndef GMODELSPATIALELLIPTICALGENERALGAUSS_HPP
29#define GMODELSPATIALELLIPTICALGENERALGAUSS_HPP
30
31/* __ Includes ___________________________________________________________ */
32#include <string>
34#include "GModelPar.hpp"
35
36/* __ Forward declarations _______________________________________________ */
37class GEnergy;
38class GTime;
39class GPhoton;
40class GRan;
41class GSkyDir;
42class GSkyRegion;
43class GXmlElement;
44
45
46/**************************************************************************
47 * @class GModelSpatialEllipticalGeneralGauss
48 *
49 * @brief Generalised elliptical gaussian source model class
50 *
51 * This class implements the spatial component of the factorised source
52 * model for an generalised elliptical Gaussian source, i.e. surface
53 * brightness according to an asymmetric generalised Gaussian.
54 ***************************************************************************/
56
57public:
58 // Constructors and destructors
61 const double& major,
62 const double& minor,
63 const double& posangle,
64 const double& ridx,
65 const std::string& coordsys = "CEL");
69
70 // Operators
72
73 // Implemented pure virtual base class methods
74 virtual void clear(void);
75 virtual GModelSpatialEllipticalGeneralGauss* clone(void) const;
76 virtual std::string classname(void) const;
77 virtual double eval(const double& theta,
78 const double& posangle,
79 const GEnergy& energy,
80 const GTime& time,
81 const bool& gradients = false) const;
82 virtual GSkyDir mc(const GEnergy& energy,
83 const GTime& time,
84 GRan& ran) const;
85 virtual bool contains(const GSkyDir& dir,
86 const double& margin = 0.0) const;
87 virtual double theta_max(void) const;
88 virtual void read(const GXmlElement& xml);
89 virtual void write(GXmlElement& xml) const;
90 virtual std::string print(const GChatter& chatter = NORMAL) const;
91
92 // Other methods
93 double ridx(void) const;
94 void ridx(const double& ridx);
95
96
97protected:
98 // Protected methods
99 void init_members(void);
101 void free_members(void);
102 void update(void) const;
103 virtual void set_region(void) const;
104
105 // Protected members
106 GModelPar m_ridx; //!< Reciprocal of exponent of the radial profile
107
108 // Cached members used for pre-computations
109 mutable double m_last_minor; //!< Last semi-minor axis
110 mutable double m_last_major; //!< Last semi-major axis
111 mutable double m_last_posangle; //!< Last position angle
112 mutable double m_cospos2; //!< squared cosine of position angle
113 mutable double m_sinpos2; //!< squared sine of position angle
114 mutable double m_sin2pos; //!< sine of twice the position angle
115 mutable double m_minor2; //!< square of minor axis
116 mutable double m_major2; //!< square of major axis
117 mutable double m_minor_rad; //!< Minor axis in radians
118 mutable double m_major_rad; //!< Major axis in radians
119 mutable double m_norm; //!< Normalization
120 mutable double m_term1; //!< Help term 1
121 mutable double m_term2; //!< Help term 2
122 mutable double m_term3; //!< Help term 3
123 mutable double m_last_ridx; //!< Last reciprocal radial index
124 mutable double m_inv_ridx; //!< Spatial profile index
125
126};
127
128
129/***********************************************************************//**
130 * @brief Return class name
131 *
132 * @return String containing the class name ("GModelSpatialEllipticalGeneralGauss").
133 ***************************************************************************/
134inline
136{
137 return ("GModelSpatialEllipticalGeneralGauss");
138}
139
140/***********************************************************************//**
141 * @brief Return reciprocal of the elliptical profile index
142 *
143 * @return Reciprocal of the elliptical profile index.
144 *
145 * Returns the reciprocal of the elliptical profile index.
146 ***************************************************************************/
147inline
149{
150 return (m_ridx.value());
151}
152
153/***********************************************************************//**
154 * @brief Set reciprocal of the elliptical profile index
155 *
156 * @param[in] ridx Reciprocal of the elliptical profile index.
157 *
158 * Sets the reciprocal of the elliptical profile index.
159 ***************************************************************************/
160inline
162{
164 return;
165}
166
167#endif /* GMODELSPATIALELLIPTICALGENERALGAUSS_HPP */
Model parameter class interface definition.
Abstract elliptical spatial model base class interface definition.
GChatter
Definition GTypemaps.hpp:33
@ NORMAL
Definition GTypemaps.hpp:36
Class that handles energies in a unit independent way.
Definition GEnergy.hpp:48
Model parameter class.
Definition GModelPar.hpp:87
double ridx(void) const
Return reciprocal of the elliptical profile index.
virtual void read(const GXmlElement &xml)
Read model from XML element.
virtual GModelSpatialEllipticalGeneralGauss & operator=(const GModelSpatialEllipticalGeneralGauss &model)
Assignment operator.
virtual double theta_max(void) const
Return maximum model radius (in radians)
virtual void clear(void)
Clear generalised elliptical Gaussian model.
virtual GModelSpatialEllipticalGeneralGauss * clone(void) const
Clone generalised elliptical Gaussian model.
virtual void write(GXmlElement &xml) const
Write model into XML element.
virtual void set_region(void) const
Set boundary sky region.
virtual double eval(const double &theta, const double &posangle, const GEnergy &energy, const GTime &time, const bool &gradients=false) const
Evaluate function (in units of sr^-1)
virtual std::string print(const GChatter &chatter=NORMAL) const
Print information.
void update(void) const
Update precomputation cache.
void copy_members(const GModelSpatialEllipticalGeneralGauss &model)
Copy class members.
virtual std::string classname(void) const
Return class name.
GModelPar m_ridx
Reciprocal of exponent of the radial profile.
virtual bool contains(const GSkyDir &dir, const double &margin=0.0) const
Checks whether model contains specified sky direction.
virtual GSkyDir mc(const GEnergy &energy, const GTime &time, GRan &ran) const
Returns MC sky direction.
Abstract elliptical spatial model base class.
double posangle(void) const
Return Position Angle of model.
const GSkyDir & dir(void) const
Return position of elliptical spatial model.
std::string coordsys(void) const
Return coordinate system.
double value(void) const
Return parameter value.
Class that handles photons.
Definition GPhoton.hpp:47
Random number generator class.
Definition GRan.hpp:44
Sky direction class.
Definition GSkyDir.hpp:62
Abstract interface for the sky region class.
Time class.
Definition GTime.hpp:55
XML element node class.