GammaLib 2.0.0
Loading...
Searching...
No Matches
GModelSpatialEllipticalDisk.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GModelSpatialEllipticalDisk.hpp - Elliptical disk source model class *
3 * ----------------------------------------------------------------------- *
4 * copyright (C) 2013-2022 by Michael Mayer *
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 GModelSpatialEllipticalDisk.hpp
23 * @brief Elliptical disk model class interface definition
24 * @author Michael Mayer
25 */
26
27#ifndef GMODELSPATIALELLIPTICALDISK_HPP
28#define GMODELSPATIALELLIPTICALDISK_HPP
29
30/* __ Includes ___________________________________________________________ */
31#include <string>
33#include "GModelPar.hpp"
34
35/* __ Forward declarations _______________________________________________ */
36class GEnergy;
37class GTime;
38class GPhoton;
39class GRan;
40class GSkyDir;
41class GSkyRegion;
42class GXmlElement;
43
44
45/**************************************************************************
46 * @class GModelSpatialEllipticalDisk
47 *
48 * @brief Elliptical disk source model class
49 *
50 * This class implements the spatial component of the factorised source
51 * model for an elliptical disk source, i.e. constant surface brightness
52 * within ellipse and no emission outside.
53 ***************************************************************************/
55
56public:
57 // Constructors and destructors
60 const double& semimajor,
61 const double& semiminor,
62 const double& posangle,
63 const std::string& coordsys = "CEL");
64 explicit GModelSpatialEllipticalDisk(const GXmlElement& xml);
66 virtual ~GModelSpatialEllipticalDisk(void);
67
68 // Operators
70
71 // Implemented pure virtual base class methods
72 virtual void clear(void);
73 virtual GModelSpatialEllipticalDisk* clone(void) const;
74 virtual std::string classname(void) const;
75 virtual double eval(const double& theta,
76 const double& posangle,
77 const GEnergy& energy,
78 const GTime& time,
79 const bool& gradients = false) const;
80 virtual GSkyDir mc(const GEnergy& energy,
81 const GTime& time,
82 GRan& ran) const;
83 virtual bool contains(const GSkyDir& dir,
84 const double& margin = 0.0) const;
85 virtual double theta_max(void) const;
86 virtual void read(const GXmlElement& xml);
87 virtual void write(GXmlElement& xml) const;
88 virtual std::string print(const GChatter& chatter = NORMAL) const;
89
90
91protected:
92 // Protected methods
93 void init_members(void);
95 void free_members(void);
96 void update(void) const;
97 virtual void set_region(void) const;
98
99 // Cached members used for pre-computations
100 mutable double m_last_semiminor; //!< Last semi-minor axis
101 mutable double m_last_semimajor; //!< Last semi-major axis
102 mutable double m_semiminor_rad; //!< Radius in radians
103 mutable double m_semimajor_rad; //!< Radius in radians
104 mutable double m_norm; //!< Normalization
105};
106
107
108/***********************************************************************//**
109 * @brief Return class name
110 *
111 * @return String containing the class name ("GModelSpatialEllipticalDisk").
112 ***************************************************************************/
113inline
115{
116 return ("GModelSpatialEllipticalDisk");
117}
118
119#endif /* GMODELSPATIALELLIPTICALDISK_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
virtual void set_region(void) const
Set boundary sky region.
virtual GModelSpatialEllipticalDisk * clone(void) const
Clone elliptical disk model.
virtual void write(GXmlElement &xml) const
Write model into XML element.
virtual bool contains(const GSkyDir &dir, const double &margin=0.0) const
Checks where model contains specified sky direction.
double m_last_semiminor
Last semi-minor axis.
virtual std::string classname(void) const
Return class name.
void init_members(void)
Initialise class members.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print information.
virtual GSkyDir mc(const GEnergy &energy, const GTime &time, GRan &ran) const
Returns MC sky direction.
void copy_members(const GModelSpatialEllipticalDisk &model)
Copy class members.
virtual GModelSpatialEllipticalDisk & operator=(const GModelSpatialEllipticalDisk &model)
Assignment operator.
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 ~GModelSpatialEllipticalDisk(void)
Destructor.
virtual void clear(void)
Clear elliptical disk model.
virtual double theta_max(void) const
Return maximum model radius (in radians)
void update(void) const
Update precomputation cache.
void free_members(void)
Delete class members.
double m_last_semimajor
Last semi-major axis.
GModelSpatialEllipticalDisk(void)
Void constructor.
virtual void read(const GXmlElement &xml)
Read model from XML element.
Abstract elliptical spatial model base class.
double semimajor(void) const
Return semi-major axis of ellipse.
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 semiminor(void) const
Return semi-minor axis of ellipse.
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.